diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index 0154ecbde98..86a3d479721 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -141,87 +141,87 @@ set(GAMEENGINE_SRC Include/Common/XferDeepCRC.h Include/Common/XferLoad.h Include/Common/XferSave.h -# Include/GameClient/Anim2D.h -# Include/GameClient/AnimateWindowManager.h + Include/GameClient/Anim2D.h + Include/GameClient/AnimateWindowManager.h # Include/GameClient/CampaignManager.h Include/GameClient/ChallengeGenerals.h Include/GameClient/ClientInstance.h Include/GameClient/ClientRandomValue.h Include/GameClient/Color.h -# Include/GameClient/CommandXlat.h + Include/GameClient/CommandXlat.h # Include/GameClient/ControlBar.h -# Include/GameClient/ControlBarResizer.h + Include/GameClient/ControlBarResizer.h # Include/GameClient/ControlBarScheme.h Include/GameClient/Credits.h -# Include/GameClient/DebugDisplay.h -# Include/GameClient/Diplomacy.h -# Include/GameClient/DisconnectMenu.h -# Include/GameClient/Display.h + Include/GameClient/DebugDisplay.h + Include/GameClient/Diplomacy.h + Include/GameClient/DisconnectMenu.h + Include/GameClient/Display.h Include/GameClient/DisplayString.h Include/GameClient/DisplayStringManager.h # Include/GameClient/Drawable.h -# Include/GameClient/DrawableInfo.h + Include/GameClient/DrawableInfo.h Include/GameClient/DrawGroupInfo.h -# Include/GameClient/EstablishConnectionsMenu.h + Include/GameClient/EstablishConnectionsMenu.h # Include/GameClient/Eva.h -# Include/GameClient/ExtendedMessageBox.h -# Include/GameClient/FontDesc.h + Include/GameClient/ExtendedMessageBox.h + Include/GameClient/FontDesc.h Include/GameClient/FXList.h # Include/GameClient/Gadget.h -# Include/GameClient/GadgetCheckBox.h -# Include/GameClient/GadgetComboBox.h -# Include/GameClient/GadgetListBox.h -# Include/GameClient/GadgetProgressBar.h -# Include/GameClient/GadgetPushButton.h -# Include/GameClient/GadgetRadioButton.h -# Include/GameClient/GadgetSlider.h -# Include/GameClient/GadgetStaticText.h -# Include/GameClient/GadgetTabControl.h -# Include/GameClient/GadgetTextEntry.h + Include/GameClient/GadgetCheckBox.h + Include/GameClient/GadgetComboBox.h + Include/GameClient/GadgetListBox.h + Include/GameClient/GadgetProgressBar.h + Include/GameClient/GadgetPushButton.h + Include/GameClient/GadgetRadioButton.h + Include/GameClient/GadgetSlider.h + Include/GameClient/GadgetStaticText.h + Include/GameClient/GadgetTabControl.h + Include/GameClient/GadgetTextEntry.h # Include/GameClient/GameClient.h Include/GameClient/GameFont.h -# Include/GameClient/GameInfoWindow.h + Include/GameClient/GameInfoWindow.h Include/GameClient/GameText.h Include/GameClient/GameWindow.h Include/GameClient/GameWindowGlobal.h -# Include/GameClient/GameWindowID.h -# Include/GameClient/GameWindowManager.h + Include/GameClient/GameWindowID.h + Include/GameClient/GameWindowManager.h Include/GameClient/GameWindowTransitions.h Include/GameClient/GlobalLanguage.h Include/GameClient/GraphDraw.h # Include/GameClient/GUICallbacks.h -# Include/GameClient/GUICommandTranslator.h + Include/GameClient/GUICommandTranslator.h Include/GameClient/HeaderTemplate.h -# Include/GameClient/HintSpy.h -# Include/GameClient/HotKey.h -# Include/GameClient/Image.h + Include/GameClient/HintSpy.h + Include/GameClient/HotKey.h + Include/GameClient/Image.h Include/GameClient/IMEManager.h # Include/GameClient/InGameUI.h Include/GameClient/Keyboard.h -# Include/GameClient/KeyDefs.h + Include/GameClient/KeyDefs.h Include/GameClient/LanguageFilter.h Include/GameClient/Line2D.h Include/GameClient/LoadScreen.h -# Include/GameClient/LookAtXlat.h + Include/GameClient/LookAtXlat.h Include/GameClient/MapUtil.h -# Include/GameClient/MessageBox.h -# Include/GameClient/MetaEvent.h -# Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h -# Include/GameClient/Module/BeaconClientUpdate.h -# Include/GameClient/Module/SwayClientUpdate.h + Include/GameClient/MessageBox.h + Include/GameClient/MetaEvent.h + Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h + Include/GameClient/Module/BeaconClientUpdate.h + Include/GameClient/Module/SwayClientUpdate.h Include/GameClient/Mouse.h Include/GameClient/ParabolicEase.h Include/GameClient/ParticleSys.h -# Include/GameClient/PlaceEventTranslator.h + Include/GameClient/PlaceEventTranslator.h Include/GameClient/ProcessAnimateWindow.h Include/GameClient/RadiusDecal.h -# Include/GameClient/RayEffect.h + Include/GameClient/RayEffect.h Include/GameClient/SelectionInfo.h # Include/GameClient/SelectionXlat.h -# Include/GameClient/Shadow.h -# Include/GameClient/Shell.h -# Include/GameClient/ShellHooks.h -# Include/GameClient/ShellMenuScheme.h + Include/GameClient/Shadow.h + Include/GameClient/Shell.h + Include/GameClient/ShellHooks.h + Include/GameClient/ShellMenuScheme.h Include/GameClient/Smudge.h Include/GameClient/Snow.h Include/GameClient/Statistics.h @@ -232,7 +232,7 @@ set(GAMEENGINE_SRC Include/GameClient/Water.h Include/GameClient/WindowLayout.h Include/GameClient/WindowVideoManager.h -# Include/GameClient/WindowXlat.h + Include/GameClient/WindowXlat.h Include/GameClient/WinInstanceData.h # Include/GameLogic/AI.h # Include/GameLogic/AIDock.h @@ -694,112 +694,112 @@ set(GAMEENGINE_SRC Source/GameClient/ClientInstance.cpp Source/GameClient/Color.cpp Source/GameClient/Credits.cpp -# Source/GameClient/Display.cpp + Source/GameClient/Display.cpp Source/GameClient/DisplayString.cpp Source/GameClient/DisplayStringManager.cpp # Source/GameClient/Drawable.cpp -# Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp -# Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp -# Source/GameClient/Drawable/Update/SwayClientUpdate.cpp + Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp + Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp + Source/GameClient/Drawable/Update/SwayClientUpdate.cpp Source/GameClient/DrawGroupInfo.cpp # Source/GameClient/Eva.cpp Source/GameClient/FXList.cpp # Source/GameClient/GameClient.cpp -# Source/GameClient/GameClientDispatch.cpp + Source/GameClient/GameClientDispatch.cpp Source/GameClient/GameText.cpp Source/GameClient/GlobalLanguage.cpp Source/GameClient/GraphDraw.cpp -# Source/GameClient/GUI/AnimateWindowManager.cpp + Source/GameClient/GUI/AnimateWindowManager.cpp Source/GameClient/GUI/ChallengeGenerals.cpp # Source/GameClient/GUI/ControlBar/ControlBar.cpp # Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp # Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp # Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp -# Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp -# Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp + Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp + Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp # Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp -# Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp -# Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp + Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp + Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp # Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp # Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp -# Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp + Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp # Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp -# Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp -# Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp -# Source/GameClient/GUI/Gadget/GadgetComboBox.cpp -# Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp -# Source/GameClient/GUI/Gadget/GadgetListBox.cpp -# Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp + Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp + Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp + Source/GameClient/GUI/Gadget/GadgetComboBox.cpp + Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp + Source/GameClient/GUI/Gadget/GadgetListBox.cpp + Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp # Source/GameClient/GUI/Gadget/GadgetPushButton.cpp -# Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp -# Source/GameClient/GUI/Gadget/GadgetStaticText.cpp -# Source/GameClient/GUI/Gadget/GadgetTabControl.cpp -# Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp -# Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp + Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp + Source/GameClient/GUI/Gadget/GadgetStaticText.cpp + Source/GameClient/GUI/Gadget/GadgetTabControl.cpp + Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp + Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp Source/GameClient/GUI/GameFont.cpp Source/GameClient/GUI/GameWindow.cpp Source/GameClient/GUI/GameWindowGlobal.cpp -# Source/GameClient/GUI/GameWindowManager.cpp + Source/GameClient/GUI/GameWindowManager.cpp # Source/GameClient/GUI/GameWindowManagerScript.cpp Source/GameClient/GUI/GameWindowTransitions.cpp # Source/GameClient/GUI/GameWindowTransitionsStyles.cpp # Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp # Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp -# Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp -# Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp -# Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp -# Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp -# Source/GameClient/GUI/GUICallbacks/InGameChat.cpp -# Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp + Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp + Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp + Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp + Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp + Source/GameClient/GUI/GUICallbacks/InGameChat.cpp + Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp # Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp + Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp + Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp # Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp + Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp + Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp + Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp + Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp # Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp + Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp + Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp # Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp + Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp + Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp # Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp + Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp # Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp + Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp + Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp # Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp + Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp # Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp + Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp + Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp # Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp + Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp # Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp # Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp + Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp + Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp # Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp + Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp # Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp + Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp + Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp # Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp + Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp + Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp # Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp + Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp # Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp -# Source/GameClient/GUI/GUICallbacks/MessageBox.cpp -# Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp + Source/GameClient/GUI/GUICallbacks/MessageBox.cpp + Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp Source/GameClient/GUI/HeaderTemplate.cpp Source/GameClient/GUI/IMEManager.cpp Source/GameClient/GUI/LoadScreen.cpp Source/GameClient/GUI/ProcessAnimateWindow.cpp # Source/GameClient/GUI/Shell/Shell.cpp -# Source/GameClient/GUI/Shell/ShellMenuScheme.cpp + Source/GameClient/GUI/Shell/ShellMenuScheme.cpp Source/GameClient/GUI/WindowLayout.cpp Source/GameClient/GUI/WindowVideoManager.cpp Source/GameClient/GUI/WinInstanceData.cpp @@ -812,7 +812,7 @@ set(GAMEENGINE_SRC # Source/GameClient/MessageStream/CommandXlat.cpp # Source/GameClient/MessageStream/GUICommandTranslator.cpp # Source/GameClient/MessageStream/HintSpy.cpp -# Source/GameClient/MessageStream/HotKey.cpp + Source/GameClient/MessageStream/HotKey.cpp # Source/GameClient/MessageStream/LookAtXlat.cpp # Source/GameClient/MessageStream/MetaEvent.cpp # Source/GameClient/MessageStream/PlaceEventTranslator.cpp @@ -823,13 +823,13 @@ set(GAMEENGINE_SRC Source/GameClient/SelectionInfo.cpp Source/GameClient/Snow.cpp Source/GameClient/Statistics.cpp -# Source/GameClient/System/Anim2D.cpp + Source/GameClient/System/Anim2D.cpp # Source/GameClient/System/CampaignManager.cpp Source/GameClient/System/Debug/AudioDebugDisplay.cpp -# Source/GameClient/System/DebugDisplay.cpp -# Source/GameClient/System/Image.cpp + Source/GameClient/System/DebugDisplay.cpp + Source/GameClient/System/Image.cpp Source/GameClient/System/ParticleSys.cpp -# Source/GameClient/System/RayEffect.cpp + Source/GameClient/System/RayEffect.cpp Source/GameClient/System/Smudge.cpp Source/GameClient/Terrain/TerrainRoads.cpp Source/GameClient/Terrain/TerrainVisual.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h b/Core/GameEngine/Include/GameClient/Anim2D.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/Anim2D.h rename to Core/GameEngine/Include/GameClient/Anim2D.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/AnimateWindowManager.h b/Core/GameEngine/Include/GameClient/AnimateWindowManager.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/AnimateWindowManager.h rename to Core/GameEngine/Include/GameClient/AnimateWindowManager.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h b/Core/GameEngine/Include/GameClient/CommandXlat.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/CommandXlat.h rename to Core/GameEngine/Include/GameClient/CommandXlat.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarResizer.h b/Core/GameEngine/Include/GameClient/ControlBarResizer.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarResizer.h rename to Core/GameEngine/Include/GameClient/ControlBarResizer.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/DebugDisplay.h b/Core/GameEngine/Include/GameClient/DebugDisplay.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/DebugDisplay.h rename to Core/GameEngine/Include/GameClient/DebugDisplay.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Diplomacy.h b/Core/GameEngine/Include/GameClient/Diplomacy.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/Diplomacy.h rename to Core/GameEngine/Include/GameClient/Diplomacy.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/DisconnectMenu.h b/Core/GameEngine/Include/GameClient/DisconnectMenu.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/DisconnectMenu.h rename to Core/GameEngine/Include/GameClient/DisconnectMenu.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Display.h b/Core/GameEngine/Include/GameClient/Display.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/Display.h rename to Core/GameEngine/Include/GameClient/Display.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/DrawableInfo.h b/Core/GameEngine/Include/GameClient/DrawableInfo.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/DrawableInfo.h rename to Core/GameEngine/Include/GameClient/DrawableInfo.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/EstablishConnectionsMenu.h b/Core/GameEngine/Include/GameClient/EstablishConnectionsMenu.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/EstablishConnectionsMenu.h rename to Core/GameEngine/Include/GameClient/EstablishConnectionsMenu.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ExtendedMessageBox.h b/Core/GameEngine/Include/GameClient/ExtendedMessageBox.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/ExtendedMessageBox.h rename to Core/GameEngine/Include/GameClient/ExtendedMessageBox.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/FontDesc.h b/Core/GameEngine/Include/GameClient/FontDesc.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/FontDesc.h rename to Core/GameEngine/Include/GameClient/FontDesc.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GUICommandTranslator.h b/Core/GameEngine/Include/GameClient/GUICommandTranslator.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GUICommandTranslator.h rename to Core/GameEngine/Include/GameClient/GUICommandTranslator.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetCheckBox.h b/Core/GameEngine/Include/GameClient/GadgetCheckBox.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetCheckBox.h rename to Core/GameEngine/Include/GameClient/GadgetCheckBox.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetComboBox.h b/Core/GameEngine/Include/GameClient/GadgetComboBox.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetComboBox.h rename to Core/GameEngine/Include/GameClient/GadgetComboBox.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetListBox.h b/Core/GameEngine/Include/GameClient/GadgetListBox.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetListBox.h rename to Core/GameEngine/Include/GameClient/GadgetListBox.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetProgressBar.h b/Core/GameEngine/Include/GameClient/GadgetProgressBar.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetProgressBar.h rename to Core/GameEngine/Include/GameClient/GadgetProgressBar.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetPushButton.h b/Core/GameEngine/Include/GameClient/GadgetPushButton.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetPushButton.h rename to Core/GameEngine/Include/GameClient/GadgetPushButton.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetRadioButton.h b/Core/GameEngine/Include/GameClient/GadgetRadioButton.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetRadioButton.h rename to Core/GameEngine/Include/GameClient/GadgetRadioButton.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetSlider.h b/Core/GameEngine/Include/GameClient/GadgetSlider.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetSlider.h rename to Core/GameEngine/Include/GameClient/GadgetSlider.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetStaticText.h b/Core/GameEngine/Include/GameClient/GadgetStaticText.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetStaticText.h rename to Core/GameEngine/Include/GameClient/GadgetStaticText.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetTabControl.h b/Core/GameEngine/Include/GameClient/GadgetTabControl.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetTabControl.h rename to Core/GameEngine/Include/GameClient/GadgetTabControl.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetTextEntry.h b/Core/GameEngine/Include/GameClient/GadgetTextEntry.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetTextEntry.h rename to Core/GameEngine/Include/GameClient/GadgetTextEntry.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameInfoWindow.h b/Core/GameEngine/Include/GameClient/GameInfoWindow.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GameInfoWindow.h rename to Core/GameEngine/Include/GameClient/GameInfoWindow.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowID.h b/Core/GameEngine/Include/GameClient/GameWindowID.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowID.h rename to Core/GameEngine/Include/GameClient/GameWindowID.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h b/Core/GameEngine/Include/GameClient/GameWindowManager.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h rename to Core/GameEngine/Include/GameClient/GameWindowManager.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/HintSpy.h b/Core/GameEngine/Include/GameClient/HintSpy.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/HintSpy.h rename to Core/GameEngine/Include/GameClient/HintSpy.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h b/Core/GameEngine/Include/GameClient/HotKey.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h rename to Core/GameEngine/Include/GameClient/HotKey.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h b/Core/GameEngine/Include/GameClient/Image.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/Image.h rename to Core/GameEngine/Include/GameClient/Image.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/KeyDefs.h b/Core/GameEngine/Include/GameClient/KeyDefs.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/KeyDefs.h rename to Core/GameEngine/Include/GameClient/KeyDefs.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/LookAtXlat.h b/Core/GameEngine/Include/GameClient/LookAtXlat.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/LookAtXlat.h rename to Core/GameEngine/Include/GameClient/LookAtXlat.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/MessageBox.h b/Core/GameEngine/Include/GameClient/MessageBox.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/MessageBox.h rename to Core/GameEngine/Include/GameClient/MessageBox.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h b/Core/GameEngine/Include/GameClient/MetaEvent.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/MetaEvent.h rename to Core/GameEngine/Include/GameClient/MetaEvent.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h b/Core/GameEngine/Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h rename to Core/GameEngine/Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Module/BeaconClientUpdate.h b/Core/GameEngine/Include/GameClient/Module/BeaconClientUpdate.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/Module/BeaconClientUpdate.h rename to Core/GameEngine/Include/GameClient/Module/BeaconClientUpdate.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Module/SwayClientUpdate.h b/Core/GameEngine/Include/GameClient/Module/SwayClientUpdate.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/Module/SwayClientUpdate.h rename to Core/GameEngine/Include/GameClient/Module/SwayClientUpdate.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/PlaceEventTranslator.h b/Core/GameEngine/Include/GameClient/PlaceEventTranslator.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/PlaceEventTranslator.h rename to Core/GameEngine/Include/GameClient/PlaceEventTranslator.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/RayEffect.h b/Core/GameEngine/Include/GameClient/RayEffect.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/RayEffect.h rename to Core/GameEngine/Include/GameClient/RayEffect.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Shadow.h b/Core/GameEngine/Include/GameClient/Shadow.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/Shadow.h rename to Core/GameEngine/Include/GameClient/Shadow.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Shell.h b/Core/GameEngine/Include/GameClient/Shell.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/Shell.h rename to Core/GameEngine/Include/GameClient/Shell.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ShellHooks.h b/Core/GameEngine/Include/GameClient/ShellHooks.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/ShellHooks.h rename to Core/GameEngine/Include/GameClient/ShellHooks.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ShellMenuScheme.h b/Core/GameEngine/Include/GameClient/ShellMenuScheme.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/ShellMenuScheme.h rename to Core/GameEngine/Include/GameClient/ShellMenuScheme.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/WindowXlat.h b/Core/GameEngine/Include/GameClient/WindowXlat.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/WindowXlat.h rename to Core/GameEngine/Include/GameClient/WindowXlat.h diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp b/Core/GameEngine/Source/GameClient/Display.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp rename to Core/GameEngine/Source/GameClient/Display.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp b/Core/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp rename to Core/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp b/Core/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp rename to Core/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp b/Core/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp rename to Core/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp b/Core/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp rename to Core/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp b/Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp rename to Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp rename to Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp b/Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp rename to Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp rename to Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp b/Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp rename to Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp b/Core/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp rename to Core/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp similarity index 99% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index 1e029a562d9..87f585d41ea 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -550,7 +550,6 @@ void HandleBuddyResponses() UnicodeString snippet = message.m_message; snippet.truncateTo(11); - UnicodeString s; s.format(TheGameText->fetch("Buddy:MessageNotification"), nick.str(), snippet.str()); lastNotificationWasStatus = FALSE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Core/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp similarity index 99% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp rename to Core/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp index 773c22dd94e..2ffe2dab159 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ b/Core/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp @@ -4062,6 +4062,3 @@ GameWindow *GameWindowManagerDummy::winCreateFromScript(AsciiString filenameStri GameWindowDummy::~GameWindowDummy() { } - - - diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/Core/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp rename to Core/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp b/Core/GameEngine/Source/GameClient/GameClientDispatch.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp rename to Core/GameEngine/Source/GameClient/GameClientDispatch.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp b/Core/GameEngine/Source/GameClient/MessageStream/HotKey.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp rename to Core/GameEngine/Source/GameClient/MessageStream/HotKey.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/Core/GameEngine/Source/GameClient/System/Anim2D.cpp similarity index 99% rename from GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp rename to Core/GameEngine/Source/GameClient/System/Anim2D.cpp index 0922aba5453..9c458e411bc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ b/Core/GameEngine/Source/GameClient/System/Anim2D.cpp @@ -297,7 +297,6 @@ Anim2D::Anim2D( Anim2DTemplate *animTemplate, Anim2DCollection *collectionSystem { // sanity DEBUG_ASSERTCRASH( animTemplate != nullptr, ("Anim2D::Anim2D - null template") ); - m_currentFrame = 0; // set the template diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/DebugDisplay.cpp b/Core/GameEngine/Source/GameClient/System/DebugDisplay.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/System/DebugDisplay.cpp rename to Core/GameEngine/Source/GameClient/System/DebugDisplay.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp b/Core/GameEngine/Source/GameClient/System/Image.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp rename to Core/GameEngine/Source/GameClient/System/Image.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/RayEffect.cpp b/Core/GameEngine/Source/GameClient/System/RayEffect.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/System/RayEffect.cpp rename to Core/GameEngine/Source/GameClient/System/RayEffect.cpp diff --git a/Core/GameEngineDevice/CMakeLists.txt b/Core/GameEngineDevice/CMakeLists.txt index 74b040200ae..379f6249141 100644 --- a/Core/GameEngineDevice/CMakeLists.txt +++ b/Core/GameEngineDevice/CMakeLists.txt @@ -32,51 +32,51 @@ set(GAMEENGINEDEVICE_SRC Include/W3DDevice/GameClient/TerrainTex.h Include/W3DDevice/GameClient/TileData.h # Include/W3DDevice/GameClient/W3DAssetManager.h -# Include/W3DDevice/GameClient/W3DAssetManagerExposed.h -# Include/W3DDevice/GameClient/W3DBibBuffer.h + Include/W3DDevice/GameClient/W3DAssetManagerExposed.h + Include/W3DDevice/GameClient/W3DBibBuffer.h # Include/W3DDevice/GameClient/W3DBridgeBuffer.h -# Include/W3DDevice/GameClient/W3DBufferManager.h -# Include/W3DDevice/GameClient/W3DCustomEdging.h -# Include/W3DDevice/GameClient/W3DCustomScene.h -# Include/W3DDevice/GameClient/W3DDebugDisplay.h -# Include/W3DDevice/GameClient/W3DDebugIcons.h -# Include/W3DDevice/GameClient/W3DDisplay.h -# Include/W3DDevice/GameClient/W3DDisplayString.h -# Include/W3DDevice/GameClient/W3DDisplayStringManager.h + Include/W3DDevice/GameClient/W3DBufferManager.h + Include/W3DDevice/GameClient/W3DCustomEdging.h + Include/W3DDevice/GameClient/W3DCustomScene.h + Include/W3DDevice/GameClient/W3DDebugDisplay.h + Include/W3DDevice/GameClient/W3DDebugIcons.h + Include/W3DDevice/GameClient/W3DDisplay.h + Include/W3DDevice/GameClient/W3DDisplayString.h + Include/W3DDevice/GameClient/W3DDisplayStringManager.h # Include/W3DDevice/GameClient/W3DDynamicLight.h -# Include/W3DDevice/GameClient/W3DFileSystem.h -# Include/W3DDevice/GameClient/W3DGadget.h + Include/W3DDevice/GameClient/W3DFileSystem.h + Include/W3DDevice/GameClient/W3DGadget.h # Include/W3DDevice/GameClient/W3DGameClient.h -# Include/W3DDevice/GameClient/W3DGameFont.h -# Include/W3DDevice/GameClient/W3DGameWindow.h -# Include/W3DDevice/GameClient/W3DGameWindowManager.h -# Include/W3DDevice/GameClient/W3DGUICallbacks.h -# Include/W3DDevice/GameClient/W3DInGameUI.h -# Include/W3DDevice/GameClient/W3DMirror.h + Include/W3DDevice/GameClient/W3DGameFont.h + Include/W3DDevice/GameClient/W3DGameWindow.h + Include/W3DDevice/GameClient/W3DGameWindowManager.h + Include/W3DDevice/GameClient/W3DGUICallbacks.h + Include/W3DDevice/GameClient/W3DInGameUI.h + Include/W3DDevice/GameClient/W3DMirror.h Include/W3DDevice/GameClient/W3DMouse.h -# Include/W3DDevice/GameClient/W3DParticleSys.h -# Include/W3DDevice/GameClient/W3DPoly.h -# Include/W3DDevice/GameClient/W3DProjectedShadow.h + Include/W3DDevice/GameClient/W3DParticleSys.h + Include/W3DDevice/GameClient/W3DPoly.h + Include/W3DDevice/GameClient/W3DProjectedShadow.h Include/W3DDevice/GameClient/W3DPropBuffer.h # Include/W3DDevice/GameClient/W3DRoadBuffer.h # Include/W3DDevice/GameClient/W3DScene.h Include/W3DDevice/GameClient/W3DShaderManager.h -# Include/W3DDevice/GameClient/W3DShadow.h -# Include/W3DDevice/GameClient/W3DShroud.h + Include/W3DDevice/GameClient/W3DShadow.h + Include/W3DDevice/GameClient/W3DShroud.h Include/W3DDevice/GameClient/W3DSmudge.h Include/W3DDevice/GameClient/W3DSnow.h -# Include/W3DDevice/GameClient/W3DStatusCircle.h + Include/W3DDevice/GameClient/W3DStatusCircle.h Include/W3DDevice/GameClient/W3DTerrainBackground.h Include/W3DDevice/GameClient/W3DTerrainTracks.h Include/W3DDevice/GameClient/W3DTerrainVisual.h Include/W3DDevice/GameClient/W3DTreeBuffer.h Include/W3DDevice/GameClient/W3DVideoBuffer.h Include/W3DDevice/GameClient/W3DView.h -# Include/W3DDevice/GameClient/W3DVolumetricShadow.h + Include/W3DDevice/GameClient/W3DVolumetricShadow.h Include/W3DDevice/GameClient/W3DWater.h Include/W3DDevice/GameClient/W3DWaterTracks.h -# Include/W3DDevice/GameClient/W3DWaypointBuffer.h -# Include/W3DDevice/GameClient/W3DWebBrowser.h + Include/W3DDevice/GameClient/W3DWaypointBuffer.h + Include/W3DDevice/GameClient/W3DWebBrowser.h Include/W3DDevice/GameClient/WorldHeightMap.h # Include/W3DDevice/GameLogic/W3DGameLogic.h # Include/W3DDevice/GameLogic/W3DGhostObject.h @@ -118,47 +118,47 @@ set(GAMEENGINEDEVICE_SRC Source/W3DDevice/GameClient/Drawable/Draw/W3DTreeDraw.cpp Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp Source/W3DDevice/GameClient/FlatHeightMap.cpp -# Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp -# Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp -# Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp -# Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp -# Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp + Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp + Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp + Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp + Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp + Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp # Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp -# Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp + Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp # Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp -# Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp -# Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp -# Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp -# Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp -# Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp -# Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp -# Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp -# Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp -# Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp + Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp + Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp + Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp + Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp + Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp + Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp + Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp + Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp + Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp Source/W3DDevice/GameClient/HeightMap.cpp -# Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp + Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp # Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp -# Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp + Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp # Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp Source/W3DDevice/GameClient/TerrainTex.cpp Source/W3DDevice/GameClient/TileData.cpp # Source/W3DDevice/GameClient/W3DAssetManager.cpp -# Source/W3DDevice/GameClient/W3DAssetManagerExposed.cpp + Source/W3DDevice/GameClient/W3DAssetManagerExposed.cpp # Source/W3DDevice/GameClient/W3DBibBuffer.cpp # Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp -# Source/W3DDevice/GameClient/W3DCustomEdging.cpp -# Source/W3DDevice/GameClient/W3DDebugDisplay.cpp -# Source/W3DDevice/GameClient/W3DDebugIcons.cpp + Source/W3DDevice/GameClient/W3DCustomEdging.cpp + Source/W3DDevice/GameClient/W3DDebugDisplay.cpp + Source/W3DDevice/GameClient/W3DDebugIcons.cpp # Source/W3DDevice/GameClient/W3DDisplay.cpp -# Source/W3DDevice/GameClient/W3DDisplayString.cpp -# Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp -# Source/W3DDevice/GameClient/W3DDynamicLight.cpp + Source/W3DDevice/GameClient/W3DDisplayString.cpp + Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp + Source/W3DDevice/GameClient/W3DDynamicLight.cpp # Source/W3DDevice/GameClient/W3DFileSystem.cpp # Source/W3DDevice/GameClient/W3DGameClient.cpp -# Source/W3DDevice/GameClient/W3DInGameUI.cpp + Source/W3DDevice/GameClient/W3DInGameUI.cpp Source/W3DDevice/GameClient/W3DMouse.cpp # Source/W3DDevice/GameClient/W3DParticleSys.cpp -# Source/W3DDevice/GameClient/W3DPoly.cpp + Source/W3DDevice/GameClient/W3DPoly.cpp Source/W3DDevice/GameClient/W3DPropBuffer.cpp # Source/W3DDevice/GameClient/W3DRoadBuffer.cpp # Source/W3DDevice/GameClient/W3DScene.cpp @@ -174,7 +174,7 @@ set(GAMEENGINEDEVICE_SRC Source/W3DDevice/GameClient/W3DVideoBuffer.cpp Source/W3DDevice/GameClient/W3DView.cpp # Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp -# Source/W3DDevice/GameClient/W3DWebBrowser.cpp + Source/W3DDevice/GameClient/W3DWebBrowser.cpp Source/W3DDevice/GameClient/Water/W3DWater.cpp Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp Source/W3DDevice/GameClient/WorldHeightMap.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManagerExposed.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManagerExposed.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManagerExposed.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManagerExposed.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBibBuffer.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DBibBuffer.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBibBuffer.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DBibBuffer.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DBufferManager.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DCustomEdging.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DCustomEdging.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DCustomEdging.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DCustomEdging.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DCustomScene.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DCustomScene.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DCustomScene.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DCustomScene.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugDisplay.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugDisplay.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugDisplay.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugDisplay.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugIcons.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugIcons.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugIcons.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugIcons.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplayString.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplayString.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplayString.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplayString.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplayStringManager.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplayStringManager.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplayStringManager.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplayStringManager.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGUICallbacks.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DGUICallbacks.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGUICallbacks.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DGUICallbacks.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGadget.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DGadget.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGadget.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DGadget.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameFont.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameFont.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameFont.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameFont.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindow.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindow.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindow.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindow.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindowManager.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindowManager.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindowManager.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindowManager.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DInGameUI.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DInGameUI.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DInGameUI.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DInGameUI.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DMirror.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DMirror.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DMirror.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DMirror.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DParticleSys.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DParticleSys.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DParticleSys.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DParticleSys.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DPoly.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DPoly.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DPoly.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DPoly.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DShadow.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShroud.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DShroud.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DShroud.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DShroud.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DStatusCircle.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DStatusCircle.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DStatusCircle.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DStatusCircle.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWaypointBuffer.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DWaypointBuffer.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWaypointBuffer.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DWaypointBuffer.h diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWebBrowser.h b/Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DWebBrowser.h similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWebBrowser.h rename to Core/GameEngineDevice/Include/W3DDevice/GameClient/W3DWebBrowser.h diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/MotionBlur.nvv b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/MotionBlur.nvv similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/MotionBlur.nvv rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/MotionBlur.nvv diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/invmonochrome.nvp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/invmonochrome.nvp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/invmonochrome.nvp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/invmonochrome.nvp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/monochrome.nvp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/monochrome.nvp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/monochrome.nvp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/monochrome.nvp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/motionblur.nvp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/motionblur.nvp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/motionblur.nvp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/motionblur.nvp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/roadnoise2.nvp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/roadnoise2.nvp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/roadnoise2.nvp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/roadnoise2.nvp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrain.nvp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrain.nvp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrain.nvp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrain.nvp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise.nvp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise.nvp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise.nvp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise.nvp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise2.nvp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise2.nvp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise2.nvp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise2.nvp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManagerExposed.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManagerExposed.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManagerExposed.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManagerExposed.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDynamicLight.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDynamicLight.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDynamicLight.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DDynamicLight.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPoly.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DPoly.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPoly.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DPoly.cpp diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp similarity index 100% rename from GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp rename to Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index 73b6cc223bf..3efb4fdc0b4 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -128,86 +128,86 @@ set(GAMEENGINE_SRC # Include/Common/XferDeepCRC.h # Include/Common/XferLoad.h # Include/Common/XferSave.h - Include/GameClient/Anim2D.h - Include/GameClient/AnimateWindowManager.h +# Include/GameClient/Anim2D.h +# Include/GameClient/AnimateWindowManager.h # Include/GameClient/ChallengeGenerals.h Include/GameClient/CampaignManager.h # Include/GameClient/ClientInstance.h # Include/GameClient/ClientRandomValue.h # Include/GameClient/Color.h - Include/GameClient/CommandXlat.h +# Include/GameClient/CommandXlat.h Include/GameClient/ControlBar.h - Include/GameClient/ControlBarResizer.h +# Include/GameClient/ControlBarResizer.h Include/GameClient/ControlBarScheme.h # Include/GameClient/Credits.h - Include/GameClient/DebugDisplay.h - Include/GameClient/Diplomacy.h - Include/GameClient/DisconnectMenu.h - Include/GameClient/Display.h +# Include/GameClient/DebugDisplay.h +# Include/GameClient/Diplomacy.h +# Include/GameClient/DisconnectMenu.h +# Include/GameClient/Display.h # Include/GameClient/DisplayString.h # Include/GameClient/DisplayStringManager.h Include/GameClient/Drawable.h - Include/GameClient/DrawableInfo.h +# Include/GameClient/DrawableInfo.h # Include/GameClient/DrawGroupInfo.h - Include/GameClient/EstablishConnectionsMenu.h +# Include/GameClient/EstablishConnectionsMenu.h Include/GameClient/Eva.h - Include/GameClient/ExtendedMessageBox.h - Include/GameClient/FontDesc.h +# Include/GameClient/ExtendedMessageBox.h +# Include/GameClient/FontDesc.h # Include/GameClient/FXList.h Include/GameClient/Gadget.h - Include/GameClient/GadgetCheckBox.h - Include/GameClient/GadgetComboBox.h - Include/GameClient/GadgetListBox.h - Include/GameClient/GadgetProgressBar.h - Include/GameClient/GadgetPushButton.h - Include/GameClient/GadgetRadioButton.h - Include/GameClient/GadgetSlider.h - Include/GameClient/GadgetStaticText.h - Include/GameClient/GadgetTabControl.h - Include/GameClient/GadgetTextEntry.h +# Include/GameClient/GadgetCheckBox.h +# Include/GameClient/GadgetComboBox.h +# Include/GameClient/GadgetListBox.h +# Include/GameClient/GadgetProgressBar.h +# Include/GameClient/GadgetPushButton.h +# Include/GameClient/GadgetRadioButton.h +# Include/GameClient/GadgetSlider.h +# Include/GameClient/GadgetStaticText.h +# Include/GameClient/GadgetTabControl.h +# Include/GameClient/GadgetTextEntry.h Include/GameClient/GameClient.h # Include/GameClient/GameFont.h - Include/GameClient/GameInfoWindow.h +# Include/GameClient/GameInfoWindow.h # Include/GameClient/GameText.h # Include/GameClient/GameWindow.h # Include/GameClient/GameWindowGlobal.h - Include/GameClient/GameWindowID.h - Include/GameClient/GameWindowManager.h +# Include/GameClient/GameWindowID.h +# Include/GameClient/GameWindowManager.h # Include/GameClient/GameWindowTransitions.h # Include/GameClient/GlobalLanguage.h # Include/GameClient/GraphDraw.h Include/GameClient/GUICallbacks.h - Include/GameClient/GUICommandTranslator.h +# Include/GameClient/GUICommandTranslator.h # Include/GameClient/HeaderTemplate.h - Include/GameClient/HintSpy.h - Include/GameClient/HotKey.h - Include/GameClient/Image.h +# Include/GameClient/HintSpy.h +# Include/GameClient/HotKey.h +# Include/GameClient/Image.h # Include/GameClient/IMEManager.h Include/GameClient/InGameUI.h # Include/GameClient/Keyboard.h - Include/GameClient/KeyDefs.h +# Include/GameClient/KeyDefs.h # Include/GameClient/LanguageFilter.h # Include/GameClient/Line2D.h # Include/GameClient/LoadScreen.h - Include/GameClient/LookAtXlat.h +# Include/GameClient/LookAtXlat.h # Include/GameClient/MapUtil.h - Include/GameClient/MessageBox.h - Include/GameClient/MetaEvent.h - Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h - Include/GameClient/Module/BeaconClientUpdate.h - Include/GameClient/Module/SwayClientUpdate.h +# Include/GameClient/MessageBox.h +# Include/GameClient/MetaEvent.h +# Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h +# Include/GameClient/Module/BeaconClientUpdate.h +# Include/GameClient/Module/SwayClientUpdate.h # Include/GameClient/Mouse.h # Include/GameClient/ParticleSys.h - Include/GameClient/PlaceEventTranslator.h +# Include/GameClient/PlaceEventTranslator.h # Include/GameClient/ProcessAnimateWindow.h # Include/GameClient/RadiusDecal.h - Include/GameClient/RayEffect.h +# Include/GameClient/RayEffect.h # Include/GameClient/SelectionInfo.h Include/GameClient/SelectionXlat.h - Include/GameClient/Shadow.h - Include/GameClient/Shell.h - Include/GameClient/ShellHooks.h - Include/GameClient/ShellMenuScheme.h +# Include/GameClient/Shadow.h +# Include/GameClient/Shell.h +# Include/GameClient/ShellHooks.h +# Include/GameClient/ShellMenuScheme.h # Include/GameClient/Statistics.h # Include/GameClient/TerrainRoads.h # Include/GameClient/TerrainVisual.h @@ -216,7 +216,7 @@ set(GAMEENGINE_SRC # Include/GameClient/Water.h # Include/GameClient/WindowLayout.h # Include/GameClient/WindowVideoManager.h - Include/GameClient/WindowXlat.h +# Include/GameClient/WindowXlat.h # Include/GameClient/WinInstanceData.h Include/GameLogic/AI.h Include/GameLogic/AIDock.h @@ -638,111 +638,111 @@ set(GAMEENGINE_SRC # Source/GameClient/ClientInstance.cpp # Source/GameClient/Color.cpp # Source/GameClient/Credits.cpp - Source/GameClient/Display.cpp +# Source/GameClient/Display.cpp # Source/GameClient/DisplayString.cpp # Source/GameClient/DisplayStringManager.cpp Source/GameClient/Drawable.cpp - Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp - Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp - Source/GameClient/Drawable/Update/SwayClientUpdate.cpp +# Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp +# Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp +# Source/GameClient/Drawable/Update/SwayClientUpdate.cpp # Source/GameClient/DrawGroupInfo.cpp Source/GameClient/Eva.cpp # Source/GameClient/FXList.cpp Source/GameClient/GameClient.cpp - Source/GameClient/GameClientDispatch.cpp +# Source/GameClient/GameClientDispatch.cpp # Source/GameClient/GameText.cpp # Source/GameClient/GlobalLanguage.cpp # Source/GameClient/GraphDraw.cpp - Source/GameClient/GUI/AnimateWindowManager.cpp +# Source/GameClient/GUI/AnimateWindowManager.cpp # Source/GameClient/GUI/ChallengeGenerals.cpp Source/GameClient/GUI/ControlBar/ControlBar.cpp Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp - Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp - Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +# Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp +# Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp - Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp - Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +# Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp +# Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp - Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp +# Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp - Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp - Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp - Source/GameClient/GUI/Gadget/GadgetComboBox.cpp - Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp - Source/GameClient/GUI/Gadget/GadgetListBox.cpp - Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp +# Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp +# Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp +# Source/GameClient/GUI/Gadget/GadgetComboBox.cpp +# Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp +# Source/GameClient/GUI/Gadget/GadgetListBox.cpp +# Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp Source/GameClient/GUI/Gadget/GadgetPushButton.cpp - Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp - Source/GameClient/GUI/Gadget/GadgetStaticText.cpp - Source/GameClient/GUI/Gadget/GadgetTabControl.cpp - Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp - Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +# Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp +# Source/GameClient/GUI/Gadget/GadgetStaticText.cpp +# Source/GameClient/GUI/Gadget/GadgetTabControl.cpp +# Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp +# Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp # Source/GameClient/GUI/GameFont.cpp # Source/GameClient/GUI/GameWindow.cpp # Source/GameClient/GUI/GameWindowGlobal.cpp - Source/GameClient/GUI/GameWindowManager.cpp +# Source/GameClient/GUI/GameWindowManager.cpp Source/GameClient/GUI/GameWindowManagerScript.cpp # Source/GameClient/GUI/GameWindowTransitions.cpp Source/GameClient/GUI/GameWindowTransitionsStyles.cpp Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp - Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp - Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp - Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp - Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp - Source/GameClient/GUI/GUICallbacks/InGameChat.cpp - Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp - Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp +# Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp +# Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp +# Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp +# Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp +# Source/GameClient/GUI/GUICallbacks/InGameChat.cpp +# Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp - Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp - Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp - Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp - Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp - Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp - Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp - Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp - Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp - Source/GameClient/GUI/GUICallbacks/MessageBox.cpp - Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp +# Source/GameClient/GUI/GUICallbacks/MessageBox.cpp +# Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp # Source/GameClient/GUI/HeaderTemplate.cpp # Source/GameClient/GUI/IMEManager.cpp # Source/GameClient/GUI/LoadScreen.cpp # Source/GameClient/GUI/ProcessAnimateWindow.cpp Source/GameClient/GUI/Shell/Shell.cpp - Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +# Source/GameClient/GUI/Shell/ShellMenuScheme.cpp # Source/GameClient/GUI/WindowLayout.cpp # Source/GameClient/GUI/WindowVideoManager.cpp # Source/GameClient/GUI/WinInstanceData.cpp @@ -755,7 +755,7 @@ set(GAMEENGINE_SRC Source/GameClient/MessageStream/CommandXlat.cpp Source/GameClient/MessageStream/GUICommandTranslator.cpp Source/GameClient/MessageStream/HintSpy.cpp - Source/GameClient/MessageStream/HotKey.cpp +# Source/GameClient/MessageStream/HotKey.cpp Source/GameClient/MessageStream/LookAtXlat.cpp Source/GameClient/MessageStream/MetaEvent.cpp Source/GameClient/MessageStream/PlaceEventTranslator.cpp @@ -764,13 +764,13 @@ set(GAMEENGINE_SRC # Source/GameClient/RadiusDecal.cpp # Source/GameClient/SelectionInfo.cpp # Source/GameClient/Statistics.cpp - Source/GameClient/System/Anim2D.cpp +# Source/GameClient/System/Anim2D.cpp Source/GameClient/System/CampaignManager.cpp # "Source/GameClient/System/Debug Displayers/AudioDebugDisplay.cpp" - Source/GameClient/System/DebugDisplay.cpp - Source/GameClient/System/Image.cpp +# Source/GameClient/System/DebugDisplay.cpp +# Source/GameClient/System/Image.cpp # Source/GameClient/System/ParticleSys.cpp - Source/GameClient/System/RayEffect.cpp +# Source/GameClient/System/RayEffect.cpp # Source/GameClient/Terrain/TerrainRoads.cpp # Source/GameClient/Terrain/TerrainVisual.cpp # Source/GameClient/VideoPlayer.cpp diff --git a/Generals/Code/GameEngine/Include/GameClient/Anim2D.h b/Generals/Code/GameEngine/Include/GameClient/Anim2D.h deleted file mode 100644 index fc19631f91f..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/Anim2D.h +++ /dev/null @@ -1,222 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Anim2D.h ///////////////////////////////////////////////////////////////////////////////// -// Author: Colin Day, July 2002 -// Desc: A collection of 2D images to make animation -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "Common/Snapshot.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// -class Anim2DCollection; -class Image; - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -enum Anim2DMode CPP_11(: Int) -{ - - ANIM_2D_INVALID = 0, - ANIM_2D_ONCE, - ANIM_2D_ONCE_BACKWARDS, - ANIM_2D_LOOP, - ANIM_2D_LOOP_BACKWARDS, - ANIM_2D_PING_PONG, - ANIM_2D_PING_PONG_BACKWARDS, - // dont' forget to add new animation mode names to Anim2DModeNames[] below - - ANIM_2D_NUM_MODES - -}; -#ifdef DEFINE_ANIM_2D_MODE_NAMES -static const char *const Anim2DModeNames[] = -{ - "NONE", - "ONCE", - "ONCE_BACKWARDS", - "LOOP", - "LOOP_BACKWARDS", - "PING_PONG", - "PING_PONG_BACKWARDS", - nullptr -}; -static_assert(ARRAY_SIZE(Anim2DModeNames) == ANIM_2D_NUM_MODES + 1, "Incorrect array size"); -#endif - -// ------------------------------------------------------------------------------------------------ -/** A template of a 2D animation */ -// ------------------------------------------------------------------------------------------------ -class Anim2DTemplate : public MemoryPoolObject -{ - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(Anim2DTemplate, "Anim2DTemplate") -public: - - Anim2DTemplate( AsciiString name ); - //virtual ~Anim2DTemplate(); - - AsciiString getName() const { return m_name; } - const Image *getFrame( UnsignedShort frameNumber ) const; - UnsignedShort getNumFrames() const { return m_numFrames; } - UnsignedShort getNumFramesBetweenUpdates() const { return m_framesBetweenUpdates; } - Anim2DMode getAnimMode() const { return m_animMode; } - Bool isRandomizedStartFrame() const { return m_randomizeStartFrame; } - - // list access for use by the Anim2DCollection only - void friend_setNextTemplate( Anim2DTemplate *animTemplate ) { m_nextTemplate = animTemplate; } - Anim2DTemplate *friend_getNextTemplate() const { return m_nextTemplate; }; - - // INI methods - const FieldParse *getFieldParse() const { return s_anim2DFieldParseTable; } - void storeImage( const Image *image ); ///< store image in next available slot - void allocateImages( UnsignedShort numFrames ); ///< allocate the array of image pointers to use - -protected: - - static void parseImage( INI *ini, void *instance, void *store, const void *userData ); - static void parseNumImages( INI *ini, void *instance, void *store, const void *userData ); - static void parseImageSequence( INI *ini, void *instance, void *store, const void *userData ); - -protected: - enum { NUM_FRAMES_INVALID = 0 }; ///< initialization value for num frames - - Anim2DTemplate* m_nextTemplate; ///< next animation in collections animation list - AsciiString m_name; ///< name of this 2D animation - const Image** m_images; ///< array of image pointers that make up this animation - UnsignedShort m_numFrames; ///< total number of frames in this animation - UnsignedShort m_framesBetweenUpdates; ///< frames between frame updates - Anim2DMode m_animMode; ///< the animation mode - Bool m_randomizeStartFrame; ///< randomize animation instance start frames - -protected: - static const FieldParse s_anim2DFieldParseTable[]; ///< the parse table for INI definition - -}; - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -enum Anim2DStatus CPP_11(: Int) -{ - ANIM_2D_STATUS_NONE = 0x00, - ANIM_2D_STATUS_FROZEN = 0x01, - ANIM_2D_STATUS_REVERSED = 0x02, // used for ping pong direction tracking - ANIM_2D_STATUS_COMPLETE = 0x04, // set when uni-directional things reach their last frame -}; - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -class Anim2D : public MemoryPoolObject, - public Snapshot -{ - -friend class Anim2DCollection; - - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( Anim2D, "Anim2D" ); - -public: - - Anim2D( Anim2DTemplate *animTemplate, Anim2DCollection *collectionSystem ); - // virtual destructor prototype provided by memory pool object - - UnsignedShort getCurrentFrame() const { return m_currentFrame; } ///< get our current frame # - void setCurrentFrame( UnsignedShort frame ); ///< set the current frame # - void randomizeCurrentFrame(); ///< randomize the current frame # - void reset(); ///< reset the current frame to the "start" - void setStatus( UnsignedByte statusBits ); ///< set status bit(s) - void clearStatus( UnsignedByte statusBits ); ///< clear status bit(s) - UnsignedByte getStatus() const { return m_status; } ///< return status bits(s) - void setAlpha( Real alpha ) { m_alpha = alpha; } ///< set alpha value - Real getAlpha() const { return m_alpha; } ///< return the current alpha value - - //Allows you to play a segment of an animation. - void setMinFrame( UnsignedShort frame ) { m_minFrame = frame; } - void setMaxFrame( UnsignedShort frame ) { m_maxFrame = frame; } - - // info about the size of the current frame - UnsignedInt getCurrentFrameWidth() const; ///< return natural width of image in the current frame - UnsignedInt getCurrentFrameHeight() const; ///< return natural height of image in the current frame - const Anim2DTemplate *getAnimTemplate() const { return m_template; } ///< return our template - - void draw( Int x, Int y ); ///< draw image at location using natural width/height - void draw( Int x, Int y, Int width, Int height ); ///< draw image at location using forced width/height - -protected: - - // snapshot methods - virtual void crc( Xfer *xfer ) override { } - virtual void xfer( Xfer *xfer ) override; - virtual void loadPostProcess() override { } - - void tryNextFrame(); ///< we've just drawn ... try to update our frame if necessary - - UnsignedShort m_currentFrame; ///< current frame of our animation - UnsignedInt m_lastUpdateFrame; ///< last frame we updated on - Anim2DTemplate *m_template; ///< pointer back to the template that defines this animation - UnsignedByte m_status; ///< status bits (see Anim2DStatus) - UnsignedShort m_minFrame; ///< min animation frame used inclusively. - UnsignedShort m_maxFrame; ///< max animation frame used inclusively. - UnsignedInt m_framesBetweenUpdates; ///< duration between each frame. - Real m_alpha; - - Anim2DCollection *m_collectionSystem; ///< system collection (if any) we're registered with - Anim2D *m_collectionSystemNext; ///< system instance tracking list - Anim2D *m_collectionSystemPrev; ///< system instance tracking list - -}; - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -class Anim2DCollection : public SubsystemInterface -{ - -public: - - Anim2DCollection(); - virtual ~Anim2DCollection() override; - - virtual void init() override; ///< initialize system - virtual void reset() override { }; ///< reset system - virtual void update() override; ///< update system - - Anim2DTemplate *findTemplate( const AsciiString& name ); ///< find animation template - Anim2DTemplate *newTemplate( const AsciiString& name ); ///< allocate a new template to be loaded - - void registerAnimation( Anim2D *anim ); ///< register animation with system - void unRegisterAnimation( Anim2D *anim ); ///< un-register animation from system - - Anim2DTemplate* getTemplateHead() const { return m_templateList; } - Anim2DTemplate* getNextTemplate( Anim2DTemplate *animTemplate ) const; - -protected: - - Anim2DTemplate *m_templateList; ///< list of available animation templates - Anim2D *m_instanceList; ///< list of all the anim 2D instance we're tracking - -}; - -// EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// -extern Anim2DCollection *TheAnim2DCollection; diff --git a/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h b/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h deleted file mode 100644 index aad9e80b7a2..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h +++ /dev/null @@ -1,235 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: AnimateWindowManager.h ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Mar 2002 -// -// Filename: AnimateWindowManager.h -// -// author: Chris Huybregts -// -// purpose: The Animate Window class will be used by registering a window with -// the manager with stating what kind of animation to do. Then on every -// update, we'll move the windows. -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "Lib/BaseType.h" -#include "Common/SubsystemInterface.h" -#include "Common/GameMemory.h" - -//----------------------------------------------------------------------------- -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class GameWindow; -class ProcessAnimateWindowSlideFromBottom; -class ProcessAnimateWindowSlideFromBottomTimed; -class ProcessAnimateWindowSlideFromTop; -class ProcessAnimateWindowSlideFromLeft; -class ProcessAnimateWindowSlideFromRight; -class ProcessAnimateWindowSlideFromRightFast; -class ProcessAnimateWindowSpiral; -class ProcessAnimateWindowSlideFromTopFast; -class ProcessAnimateWindowSideSelect; -class ProcessAnimateWindow; - -//----------------------------------------------------------------------------- -// TYPE DEFINES /////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -enum AnimTypes CPP_11(: Int) -{ - WIN_ANIMATION_NONE = 0, - WIN_ANIMATION_SLIDE_RIGHT, - WIN_ANIMATION_SLIDE_RIGHT_FAST, - WIN_ANIMATION_SLIDE_LEFT, - WIN_ANIMATION_SLIDE_TOP, - WIN_ANIMATION_SLIDE_BOTTOM, - WIN_ANIMATION_SPIRAL, - WIN_ANIMATION_SLIDE_BOTTOM_TIMED, - WIN_ANIMATION_SLIDE_TOP_FAST, - WIN_ANIMATION_COUNT -} ; - -//----------------------------------------------------------------------------- -// TheSuperHackers @build xezon 14/03/2025 Puts class into namespace to avoid name collision with AnimateWindow function in WinUser.h -namespace wnd -{ -class AnimateWindow : public MemoryPoolObject -{ - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AnimateWindow, "AnimateWindow") -public: - AnimateWindow(); - //~AnimateWindow(); - - static AnimateWindow* createNewInstance() - { - return newInstance(AnimateWindow); - } - - void setAnimData( ICoord2D startPos, ICoord2D endPos, ICoord2D curPos, ICoord2D restPos, Coord2D vel, UnsignedInt startTime, UnsignedInt endTime); - - ICoord2D getStartPos(); ///< Get the Start Position 2D coord - ICoord2D getCurPos(); ///< Get the Current Position 2D coord - ICoord2D getEndPos(); ///< Get the End Position 2D coord - ICoord2D getRestPos(); ///< Get the Rest Position 2D coord - GameWindow *getGameWindow(); ///< Get the GameWindow that will be animating - AnimTypes getAnimType(); ///< Get the Animation type - UnsignedInt getDelay(); ///< Get the Time Delay - Coord2D getVel(); ///< Get the Velocity Position 2D coord - UnsignedInt getStartTime(); ///< Get the start time of the time-based anim - UnsignedInt getEndTime(); ///< Get the end time of the time-based anim - - void setStartPos( ICoord2D starPos); ///< Set the Start Position 2D coord - void setCurPos( ICoord2D curPos); ///< Set the Current Position 2D coord - void setEndPos( ICoord2D endPos); ///< Set the End Position 2D coord - void setRestPos( ICoord2D restPos); ///< Set the Rest Position 2D coord - void setGameWindow( GameWindow *win); ///< Set the GameWindow that will be animating - void setAnimType( AnimTypes animType); ///< Set the Animation type - void setDelay( UnsignedInt delay); ///< Set the Time Delay - void setVel( Coord2D vel); ///< Set the Velocity Position 2D coord - void setStartTime( UnsignedInt t); ///< Set the start time of the time-based anim - void setEndTime( UnsignedInt t); ///< Set the end time of the time-based anim - - void setFinished(Bool finished); ///< Set if the animation has finished - Bool isFinished(); ///< Return if the animation has finished or not. - void setNeedsToFinish( Bool needsToFinish); ///< set if we need this animation to finish for the manager to return true - Bool needsToFinish(); ///< set if the animation has finished - -private: - UnsignedInt m_delay; ///< Holds the delay time in which the animation will start (in milliseconds) - ICoord2D m_startPos; ///< Holds the starting position of the animation - ///<(usually is also the end position of the animation when the animation is reversed) - ICoord2D m_endPos; ///< Holds the target End Position (usually is the same as the rest position) - ICoord2D m_curPos; ///< It's Current Position - ICoord2D m_restPos; ///< When the Manager Resets, It sets the window's position to this position - GameWindow *m_win; ///< the window that this animation is happening on - Coord2D m_vel; ///< the Velocity of the animation - UnsignedInt m_startTime; ///< time we started the time-based anim - UnsignedInt m_endTime; ///< time we should end the time-based anim - AnimTypes m_animType; ///< The type of animation that will happen - Bool m_needsToFinish; ///< Flag to tell the manager if we need to finish before it's done with it's animation - Bool m_isFinished; ///< We're finished -}; -} // namespace wnd - - - -//----------------------------------------------------------------------------- -typedef std::list AnimateWindowList; - -//----------------------------------------------------------------------------- -class AnimateWindowManager : public SubsystemInterface -{ -public: - AnimateWindowManager(); - virtual ~AnimateWindowManager() override; - - // Inhertited from subsystem ==================================================================== - virtual void init() override; - virtual void reset() override; - virtual void update() override; - //=============================================================================================== - - void registerGameWindow(GameWindow *win, AnimTypes animType, Bool needsToFinish, UnsignedInt ms = 0, UnsignedInt delayMs = 0); // Registers a new window to animate. - Bool isFinished(); ///< Are all the animations that need to be finished, finished? - void reverseAnimateWindow(); ///< tell each animation type to setup the windows to run in reverse - void resetToRestPosition(); ///< Reset all windows to their rest position - Bool isReversed(); ///< Returns whether or not we're in our reversed state. - Bool isEmpty(); -private: - AnimateWindowList m_winList; ///< A list of AnimationWindows that we don't care if their finished animating - AnimateWindowList m_winMustFinishList; ///< A list of AnimationWindows that we do care about - Bool m_needsUpdate; ///< If we're done animating all our monitored windows, then this will be false - Bool m_reverse; ///< Are we in a reverse state? - ProcessAnimateWindowSlideFromRight *m_slideFromRight; ///< Holds the process in which the windows slide from the right - ProcessAnimateWindowSlideFromRightFast *m_slideFromRightFast; - ProcessAnimateWindowSlideFromTop *m_slideFromTop; ///< Holds the process in which the windows slide from the Top - ProcessAnimateWindowSlideFromLeft *m_slideFromLeft; ///< Holds the process in which the windows slide from the Left - ProcessAnimateWindowSlideFromBottom *m_slideFromBottom; ///< Holds the process in which the windows slide from the Bottom - ProcessAnimateWindowSpiral *m_spiral; ///< Holds the process in which the windows Spiral onto the screen - ProcessAnimateWindowSlideFromBottomTimed *m_slideFromBottomTimed; ///< Holds the process in which the windows slide from the Bottom in a time-based fashion - ProcessAnimateWindowSlideFromTopFast *m_slideFromTopFast; ///< holds the process in wich the windows slide from the top,fast - ProcessAnimateWindow *getProcessAnimate( AnimTypes animType); ///< returns the process for the kind of animation we need. - -}; - -//----------------------------------------------------------------------------- -// INLINING /////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -namespace wnd -{ - inline ICoord2D AnimateWindow::getStartPos() { return m_startPos; }; - inline ICoord2D AnimateWindow::getCurPos() { return m_curPos; }; - inline ICoord2D AnimateWindow::getEndPos() { return m_endPos; }; - inline ICoord2D AnimateWindow::getRestPos() { return m_restPos; }; - inline GameWindow *AnimateWindow::getGameWindow(){ return m_win; }; - inline AnimTypes AnimateWindow::getAnimType() { return m_animType; }; - inline UnsignedInt AnimateWindow::getDelay() { return m_delay; }; - inline Coord2D AnimateWindow::getVel() { return m_vel; }; - inline UnsignedInt AnimateWindow::getStartTime() { return m_startTime; }; - inline UnsignedInt AnimateWindow::getEndTime() { return m_endTime; }; - - inline void AnimateWindow::setStartPos( ICoord2D startPos) { m_startPos = startPos; }; - inline void AnimateWindow::setCurPos( ICoord2D curPos) { m_curPos = curPos; }; - inline void AnimateWindow::setEndPos( ICoord2D endPos) { m_endPos = endPos; }; - inline void AnimateWindow::setRestPos( ICoord2D restPos) { m_restPos = restPos; }; - inline void AnimateWindow::setGameWindow( GameWindow *win) { m_win = win; }; - inline void AnimateWindow::setAnimType( AnimTypes animType) { m_animType = animType; }; - inline void AnimateWindow::setDelay( UnsignedInt delay) { m_delay = delay; }; - inline void AnimateWindow::setVel( Coord2D vel) { m_vel = vel; }; - inline void AnimateWindow::setStartTime( UnsignedInt t ) { m_startTime = t; } - inline void AnimateWindow::setEndTime( UnsignedInt t ) { m_endTime = t; } - - inline void AnimateWindow::setFinished( Bool finished) { m_isFinished = finished; }; - inline Bool AnimateWindow::isFinished() { return m_isFinished; }; - inline void AnimateWindow::setNeedsToFinish( Bool needsToFinish) { m_needsToFinish = needsToFinish; }; - inline Bool AnimateWindow::needsToFinish() { return m_needsToFinish; }; -} // namespace wnd - - inline Bool AnimateWindowManager::isFinished() { return !m_needsUpdate; }; - inline Bool AnimateWindowManager::isReversed() { return m_reverse; }; - inline Bool AnimateWindowManager::isEmpty(){return (m_winList.empty() && m_winMustFinishList.empty()); } -//----------------------------------------------------------------------------- -// EXTERNALS ////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/CommandXlat.h b/Generals/Code/GameEngine/Include/GameClient/CommandXlat.h deleted file mode 100644 index fec363bbc59..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/CommandXlat.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: CommandXlat.h /////////////////////////////////////////////////////////// -// Author: Steven Johnson, Dec 2001 - -#pragma once - -#include "GameClient/InGameUI.h" - -enum GUICommandType CPP_11(: Int); - -//----------------------------------------------------------------------------- -class CommandTranslator : public GameMessageTranslator -{ -public: - - CommandTranslator(); - virtual ~CommandTranslator() override; - - enum CommandEvaluateType { DO_COMMAND, DO_HINT, EVALUATE_ONLY }; - - - GameMessage::Type evaluateForceAttack( Drawable *draw, const Coord3D *pos, CommandEvaluateType type ); - GameMessage::Type evaluateContextCommand( Drawable *draw, const Coord3D *pos, CommandEvaluateType type ); - -private: - - Int m_objective; - Bool m_teamExists; ///< is there a currently selected "team"? - - // these are for determining if a drag occurred or it was just a sloppy click - ICoord2D m_mouseRightDragAnchor; // the location of a possible mouse drag start - ICoord2D m_mouseRightDragLift; // the location of a possible mouse drag end - UnsignedInt m_mouseRightDown; // when the mouse down happened - UnsignedInt m_mouseRightUp; // when the mouse up happened - - GameMessage::Type createMoveToLocationMessage( Drawable *draw, const Coord3D *dest, CommandEvaluateType commandType ); - GameMessage::Type createAttackMessage( Drawable *draw, Drawable *other, CommandEvaluateType commandType ); - GameMessage::Type createEnterMessage( Drawable *enter, CommandEvaluateType commandType ); - GameMessage::Type issueMoveToLocationCommand( const Coord3D *pos, Drawable *drawableInWay, CommandEvaluateType commandType ); - GameMessage::Type issueAttackCommand( Drawable *target, CommandEvaluateType commandType, GUICommandType command = (GUICommandType)0 ); - GameMessage::Type issueSpecialPowerCommand( const CommandButton *command, CommandEvaluateType commandType, Drawable *target, const Coord3D *pos, Object* ignoreSelObj ); - GameMessage::Type issueFireWeaponCommand( const CommandButton *command, CommandEvaluateType commandType, Drawable *target, const Coord3D *pos ); - GameMessage::Type issueCombatDropCommand( const CommandButton *command, CommandEvaluateType commandType, Drawable *target, const Coord3D *pos ); - - virtual GameMessageDisposition translateGameMessage(const GameMessage *msg) override; -}; - - -enum FilterTypes CPP_11(: Int) -{ - FT_NULL_FILTER=0, - // The following are screen filter shaders, that modify the rendered viewport after it is drawn. - FT_VIEW_BW_FILTER, //filter to apply a black & white filter to the screen. - FT_VIEW_MOTION_BLUR_FILTER, //filter to apply motion blur filter to screen. - FT_VIEW_CROSSFADE, ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ControlBarResizer.h ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Sep 2002 -// -// Filename: ControlBarResizer.h -// -// author: Chris Huybregts -// -// purpose: -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// TYPE DEFINES /////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class ResizerWindow -{ -public: -ResizerWindow(); - AsciiString m_name; - ICoord2D m_defaultSize; - ICoord2D m_defaultPos; - ICoord2D m_altSize; - ICoord2D m_altPos; -}; - -class ControlBarResizer -{ -public: - ControlBarResizer(); - ~ControlBarResizer(); - - void init(); - - // parse Functions for the INI file - const FieldParse *getFieldParse() const { return m_controlBarResizerParseTable; } ///< returns the parsing fields - static const FieldParse m_controlBarResizerParseTable[]; ///< the parse table - - ResizerWindow *findResizerWindow( AsciiString name ); ///< attempt to find the control bar scheme by it's name - ResizerWindow *newResizerWindow( AsciiString name ); ///< create a new control bar scheme and return it. - - void sizeWindowsDefault(); - void sizeWindowsAlt(); - - typedef std::list< ResizerWindow *> ResizerWindowList; - ResizerWindowList m_resizerWindowsList; - -}; -//----------------------------------------------------------------------------- -// INLINING /////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// EXTERNALS ////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/DebugDisplay.h b/Generals/Code/GameEngine/Include/GameClient/DebugDisplay.h deleted file mode 100644 index f9137491d8f..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/DebugDisplay.h +++ /dev/null @@ -1,147 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//---------------------------------------------------------------------------- -// -// Project: Generals -// -// Module: Debug -// -// File name: GameClient/DebugDisplay.h -// -// Created: 11/13/01 TR -// -//---------------------------------------------------------------------------- - -#pragma once - -//---------------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------------- - -#include "Lib/BaseType.h" -#include - - -//---------------------------------------------------------------------------- -// Forward References -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Type Defines -//---------------------------------------------------------------------------- - - -//=============================== -// DebugDisplayInterface -//=============================== - -class DebugDisplayInterface -{ - - public: - - enum Color - { - WHITE, - BLACK, - YELLOW, - RED, - GREEN, - BLUE, - }; - - virtual ~DebugDisplayInterface() {}; - - virtual void printf( const Char *format, ...) = 0; ///< Print formatted text at current cursor position - virtual void setCursorPos( Int x, Int y ) = 0; ///< Set new cursor position - virtual Int getCursorXPos() = 0; ///< Get current X position of cursor - virtual Int getCursorYPos() = 0; ///< Get current Y position of cursor - virtual Int getWidth() = 0; ///< Get character width of display - virtual Int getHeight() = 0; ///< Get character height of display - virtual void setTextColor( Color color ) = 0; ///< Set text color - virtual void setRightMargin( Int rightPos ) = 0; ///< Set right margin position - virtual void setLeftMargin( Int leftPos ) = 0; ///< Set left margin position - virtual void reset() = 0; ///< Reset back to default settings - - protected: - - virtual void drawText( Int x, Int y, Char *text ) = 0; ///< Render null ternimated string at current cursor position -}; - - -//=============================== -// DebugDisplay -//=============================== - -class DebugDisplay : public DebugDisplayInterface -{ - - public: - - DebugDisplay(); - virtual ~DebugDisplay() override {}; - - virtual void printf( const Char *format, ...) override; ///< Print formatted text at current cursor position - virtual void setCursorPos( Int x, Int y ) override; ///< Set new cursor position - virtual Int getCursorXPos() override; ///< Get current X position of cursor - virtual Int getCursorYPos() override; ///< Get current Y position of cursor - virtual Int getWidth() override; ///< Get character width of display - virtual Int getHeight() override; ///< Get character height of display - virtual void setTextColor( Color color ) override; ///< set text color - virtual void setRightMargin( Int rightPos ) override; ///< set right margin position - virtual void setLeftMargin( Int leftPos ) override; ///< set left margin position - virtual void reset() override; ///< Reset back to default settings - - protected: - - Color m_textColor; ///< Color to render text in - Int m_xPos; ///< Current X position of cursor - Int m_yPos; ///< Current Y position of cursor - Int m_width; ///< Character width of display - Int m_height; ///< Character height of display - Int m_rightMargin;///< Right margin position - Int m_leftMargin; ///< Left margin position - -}; - -// displayers - -#if defined(RTS_DEBUG) -extern void AudioDebugDisplay( DebugDisplayInterface *debugDisplay, void *userData, FILE *fp ); -#endif - - -//---------------------------------------------------------------------------- -// Inlining -//---------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/Diplomacy.h b/Generals/Code/GameEngine/Include/GameClient/Diplomacy.h deleted file mode 100644 index 7f2aa04f987..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/Diplomacy.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Diplomacy.h ///////////////////////////////////////////////////////////////////////////// -// Author: Matthew D. Campbell, Sept 2002 -////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -void PopulateInGameDiplomacyPopup(); -void UpdateDiplomacyBriefingText(AsciiString newText, Bool clear); - -typedef std::list BriefingList; -BriefingList* GetBriefingTextList(); diff --git a/Generals/Code/GameEngine/Include/GameClient/DisconnectMenu.h b/Generals/Code/GameEngine/Include/GameClient/DisconnectMenu.h deleted file mode 100644 index 81451f7b9a8..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/DisconnectMenu.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "GameNetwork/DisconnectManager.h" - -enum DisconnectMenuStateType CPP_11(: Int) { - DISCONNECTMENUSTATETYPE_SCREENON, - DISCONNECTMENUSTATETYPE_SCREENOFF -}; - -class DisconnectMenu { -public: - DisconnectMenu(); - virtual ~DisconnectMenu(); - - void init(); - - void attachDisconnectManager(DisconnectManager *disconnectManager); - - void showScreen(); - void hideScreen(); - Bool isScreenVisible() { return m_menuState == DISCONNECTMENUSTATETYPE_SCREENON; } - - void showPlayerControls(Int slot); - void hidePlayerControls(Int slot); - void showPacketRouterTimeout(); - void hidePacketRouterTimeout(); - - void setPlayerName(Int playerNum, UnicodeString name); - void setPlayerTimeoutTime(Int playerNum, time_t newTime); - void setPacketRouterTimeoutTime(time_t newTime); - - void sendChat(UnicodeString text); - void showChat(UnicodeString text); - - void quitGame(); - void removePlayer(Int slot, UnicodeString playerName); - void voteForPlayer(Int slot); - void updateVotes(Int slot, Int votes); - -protected: - DisconnectManager *m_disconnectManager; ///< For retrieving status updates from the disconnect manager. - DisconnectMenuStateType m_menuState; ///< The current state of the menu screen. - - static const char *const m_playerNameTextControlNames[MAX_SLOTS]; ///< names of the player name controls in the window. - static const char *const m_playerTimeoutTextControlNames[MAX_SLOTS]; ///< names of the timeout controls in the window. - static const char *const m_playerVoteButtonControlNames[MAX_SLOTS]; ///< names of the vote button controls in the window. - static const char *const m_playerVoteCountControlNames[MAX_SLOTS]; ///< names of the vote count static text controls in the window. - static const char *const m_packetRouterTimeoutControlName; ///< name of the packet router timeout control window. - static const char *const m_packetRouterTimeoutLabelControlName; ///< name of the packet router timeout label control window. - static const char *const m_textDisplayControlName; ///< name of the text display listbox control window. -}; - -extern DisconnectMenu *TheDisconnectMenu; diff --git a/Generals/Code/GameEngine/Include/GameClient/Display.h b/Generals/Code/GameEngine/Include/GameClient/Display.h deleted file mode 100644 index dab09f09c1a..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/Display.h +++ /dev/null @@ -1,229 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Display.h //////////////////////////////////////////////////////////// -// The graphics display singleton -// Author: Michael S. Booth, March 2001 - -#pragma once - -#include "Common/SubsystemInterface.h" -#include "GameClient/Color.h" -#include "GameClient/GameFont.h" -#include "GameClient/View.h" - -struct ShroudLevel -{ - Short m_currentShroud; ///< A Value of 1 means shrouded. 0 is not. Negative is the count of people looking. - Short m_activeShroudLevel;///< A Value of 0 means passive shroud. Positive is the count of people shrouding. -}; - -class VideoBuffer; -class VideoStreamInterface; -class DebugDisplayInterface; -class Radar; -class Image; -class DisplayString; -enum StaticGameLODLevel CPP_11(: Int); -/** - * The Display class implements the Display interface - */ -class Display : public SubsystemInterface -{ - -public: - enum DrawImageMode - { - DRAW_IMAGE_SOLID, - DRAW_IMAGE_GRAYSCALE, //draw image without blending and ignoring alpha - DRAW_IMAGE_ALPHA, //alpha blend the image into frame buffer - DRAW_IMAGE_ADDITIVE //additive blend the image into frame buffer - }; - - typedef void (DebugDisplayCallback)( DebugDisplayInterface *debugDisplay, void *userData, FILE *fp ); - - Display(); - virtual ~Display() override; - - virtual void init() override { }; ///< Initialize - virtual void reset() override; ///< Reset system - virtual void update() override; ///< Update system - - //--------------------------------------------------------------------------------------- - // Display attribute methods - virtual void setWidth( UnsignedInt width ); ///< Sets the width of the display - virtual void setHeight( UnsignedInt height ); ///< Sets the height of the display - virtual UnsignedInt getWidth() { return m_width; } ///< Returns the width of the display - virtual UnsignedInt getHeight() { return m_height; } ///< Returns the height of the display - virtual void setBitDepth( UnsignedInt bitDepth ) { m_bitDepth = bitDepth; } - virtual UnsignedInt getBitDepth() { return m_bitDepth; } - virtual void setWindowed( Bool windowed ) { m_windowed = windowed; } ///< set windowd/fullscreen flag - virtual Bool getWindowed() { return m_windowed; } ///< return widowed/fullscreen flag - virtual Bool setDisplayMode( UnsignedInt xres, UnsignedInt yres, UnsignedInt bitdepth, Bool windowed ); ///getNextView(); - return nullptr; - } - - virtual void drawViews(); ///< Render all views of the world - virtual void updateViews (); ///< Updates state of world views - virtual void stepViews(); ///< Update views for every fixed time step - - virtual VideoBuffer* createVideoBuffer() = 0; ///< Create a video buffer that can be used for this display - - //--------------------------------------------------------------------------------------- - // Drawing management - virtual void setClipRegion( IRegion2D *region ) = 0; ///< Set clip rectangle for 2D draw operations. - virtual Bool isClippingEnabled() = 0; - virtual void enableClipping( Bool onoff ) = 0; - - virtual void step() {}; ///< Do one fixed time step - virtual void draw() override; ///< Redraw the entire display - virtual void setTimeOfDay( TimeOfDay tod ) = 0; ///< Set the time of day for this display - virtual void createLightPulse( const Coord3D *pos, const RGBColor *color, Real innerRadius,Real attenuationWidth, - UnsignedInt increaseFrameTime, UnsignedInt decayFrameTime//, Bool donut = FALSE - ) = 0; - - /// draw a line on the display in pixel coordinates with the specified color - virtual void drawLine( Int startX, Int startY, Int endX, Int endY, - Real lineWidth, UnsignedInt lineColor ) = 0; - /// draw a line on the display in pixel coordinates with the specified 2 colors - virtual void drawLine( Int startX, Int startY, Int endX, Int endY, - Real lineWidth, UnsignedInt lineColor1, UnsignedInt lineColor2 ) = 0; - /// draw a rect border on the display in pixel coordinates with the specified color - virtual void drawOpenRect( Int startX, Int startY, Int width, Int height, - Real lineWidth, UnsignedInt lineColor ) = 0; - /// draw a filled rect on the display in pixel coords with the specified color - virtual void drawFillRect( Int startX, Int startY, Int width, Int height, - UnsignedInt color ) = 0; - - /// Draw a percentage of a rectangle, much like a clock - virtual void drawRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) = 0; - virtual void drawRemainingRectClock(Int startX, Int startY, Int width, Int height, Int percent, UnsignedInt color) = 0; - - /// draw an image fit within the screen coordinates - virtual void drawImage( const Image *image, Int startX, Int startY, - Int endX, Int endY, Color color = 0xFFFFFFFF, DrawImageMode mode=DRAW_IMAGE_ALPHA) = 0; - - /// draw a video buffer fit within the screen coordinates - virtual void drawScaledVideoBuffer( VideoBuffer *buffer, VideoStreamInterface *stream ) = 0; - virtual void drawVideoBuffer( VideoBuffer *buffer, Int startX, Int startY, - Int endX, Int endY ) = 0; - - /// FullScreen video playback - virtual void playLogoMovie( AsciiString movieName, Int minMovieLength, Int minCopyrightLength ); - virtual void playMovie( AsciiString movieName ); - virtual void stopMovie(); - virtual Bool isMoviePlaying(); - - /// Register debug display callback - virtual void setDebugDisplayCallback( DebugDisplayCallback *callback, void *userData = nullptr ); - virtual DebugDisplayCallback *getDebugDisplayCallback(); - - virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting ) = 0; ///< set shroud - virtual void clearShroud() = 0; ///< empty the entire shroud - virtual void setBorderShroudLevel(UnsignedByte level) = 0; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: DrawableInfo.h /////////////////////////////////////////////////////////////////////////////// -// Simple structure used to bind W3D renderObjects to our own Drawables. -// Author: Mark Wilczynski, August 2002 - -#pragma once - -#include "Common/GameType.h" - -class Drawable; -class GhostObject; -class Object; - -struct DrawableInfo -{ - enum ExtraRenderFlags - { ERF_IS_NORMAL=0, - ERF_IS_OCCLUDED= 0x00000001, - ERF_POTENTIAL_OCCLUDER= 0x00000002, - ERF_POTENTIAL_OCCLUDEE= 0x00000004, - ERF_IS_TRANSLUCENT= 0x00000008, - ERF_IS_NON_OCCLUDER_OR_OCCLUDEE = 0x00000010, - ERF_DELAYED_RENDER = ERF_IS_TRANSLUCENT|ERF_POTENTIAL_OCCLUDEE, - }; - - DrawableInfo() : m_shroudStatusObjectID(INVALID_ID), m_drawable(nullptr), m_ghostObject(nullptr), m_flags(ERF_IS_NORMAL) {} - - ObjectID m_shroudStatusObjectID; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//// EstablishConnectionsMenu.h ///////////////////////// - -#include "GameNetwork/NetworkDefs.h" -#include "GameNetwork/NAT.h" - -enum EstablishConnectionsMenuStateType CPP_11(: Int) { - ESTABLISHCONNECTIONSMENUSTATETYPE_SCREENON, - ESTABLISHCONNECTIONSMENUSTATETYPE_SCREENOFF -}; - -class EstablishConnectionsMenu { -public: - EstablishConnectionsMenu(); - virtual ~EstablishConnectionsMenu(); - - void initMenu(); - void endMenu(); - void abortGame(); - - void setPlayerName(Int slot, UnicodeString name); - void setPlayerStatus(Int slot, NATConnectionState state); - -protected: - EstablishConnectionsMenuStateType m_menuState; - - static const char *const m_playerReadyControlNames[MAX_SLOTS]; - static const char *const m_playerNameControlNames[MAX_SLOTS]; - static const char *const m_playerStatusControlNames[MAX_SLOTS]; -}; - -extern EstablishConnectionsMenu *TheEstablishConnectionsMenu; diff --git a/Generals/Code/GameEngine/Include/GameClient/ExtendedMessageBox.h b/Generals/Code/GameEngine/Include/GameClient/ExtendedMessageBox.h deleted file mode 100644 index 25c13a718f8..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/ExtendedMessageBox.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ExtendedMessageBox.h ///////////////////////////////////////////////////////////////////// -// Author: Matt Campbell, January 2003 -// Description: We go quiet in 1 day, gold in 15. Poor time to rewrite message boxes, so -// we get this file instead. Phooey. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "GameClient/GameWindowManager.h" - -// return codes for message box callbacks -enum MessageBoxReturnType CPP_11(: Int) { - MB_RETURN_CLOSE, - MB_RETURN_KEEPOPEN -}; - -typedef MessageBoxReturnType (* MessageBoxFunc)( void *userData ); - -// WindowExMessageBoxData --------------------------------------------------------- -/** Data attached to each extended Message box window */ -//----------------------------------------------------------------------------- -struct WindowExMessageBoxData -{ - MessageBoxFunc yesCallback; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: FontDesc.h /////////////////////////////////////////////////////////////////////////////// -// Simple structure used to hold font descriptions. -// Author: Mark Wilczynski, October 2002 - -#pragma once - -#include "Common/GameType.h" - -struct FontDesc -{ - FontDesc(); - AsciiString name; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GUICommandTranslator.h /////////////////////////////////////////////////////////////////// -// Author: Colin Day, March 2002 -// Desc: Translator for commands activated from the selection GUI, such as special unit -// actions, that require additional clicks in the world like selecting a target -// object or location -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// -#include "GameClient/InGameUI.h" - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -class GUICommandTranslator : public GameMessageTranslator -{ - -public: - - GUICommandTranslator(); - virtual ~GUICommandTranslator() override; - - virtual GameMessageDisposition translateGameMessage( const GameMessage *msg ) override; -}; diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetCheckBox.h b/Generals/Code/GameEngine/Include/GameClient/GadgetCheckBox.h deleted file mode 100644 index 8c7ef8334ca..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetCheckBox.h +++ /dev/null @@ -1,139 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetCheckBox.h ///////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetCheckBox.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for checkboxes -// -// CheckBox IMAGE/COLOR organization -// When control is enabled: -// enabledDrawData[ 0 ] is the background image for the whole enabled control -// enabledDrawData[ 1 ] is the enabled, unselected check box -// enabledDrawData[ 2 ] is the enabled, selected check box -// -// When control is disabled: -// disabledDrawData[ 0 ] is the background image for the whole disabled control -// disabledDrawData[ 1 ] is the disabled, unselected check box -// disabledDrawData[ 2 ] si the disabled, selected check box -// -// When control is hilited (mouse over it and enabled) -// hiliteDrawData[ 0 ] is the background image for the whole hilited control -// hiliteDrawData[ 1 ] is the hilited, unselected check box -// hiliteDrawData[ 2 ] is the hilited, selected check box -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -extern void GadgetCheckBoxSetText( GameWindow *g, UnicodeString text ); -extern Bool GadgetCheckBoxIsChecked( GameWindow *g ); -extern void GadgetCheckBoxSetChecked( GameWindow *g, Bool isChecked); -extern void GadgetCheckBoxToggle( GameWindow *g); - -inline void GadgetCheckBoxSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetCheckBoxSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetCheckBoxSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetCheckBoxSetEnabledUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetCheckBoxSetEnabledUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); } -inline void GadgetCheckBoxSetEnabledUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); } -inline void GadgetCheckBoxSetEnabledCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); } -inline void GadgetCheckBoxSetEnabledCheckedBoxColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 2, color ); } -inline void GadgetCheckBoxSetEnabledCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 2, color ); } -inline const Image *GadgetCheckBoxGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline Color GadgetCheckBoxGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetCheckBoxGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } -inline const Image *GadgetCheckBoxGetEnabledUncheckedBoxImage( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline Color GadgetCheckBoxGetEnabledUncheckedBoxColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); } -inline Color GadgetCheckBoxGetEnabledUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); } -inline const Image *GadgetCheckBoxGetEnabledCheckedBoxImage( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline Color GadgetCheckBoxGetEnabledCheckedBoxColor( GameWindow *g ) { return g->winGetEnabledColor( 2 ); } -inline Color GadgetCheckBoxGetEnabledCheckedBoxBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 2 ); } - -inline void GadgetCheckBoxSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetCheckBoxSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetCheckBoxSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetCheckBoxSetDisabledUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetCheckBoxSetDisabledUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); } -inline void GadgetCheckBoxSetDisabledUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); } -inline void GadgetCheckBoxSetDisabledCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); } -inline void GadgetCheckBoxSetDisabledCheckedBoxColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 2, color ); } -inline void GadgetCheckBoxSetDisabledCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 2, color ); } -inline const Image *GadgetCheckBoxGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline Color GadgetCheckBoxGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetCheckBoxGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } -inline const Image *GadgetCheckBoxGetDisabledUncheckedBoxImage( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline Color GadgetCheckBoxGetDisabledUncheckedBoxColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); } -inline Color GadgetCheckBoxGetDisabledUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); } -inline const Image *GadgetCheckBoxGetDisabledCheckedBoxImage( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline Color GadgetCheckBoxGetDisabledCheckedBoxColor( GameWindow *g ) { return g->winGetDisabledColor( 2 ); } -inline Color GadgetCheckBoxGetDisabledCheckedBoxBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 2 ); } - -inline void GadgetCheckBoxSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetCheckBoxSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetCheckBoxSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetCheckBoxSetHiliteUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetCheckBoxSetHiliteUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); } -inline void GadgetCheckBoxSetHiliteUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); } -inline void GadgetCheckBoxSetHiliteCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); } -inline void GadgetCheckBoxSetHiliteCheckedBoxColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 2, color ); } -inline void GadgetCheckBoxSetHiliteCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 2, color ); } -inline const Image *GadgetCheckBoxGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline Color GadgetCheckBoxGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetCheckBoxGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } -inline const Image *GadgetCheckBoxGetHiliteUncheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline Color GadgetCheckBoxGetHiliteUncheckedBoxColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); } -inline Color GadgetCheckBoxGetHiliteUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); } -inline const Image *GadgetCheckBoxGetHiliteCheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline Color GadgetCheckBoxGetHiliteCheckedBoxColor( GameWindow *g ) { return g->winGetHiliteColor( 2 ); } -inline Color GadgetCheckBoxGetHiliteCheckedBoxBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 2 ); } - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetComboBox.h b/Generals/Code/GameEngine/Include/GameClient/GadgetComboBox.h deleted file mode 100644 index 51589981437..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetComboBox.h +++ /dev/null @@ -1,192 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetComboBox.h ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetComboBox.h -// -// Created: Chris Huybregts, November 2001 -// -// Desc: Helpful interface for ComboBoxes -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/Gadget.h" -#include "GameClient/GameWindow.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -extern void GadgetComboBoxSetFont( GameWindow *comboBox, GameFont *font ); -extern UnicodeString GadgetComboBoxGetText( GameWindow *comboBox ); -extern void GadgetComboBoxSetText( GameWindow *comboBox, UnicodeString text ); -extern Int GadgetComboBoxAddEntry( GameWindow *comboBox, UnicodeString text, Color color ); -extern void GadgetComboBoxReset( GameWindow *comboBox ); - -extern void GadgetComboBoxSetSelectedPos( GameWindow *comboBox, Int selectedIndex, Bool dontHide = FALSE ); -extern void GadgetComboBoxGetSelectedPos( GameWindow *comboBox, Int *selectedIndex ); -extern void GadgetComboBoxSetItemData( GameWindow *comboBox, Int index, void *data ); -extern void *GadgetComboBoxGetItemData( GameWindow *comboBox, Int index ); -extern Int GadgetComboBoxGetLength( GameWindow *comboBox ); - -extern void GadgetComboBoxHideList( GameWindow *comboBox ); -// Functions that set the ComboBoxData Parameters -extern void GadgetComboBoxSetAsciiOnly(GameWindow *comboBox, Bool isAsciiOnly ); -extern void GadgetComboBoxSetLettersAndNumbersOnly(GameWindow *comboBox, Bool isLettersAndNumbersOnly ); -extern void GadgetComboBoxSetMaxChars( GameWindow *comboBox, Int maxChars ); -extern void GadgetComboBoxSetMaxDisplay( GameWindow *comboBox, Int maxDisplay ); -extern void GadgetComboBoxSetIsEditable(GameWindow *comboBox, Bool isEditable ); - -//setup all the Font Colors -extern void GadgetComboBoxSetEnabledTextColors( GameWindow *comboBox,Color color, Color borderColor ); -extern void GadgetComboBoxSetDisabledTextColors( GameWindow *comboBox,Color color, Color borderColor ); -extern void GadgetComboBoxSetHiliteTextColors( GameWindow *comboBox,Color color, Color borderColor ); -extern void GadgetComboBoxSetIMECompositeTextColors( GameWindow *comboBox, Color color, Color borderColor ); - -// -// you can use this to set the colors for the list box all at once, note that -// it will also automatically change the colors for any attached slider -// and those slider buttons and thumb as well as the drop down button and edit box. -// -extern void GadgetComboBoxSetColors( GameWindow *comboBox, - Color enabledColor, - Color enabledBorderColor, - Color enabledSelectedItemColor, - Color enabledSelectedItemBorderColor, - Color disabledColor, - Color disabledBorderColor, - Color disabledSelectedItemColor, - Color disabledSelectedItemBorderColor, - Color hiliteColor, - Color hiliteBorderColor, - Color hiliteSelectedItemColor, - Color hiliteSelectedItemBorderColor ); - -inline void GadgetComboBoxSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetComboBoxSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetComboBoxSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetComboBoxSetEnabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetComboBoxSetEnabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); } -inline void GadgetComboBoxSetEnabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); } -inline void GadgetComboBoxSetEnabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); } -inline void GadgetComboBoxSetEnabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); } -inline void GadgetComboBoxSetEnabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); } -inline const Image *GadgetComboBoxGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline Color GadgetComboBoxGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetComboBoxGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } -inline const Image *GadgetComboBoxGetEnabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image *GadgetComboBoxGetEnabledSelectedItemImageRight( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline const Image *GadgetComboBoxGetEnabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); } -inline const Image *GadgetComboBoxGetEnabledSelectedItemImageSmallCenter( GameWindow *g ){ return g->winGetEnabledImage( 4 ); } -inline Color GadgetComboBoxGetEnabledSelectedItemColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); } -inline Color GadgetComboBoxGetEnabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); } - -inline void GadgetComboBoxSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetComboBoxSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetComboBoxSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetComboBoxSetDisabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetComboBoxSetDisabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); } -inline void GadgetComboBoxSetDisabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); } -inline void GadgetComboBoxSetDisabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); } -inline void GadgetComboBoxSetDisabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); } -inline void GadgetComboBoxSetDisabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); } -inline const Image *GadgetComboBoxGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline Color GadgetComboBoxGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetComboBoxGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } -inline const Image *GadgetComboBoxGetDisabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image *GadgetComboBoxGetDisabledSelectedItemImageRight( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline const Image *GadgetComboBoxGetDisabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); } -inline const Image *GadgetComboBoxGetDisabledSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 4 ); } -inline Color GadgetComboBoxGetDisabledSelectedItemColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); } -inline Color GadgetComboBoxGetDisabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); } - -inline void GadgetComboBoxSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetComboBoxSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetComboBoxSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetComboBoxSetHiliteSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetComboBoxSetHiliteSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); } -inline void GadgetComboBoxSetHiliteSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); } -inline void GadgetComboBoxSetHiliteSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); } -inline void GadgetComboBoxSetHiliteSelectedItemColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); } -inline void GadgetComboBoxSetHiliteSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); } -inline const Image *GadgetComboBoxGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline Color GadgetComboBoxGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetComboBoxGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } -inline const Image *GadgetComboBoxGetHiliteSelectedItemImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image *GadgetComboBoxGetHiliteSelectedItemImageRight( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline const Image *GadgetComboBoxGetHiliteSelectedItemImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); } -inline const Image *GadgetComboBoxGetHiliteSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 4 ); } -inline Color GadgetComboBoxGetHiliteSelectedItemColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); } -inline Color GadgetComboBoxGetHiliteSelectedItemBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); } - -inline GameWindow *GadgetComboBoxGetDropDownButton( GameWindow *g ) -{ - ComboBoxData *comboBoxData = (ComboBoxData *)g->winGetUserData(); - - if( comboBoxData && comboBoxData->dropDownButton ) - return comboBoxData->dropDownButton; - return nullptr; -} -inline GameWindow *GadgetComboBoxGetListBox( GameWindow *g ) -{ - ComboBoxData *comboBoxData = (ComboBoxData *)g->winGetUserData(); - - if( comboBoxData && comboBoxData->listBox) - return comboBoxData->listBox; - return nullptr; - -} - -inline GameWindow *GadgetComboBoxGetEditBox( GameWindow *g ) -{ - ComboBoxData *comboBoxData = (ComboBoxData *)g->winGetUserData(); - - if( comboBoxData && comboBoxData->editBox) - return comboBoxData->editBox; - return nullptr; - -} - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetListBox.h b/Generals/Code/GameEngine/Include/GameClient/GadgetListBox.h deleted file mode 100644 index d6349031d8b..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetListBox.h +++ /dev/null @@ -1,208 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetListBox.h ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetListBox.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for ListBoxes -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/Gadget.h" -#include "GameClient/GameWindow.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// -typedef struct _RightClickStruct -{ - Int mouseX; - Int mouseY; - Int pos; -} RightClickStruct; - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -extern Int GadgetListBoxGetEntryBasedOnXY( GameWindow *listbox, Int x, Int y, Int &row, Int &column); -extern void GadgetListboxCreateScrollbar( GameWindow *listbox ); -extern void GadgetListBoxAddMultiSelect( GameWindow *listbox ); -extern void GadgetListBoxRemoveMultiSelect( GameWindow *listbox ); -extern void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ); -extern Int GadgetListBoxGetListLength( GameWindow *listbox ); ///< Returns the maximum possible number of list entries. Length is synonymous to rows -extern Int GadgetListBoxGetMaxSelectedLength( GameWindow *listbox ); ///< Returns the maximum possible number of list entries that can be selected -extern Int GadgetListBoxGetNumEntries( GameWindow *listbox ); -extern Int GadgetListBoxGetNumColumns( GameWindow *listbox ); -extern Int GadgetListBoxGetColumnWidth( GameWindow *listbox, Int column ); - -extern void GadgetListBoxSetFont( GameWindow *listbox, GameFont *font ); -extern UnicodeString GadgetListBoxGetText( GameWindow *listbox, Int row, Int column = 0); -extern UnicodeString GadgetListBoxGetTextAndColor( GameWindow *listbox, Color *color, Int row, Int column = 0); -extern Int GadgetListBoxAddEntryText( GameWindow *listbox, UnicodeString text, Color color, Int row, Int column = -1, Bool overwrite = TRUE); -extern Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image, - Int row, Int column = -1, - Bool overwrite = TRUE, Color color = 0xFFFFFFFF ); -extern Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image, - Int row, Int column, - Int hight, Int width, - Bool overwrite = TRUE, Color color = 0xFFFFFFFF ); -extern void GadgetListBoxSetSelected( GameWindow *listbox, Int selectIndex ); -extern void GadgetListBoxSetSelected( GameWindow *listbox, const Int *selectList, Int selectCount = 1 ); -extern void GadgetListBoxGetSelected( GameWindow *listbox, Int *selectList ); -extern void GadgetListBoxReset( GameWindow *listbox ); -extern void GadgetListBoxSetItemData( GameWindow *listbox, void *data, Int row, Int column = 0); -extern void *GadgetListBoxGetItemData( GameWindow *listbox, Int row, Int column = 0); - -extern bool GadgetListBoxIsFull(GameWindow *window); - -extern Int GadgetListBoxGetBottomVisibleEntry( GameWindow *window ); -extern void GadgetListBoxSetBottomVisibleEntry( GameWindow *window, Int newPos ); - -extern Int GadgetListBoxGetTopVisibleEntry( GameWindow *window ); -extern void GadgetListBoxSetTopVisibleEntry( GameWindow *window, Int newPos ); - -extern void GadgetListBoxSetAudioFeedback( GameWindow *listbox, Bool enable ); - -// -// you can use this to set the colors for the list box all at once, note that -// it will also automatically change the colors for any attached slider -// and those slider buttons and thumb -// -extern void GadgetListBoxSetColors( GameWindow *listbox, - Color enabledColor, - Color enabledBorderColor, - Color enabledSelectedItemColor, - Color enabledSelectedItemBorderColor, - Color disabledColor, - Color disabledBorderColor, - Color disabledSelectedItemColor, - Color disabledSelectedItemBorderColor, - Color hiliteColor, - Color hiliteBorderColor, - Color hiliteSelectedItemColor, - Color hiliteSelectedItemBorderColor ); - -inline void GadgetListBoxSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetListBoxSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetListBoxSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetListBoxSetEnabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetListBoxSetEnabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); } -inline void GadgetListBoxSetEnabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); } -inline void GadgetListBoxSetEnabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); } -inline void GadgetListBoxSetEnabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); } -inline void GadgetListBoxSetEnabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); } -inline const Image *GadgetListBoxGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline Color GadgetListBoxGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetListBoxGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } -inline const Image *GadgetListBoxGetEnabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image *GadgetListBoxGetEnabledSelectedItemImageRight( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline const Image *GadgetListBoxGetEnabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); } -inline const Image *GadgetListBoxGetEnabledSelectedItemImageSmallCenter( GameWindow *g ){ return g->winGetEnabledImage( 4 ); } -inline Color GadgetListBoxGetEnabledSelectedItemColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); } -inline Color GadgetListBoxGetEnabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); } - -inline void GadgetListBoxSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetListBoxSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetListBoxSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetListBoxSetDisabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetListBoxSetDisabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); } -inline void GadgetListBoxSetDisabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); } -inline void GadgetListBoxSetDisabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); } -inline void GadgetListBoxSetDisabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); } -inline void GadgetListBoxSetDisabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); } -inline const Image *GadgetListBoxGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline Color GadgetListBoxGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetListBoxGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } -inline const Image *GadgetListBoxGetDisabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image *GadgetListBoxGetDisabledSelectedItemImageRight( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline const Image *GadgetListBoxGetDisabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); } -inline const Image *GadgetListBoxGetDisabledSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 4 ); } -inline Color GadgetListBoxGetDisabledSelectedItemColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); } -inline Color GadgetListBoxGetDisabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); } - -inline void GadgetListBoxSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetListBoxSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetListBoxSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetListBoxSetHiliteSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetListBoxSetHiliteSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); } -inline void GadgetListBoxSetHiliteSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); } -inline void GadgetListBoxSetHiliteSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); } -inline void GadgetListBoxSetHiliteSelectedItemColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); } -inline void GadgetListBoxSetHiliteSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); } -inline const Image *GadgetListBoxGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline Color GadgetListBoxGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetListBoxGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } -inline const Image *GadgetListBoxGetHiliteSelectedItemImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image *GadgetListBoxGetHiliteSelectedItemImageRight( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline const Image *GadgetListBoxGetHiliteSelectedItemImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); } -inline const Image *GadgetListBoxGetHiliteSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 4 ); } -inline Color GadgetListBoxGetHiliteSelectedItemColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); } -inline Color GadgetListBoxGetHiliteSelectedItemBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); } - -inline GameWindow *GadgetListBoxGetSlider( GameWindow *g ) -{ - ListboxData *listData = (ListboxData *)g->winGetUserData(); - - if( listData && listData->slider ) - return listData->slider; - return nullptr; -} -inline GameWindow *GadgetListBoxGetUpButton( GameWindow *g ) -{ - ListboxData *listData = (ListboxData *)g->winGetUserData(); - - if( listData && listData->upButton ) - return listData->upButton; - return nullptr; -} -inline GameWindow *GadgetListBoxGetDownButton( GameWindow *g ) -{ - ListboxData *listData = (ListboxData *)g->winGetUserData(); - - if( listData && listData->downButton ) - return listData->downButton; - return nullptr; - -} - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetProgressBar.h b/Generals/Code/GameEngine/Include/GameClient/GadgetProgressBar.h deleted file mode 100644 index a4ce3684857..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetProgressBar.h +++ /dev/null @@ -1,140 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetProgressBar.h ////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetProgressBar.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for ProgressBars -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - - -extern void GadgetProgressBarSetProgress( GameWindow *g, Int progress ); -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -inline void GadgetProgressBarSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetProgressBarSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetProgressBarSetEnabledImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetProgressBarSetEnabledImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetProgressBarSetEnabledImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); } -inline void GadgetProgressBarSetEnabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); } -inline void GadgetProgressBarSetEnabledBarColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 4, color ); } -inline void GadgetProgressBarSetEnabledBarBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 4, color ); } -inline void GadgetProgressBarSetEnabledBarImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); } -inline void GadgetProgressBarSetEnabledBarImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 5, image ); } -inline void GadgetProgressBarSetEnabledBarImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 6, image ); } -inline void GadgetProgressBarSetEnabledBarImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 7, image ); } -inline Color GadgetProgressBarGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetProgressBarGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } -inline const Image *GadgetProgressBarGetEnabledImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline const Image * GadgetProgressBarGetEnabledImageRight( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image * GadgetProgressBarGetEnabledImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline const Image * GadgetProgressBarGetEnabledImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); } -inline Color GadgetProgressBarGetEnabledBarColor( GameWindow *g ) { return g->winGetEnabledColor( 4 ); } -inline Color GadgetProgressBarGetEnabledBarBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 4 ); } -inline const Image * GadgetProgressBarGetEnabledBarImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 4 ); } -inline const Image * GadgetProgressBarGetEnabledBarImageRight( GameWindow *g ) { return g->winGetEnabledImage( 5 ); } -inline const Image * GadgetProgressBarGetEnabledBarImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 6 ); } -inline const Image * GadgetProgressBarGetEnabledBarImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 7 ); } - -//----------------------------------------------------------------------------- -inline void GadgetProgressBarSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetProgressBarSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetProgressBarSetDisabledImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetProgressBarSetDisabledImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetProgressBarSetDisabledImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); } -inline void GadgetProgressBarSetDisabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); } -inline void GadgetProgressBarSetDisabledBarColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 4, color ); } -inline void GadgetProgressBarSetDisabledBarBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 4, color ); } -inline void GadgetProgressBarSetDisabledBarImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); } -inline void GadgetProgressBarSetDisabledBarImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 5, image ); } -inline void GadgetProgressBarSetDisabledBarImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 6, image ); } -inline void GadgetProgressBarSetDisabledBarImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 7, image ); } -inline Color GadgetProgressBarGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetProgressBarGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } -inline const Image *GadgetProgressBarGetDisabledImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline const Image * GadgetProgressBarGetDisabledImageRight( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image * GadgetProgressBarGetDisabledImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline const Image * GadgetProgressBarGetDisabledImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); } -inline Color GadgetProgressBarGetDisabledBarColor( GameWindow *g ) { return g->winGetDisabledColor( 4 ); } -inline Color GadgetProgressBarGetDisabledBarBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 4 ); } -inline const Image * GadgetProgressBarGetDisabledBarImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 4 ); } -inline const Image * GadgetProgressBarGetDisabledBarImageRight( GameWindow *g ) { return g->winGetDisabledImage( 5 ); } -inline const Image * GadgetProgressBarGetDisabledBarImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 6 ); } -inline const Image * GadgetProgressBarGetDisabledBarImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 7 ); } - -//----------------------------------------------------------------------------- -inline void GadgetProgressBarSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetProgressBarSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetProgressBarSetHiliteImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetProgressBarSetHiliteImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetProgressBarSetHiliteImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); } -inline void GadgetProgressBarSetHiliteImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); } -inline void GadgetProgressBarSetHiliteBarColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 4, color ); } -inline void GadgetProgressBarSetHiliteBarBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 4, color ); } -inline void GadgetProgressBarSetHiliteBarImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); } -inline void GadgetProgressBarSetHiliteBarImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 5, image ); } -inline void GadgetProgressBarSetHiliteBarImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 6, image ); } -inline void GadgetProgressBarSetHiliteBarImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 7, image ); } -inline Color GadgetProgressBarGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetProgressBarGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } -inline const Image *GadgetProgressBarGetHiliteImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline const Image * GadgetProgressBarGetHiliteImageRight( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image * GadgetProgressBarGetHiliteImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline const Image * GadgetProgressBarGetHiliteImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); } -inline Color GadgetProgressBarGetHiliteBarColor( GameWindow *g ) { return g->winGetHiliteColor( 4 ); } -inline Color GadgetProgressBarGetHiliteBarBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 4 ); } -inline const Image * GadgetProgressBarGetHiliteBarImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 4 ); } -inline const Image * GadgetProgressBarGetHiliteBarImageRight( GameWindow *g ) { return g->winGetHiliteImage( 5 ); } -inline const Image * GadgetProgressBarGetHiliteBarImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 6 ); } -inline const Image * GadgetProgressBarGetHiliteBarImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 7 ); } - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetPushButton.h b/Generals/Code/GameEngine/Include/GameClient/GadgetPushButton.h deleted file mode 100644 index 017a4048b10..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetPushButton.h +++ /dev/null @@ -1,171 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetPushButton.h /////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetPushButton.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for PushButtons -// -// PushButton IMAGE/COLOR organization -// When control is enabled: -// enabledDrawData[ 0 ] is the background image for the whole enabled control -// enabledDrawData[ 1 ] is the enabled, selected button graphic -// -// When control is disabled: -// disabledDrawData[ 0 ] is the background image for the whole disabled control -// disabledDrawData[ 1 ] is the disabled, but selected button graphic -// -// When control is hilited (mouse over it and enabled) -// hiliteDrawData[ 0 ] is the background image for the whole hilited control -// hiliteDrawData[ 1 ] is the hilited, selected button graphic -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -void GadgetCheckLikeButtonSetVisualCheck( GameWindow *g, Bool checked ); -Bool GadgetCheckLikeButtonIsChecked( GameWindow *g ); -void GadgetButtonEnableCheckLike( GameWindow *g, Bool makeCheckLike, Bool initiallyChecked ); - -void GadgetButtonSetText( GameWindow *g, UnicodeString text ); -void GadgetButtonDrawClock( GameWindow *g, Int percent, Color color ); //Darkens the progress -void GadgetButtonDrawInverseClock( GameWindow *g, Int percent, Color color ); //Darkens the remaining portion. -void GadgetButtonDrawOverlayImage( GameWindow *g, const Image *image ); -void GadgetButtonSetBorder( GameWindow *g, Color color, Bool drawBorder = TRUE ); -void GadgetButtonSetData(GameWindow *g, void *data); -void *GadgetButtonGetData(GameWindow *g); -void GadgetButtonSetAltSound( GameWindow *g, AsciiString altSound ); -inline void GadgetButtonSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); g->winSetEnabledImage( 5, nullptr );g->winSetEnabledImage( 6, nullptr );} -inline void GadgetButtonSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetButtonSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetButtonSetEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); g->winSetEnabledImage( 2, nullptr );g->winSetEnabledImage( 3, nullptr );} -inline void GadgetButtonSetEnabledSelectedColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); } -inline void GadgetButtonSetEnabledSelectedBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); } -inline const Image *GadgetButtonGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline Color GadgetButtonGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetButtonGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } -inline const Image *GadgetButtonGetEnabledSelectedImage( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline Color GadgetButtonGetEnabledSelectedColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); } -inline Color GadgetButtonGetEnabledSelectedBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); } - -inline void GadgetButtonSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); g->winSetEnabledImage( 5, nullptr );g->winSetEnabledImage( 6, nullptr );} -inline void GadgetButtonSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetButtonSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetButtonSetDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); g->winSetEnabledImage( 2, nullptr );g->winSetEnabledImage( 3, nullptr );} -inline void GadgetButtonSetDisabledSelectedColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); } -inline void GadgetButtonSetDisabledSelectedBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); } -inline const Image *GadgetButtonGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline Color GadgetButtonGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetButtonGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } -inline const Image *GadgetButtonGetDisabledSelectedImage( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline Color GadgetButtonGetDisabledSelectedColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); } -inline Color GadgetButtonGetDisabledSelectedBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); } - -inline void GadgetButtonSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); g->winSetEnabledImage( 5, nullptr );g->winSetEnabledImage( 6, nullptr );} -inline void GadgetButtonSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetButtonSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetButtonSetHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); g->winSetEnabledImage( 2, nullptr );g->winSetEnabledImage( 3, nullptr );} -inline void GadgetButtonSetHiliteSelectedColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); } -inline void GadgetButtonSetHiliteSelectedBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); } -inline const Image *GadgetButtonGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline Color GadgetButtonGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetButtonGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } -inline const Image *GadgetButtonGetHiliteSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline Color GadgetButtonGetHiliteSelectedColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); } -inline Color GadgetButtonGetHiliteSelectedBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); } - -inline const Image *GadgetButtonGetLeftHiliteSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image *GadgetButtonGetMiddleHiliteSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 3 ); } -inline const Image *GadgetButtonGetRightHiliteSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 4 ); } - -inline const Image *GadgetButtonGetLeftHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline const Image *GadgetButtonGetMiddleHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 5 ); } -inline const Image *GadgetButtonGetRightHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 6 ); } - -inline void GadgetButtonSetLeftHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetButtonSetMiddleHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); } -inline void GadgetButtonSetRightHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); } - -inline void GadgetButtonSetLeftHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetButtonSetMiddleHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 5, image ); } -inline void GadgetButtonSetRightHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 6, image ); } - - -inline const Image *GadgetButtonGetLeftDisabledSelectedImage( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image *GadgetButtonGetMiddleDisabledSelectedImage( GameWindow *g ) { return g->winGetDisabledImage( 3 ); } -inline const Image *GadgetButtonGetRightDisabledSelectedImage( GameWindow *g ) { return g->winGetDisabledImage( 4 ); } - -inline const Image *GadgetButtonGetLeftDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline const Image *GadgetButtonGetMiddleDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 5 ); } -inline const Image *GadgetButtonGetRightDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 6 ); } - -inline void GadgetButtonSetLeftDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetButtonSetMiddleDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); } -inline void GadgetButtonSetRightDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); } - -inline void GadgetButtonSetLeftDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetButtonSetMiddleDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 5, image ); } -inline void GadgetButtonSetRightDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 6, image ); } - -inline const Image *GadgetButtonGetLeftEnabledSelectedImage( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image *GadgetButtonGetMiddleEnabledSelectedImage( GameWindow *g ) { return g->winGetEnabledImage( 3 ); } -inline const Image *GadgetButtonGetRightEnabledSelectedImage( GameWindow *g ) { return g->winGetEnabledImage( 4 ); } - -inline const Image *GadgetButtonGetLeftEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline const Image *GadgetButtonGetMiddleEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 5 ); } -inline const Image *GadgetButtonGetRightEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 6 ); } - -inline void GadgetButtonSetLeftEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetButtonSetMiddleEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); } -inline void GadgetButtonSetRightEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); } - -inline void GadgetButtonSetLeftEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetButtonSetMiddleEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 5, image ); } -inline void GadgetButtonSetRightEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 6, image ); } -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetRadioButton.h b/Generals/Code/GameEngine/Include/GameClient/GadgetRadioButton.h deleted file mode 100644 index 331927813cd..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetRadioButton.h +++ /dev/null @@ -1,146 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetRadioButton.h ////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetRadioButton.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for RadioButtons -// -// RadioButton IMAGE/COLOR organization -// When control is enabled: -// enabledDrawData[ 0 ] is the background image for the whole enabled control -// enabledDrawData[ 1 ] is the enabled, unselected radio box -// enabledDrawData[ 2 ] is the enabled, selected radio box -// -// When control is disabled: -// disabledDrawData[ 0 ] is the background image for the whole disabled control -// disabledDrawData[ 1 ] is the disabled, unselected radio box -// disabledDrawData[ 2 ] si the disabled, selected radio box -// -// When control is hilited (mouse over it and enabled) -// hiliteDrawData[ 0 ] is the background image for the whole hilited control -// hiliteDrawData[ 1 ] is the hilited, unselected radio box -// hiliteDrawData[ 2 ] is the hilited, selected radio box -// -// GadgetRadioGetEnabledImage // LEFT -// GadgetRadioGetEnabledUncheckedBoxImage // Middle -// GadgetRadioGetEnabledCheckedBoxImage // right -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -extern void GadgetRadioSetText( GameWindow *g, UnicodeString text ); -extern void GadgetRadioSetSelection( GameWindow *g, Bool sendMsg ); -extern void GadgetRadioSetGroup( GameWindow *g, Int group, Int screen ); - -inline void GadgetRadioSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetRadioSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetRadioSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetRadioSetEnabledUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetRadioSetEnabledUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); } -inline void GadgetRadioSetEnabledUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); } -inline void GadgetRadioSetEnabledCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); } -inline void GadgetRadioSetEnabledCheckedBoxColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 2, color ); } -inline void GadgetRadioSetEnabledCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 2, color ); } -inline const Image *GadgetRadioGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline Color GadgetRadioGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetRadioGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } -inline const Image *GadgetRadioGetEnabledUncheckedBoxImage( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline Color GadgetRadioGetEnabledUncheckedBoxColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); } -inline Color GadgetRadioGetEnabledUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); } -inline const Image *GadgetRadioGetEnabledCheckedBoxImage( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline Color GadgetRadioGetEnabledCheckedBoxColor( GameWindow *g ) { return g->winGetEnabledColor( 2 ); } -inline Color GadgetRadioGetEnabledCheckedBoxBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 2 ); } - -inline void GadgetRadioSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetRadioSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetRadioSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetRadioSetDisabledUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetRadioSetDisabledUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); } -inline void GadgetRadioSetDisabledUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); } -inline void GadgetRadioSetDisabledCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); } -inline void GadgetRadioSetDisabledCheckedBoxColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 2, color ); } -inline void GadgetRadioSetDisabledCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 2, color ); } -inline const Image *GadgetRadioGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline Color GadgetRadioGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetRadioGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } -inline const Image *GadgetRadioGetDisabledUncheckedBoxImage( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline Color GadgetRadioGetDisabledUncheckedBoxColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); } -inline Color GadgetRadioGetDisabledUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); } -inline const Image *GadgetRadioGetDisabledCheckedBoxImage( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline Color GadgetRadioGetDisabledCheckedBoxColor( GameWindow *g ) { return g->winGetDisabledColor( 2 ); } -inline Color GadgetRadioGetDisabledCheckedBoxBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 2 ); } - -inline void GadgetRadioSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetRadioSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetRadioSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetRadioSetHiliteUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetRadioSetHiliteUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); } -inline void GadgetRadioSetHiliteUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); } -inline void GadgetRadioSetHiliteCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); } -inline void GadgetRadioSetHiliteCheckedBoxColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 2, color ); } -inline void GadgetRadioSetHiliteCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 2, color ); } -inline const Image *GadgetRadioGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline Color GadgetRadioGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetRadioGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } -inline const Image *GadgetRadioGetHiliteUncheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline Color GadgetRadioGetHiliteUncheckedBoxColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); } -inline Color GadgetRadioGetHiliteUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); } -inline const Image *GadgetRadioGetHiliteCheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline Color GadgetRadioGetHiliteCheckedBoxColor( GameWindow *g ) { return g->winGetHiliteColor( 2 ); } -inline Color GadgetRadioGetHiliteCheckedBoxBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 2 ); } - -inline const Image *GadgetRadioGetSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 3 ); } -inline const Image *GadgetRadioGetSelectedUncheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 4 ); } -inline const Image *GadgetRadioGetSelectedCheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 5 ); } - - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetSlider.h b/Generals/Code/GameEngine/Include/GameClient/GadgetSlider.h deleted file mode 100644 index 1b3cfb034ab..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetSlider.h +++ /dev/null @@ -1,439 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetSlider.h /////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetSlider.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for Sliders -// -// Slider Sliders are constructed of 4 pieces, two end pieces, -// a repeating center, and a smaller repeating center pieces -// to fill small seams. Since there are vertical sliders -// and horizontal sliders, the LEFT end of a horizontal -// slider is stored in the same place as the TOP end for a -// vertical slider. The RIGHT end of a horizontal is -// also equivalent to the BOTTOM end of a vertical one. -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/Gadget.h" -#include "GameClient/Image.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// -enum{ -HORIZONTAL_SLIDER_THUMB_POSITION = HORIZONTAL_SLIDER_THUMB_HEIGHT *2/3 -}; -// INLINING /////////////////////////////////////////////////////////////////// - -inline void GadgetSliderGetMinMax( GameWindow *g, Int *min, Int *max ) -{ - SliderData *sData = (SliderData *)g->winGetUserData(); - - *max = sData->maxVal; - *min = sData->minVal; - -} -inline GameWindow *GadgetSliderGetThumb( GameWindow *g ) { return g->winGetChild(); } - -inline void GadgetSliderSetPosition( GameWindow *win, Int pos ) -{ - TheWindowManager->winSendSystemMsg( win, - GSM_SET_SLIDER, - pos, - 0 ); -} - -inline Int GadgetSliderGetPosition( GameWindow *win ) -{ - SliderData *sData = (SliderData *)win->winGetUserData(); - if (sData) - { - return sData->position; - } - return -1; -} - -// sliders are drawn from pieces, a left/top, right/bottom, repeating center, and small repeating center -inline void GadgetSliderSetEnabledImages( GameWindow *g, const Image *left, const Image *right, const Image *center, const Image *smallCenter ) -{ - g->winSetEnabledImage( 0, left ); - g->winSetEnabledImage( 1, right ); - g->winSetEnabledImage( 2, center ); - g->winSetEnabledImage( 3, smallCenter ); -} -inline void GadgetSliderSetEnabledImageLeft( GameWindow *g, const Image *left ) { g->winSetEnabledImage( 0, left ); } -inline void GadgetSliderSetEnabledImageTop( GameWindow *g, const Image *left ) { g->winSetEnabledImage( 0, left ); } -inline void GadgetSliderSetEnabledImageRight( GameWindow *g, const Image *right ) { g->winSetEnabledImage( 1, right ); } -inline void GadgetSliderSetEnabledImageBottom( GameWindow *g, const Image *right ) { g->winSetEnabledImage( 1, right ); } -inline void GadgetSliderSetEnabledImageCenter( GameWindow *g, const Image *center ) { g->winSetEnabledImage( 2, center ); } -inline void GadgetSliderSetEnabledImageSmallCenter( GameWindow *g, const Image *smallCenter ) { g->winSetEnabledImage( 3, smallCenter ); } -inline void GadgetSliderSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetSliderSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline const Image *GadgetSliderGetEnabledImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline const Image *GadgetSliderGetEnabledImageTop( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline const Image *GadgetSliderGetEnabledImageRight( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image *GadgetSliderGetEnabledImageBottom( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image *GadgetSliderGetEnabledImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline const Image *GadgetSliderGetEnabledImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); } -inline Color GadgetSliderGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetSliderGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } - -// sliders are drawn from pieces, a left/top, right/bottom, repeating center, and small repeating center -inline void GadgetSliderSetDisabledImages( GameWindow *g, const Image *left, const Image *right, const Image *center, const Image *smallCenter ) -{ - g->winSetDisabledImage( 0, left ); - g->winSetDisabledImage( 1, right ); - g->winSetDisabledImage( 2, center ); - g->winSetDisabledImage( 3, smallCenter ); -} -inline void GadgetSliderSetDisabledImageLeft( GameWindow *g, const Image *left ) { g->winSetDisabledImage( 0, left ); } -inline void GadgetSliderSetDisabledImageTop( GameWindow *g, const Image *left ) { g->winSetDisabledImage( 0, left ); } -inline void GadgetSliderSetDisabledImageRight( GameWindow *g, const Image *right ) { g->winSetDisabledImage( 1, right ); } -inline void GadgetSliderSetDisabledImageBottom( GameWindow *g, const Image *right ) { g->winSetDisabledImage( 1, right ); } -inline void GadgetSliderSetDisabledImageCenter( GameWindow *g, const Image *center ) { g->winSetDisabledImage( 2, center ); } -inline void GadgetSliderSetDisabledImageSmallCenter( GameWindow *g, const Image *smallCenter ) { g->winSetDisabledImage( 3, smallCenter ); } -inline void GadgetSliderSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetSliderSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline const Image *GadgetSliderGetDisabledImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline const Image *GadgetSliderGetDisabledImageTop( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline const Image *GadgetSliderGetDisabledImageRight( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image *GadgetSliderGetDisabledImageBottom( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image *GadgetSliderGetDisabledImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline const Image *GadgetSliderGetDisabledImageSmallCenter( GameWindow *g ){ return g->winGetDisabledImage( 3 ); } -inline Color GadgetSliderGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetSliderGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } - -// sliders are drawn from pieces, a left/top, right/bottom, repeating center, and small repeating center -inline void GadgetSliderSetHiliteImages( GameWindow *g, const Image *left, const Image *right, const Image *center, const Image *smallCenter ) -{ - g->winSetHiliteImage( 0, left ); - g->winSetHiliteImage( 1, right ); - g->winSetHiliteImage( 2, center ); - g->winSetHiliteImage( 3, smallCenter ); -} -inline void GadgetSliderSetHiliteImageLeft( GameWindow *g, const Image *left ) { g->winSetHiliteImage( 0, left ); } -inline void GadgetSliderSetHiliteImageTop( GameWindow *g, const Image *left ) { g->winSetHiliteImage( 0, left ); } -inline void GadgetSliderSetHiliteImageRight( GameWindow *g, const Image *right ) { g->winSetHiliteImage( 1, right ); } -inline void GadgetSliderSetHiliteImageBottom( GameWindow *g, const Image *right ) { g->winSetHiliteImage( 1, right ); } -inline void GadgetSliderSetHiliteImageCenter( GameWindow *g, const Image *center ) { g->winSetHiliteImage( 2, center ); } -inline void GadgetSliderSetHiliteImageSmallCenter( GameWindow *g, const Image *smallCenter ) { g->winSetHiliteImage( 3, smallCenter ); } -inline void GadgetSliderSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetSliderSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline const Image *GadgetSliderGetHiliteImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline const Image *GadgetSliderGetHiliteImageTop( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline const Image *GadgetSliderGetHiliteImageRight( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image *GadgetSliderGetHiliteImageBottom( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image *GadgetSliderGetHiliteImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline const Image *GadgetSliderGetHiliteImageSmallCenter( GameWindow *g ){ return g->winGetHiliteImage( 3 ); } -inline Color GadgetSliderGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetSliderGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } - -/////////////////////////////////////////////////////////////////////////////// -// Functions to set the images and colors for the slider thumb -/////////////////////////////////////////////////////////////////////////////// - -// enabled -inline void GadgetSliderSetEnabledThumbImage( GameWindow *g, const Image *image ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetEnabledImage( thumb, image ); - } -inline void GadgetSliderSetEnabledThumbColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetEnabledColor( thumb, color ); - } -inline void GadgetSliderSetEnabledThumbBorderColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetEnabledBorderColor( thumb, color ); - } -inline void GadgetSliderSetEnabledSelectedThumbImage( GameWindow *g, const Image *image ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetEnabledSelectedImage( thumb, image ); - } -inline void GadgetSliderSetEnabledSelectedThumbColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetEnabledSelectedColor( thumb, color ); - } -inline void GadgetSliderSetEnabledSelectedThumbBorderColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetEnabledSelectedBorderColor( thumb, color ); - } -inline const Image *GadgetSliderGetEnabledThumbImage( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetEnabledImage( thumb ); - else - return nullptr; - } -inline Color GadgetSliderGetEnabledThumbColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetEnabledColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline Color GadgetSliderGetEnabledThumbBorderColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetEnabledBorderColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline const Image *GadgetSliderGetEnabledSelectedThumbImage( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetEnabledSelectedImage( thumb ); - else - return nullptr; - } -inline Color GadgetSliderGetEnabledSelectedThumbColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetEnabledSelectedColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline Color GadgetSliderGetEnabledSelectedThumbBorderColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetEnabledSelectedBorderColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } - - -// disabled -inline void GadgetSliderSetDisabledThumbImage( GameWindow *g, const Image *image ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetDisabledImage( thumb, image ); - } -inline void GadgetSliderSetDisabledThumbColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetDisabledColor( thumb, color ); - } -inline void GadgetSliderSetDisabledThumbBorderColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetDisabledBorderColor( thumb, color ); - } -inline void GadgetSliderSetDisabledSelectedThumbImage( GameWindow *g, const Image *image ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetDisabledSelectedImage( thumb, image ); - } -inline void GadgetSliderSetDisabledSelectedThumbColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetDisabledSelectedColor( thumb, color ); - } -inline void GadgetSliderSetDisabledSelectedThumbBorderColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetDisabledSelectedBorderColor( thumb, color ); - } -inline const Image *GadgetSliderGetDisabledThumbImage( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetDisabledImage( thumb ); - else - return nullptr; - } -inline Color GadgetSliderGetDisabledThumbColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetDisabledColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline Color GadgetSliderGetDisabledThumbBorderColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetDisabledBorderColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline const Image *GadgetSliderGetDisabledSelectedThumbImage( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetDisabledSelectedImage( thumb ); - else - return nullptr; - } -inline Color GadgetSliderGetDisabledSelectedThumbColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetDisabledSelectedColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline Color GadgetSliderGetDisabledSelectedThumbBorderColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetDisabledSelectedBorderColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } - -// hilite -inline void GadgetSliderSetHiliteThumbImage( GameWindow *g, const Image *image ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetHiliteImage( thumb, image ); - } -inline void GadgetSliderSetHiliteThumbColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetHiliteColor( thumb, color ); - } -inline void GadgetSliderSetHiliteThumbBorderColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetHiliteBorderColor( thumb, color ); - } -inline void GadgetSliderSetHiliteSelectedThumbImage( GameWindow *g, const Image *image ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetHiliteSelectedImage( thumb, image ); - } -inline void GadgetSliderSetHiliteSelectedThumbColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetHiliteSelectedColor( thumb, color ); - } -inline void GadgetSliderSetHiliteSelectedThumbBorderColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetHiliteSelectedBorderColor( thumb, color ); - } -inline const Image *GadgetSliderGetHiliteThumbImage( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetHiliteImage( thumb ); - else - return nullptr; - } -inline Color GadgetSliderGetHiliteThumbColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetHiliteColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline Color GadgetSliderGetHiliteThumbBorderColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetHiliteBorderColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline const Image *GadgetSliderGetHiliteSelectedThumbImage( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetHiliteSelectedImage( thumb ); - else - return nullptr; - } -inline Color GadgetSliderGetHiliteSelectedThumbColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetHiliteSelectedColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline Color GadgetSliderGetHiliteSelectedThumbBorderColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetHiliteSelectedBorderColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetStaticText.h b/Generals/Code/GameEngine/Include/GameClient/GadgetStaticText.h deleted file mode 100644 index 83090aec761..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetStaticText.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetStaticText.h /////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetStaticText.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for StaticTexts -// -// StaticText IMAGE/COLOR organization -// When control is enabled: -// enabledDrawData[ 0 ] is the background image for the whole enabled control -// -// When control is disabled: -// disabledDrawData[ 0 ] is the background image for the whole disabled control -// -// When control is hilited (mouse over it and enabled) -// hiliteDrawData[ 0 ] is the background image for the whole hilited control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -extern void GadgetStaticTextSetText( GameWindow *window, UnicodeString text ); -extern UnicodeString GadgetStaticTextGetText( GameWindow *window ); -extern void GadgetStaticTextSetFont( GameWindow *window, GameFont *font ); - -// text colors - -// enabled background -inline void GadgetStaticTextSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetStaticTextSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetStaticTextSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline const Image *GadgetStaticTextGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline Color GadgetStaticTextGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetStaticTextGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } - -// disabled background -inline void GadgetStaticTextSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetStaticTextSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetStaticTextSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline const Image *GadgetStaticTextGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline Color GadgetStaticTextGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetStaticTextGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } - -// hilite if we choose to use it -inline void GadgetStaticTextSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetStaticTextSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetStaticTextSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline const Image *GadgetStaticTextGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline Color GadgetStaticTextGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetStaticTextGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetTabControl.h b/Generals/Code/GameEngine/Include/GameClient/GadgetTabControl.h deleted file mode 100644 index 17a91ba631a..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetTabControl.h +++ /dev/null @@ -1,273 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: C:\projects\RTS\code\gameengine\Include\GameClient\GadgetTabControl.h -// -// Created: Graham Smallwood, November 2001 -// -// Desc: Helpful interface for TabControls -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -enum -{ - GTC_BACKGROUND = 0, - GTC_TAB_0, - GTC_TAB_1, - GTC_TAB_2, - GTC_TAB_3, - GTC_TAB_4, - GTC_TAB_5, - GTC_TAB_6, - GTC_TAB_7 -}; -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -extern void GadgetTabControlComputeTabRegion( GameWindow *tabControl );///< Recalc the tab positions based on userData -extern void GadgetTabControlCreateSubPanes( GameWindow *tabControl);///< Create (destroy old) Windows attached to userData as Panes -extern void GadgetTabControlComputeSubPaneSize( GameWindow *tabControl, Int *width, Int *height, Int *x, Int *y );///winSetEnabledImage( GTC_TAB_0, image ); } -inline void GadgetTabControlSetEnabledColorTabZero( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_0, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabZero( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_0, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabZero( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_0 ); } -inline Color GadgetTabControlGetEnabledColorTabZero( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_0 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabZero( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_0 ); } - -inline void GadgetTabControlSetEnabledImageTabOne( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_1, image ); } -inline void GadgetTabControlSetEnabledColorTabOne( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_1, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabOne( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_1, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabOne( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_1 ); } -inline Color GadgetTabControlGetEnabledColorTabOne( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_1 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabOne( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_1 ); } - -inline void GadgetTabControlSetEnabledImageTabTwo( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_2, image ); } -inline void GadgetTabControlSetEnabledColorTabTwo( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_2, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabTwo( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_2, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabTwo( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_2 ); } -inline Color GadgetTabControlGetEnabledColorTabTwo( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_2 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabTwo( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_2 ); } - -inline void GadgetTabControlSetEnabledImageTabThree( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_3, image ); } -inline void GadgetTabControlSetEnabledColorTabThree( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_3, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabThree( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_3, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabThree( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_3 ); } -inline Color GadgetTabControlGetEnabledColorTabThree( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_3 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabThree( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_3 ); } - -inline void GadgetTabControlSetEnabledImageTabFour( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_4, image ); } -inline void GadgetTabControlSetEnabledColorTabFour( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_4, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabFour( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_4, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabFour( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_4 ); } -inline Color GadgetTabControlGetEnabledColorTabFour( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_4 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabFour( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_4 ); } - -inline void GadgetTabControlSetEnabledImageTabFive( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_5, image ); } -inline void GadgetTabControlSetEnabledColorTabFive( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_5, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabFive( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_5, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabFive( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_5 ); } -inline Color GadgetTabControlGetEnabledColorTabFive( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_5 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabFive( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_5 ); } - -inline void GadgetTabControlSetEnabledImageTabSix( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_6, image ); } -inline void GadgetTabControlSetEnabledColorTabSix( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_6, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabSix( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_6, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabSix( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_6 ); } -inline Color GadgetTabControlGetEnabledColorTabSix( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_6 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabSix( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_6 ); } - -inline void GadgetTabControlSetEnabledImageTabSeven( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_7, image ); } -inline void GadgetTabControlSetEnabledColorTabSeven( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_7, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabSeven( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_7, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabSeven( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_7 ); } -inline Color GadgetTabControlGetEnabledColorTabSeven( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_7 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabSeven( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_7 ); } - -inline void GadgetTabControlSetEnabledImageBackground( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_BACKGROUND, image ); } -inline void GadgetTabControlSetEnabledColorBackground( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_BACKGROUND, color ); } -inline void GadgetTabControlSetEnabledBorderColorBackground( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_BACKGROUND, color ); } -inline const Image *GadgetTabControlGetEnabledImageBackground( GameWindow *g ) { return g->winGetEnabledImage( GTC_BACKGROUND ); } -inline Color GadgetTabControlGetEnabledColorBackground( GameWindow *g ) { return g->winGetEnabledColor( GTC_BACKGROUND ); } -inline Color GadgetTabControlGetEnabledBorderColorBackground( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_BACKGROUND ); } - - - - -inline void GadgetTabControlSetDisabledImageTabZero( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_0, image ); } -inline void GadgetTabControlSetDisabledColorTabZero( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_0, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabZero( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_0, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabZero( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_0 ); } -inline Color GadgetTabControlGetDisabledColorTabZero( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_0 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabZero( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_0 ); } - -inline void GadgetTabControlSetDisabledImageTabOne( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_1, image ); } -inline void GadgetTabControlSetDisabledColorTabOne( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_1, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabOne( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_1, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabOne( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_1 ); } -inline Color GadgetTabControlGetDisabledColorTabOne( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_1 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabOne( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_1 ); } - -inline void GadgetTabControlSetDisabledImageTabTwo( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_2, image ); } -inline void GadgetTabControlSetDisabledColorTabTwo( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_2, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabTwo( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_2, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabTwo( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_2 ); } -inline Color GadgetTabControlGetDisabledColorTabTwo( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_2 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabTwo( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_2 ); } - -inline void GadgetTabControlSetDisabledImageTabThree( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_3, image ); } -inline void GadgetTabControlSetDisabledColorTabThree( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_3, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabThree( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_3, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabThree( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_3 ); } -inline Color GadgetTabControlGetDisabledColorTabThree( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_3 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabThree( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_3 ); } - -inline void GadgetTabControlSetDisabledImageTabFour( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_4, image ); } -inline void GadgetTabControlSetDisabledColorTabFour( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_4, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabFour( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_4, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabFour( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_4 ); } -inline Color GadgetTabControlGetDisabledColorTabFour( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_4 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabFour( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_4 ); } - -inline void GadgetTabControlSetDisabledImageTabFive( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_5, image ); } -inline void GadgetTabControlSetDisabledColorTabFive( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_5, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabFive( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_5, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabFive( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_5 ); } -inline Color GadgetTabControlGetDisabledColorTabFive( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_5 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabFive( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_5 ); } - -inline void GadgetTabControlSetDisabledImageTabSix( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_6, image ); } -inline void GadgetTabControlSetDisabledColorTabSix( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_6, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabSix( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_6, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabSix( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_6 ); } -inline Color GadgetTabControlGetDisabledColorTabSix( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_6 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabSix( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_6 ); } - -inline void GadgetTabControlSetDisabledImageTabSeven( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_7, image ); } -inline void GadgetTabControlSetDisabledColorTabSeven( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_7, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabSeven( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_7, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabSeven( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_7 ); } -inline Color GadgetTabControlGetDisabledColorTabSeven( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_7 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabSeven( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_7 ); } - -inline void GadgetTabControlSetDisabledImageBackground( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_BACKGROUND, image ); } -inline void GadgetTabControlSetDisabledColorBackground( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_BACKGROUND, color ); } -inline void GadgetTabControlSetDisabledBorderColorBackground( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_BACKGROUND, color ); } -inline const Image *GadgetTabControlGetDisabledImageBackground( GameWindow *g ) { return g->winGetDisabledImage( GTC_BACKGROUND ); } -inline Color GadgetTabControlGetDisabledColorBackground( GameWindow *g ) { return g->winGetDisabledColor( GTC_BACKGROUND ); } -inline Color GadgetTabControlGetDisabledBorderColorBackground( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_BACKGROUND ); } - - - - -inline void GadgetTabControlSetHiliteImageTabZero( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_0, image ); } -inline void GadgetTabControlSetHiliteColorTabZero( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_0, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabZero( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_0, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabZero( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_0 ); } -inline Color GadgetTabControlGetHiliteColorTabZero( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_0 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabZero( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_0 ); } - -inline void GadgetTabControlSetHiliteImageTabOne( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_1, image ); } -inline void GadgetTabControlSetHiliteColorTabOne( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_1, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabOne( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_1, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabOne( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_1 ); } -inline Color GadgetTabControlGetHiliteColorTabOne( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_1 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabOne( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_1 ); } - -inline void GadgetTabControlSetHiliteImageTabTwo( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_2, image ); } -inline void GadgetTabControlSetHiliteColorTabTwo( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_2, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabTwo( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_2, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabTwo( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_2 ); } -inline Color GadgetTabControlGetHiliteColorTabTwo( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_2 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabTwo( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_2 ); } - -inline void GadgetTabControlSetHiliteImageTabThree( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_3, image ); } -inline void GadgetTabControlSetHiliteColorTabThree( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_3, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabThree( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_3, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabThree( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_3 ); } -inline Color GadgetTabControlGetHiliteColorTabThree( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_3 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabThree( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_3 ); } - -inline void GadgetTabControlSetHiliteImageTabFour( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_4, image ); } -inline void GadgetTabControlSetHiliteColorTabFour( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_4, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabFour( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_4, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabFour( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_4 ); } -inline Color GadgetTabControlGetHiliteColorTabFour( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_4 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabFour( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_4 ); } - -inline void GadgetTabControlSetHiliteImageTabFive( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_5, image ); } -inline void GadgetTabControlSetHiliteColorTabFive( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_5, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabFive( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_5, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabFive( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_5 ); } -inline Color GadgetTabControlGetHiliteColorTabFive( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_5 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabFive( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_5 ); } - -inline void GadgetTabControlSetHiliteImageTabSix( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_6, image ); } -inline void GadgetTabControlSetHiliteColorTabSix( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_6, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabSix( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_6, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabSix( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_6 ); } -inline Color GadgetTabControlGetHiliteColorTabSix( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_6 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabSix( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_6 ); } - -inline void GadgetTabControlSetHiliteImageTabSeven( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_7, image ); } -inline void GadgetTabControlSetHiliteColorTabSeven( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_7, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabSeven( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_7, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabSeven( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_7 ); } -inline Color GadgetTabControlGetHiliteColorTabSeven( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_7 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabSeven( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_7 ); } - -inline void GadgetTabControlSetHiliteImageBackground( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_BACKGROUND, image ); } -inline void GadgetTabControlSetHiliteColorBackground( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_BACKGROUND, color ); } -inline void GadgetTabControlSetHiliteBorderColorBackground( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_BACKGROUND, color ); } -inline const Image *GadgetTabControlGetHiliteImageBackground( GameWindow *g ) { return g->winGetHiliteImage( GTC_BACKGROUND ); } -inline Color GadgetTabControlGetHiliteColorBackground( GameWindow *g ) { return g->winGetHiliteColor( GTC_BACKGROUND ); } -inline Color GadgetTabControlGetHiliteBorderColorBackground( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_BACKGROUND ); } - - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetTextEntry.h b/Generals/Code/GameEngine/Include/GameClient/GadgetTextEntry.h deleted file mode 100644 index 5d9dd65703d..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetTextEntry.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetTextEntry.h //////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetTextEntry.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for TextEntrys -// -// TextEntry IMAGE/COLOR organization -// -// note that windows that have an outlined text field will use the color -// for the outline specified with the TextBorder... functions -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindowManager.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -class GameWindow; - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -inline void GadgetTextEntrySetText( GameWindow *g, UnicodeString text ) -{ - TheWindowManager->winSendSystemMsg( g, GEM_SET_TEXT, (WindowMsgData)&text, 0 ); -} -extern UnicodeString GadgetTextEntryGetText( GameWindow *textentry ); ///< Get the text from the text entry field -extern void GadgetTextEntrySetMaxLen( GameWindow *g, Short length ); -extern void GadgetTextEntrySetFont( GameWindow *g, GameFont *font ); ///< set font for window and edit text display strings -inline void GadgetTextEntrySetTextColor( GameWindow *g, Color color ) -{ - Color back = g->winGetEnabledTextBorderColor(); - g->winSetEnabledTextColors(color,back); - g->winSetDisabledTextColors(GameDarkenColor(color, 25),back); -} -// text colors - -// enabled -inline void GadgetTextEntrySetEnabledImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetTextEntrySetEnabledImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetTextEntrySetEnabledImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); } -inline void GadgetTextEntrySetEnabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); } -inline void GadgetTextEntrySetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetTextEntrySetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline const Image *GadgetTextEntryGetEnabledImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline const Image *GadgetTextEntryGetEnabledImageRight( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image *GadgetTextEntryGetEnabledImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline const Image *GadgetTextEntryGetEnabledImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); } -inline Color GadgetTextEntryGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetTextEntryGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } - -// disabled -inline void GadgetTextEntrySetDisabledImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetTextEntrySetDisabledImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetTextEntrySetDisabledImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); } -inline void GadgetTextEntrySetDisabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); } -inline void GadgetTextEntrySetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetTextEntrySetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline const Image *GadgetTextEntryGetDisabledImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline const Image *GadgetTextEntryGetDisabledImageRight( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image *GadgetTextEntryGetDisabledImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline const Image *GadgetTextEntryGetDisabledImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); } -inline Color GadgetTextEntryGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetTextEntryGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } - -// hilite -inline void GadgetTextEntrySetHiliteImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetTextEntrySetHiliteImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetTextEntrySetHiliteImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); } -inline void GadgetTextEntrySetHiliteImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); } -inline void GadgetTextEntrySetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetTextEntrySetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline const Image *GadgetTextEntryGetHiliteImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline const Image *GadgetTextEntryGetHiliteImageRight( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image *GadgetTextEntryGetHiliteImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline const Image *GadgetTextEntryGetHiliteImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); } -inline Color GadgetTextEntryGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetTextEntryGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GameInfoWindow.h b/Generals/Code/GameEngine/Include/GameClient/GameInfoWindow.h deleted file mode 100644 index 2fc315faa20..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GameInfoWindow.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GameInfoWindow.h /////////////////////////////////////////////////////////////////////////// -// Created: Chris Huybregts, Feb 2002 -// Desc: Game Info Window Header -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" -#include "GameNetwork/LANGameInfo.h" - -// Function Stubs for GameInfoWindow -extern void CreateLANGameInfoWindow( GameWindow *sizeAndPosWin ); -extern void DestroyGameInfoWindow(); -extern void RefreshGameInfoWindow(GameInfo *gameInfo, UnicodeString gameName); -extern void HideGameInfoWindow(Bool hide); diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindowID.h b/Generals/Code/GameEngine/Include/GameClient/GameWindowID.h deleted file mode 100644 index 9d5eec2be54..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindowID.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GameWindowID.h /////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GameWindowID.h -// -// Created: Colin Day, July 2001 -// -// Desc: Game window ID definitions, this is so we can uniquely -// identify any window in the game and pass messages from -// anywhere to anywhere else instantly -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// -#define GWID_INVALID 0 - -#define GWID_SIDEBAR 100 - -#define GWID_SIDEBAR_1 101 -#define GWID_SIDEBAR_2 102 -#define GWID_SIDEBAR_3 103 -#define GWID_SIDEBAR_4 104 -#define GWID_SIDEBAR_5 105 -#define GWID_SIDEBAR_6 106 -#define GWID_SIDEBAR_7 107 -#define GWID_SIDEBAR_8 108 -#define GWID_SIDEBAR_9 109 -#define GWID_SIDEBAR_10 110 -#define GWID_SIDEBAR_11 111 -#define GWID_SIDEBAR_12 112 - -#define GWID_SIDEBAR_TAB_1 151 -#define GWID_SIDEBAR_TAB_2 152 -#define GWID_SIDEBAR_TAB_3 153 -#define GWID_SIDEBAR_TAB_4 154 - -#define GWID_SIDEBAR_RADAR 175 - -// INLINING /////////////////////////////////////////////////////////////////// - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h b/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h deleted file mode 100644 index a3a4f53a4a6..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h +++ /dev/null @@ -1,414 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GameWindowManager.h ////////////////////////////////////////////////////////////////////// -// Created: Colin Day, June 2001 -// Desc: The game window manager is the interface for interacting with -// the windowing system for purposes of any menus, or GUI -// controls. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "Common/STLTypedefs.h" -#include "Common/SubsystemInterface.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/Gadget.h" - -class GameWindow; - -//------------------------------------------------------------------------------------------------- -/** Window layout info is a structure that can be passed to the load function of - * a window script. After the script is loaded, this parameter (if present) - * will contain information about the script file at a global level such - * as what file version was loaded, global layout callbacks, etc */ -//------------------------------------------------------------------------------------------------- -enum { MAX_LAYOUT_FUNC_LEN = 256 }; - -typedef std::list GameWindowList; - -class WindowLayoutInfo -{ - -public: - WindowLayoutInfo(); - - UnsignedInt version; ///< file version that was loaded - WindowLayoutInitFunc init; ///< init method (if specified) - WindowLayoutUpdateFunc update; ///< update method (if specified) - WindowLayoutShutdownFunc shutdown; ///< shutdown method (if specified) - AsciiString initNameString; ///< init method in flavor of string name - AsciiString updateNameString; ///< update method in string flavor - AsciiString shutdownNameString; ///< shutdown method in string flavor, mmm! - std::list windows; ///< list of top-level windows in the layout -}; - -//------------------------------------------------------------------------------------------------- -/** There exists a singleton GameWindowManager that defines how we can - * interact with the game windowing system */ -//------------------------------------------------------------------------------------------------- -class GameWindowManager : public SubsystemInterface -{ - -friend class GameWindow; - -public: - - GameWindowManager(); - virtual ~GameWindowManager() override; - - //----------------------------------------------------------------------------------------------- - virtual void init() override; ///< initialize function - virtual void reset() override; ///< reset the system - virtual void update() override; ///< update method, called once per frame - - virtual GameWindow *allocateNewWindow() = 0; ///< new game window - - void linkWindow( GameWindow *window ); ///< link into master list - void unlinkWindow( GameWindow *window ); ///< unlink from master list - void unlinkChildWindow( GameWindow *window ); ///< remove child from parent list - void insertWindowAheadOf( GameWindow *window, GameWindow *aheadOf ); ///< add window to list 'ahead of' - - virtual GameWinDrawFunc getPushButtonImageDrawFunc() = 0; - virtual GameWinDrawFunc getPushButtonDrawFunc() = 0; - virtual GameWinDrawFunc getCheckBoxImageDrawFunc() = 0; - virtual GameWinDrawFunc getCheckBoxDrawFunc() = 0; - virtual GameWinDrawFunc getRadioButtonImageDrawFunc() = 0; - virtual GameWinDrawFunc getRadioButtonDrawFunc() = 0; - virtual GameWinDrawFunc getTabControlImageDrawFunc() = 0; - virtual GameWinDrawFunc getTabControlDrawFunc() = 0; - virtual GameWinDrawFunc getListBoxImageDrawFunc() = 0; - virtual GameWinDrawFunc getListBoxDrawFunc() = 0; - virtual GameWinDrawFunc getComboBoxImageDrawFunc() = 0; - virtual GameWinDrawFunc getComboBoxDrawFunc() = 0; - virtual GameWinDrawFunc getHorizontalSliderImageDrawFunc() = 0; - virtual GameWinDrawFunc getHorizontalSliderDrawFunc() = 0; - virtual GameWinDrawFunc getVerticalSliderImageDrawFunc() = 0; - virtual GameWinDrawFunc getVerticalSliderDrawFunc() = 0; - virtual GameWinDrawFunc getProgressBarImageDrawFunc() = 0; - virtual GameWinDrawFunc getProgressBarDrawFunc() = 0; - virtual GameWinDrawFunc getStaticTextImageDrawFunc() = 0; - virtual GameWinDrawFunc getStaticTextDrawFunc() = 0; - virtual GameWinDrawFunc getTextEntryImageDrawFunc() = 0; - virtual GameWinDrawFunc getTextEntryDrawFunc() = 0; - - //--------------------------------------------------------------------------- - - virtual GameWinDrawFunc getDefaultDraw(); ///< return default draw func - virtual GameWinSystemFunc getDefaultSystem(); ///< return default system func - virtual GameWinInputFunc getDefaultInput(); ///< return default input func - virtual GameWinTooltipFunc getDefaultTooltip(); ///< return default tooltip func - - //--------------------------------------------------------------------------- - // MessageBox creation - virtual GameWindow *gogoMessageBox(Int x, Int y, Int width, Int height, UnsignedShort buttonFlags, - UnicodeString titleString, UnicodeString bodyString, - GameWinMsgBoxFunc yesCallback, - GameWinMsgBoxFunc noCallback, - GameWinMsgBoxFunc okCallback, - GameWinMsgBoxFunc cancelCallback ); - - virtual GameWindow *gogoMessageBox(Int x, Int y, Int width, Int height, UnsignedShort buttonFlags, - UnicodeString titleString, UnicodeString bodyString, - GameWinMsgBoxFunc yesCallback, - GameWinMsgBoxFunc noCallback, - GameWinMsgBoxFunc okCallback, - GameWinMsgBoxFunc cancelCallback, Bool useLogo ); - - - //--------------------------------------------------------------------------- - // gadget creation - virtual GameWindow *gogoGadgetPushButton( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetCheckbox( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetRadioButton( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - RadioButtonData *rData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetTabControl( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - TabControlData *rData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetListBox( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - ListboxData *listboxData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetSlider( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - SliderData *sliderData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetProgressBar( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetStaticText( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - TextData *textData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetTextEntry( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - EntryData *entryData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetComboBox( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - ComboBoxData *comboBoxDataTemplate, - GameFont *defaultFont, Bool defaultVisual ); - - /** Use this method to assign the default images to gadgets as - * they area created */ - virtual void assignDefaultGadgetLook( GameWindow *gadget, - GameFont *defaultFont, - Bool assignVisual ); - - //--------------------------------------------------------------------------- - // Creating windows - /// create new window(s) from .wnd file ... see definition for what is returned - virtual GameWindow *winCreateFromScript( AsciiString filename, WindowLayoutInfo *info = nullptr ); - - /// create new window(s) from .wnd file and wrap in a WindowLayout - virtual WindowLayout *winCreateLayout( AsciiString filename ); - - /// free temporary strings to make the memory leak manager happy. - virtual void freeStaticStrings(); - - /// create a new window by setting up parameters and callbacks - virtual GameWindow *winCreate( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - GameWinSystemFunc system, - WinInstanceData *instData = nullptr ); - - //--------------------------------------------------------------------------- - // Manipulating windows in the system - virtual Int winDestroy( GameWindow *window ); ///< destroy this window - virtual Int winDestroyAll(); ///< destroy all windows in the system - virtual GameWindow *winGetWindowList(); ///< get head of master list - - /// hide all windows in a certain range of id's (inclusive ); - virtual void hideWindowsInRange( GameWindow *baseWindow, Int first, Int last, - Bool hideFlag ); - /// enable all windows in a range of id's (inclusive) - virtual void enableWindowsInRange( GameWindow *baseWindow, Int first, Int last, - Bool enableFlag ); - - /// this gets called from winHide() when a window hides itself - virtual void windowHiding( GameWindow *window ); - - virtual void winRepaint(); ///< draw GUI in reverse order - - virtual void winNextTab( GameWindow *window ); ///< give keyboard focus to the next window in the tab list - - virtual void winPrevTab( GameWindow *window ); ///< give keyboard focus to the previous window in the tab list - - virtual void registerTabList( GameWindowList tabList ); ///< we have to register a Tab List - virtual void clearTabList(); ///< we's gotz ta clear the tab list yo! - - // -------------------------------------------------------------------------- - /// process a single mouse event - virtual WinInputReturnCode winProcessMouseEvent( GameWindowMessage msg, - ICoord2D *mousePos, - void *data ); - /// process a singke key event - virtual WinInputReturnCode winProcessKey( UnsignedByte key, - UnsignedByte state ); - // -------------------------------------------------------------------------- - - virtual GameWindow *winGetFocus(); ///< return window that has the focus - virtual Int winSetFocus( GameWindow *window ); ///< set this window as has focus - virtual void winSetGrabWindow( GameWindow *window ); ///< set the grab window - virtual GameWindow *winGetGrabWindow(); ///< who is currently 'held' by mouse - virtual void winSetLoneWindow( GameWindow *window ); ///< set the open window - - // Finds the top-level window at the mouse position that matches the required and forbidden status masks. - virtual GameWindow* findWindowUnderMouse(GameWindow*& toolTipWindow, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask); - static bool isMouseWithinWindow(GameWindow* window, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask); - - virtual Bool isEnabled( GameWindow *win ); ///< is window or parents enabled - virtual Bool isHidden( GameWindow *win ); ///< is parent or parents hidden - virtual void addWindowToParent( GameWindow *window, GameWindow *parent ); - virtual void addWindowToParentAtEnd( GameWindow *window, GameWindow *parent ); - - /// sends a system message to specified window - virtual WindowMsgHandledType winSendSystemMsg( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ); - - /// sends an input message to the specified window - virtual WindowMsgHandledType winSendInputMsg( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ); - - /** get the window pointer from id, starting at 'window' and searching - down the hierarchy. If 'window' is nullptr then all windows will - be searched */ - virtual GameWindow *winGetWindowFromId( GameWindow *window, Int id ); - virtual Int winCapture( GameWindow *window ); ///< captures the mouse - virtual Int winRelease( GameWindow *window ); ///< release mouse capture - virtual GameWindow *winGetCapture(); ///< current mouse capture settings - - virtual Int winSetModal( GameWindow *window ); ///< put at top of modal stack - virtual Int winUnsetModal( GameWindow *window ); /**< take window off modal stack, if window is - not at top of stack and error will occur */ - - //--------------------------------------------------------------------------- - ///////////////////////////////////////////////////////////////////////////// - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - // The following public functions you should implement change the guts - // for to work with your application. Rather than draw images, or do string - // operations with native methods, the game window system will always call - // these methods to get the work done it needs - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - ///////////////////////////////////////////////////////////////////////////// - //--------------------------------------------------------------------------- - - /// draw image, coord are in screen and should be kepth within that box specified - virtual void winDrawImage( const Image *image, Int startX, Int startY, Int endX, Int endY, Color color = 0xFFFFFFFF ); - /// draw filled rect, coords are absolute screen coords - virtual void winFillRect( Color color, Real width, Int startX, Int startY, Int endX, Int endY ); - /// draw rect outline, coords are absolute screen coords - virtual void winOpenRect( Color color, Real width, Int startX, Int startY, Int endX, Int endY ); - /// draw line, coords are absolute screen coords - virtual void winDrawLine( Color color, Real width, Int startX, Int startY, Int endX, Int endY ); - /// Make a color representation out of RGBA components - virtual Color winMakeColor( UnsignedByte red, UnsignedByte green, UnsignedByte blue, UnsignedByte alpha ); - /** Find an image reference and return a pointer to its image, you may - recreate all Image structs to suit your project */ - virtual const Image *winFindImage( const char *name ); - virtual Int winFontHeight( GameFont *font ); ///< get height of font in pixels - virtual Int winIsDigit( Int c ); ///< is character a digit - virtual Int winIsAscii( Int c ); ///< is character a digit - virtual Int winIsAlNum( Int c ); ///< is character alpha-numeric - virtual void winFormatText( GameFont *font, UnicodeString text, Color color, - Int x, Int y, Int width, Int height ); - virtual void winGetTextSize( GameFont *font, UnicodeString text, - Int *width, Int *height, Int maxWidth ); - virtual UnicodeString winTextLabelToText( AsciiString label ); ///< convert localizable text label to real text - virtual GameFont *winFindFont( AsciiString fontName, Int pointSize, Bool bold ); ///< get a font given a name - - /// @todo just for testing, remov this - Bool initTestGUI(); - - virtual GameWindow *getWindowUnderCursor( Int x, Int y, Bool ignoreEnabled = FALSE ); ///< find the top window at the given coordinates - - //--------------------------------------------------------------------------- - ///////////////////////////////////////////////////////////////////////////// - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - ///////////////////////////////////////////////////////////////////////////// - //--------------------------------------------------------------------------- - -protected: - - void processDestroyList(); ///< process windows waiting to be killed - - Int drawWindow( GameWindow *window ); ///< draw this window - - void dumpWindow( GameWindow *window ); ///< for debugging - - GameWindow *m_windowList; // list of all top level windows - GameWindow *m_windowTail; // last in windowList - - GameWindow *m_destroyList; // list of windows to destroy - - GameWindow *m_currMouseRgn; // window that mouse is over - GameWindow *m_mouseCaptor; // window that captured mouse - GameWindow *m_keyboardFocus; // window that has input focus - ModalWindow *m_modalHead; // top of windows in the modal stack - GameWindow *m_grabWindow; // window that grabbed the last down event - GameWindow *m_loneWindow; // Set if we just opened a Lone Window - GameWindowList m_tabList; // we have to register a tab list to make a tab list. - const Image *m_cursorBitmap; - UnsignedInt m_captureFlags; - -}; - -// INLINE ///////////////////////////////////////////////////////////////////////////////////////// -inline GameWinDrawFunc GameWindowManager::getDefaultDraw() { return GameWinDefaultDraw; } -inline GameWinSystemFunc GameWindowManager::getDefaultSystem() { return GameWinDefaultSystem; } -inline GameWinInputFunc GameWindowManager::getDefaultInput() { return GameWinDefaultInput; } -inline GameWinTooltipFunc GameWindowManager::getDefaultTooltip() { return GameWinDefaultTooltip; } - -// EXTERN ///////////////////////////////////////////////////////////////////////////////////////// -extern GameWindowManager *TheWindowManager; ///< singleton extern definition -extern UnsignedInt WindowLayoutCurrentVersion; ///< current version of our window layouts - -// this function lets us generically pass button selections to our parent, we may -// frequently want to do this because we want windows grouped on child windows for -// convenience, but only want one logical system procedure responding to them all -extern WindowMsgHandledType PassSelectedButtonsToParentSystem( GameWindow *window, - UnsignedInt msg, - WindowMsgData mData1, - WindowMsgData mData2 ); -extern WindowMsgHandledType PassMessagesToParentSystem( GameWindow *window, - UnsignedInt msg, - WindowMsgData mData1, - WindowMsgData mData2 ); - -// TheSuperHackers @feature helmutbuhler 24/04/2025 -// GameWindowManager that does nothing. Used for Headless Mode. -class GameWindowManagerDummy : public GameWindowManager -{ -public: - virtual GameWindow *winGetWindowFromId(GameWindow *window, Int id) override; - virtual GameWindow *winCreateFromScript(AsciiString filenameString, WindowLayoutInfo *info) override; - - virtual GameWindow *allocateNewWindow() override { return newInstance(GameWindowDummy); } - - virtual GameWinDrawFunc getPushButtonImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getPushButtonDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getCheckBoxImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getCheckBoxDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getRadioButtonImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getRadioButtonDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getTabControlImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getTabControlDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getListBoxImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getListBoxDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getComboBoxImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getComboBoxDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getHorizontalSliderImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getHorizontalSliderDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getVerticalSliderImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getVerticalSliderDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getProgressBarImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getProgressBarDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getStaticTextImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getStaticTextDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getTextEntryImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getTextEntryDrawFunc() override { return nullptr; } -}; diff --git a/Generals/Code/GameEngine/Include/GameClient/HintSpy.h b/Generals/Code/GameEngine/Include/GameClient/HintSpy.h deleted file mode 100644 index 32cf775deda..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/HintSpy.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: HintSpy.h /////////////////////////////////////////////////////////// -// Author: Steven Johnson, Dec 2001 - -#pragma once - -#include "GameClient/InGameUI.h" - -//----------------------------------------------------------------------------- -class HintSpyTranslator : public GameMessageTranslator -{ -public: - virtual GameMessageDisposition translateGameMessage(const GameMessage *msg) override; - virtual ~HintSpyTranslator() override { } -}; diff --git a/Generals/Code/GameEngine/Include/GameClient/HotKey.h b/Generals/Code/GameEngine/Include/GameClient/HotKey.h deleted file mode 100644 index 3c9cade4eef..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/HotKey.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - - -// FILE: HotKey.h ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Sep 2002 -// -// Filename: HotKey.h -// -// author: Chris Huybregts -// -// purpose: -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "Common/SubsystemInterface.h" -#include "Common/MessageStream.h" -//----------------------------------------------------------------------------- -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class AsciiString; -class GameWindow; -//----------------------------------------------------------------------------- -// TYPE DEFINES /////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class HotKeyTranslator : public GameMessageTranslator -{ -public: - virtual GameMessageDisposition translateGameMessage(const GameMessage *msg) override; - virtual ~HotKeyTranslator() override { } -}; - -//----------------------------------------------------------------------------- -class HotKey -{ -public: - HotKey(); - GameWindow *m_win; - AsciiString m_key; - // we may need a checkmark system. -}; - -//----------------------------------------------------------------------------- -class HotKeyManager : public SubsystemInterface -{ -public: - HotKeyManager(); - virtual ~HotKeyManager() override; - // Inherited from subsystem interface ----------------------------------------------------------- - virtual void init() override; ///< Initialize the Hotkey system - virtual void update() override {} ///< A No-op for us - virtual void reset() override; ///< Reset - //----------------------------------------------------------------------------------------------- - - void addHotKey( GameWindow *win, const AsciiString& key); - Bool executeHotKey( const AsciiString& key); // called fromt eh HotKeyTranslator - - AsciiString searchHotKey( const AsciiString& label); - AsciiString searchHotKey( const UnicodeString& uStr ); - -private: - typedef std::map HotKeyMap; - HotKeyMap m_hotKeyMap; -}; -extern HotKeyManager *TheHotKeyManager; -//----------------------------------------------------------------------------- -// INLINING /////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// EXTERNALS ////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/Image.h b/Generals/Code/GameEngine/Include/GameClient/Image.h deleted file mode 100644 index 1436c02d66e..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/Image.h +++ /dev/null @@ -1,171 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Image.h ////////////////////////////////////////////////////////////////////////////////// -// Created: Colin Day, June 2001 -// Desc: High level representation of images, this is currently being -// written so we have a way to refer to images in the windows GUI. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "Common/AsciiString.h" -#include "Common/GameMemory.h" -#include "Common/SubsystemInterface.h" -#include - -struct FieldParse; -class INI; - -//------------------------------------------------------------------------------------------------- -/** Image status bits. Keep in sync with imageStatusNames[] */ -//------------------------------------------------------------------------------------------------- -typedef enum -{ - IMAGE_STATUS_NONE = 0x00000000, - IMAGE_STATUS_ROTATED_90_CLOCKWISE = 0x00000001, // image should be treated as rotated - IMAGE_STATUS_RAW_TEXTURE = 0x00000002, // image struct contains raw texture data - -} ImageStatus; -#ifdef DEFINE_IMAGE_STATUS_NAMES -static const char *const imageStatusNames[] = -{ - "ROTATED_90_CLOCKWISE", - "RAW_TEXTURE", - nullptr -}; -#endif // end DEFINE_IMAGE_STATUS_NAMES - -//------------------------------------------------------------------------------------------------- -/** Image bitmap information */ -//------------------------------------------------------------------------------------------------- -class Image : public MemoryPoolObject -{ - -MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( Image, "Image" ); - -public: - - Image(); - // virtual destructor defined by memory pool object - - void setName( AsciiString name ); ///< set image name - AsciiString getName() const; ///< return name - void setFilename( AsciiString filename ); ///< set filename - AsciiString getFilename() const; ///< return filename - void setUV( Region2D *uv ); ///< set UV coord range - const Region2D *getUV() const; ///< get UV coords - void setTextureWidth( Int width ); ///< set width of texture page this image is on - void setTextureHeight( Int height ); ///< set height of texture page this image is on - const ICoord2D *getTextureSize() const; ///< return the texture size defined - void setImageSize( ICoord2D *size ); ///< set image width and height - const ICoord2D *getImageSize() const; ///< get size - Int getImageWidth() const; ///< get width - Int getImageHeight() const; ///< get height - void setRawTextureData( void *data ); ///< set raw texture data - const void *getRawTextureData() const; ///< get raw texture data - UnsignedInt setStatus( UnsignedInt bit ); ///< set status bit - UnsignedInt clearStatus( UnsignedInt bit ); ///< clear status bit - UnsignedInt getStatus() const; ///< get status bits - - - // for parsing from INI - const FieldParse *getFieldParse() const { return m_imageFieldParseTable; } - static void parseImageCoords( INI* ini, void *instance, void *store, const void* /*userData*/ ); - static void parseImageStatus( INI* ini, void *instance, void *store, const void* /*userData*/ ); - -protected: - -friend class ImageCollection; - - AsciiString m_name; ///< name for this image - AsciiString m_filename; ///< texture filename this image is in - ICoord2D m_textureSize; ///< size of the texture this image is a part of - Region2D m_UVCoords; ///< texture UV coords for image - ICoord2D m_imageSize; ///< dimensions of image - void *m_rawTextureData; ///< raw texture data - UnsignedInt m_status; ///< status bits from ImageStatus - - static const FieldParse m_imageFieldParseTable[]; ///< the parse table for INI definition - -}; - -//------------------------------------------------------------------------------------------------- -/** A collection of images */ -//------------------------------------------------------------------------------------------------- -class ImageCollection : public SubsystemInterface -{ - typedef std::map ImageMap; - -public: - - ImageCollection(); - virtual ~ImageCollection() override; - - virtual void init() override { }; ///< initialize system - virtual void reset() override { }; ///< reset system - virtual void update() override { }; ///< update system - - void load( Int textureSize ); ///< load images - - const Image *findImage( NameKeyType namekey ) const; ///< find image based on name key - const Image *findImageByName( const AsciiString& name ) const; ///< find image based on name - const Image *findImageByName( const char* name ) const; ///< find image based on name - - /// adds the given image to the collection, transfers ownership to this object - void addImage(Image *image); - - /// enumerates the list of existing images - Image *Enum(unsigned index) - { - for (ImageMap::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) - if (!index--) - return i->second; - return nullptr; - } - -protected: - ImageMap m_imageMap; ///< maps named keys to images -}; - -// INLINING /////////////////////////////////////////////////////////////////////////////////////// -inline void Image::setName( AsciiString name ) { m_name = name; } -inline AsciiString Image::getName() const { return m_name; } -inline void Image::setFilename( AsciiString name ) { m_filename = name; } -inline AsciiString Image::getFilename() const { return m_filename; } -inline void Image::setUV( Region2D *uv ) { if( uv ) m_UVCoords = *uv; } -inline const Region2D *Image::getUV() const { return &m_UVCoords; } -inline void Image::setTextureWidth( Int width ) { m_textureSize.x = width; } -inline void Image::setTextureHeight( Int height ) { m_textureSize.y = height; } -inline void Image::setImageSize( ICoord2D *size ) { m_imageSize = *size; } -inline const ICoord2D *Image::getImageSize() const { return &m_imageSize; } -inline const ICoord2D *Image::getTextureSize() const { return &m_textureSize; } -inline Int Image::getImageWidth() const { return m_imageSize.x; } -inline Int Image::getImageHeight() const { return m_imageSize.y; } -inline void Image::setRawTextureData( void *data ) { m_rawTextureData = data; } -inline const void *Image::getRawTextureData() const { return m_rawTextureData; } -inline UnsignedInt Image::getStatus() const { return m_status; } - -// EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// -extern ImageCollection *TheMappedImageCollection; ///< mapped images diff --git a/Generals/Code/GameEngine/Include/GameClient/KeyDefs.h b/Generals/Code/GameEngine/Include/GameClient/KeyDefs.h deleted file mode 100644 index 3c9f14394de..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/KeyDefs.h +++ /dev/null @@ -1,261 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: KeyDefs.h //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: KeyDefs.h -// -// Created: Mike Morrison, 1995 -// Colin Day, June 2001 -// -// Desc: Basic keyboard key definitions. -// -/** @todo NOTE: These key definitions are currently tied directly to the -* Direct Input key codes, therefore making these definitions device -* dependent even though this code lives on the device INdependent side -* of the engine. In the future to be truly device independent we -* need to define our own key codes, and have a translation between -* what we read from the device to our own system*/ -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include -#ifndef DIRECTINPUT_VERSION -# define DIRECTINPUT_VERSION 0x800 -#endif - -#include -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// TYPE DEFINES /////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef DIK_OEM_102 -#define DIK_OEM_102 0x56 /* < > | on UK/Germany keyboards */ -#endif - -#ifndef DIK_KANA -#define DIK_KANA 0x70 /* (Japanese keyboard) */ -#endif - -#ifndef DIK_CONVERT -#define DIK_CONVERT 0x79 /* (Japanese keyboard) */ -#endif - -#ifndef DIK_NOCONVERT -#define DIK_NOCONVERT 0x7B /* (Japanese keyboard) */ -#endif - -#ifndef DIK_YEN -#define DIK_YEN 0x7D /* (Japanese keyboard) */ -#endif - -#ifndef DIK_CIRCUMFLEX -#define DIK_CIRCUMFLEX 0x90 /* (Japanese keyboard) */ -#endif - -#ifndef DIK_KANJI -#define DIK_KANJI 0x94 /* (Japanese keyboard) */ -#endif - -//============================================================================= -/** The key tables */ -//============================================================================= - -enum KeyDefType CPP_11(: UnsignedByte) -{ - // keypad keys ---------------------------------------------------------------- - KEY_KP0 = DIK_NUMPAD0, - KEY_KP1 = DIK_NUMPAD1, - KEY_KP2 = DIK_NUMPAD2, - KEY_KP3 = DIK_NUMPAD3, - KEY_KP4 = DIK_NUMPAD4, - KEY_KP5 = DIK_NUMPAD5, - KEY_KP6 = DIK_NUMPAD6, - KEY_KP7 = DIK_NUMPAD7, - KEY_KP8 = DIK_NUMPAD8, - KEY_KP9 = DIK_NUMPAD9, - KEY_KPDEL = DIK_NUMPADPERIOD, - KEY_KPSTAR = DIK_NUMPADSTAR, - KEY_KPMINUS = DIK_NUMPADMINUS, - KEY_KPPLUS = DIK_NUMPADPLUS, - - // regular keys --------------------------------------------------------------- - KEY_ESC = DIK_ESCAPE, - KEY_BACKSPACE = DIK_BACK, - KEY_ENTER = DIK_RETURN, - KEY_SPACE = DIK_SPACE, - KEY_TAB = DIK_TAB, - KEY_F1 = DIK_F1, - KEY_F2 = DIK_F2, - KEY_F3 = DIK_F3, - KEY_F4 = DIK_F4, - KEY_F5 = DIK_F5, - KEY_F6 = DIK_F6, - KEY_F7 = DIK_F7, - KEY_F8 = DIK_F8, - KEY_F9 = DIK_F9, - KEY_F10 = DIK_F10, - KEY_F11 = DIK_F11, - KEY_F12 = DIK_F12, - KEY_A = DIK_A, - KEY_B = DIK_B, - KEY_C = DIK_C, - KEY_D = DIK_D, - KEY_E = DIK_E, - KEY_F = DIK_F, - KEY_G = DIK_G, - KEY_H = DIK_H, - KEY_I = DIK_I, - KEY_J = DIK_J, - KEY_K = DIK_K, - KEY_L = DIK_L, - KEY_M = DIK_M, - KEY_N = DIK_N, - KEY_O = DIK_O, - KEY_P = DIK_P, - KEY_Q = DIK_Q, - KEY_R = DIK_R, - KEY_S = DIK_S, - KEY_T = DIK_T, - KEY_U = DIK_U, - KEY_V = DIK_V, - KEY_W = DIK_W, - KEY_X = DIK_X, - KEY_Y = DIK_Y, - KEY_Z = DIK_Z, - KEY_1 = DIK_1, - KEY_2 = DIK_2, - KEY_3 = DIK_3, - KEY_4 = DIK_4, - KEY_5 = DIK_5, - KEY_6 = DIK_6, - KEY_7 = DIK_7, - KEY_8 = DIK_8, - KEY_9 = DIK_9, - KEY_0 = DIK_0, - KEY_MINUS = DIK_MINUS, - KEY_EQUAL = DIK_EQUALS, - KEY_LBRACKET = DIK_LBRACKET, - KEY_RBRACKET = DIK_RBRACKET, - KEY_SEMICOLON = DIK_SEMICOLON, - KEY_APOSTROPHE = DIK_APOSTROPHE, - KEY_TICK = DIK_GRAVE, - KEY_BACKSLASH = DIK_BACKSLASH, - KEY_COMMA = DIK_COMMA, - KEY_PERIOD = DIK_PERIOD, - KEY_SLASH = DIK_SLASH, - - // special keys --------------------------------------------------------------- - KEY_SYSREQ = DIK_SYSRQ, - - KEY_CAPS = DIK_CAPSLOCK, - KEY_NUM = DIK_NUMLOCK, - KEY_SCROLL = DIK_SCROLL, - KEY_LCTRL = DIK_LCONTROL, - KEY_LALT = DIK_LALT, - KEY_LSHIFT = DIK_LSHIFT, - KEY_RSHIFT = DIK_RSHIFT, - - KEY_UP = DIK_UPARROW, - KEY_DOWN = DIK_DOWNARROW, - KEY_LEFT = DIK_LEFTARROW, - KEY_RIGHT = DIK_RIGHTARROW, - KEY_RALT = DIK_RALT, - KEY_RCTRL = DIK_RCONTROL, - KEY_HOME = DIK_HOME, - KEY_END = DIK_END, - KEY_PGUP = DIK_PGUP, - KEY_PGDN = DIK_PGDN, - KEY_INS = DIK_INSERT, - KEY_DEL = DIK_DELETE, - KEY_KPENTER = DIK_NUMPADENTER, - KEY_KPSLASH = DIK_NUMPADSLASH, - - KEY_102 = DIK_OEM_102, - - // Japanese keyboard keys ----------------------------------------------------- - KEY_KANA = DIK_KANA, - KEY_CONVERT = DIK_CONVERT, - KEY_NOCONVERT = DIK_NOCONVERT, - KEY_YEN = DIK_YEN, - KEY_CIRCUMFLEX = DIK_CIRCUMFLEX, - KEY_KANJI = DIK_KANJI, - - // specials ------------------------------------------------------------------- - KEY_NONE = 0x00, ///< to report end of key stream - KEY_LOST = 0xFF, ///< to report lost keyboard focus - -}; - -enum -{ - KEY_COUNT = 256 -}; - -// state for keyboard IO ------------------------------------------------------ -enum -{ - KEY_STATE_NONE = 0x0000, // No modifier state - KEY_STATE_UP = 0x0001, // Key is up (default state) - KEY_STATE_DOWN = 0x0002, // Key is down - KEY_STATE_LCONTROL = 0x0004, // Left control is pressed - KEY_STATE_RCONTROL = 0x0008, // Right control is pressed - KEY_STATE_LSHIFT = 0x0010, // left shift is pressed - KEY_STATE_RSHIFT = 0x0020, // right shift is pressed - KEY_STATE_LALT = 0x0040, // left alt is pressed - KEY_STATE_RALT = 0x0080, // right alt is pressed - KEY_STATE_AUTOREPEAT = 0x0100, // Key is down due to autorepeat (only seen in conjunction with KEY_STATE_DOWN) - KEY_STATE_CAPSLOCK = 0x0200, // Caps Lock key is on. - KEY_STATE_SHIFT2 = 0x0400, // Alternate shift key is pressed (I think this is for foreign keyboards..) - - // modifier combinations when left/right isn't a factor - KEY_STATE_CONTROL = (KEY_STATE_LCONTROL | KEY_STATE_RCONTROL), - KEY_STATE_SHIFT = (KEY_STATE_LSHIFT | KEY_STATE_RSHIFT | KEY_STATE_SHIFT2 ), - KEY_STATE_ALT = (KEY_STATE_LALT | KEY_STATE_RALT) - -}; - -// INLINING /////////////////////////////////////////////////////////////////// - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/LookAtXlat.h b/Generals/Code/GameEngine/Include/GameClient/LookAtXlat.h deleted file mode 100644 index 493d55ba53f..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/LookAtXlat.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: LookAtXlat.h /////////////////////////////////////////////////////////// -// Author: Steven Johnson, Dec 2001 - -#pragma once - -#include "GameClient/InGameUI.h" - -//----------------------------------------------------------------------------- -// TheSuperHackers @feature The Screen Edge Scrolling can now be enabled or -// disabled depending on the App being Windowed or Fullscreen. -typedef UnsignedInt ScreenEdgeScrollMode; -enum ScreenEdgeScrollMode_ CPP_11(: ScreenEdgeScrollMode) -{ - ScreenEdgeScrollMode_EnabledInWindowedApp = 1<<0, // Scroll when touching the edge while the app is windowed - ScreenEdgeScrollMode_EnabledInFullscreenApp = 1<<1, // Scroll when touching the edge while the app is fullscreen - - ScreenEdgeScrollMode_Default = ScreenEdgeScrollMode_EnabledInFullscreenApp, // Default based on original game behavior -}; - -//----------------------------------------------------------------------------- -class LookAtTranslator : public GameMessageTranslator -{ -public: - LookAtTranslator(); - virtual ~LookAtTranslator() override; - - virtual GameMessageDisposition translateGameMessage(const GameMessage *msg) override; - virtual const ICoord2D* getRMBScrollAnchor(); // get m_anchor ICoord2D if we're RMB scrolling - Bool hasMouseMovedRecently(); - void setCurrentPos( const ICoord2D& pos ); - void setScreenEdgeScrollMode(ScreenEdgeScrollMode mode); - - void resetModes(); //Used when disabling input, so when we reenable it we aren't stuck in a mode. - -private: - enum - { - MAX_VIEW_LOCS = 8 - }; - enum ScrollType - { - SCROLL_NONE = 0, - SCROLL_RMB, - SCROLL_KEY, - SCROLL_SCREENEDGE - }; - ICoord2D m_anchor; - ICoord2D m_originalAnchor; - ICoord2D m_currentPos; - Real m_anchorAngle; - Bool m_isScrolling; // set to true if we are in the act of RMB scrolling - Bool m_isRotating; // set to true if we are in the act of MMB rotating - Bool m_isPitching; // set to true if we are in the act of ALT pitch rotation - Bool m_isChangingFOV; // set to true if we are in the act of changing the field of view - UnsignedInt m_middleButtonDownTimeMsec; // real-time in milliseconds when middle button goes down - DrawableID m_lastPlaneID; - ViewLocation m_viewLocation[ MAX_VIEW_LOCS ]; - ScrollType m_scrollType; - ScreenEdgeScrollMode m_screenEdgeScrollMode; - UnsignedInt m_lastMouseMoveTimeMsec; // real-time in milliseconds when mouse last moved - - void setScrolling( ScrollType scrollType ); - void stopScrolling(); - Bool canScrollAtScreenEdge() const; -}; - -extern LookAtTranslator *TheLookAtTranslator; diff --git a/Generals/Code/GameEngine/Include/GameClient/MessageBox.h b/Generals/Code/GameEngine/Include/GameClient/MessageBox.h deleted file mode 100644 index cf5951e0990..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/MessageBox.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: MessageBox.h ///////////////////////////////////////////////////////////////////////////// -// Author: Chris Huybregts, November 2001 -// Description: Message Box file containing user aliases -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "GameClient/GameWindowManager.h" - -GameWindow *MessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback); ///< convenience function for displaying a Message box with Yes and No buttons -GameWindow *QuitMessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback); ///< convenience function for displaying a Message box with Yes and No buttons - - -GameWindow *MessageBoxYesNoCancel(UnicodeString titleString,UnicodeString bodyString, GameWinMsgBoxFunc yesCallback, GameWinMsgBoxFunc noCallback, GameWinMsgBoxFunc cancelCallback);///< convenience function for displaying a Message box with Yes,No and Cancel buttons - - -GameWindow *MessageBoxOkCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback,GameWinMsgBoxFunc cancelCallback);///< convenience function for displaying a Message box with Ok and Cancel buttons - -GameWindow *MessageBoxOk(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback);///< convenience function for displaying a Message box with Ok button - - -GameWindow *MessageBoxCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc cancelCallback);///< convenience function for displaying a Message box with Cancel button diff --git a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h b/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h deleted file mode 100644 index bc2d201ba24..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/MetaEvent.h +++ /dev/null @@ -1,401 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: MetaEvent.h /////////////////////////////////////////////////////////// -// Author: Steven Johnson, Dec 2001 - -#pragma once - -#include "Common/SubsystemInterface.h" -#include "GameClient/InGameUI.h" - - -enum MappableKeyCategories CPP_11(: Int) -{ - CATEGORY_CONTROL = 0, - CATEGORY_INFORMATION, - CATEGORY_INTERFACE, - CATEGORY_SELECTION, - CATEGORY_TAUNT, - CATEGORY_TEAM, - CATEGORY_MISC, - CATEGORY_DEBUG, - - CATEGORY_NUM_CATEGORIES -}; - -static const LookupListRec CategoryListName[] = -{ - {"CONTROL", CATEGORY_CONTROL}, - {"INFORMATION", CATEGORY_INFORMATION}, - {"INTERFACE", CATEGORY_INTERFACE}, - {"SELECTION", CATEGORY_SELECTION}, - {"TAUNT", CATEGORY_TAUNT}, - {"TEAM", CATEGORY_TEAM}, - {"MISC", CATEGORY_MISC}, - {"DEBUG", CATEGORY_DEBUG}, - { nullptr, 0} -}; - - -// ------------------------------------------------------------------------------- -// the keys we allow to be mapped to Meta-events. -// note that this is a subset of all the keys available; -// in particular, "modifier" keys and keypad keys aren't -// available. Note that MappableKeyType is a SUBSET of -// KeyDefType; this is extremely important to maintain! -enum MappableKeyType CPP_11(: Int) -{ - // keypad keys ---------------------------------------------------------------- - MK_KP0 = KEY_KP0, - MK_KP1 = KEY_KP1, - MK_KP2 = KEY_KP2, - MK_KP3 = KEY_KP3, - MK_KP4 = KEY_KP4, - MK_KP5 = KEY_KP5, - MK_KP6 = KEY_KP6, - MK_KP7 = KEY_KP7, - MK_KP8 = KEY_KP8, - MK_KP9 = KEY_KP9, - MK_KPDEL = KEY_KPDEL, - MK_KPSTAR = KEY_KPSTAR, - MK_KPMINUS = KEY_KPMINUS, - MK_KPPLUS = KEY_KPPLUS, - MK_KPENTER = KEY_KPENTER, - MK_KPSLASH = KEY_KPSLASH, - - MK_ESC = KEY_ESC, - MK_BACKSPACE = KEY_BACKSPACE, - MK_ENTER = KEY_ENTER, - MK_SPACE = KEY_SPACE, - MK_TAB = KEY_TAB, - MK_F1 = KEY_F1, - MK_F2 = KEY_F2, - MK_F3 = KEY_F3, - MK_F4 = KEY_F4, - MK_F5 = KEY_F5, - MK_F6 = KEY_F6, - MK_F7 = KEY_F7, - MK_F8 = KEY_F8, - MK_F9 = KEY_F9, - MK_F10 = KEY_F10, - MK_F11 = KEY_F11, - MK_F12 = KEY_F12, - MK_A = KEY_A, - MK_B = KEY_B, - MK_C = KEY_C, - MK_D = KEY_D, - MK_E = KEY_E, - MK_F = KEY_F, - MK_G = KEY_G, - MK_H = KEY_H, - MK_I = KEY_I, - MK_J = KEY_J, - MK_K = KEY_K, - MK_L = KEY_L, - MK_M = KEY_M, - MK_N = KEY_N, - MK_O = KEY_O, - MK_P = KEY_P, - MK_Q = KEY_Q, - MK_R = KEY_R, - MK_S = KEY_S, - MK_T = KEY_T, - MK_U = KEY_U, - MK_V = KEY_V, - MK_W = KEY_W, - MK_X = KEY_X, - MK_Y = KEY_Y, - MK_Z = KEY_Z, - MK_1 = KEY_1, - MK_2 = KEY_2, - MK_3 = KEY_3, - MK_4 = KEY_4, - MK_5 = KEY_5, - MK_6 = KEY_6, - MK_7 = KEY_7, - MK_8 = KEY_8, - MK_9 = KEY_9, - MK_0 = KEY_0, - MK_MINUS = KEY_MINUS, - MK_EQUAL = KEY_EQUAL, - MK_LBRACKET = KEY_LBRACKET, - MK_RBRACKET = KEY_RBRACKET, - MK_SEMICOLON = KEY_SEMICOLON, - MK_APOSTROPHE = KEY_APOSTROPHE, - MK_TICK = KEY_TICK, - MK_BACKSLASH = KEY_BACKSLASH, - MK_COMMA = KEY_COMMA, - MK_PERIOD = KEY_PERIOD, - MK_SLASH = KEY_SLASH, - MK_UP = KEY_UP, - MK_DOWN = KEY_DOWN, - MK_LEFT = KEY_LEFT, - MK_RIGHT = KEY_RIGHT, - MK_HOME = KEY_HOME, - MK_END = KEY_END, - MK_PGUP = KEY_PGUP, - MK_PGDN = KEY_PGDN, - MK_INS = KEY_INS, - MK_DEL = KEY_DEL, - MK_NONE = KEY_NONE - -}; - -static const LookupListRec KeyNames[] = -{ - // keypad keys ---------------------------------------------------------------- - { "KEY_KP0", MK_KP0 }, - { "KEY_KP1", MK_KP1 }, - { "KEY_KP2", MK_KP2 }, - { "KEY_KP3", MK_KP3 }, - { "KEY_KP4", MK_KP4 }, - { "KEY_KP5", MK_KP5 }, - { "KEY_KP6", MK_KP6 }, - { "KEY_KP7", MK_KP7 }, - { "KEY_KP8", MK_KP8 }, - { "KEY_KP9", MK_KP9 }, - { "KEY_KPDEL", MK_KPDEL }, - { "KEY_KPSTAR", MK_KPSTAR }, - { "KEY_KPMINUS", MK_KPMINUS }, - { "KEY_KPPLUS", MK_KPPLUS }, - { "KEY_KPENTER", MK_KPENTER }, - { "KEY_KPSLASH", MK_KPSLASH }, - - { "KEY_ESC", MK_ESC }, - { "KEY_BACKSPACE", MK_BACKSPACE }, - { "KEY_ENTER", MK_ENTER }, - { "KEY_SPACE", MK_SPACE }, - { "KEY_TAB", MK_TAB }, - { "KEY_F1", MK_F1 }, - { "KEY_F2", MK_F2 }, - { "KEY_F3", MK_F3 }, - { "KEY_F4", MK_F4 }, - { "KEY_F5", MK_F5 }, - { "KEY_F6", MK_F6 }, - { "KEY_F7", MK_F7 }, - { "KEY_F8", MK_F8 }, - { "KEY_F9", MK_F9 }, - { "KEY_F10", MK_F10 }, - { "KEY_F11", MK_F11 }, - { "KEY_F12", MK_F12 }, - { "KEY_A", MK_A }, - { "KEY_B", MK_B }, - { "KEY_C", MK_C }, - { "KEY_D", MK_D }, - { "KEY_E", MK_E }, - { "KEY_F", MK_F }, - { "KEY_G", MK_G }, - { "KEY_H", MK_H }, - { "KEY_I", MK_I }, - { "KEY_J", MK_J }, - { "KEY_K", MK_K }, - { "KEY_L", MK_L }, - { "KEY_M", MK_M }, - { "KEY_N", MK_N }, - { "KEY_O", MK_O }, - { "KEY_P", MK_P }, - { "KEY_Q", MK_Q }, - { "KEY_R", MK_R }, - { "KEY_S", MK_S }, - { "KEY_T", MK_T }, - { "KEY_U", MK_U }, - { "KEY_V", MK_V }, - { "KEY_W", MK_W }, - { "KEY_X", MK_X }, - { "KEY_Y", MK_Y }, - { "KEY_Z", MK_Z }, - { "KEY_1", MK_1 }, - { "KEY_2", MK_2 }, - { "KEY_3", MK_3 }, - { "KEY_4", MK_4 }, - { "KEY_5", MK_5 }, - { "KEY_6", MK_6 }, - { "KEY_7", MK_7 }, - { "KEY_8", MK_8 }, - { "KEY_9", MK_9 }, - { "KEY_0", MK_0 }, - { "KEY_MINUS", MK_MINUS }, - { "KEY_EQUAL", MK_EQUAL }, - { "KEY_LBRACKET", MK_LBRACKET }, - { "KEY_RBRACKET", MK_RBRACKET }, - { "KEY_SEMICOLON", MK_SEMICOLON }, - { "KEY_APOSTROPHE", MK_APOSTROPHE }, - { "KEY_TICK", MK_TICK }, - { "KEY_BACKSLASH", MK_BACKSLASH }, - { "KEY_COMMA", MK_COMMA }, - { "KEY_PERIOD", MK_PERIOD }, - { "KEY_SLASH", MK_SLASH }, - { "KEY_UP", MK_UP }, - { "KEY_DOWN", MK_DOWN }, - { "KEY_LEFT", MK_LEFT }, - { "KEY_RIGHT", MK_RIGHT }, - { "KEY_HOME", MK_HOME }, - { "KEY_END", MK_END }, - { "KEY_PGUP", MK_PGUP }, - { "KEY_PGDN", MK_PGDN }, - { "KEY_INS", MK_INS }, - { "KEY_DEL", MK_DEL }, - { "KEY_NONE", MK_NONE }, - { nullptr, 0 } -}; - -// ------------------------------------------------------------------------------- -enum MappableKeyTransition CPP_11(: Int) -{ - DOWN, - UP, - DOUBLEDOWN, // if a key transition is repeated immediately, we generate this. - - MAPPABLE_KEY_TRANSITION_COUNT -}; - -static const LookupListRec TransitionNames[] = -{ - { "DOWN", DOWN }, - { "UP", UP }, - { "DOUBLEDOWN", DOUBLEDOWN }, - { nullptr, 0 } -}; -static_assert(ARRAY_SIZE(TransitionNames) == MAPPABLE_KEY_TRANSITION_COUNT + 1, "Incorrect array size"); - -// ------------------------------------------------------------------------------- -// an easier-to-type subset of the KEY_STATE stuff. -enum MappableKeyModState CPP_11(: Int) -{ - NONE = 0, - CTRL = KEY_STATE_LCONTROL, - ALT = KEY_STATE_LALT, - SHIFT = KEY_STATE_LSHIFT, - CTRL_ALT = CTRL|ALT, - SHIFT_CTRL = SHIFT|CTRL, - SHIFT_ALT = SHIFT|ALT, - SHIFT_ALT_CTRL = SHIFT|ALT|CTRL -}; - -static const LookupListRec ModifierNames[] = -{ - { "NONE", NONE }, - { "CTRL", CTRL }, - { "ALT", ALT }, - { "SHIFT", SHIFT }, - { "CTRL_ALT", CTRL_ALT }, - { "SHIFT_CTRL", SHIFT_CTRL }, - { "SHIFT_ALT", SHIFT_ALT }, - { "SHIFT_ALT_CTRL" , SHIFT_ALT_CTRL }, - { nullptr, 0 } -}; - - - -// ------------------------------------------------------------------------------- -// CommandUsableInType sets in what state the commands are allowed. -enum CommandUsableInType CPP_11(: Int) -{ - COMMANDUSABLE_NONE = 0, - - COMMANDUSABLE_SHELL = (1 << 0), // Command is usable when in Shell (Menus) - COMMANDUSABLE_GAME = (1 << 1), // Command is usable when not in Shell - COMMANDUSABLE_OBSERVER = (1 << 2), // TheSuperHackers @feature Command is usable when observing - - COMMANDUSABLE_EVERYWHERE = ~0, -}; - -static const char* const TheCommandUsableInNames[] = -{ - "SHELL", - "GAME", - "OBSERVER", - - nullptr -}; - -// ------------------------------------------------------------------------------- -class MetaMapRec : public MemoryPoolObject -{ - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(MetaMapRec, "MetaMapRec") -public: - MetaMapRec* m_next; - GameMessage::Type m_meta; ///< the meta-event to emit - MappableKeyType m_key; ///< the key we want - MappableKeyTransition m_transition; ///< the state of the key - MappableKeyModState m_modState; ///< the required state of the ctrl-alt-shift keys - CommandUsableInType m_usableIn; ///< the allowed place the command can be used in - // Next fields are added for Key mapping Dialog - MappableKeyCategories m_category; ///< This is the category the key falls under - UnicodeString m_description; ///< The description string for the keys - UnicodeString m_displayName; ///< The display name of our command -}; -EMPTY_DTOR(MetaMapRec) - - -//----------------------------------------------------------------------------- -class MetaEventTranslator : public GameMessageTranslator -{ -private: - - Int m_lastKeyDown; // really a MappableKeyType - Int m_lastModState; // really a MappableKeyModState - - enum { NUM_MOUSE_BUTTONS = 3 }; - ICoord2D m_mouseDownPosition[NUM_MOUSE_BUTTONS]; - Bool m_nextUpShouldCreateDoubleClick[NUM_MOUSE_BUTTONS]; - -public: - MetaEventTranslator(); - virtual ~MetaEventTranslator() override; - virtual GameMessageDisposition translateGameMessage(const GameMessage *msg) override; -}; - -//----------------------------------------------------------------------------- -class MetaMap : public SubsystemInterface -{ - friend class MetaEventTranslator; - -private: - MetaMapRec *m_metaMaps; - -protected: - GameMessage::Type findGameMessageMetaType(const char* name); - MetaMapRec *getMetaMapRec(GameMessage::Type t); - -public: - - MetaMap(); - virtual ~MetaMap() override; - - virtual void init() override { } - virtual void reset() override { } - virtual void update() override { } - - static void parseMetaMap(INI* ini); - - // TheSuperHackers @info Function to generate default key mappings - // for actions that were not found in a CommandMap.ini - static void generateMetaMap(); - - const MetaMapRec *getFirstMetaMapRec() const { return m_metaMaps; } -}; - -extern MetaMap *TheMetaMap; diff --git a/Generals/Code/GameEngine/Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h b/Generals/Code/GameEngine/Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h deleted file mode 100644 index ca57ee41459..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: AnimatedParticleSysBoneClientUpdate.h ////////////////////////////////////////////////////////////////// -// Author: Mark Lorenzen, October 2002 -// Desc: client update module to translate particle systems with animation -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "Common/ClientUpdateModule.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// -class Thing; - -class AnimatedParticleSysBoneClientUpdate : public ClientUpdateModule -{ - - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( AnimatedParticleSysBoneClientUpdate, "AnimatedParticleSysBoneClientUpdate" ) - MAKE_STANDARD_MODULE_MACRO( AnimatedParticleSysBoneClientUpdate ); - -public: - - AnimatedParticleSysBoneClientUpdate( Thing *thing, const ModuleData* moduleData ); - // virtual destructor prototype provided by memory pool declaration - - /// the client update callback - virtual void clientUpdate() override; - - -protected: - - - UnsignedInt m_life; - -}; diff --git a/Generals/Code/GameEngine/Include/GameClient/Module/BeaconClientUpdate.h b/Generals/Code/GameEngine/Include/GameClient/Module/BeaconClientUpdate.h deleted file mode 100644 index a13aaf84e83..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/Module/BeaconClientUpdate.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: BeaconClientUpdate.h //////////////////////////////////////////////////////////////////// -// Author: Matthew D. Campbell, August 2002 -// Desc: Beacon client update module -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "Common/ClientUpdateModule.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// -class Thing; -class ParticleSystem; - -//------------------------------------------------------------------------------------------------- -class BeaconClientUpdateModuleData : public ClientUpdateModuleData -{ -public: - UnsignedInt m_framesBetweenRadarPulses; - UnsignedInt m_radarPulseDuration; - - BeaconClientUpdateModuleData(); - virtual ~BeaconClientUpdateModuleData() override; - static void buildFieldParse(MultiIniFieldParse& p); -}; - -//------------------------------------------------------------------------------------------------- -/** The tree way client update module */ -//------------------------------------------------------------------------------------------------- -class BeaconClientUpdate : public ClientUpdateModule -{ - - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( BeaconClientUpdate, "BeaconClientUpdate" ) - MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA( BeaconClientUpdate, BeaconClientUpdateModuleData ); - -public: - - BeaconClientUpdate( Thing *thing, const ModuleData* moduleData ); - // virtual destructor prototype provided by memory pool declaration - - /// the client update callback - virtual void clientUpdate() override; - void hideBeacon(); - -protected: - - ParticleSystemID m_particleSystemID; - UnsignedInt m_lastRadarPulse; - -}; diff --git a/Generals/Code/GameEngine/Include/GameClient/Module/SwayClientUpdate.h b/Generals/Code/GameEngine/Include/GameClient/Module/SwayClientUpdate.h deleted file mode 100644 index efd621b826a..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/Module/SwayClientUpdate.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: SwayClientUpdate.h //////////////////////////////////////////////////////////////////// -// Author: Matthew D. Campbell, May 2002 -// Desc: Tree sway client update module -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "Common/ClientUpdateModule.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// -class Thing; - -//------------------------------------------------------------------------------------------------- -/** The tree way client update module */ -//------------------------------------------------------------------------------------------------- -class SwayClientUpdate : public ClientUpdateModule -{ - - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( SwayClientUpdate, "SwayClientUpdate" ) - MAKE_STANDARD_MODULE_MACRO( SwayClientUpdate ); - -public: - - SwayClientUpdate( Thing *thing, const ModuleData* moduleData ); - // virtual destructor prototype provided by memory pool declaration - - /// the client update callback - virtual void clientUpdate() override; - - void stopSway() { m_swaying = false; } - -protected: - - Real m_curValue; - Real m_curAngle; - Real m_curDelta; - Real m_curAngleLimit; - Real m_leanAngle; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: PlaceEventTranslator.h /////////////////////////////////////////////////////////// -// Author: Steven Johnson, Dec 2001 - -#pragma once - -#include "GameClient/InGameUI.h" - -//----------------------------------------------------------------------------- -class PlaceEventTranslator : public GameMessageTranslator -{ -private: - UnsignedInt m_frameOfUpButton; - -public: - PlaceEventTranslator(); - virtual ~PlaceEventTranslator() override; - virtual GameMessageDisposition translateGameMessage(const GameMessage *msg) override; -}; diff --git a/Generals/Code/GameEngine/Include/GameClient/RayEffect.h b/Generals/Code/GameEngine/Include/GameClient/RayEffect.h deleted file mode 100644 index e2e8ef2541c..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/RayEffect.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: RayEffect.h ////////////////////////////////////////////////////////////////////////////// -// Created: Colin Day, May 2001 -// Desc: Ray effect manager -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// INCLUDE //////////////////////////////////////////////////////////////////////////////////////// -#include "Lib/BaseType.h" -#include "Common/SubsystemInterface.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// -class Drawable; - -//------------------------------------------------------------------------------------------------- -/** Data the ray effect system keeps for an entry */ -//------------------------------------------------------------------------------------------------- -struct RayEffectData -{ - - const Drawable *draw; ///< the drawable - Coord3D startLoc; ///< start location for ray - Coord3D endLoc; ///< end location for ray - -}; - -//------------------------------------------------------------------------------------------------- -/** This class maintains all the ray effects visible in the world */ -//------------------------------------------------------------------------------------------------- -class RayEffectSystem : public SubsystemInterface -{ - -public: - - RayEffectSystem(); - virtual ~RayEffectSystem() override; - - virtual void init() override; - virtual void reset() override; - virtual void update() override { } - - /// add a ray effect entry for this drawable - void addRayEffect( const Drawable *draw, const Coord3D *startLoc, const Coord3D *endLoc ); - - /// given a drawable, remove its effect from the system - void deleteRayEffect( const Drawable *draw ); - - /** given a drawable, if it is in the ray effect system list retrieve - the ray effect data for its entry */ - void getRayEffectData( const Drawable *draw, RayEffectData *effectData ); - -protected: - - /// find an effect data entry based on the drawable - RayEffectData *findEntry( const Drawable *draw ); - - enum - { - MAX_RAY_EFFECTS = 128 - }; - RayEffectData m_effectData[ MAX_RAY_EFFECTS ]; ///< all the ray effects - -}; - -// EXTERN ///////////////////////////////////////////////////////////////////////////////////////// -extern RayEffectSystem *TheRayEffects; ///< the ray effects singleton external diff --git a/Generals/Code/GameEngine/Include/GameClient/Shadow.h b/Generals/Code/GameEngine/Include/GameClient/Shadow.h deleted file mode 100644 index bb726502afe..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/Shadow.h +++ /dev/null @@ -1,224 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Shadow.h ///////////////////////////////////////////////////////////////////////////////// -// Author: Colin Day, November 2001 -// Modified: Mark Wilczynski, February 2002 -// Desc: Shadow descriptions -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// -// skeleton definition of shadow types -// - -// shadow bit flags, keep this in sync with TheShadowNames -enum ShadowType CPP_11(: Int) -{ - SHADOW_NONE = 0x00000000, - SHADOW_DECAL = 0x00000001, //shadow decal applied via modulate blend - SHADOW_VOLUME = 0x00000002, - SHADOW_PROJECTION = 0x00000004, - SHADOW_DYNAMIC_PROJECTION = 0x00000008, //extra setting for shadows which need dynamic updates - SHADOW_DIRECTIONAL_PROJECTION = 0x00000010, //extra setting for shadow decals that rotate with sun direction - SHADOW_ALPHA_DECAL = 0x00000020, //not really for shadows but for other decal uses. Alpha blended. - SHADOW_ADDITIVE_DECAL = 0x00000040 //not really for shadows but for other decal uses. Additive blended. -}; -#ifdef DEFINE_SHADOW_NAMES -static const char* const TheShadowNames[] = -{ - "SHADOW_DECAL", - "SHADOW_VOLUME", - "SHADOW_PROJECTION", - "SHADOW_DYNAMIC_PROJECTION", - "SHADOW_DIRECTIONAL_PROJECTION", - "SHADOW_ALPHA_DECAL", - "SHADOW_ADDITIVE_DECAL", - nullptr -}; -#endif // end DEFINE_SHADOW_NAMES - -#define MAX_SHADOW_LIGHTS 1 //maximum number of shadow casting light sources in scene - support for more than 1 has been dropped from most code. - -class RenderObjClass; //forward reference -class RenderCost; //forward reference - -//Interface to all shadow objects. -class Shadow -{ - -public: - - struct ShadowTypeInfo - { - ShadowTypeInfo() - { - m_ShadowName[0] = '\0'; - m_type = SHADOW_NONE; - allowUpdates = false; - allowWorldAlign = false; - m_sizeX = 0.0f; - m_sizeY = 0.0f; - m_offsetX = 0.0f; - m_offsetY = 0.0f; - } - - char m_ShadowName[64]; //when set, overrides the default model shadow (used mostly for Decals). - ShadowType m_type; //type of shadow - Bool allowUpdates; //whether to update the shadow image when object/light moves. - Bool allowWorldAlign; //whether to align shadow to world geometry or draw as horizontal decal. - Real m_sizeX; //world size of decal projection - Real m_sizeY; //world size of decal projection - Real m_offsetX; //world shift along x axis - Real m_offsetY; //world shift along y axis - }; - - Shadow() : m_diffuse(0xffffffff), m_color(0xffffffff), m_opacity (0x000000ff), m_localAngle(0.0f) {} - - ///> 8) & 0xff) * fvalue)) - |REAL_TO_INT(((Real)((m_color >> 16) & 0xff) * fvalue)); - } - } -} - -inline void Shadow::setColor(Color value) -{ - m_color = value & 0x00ffffff; //filter out alpha - - if (m_type & SHADOW_ALPHA_DECAL) - { - m_diffuse=m_color | (m_opacity << 24); - } - else - { - if (m_type & SHADOW_ADDITIVE_DECAL) - { - Real fvalue=(Real)m_opacity/255.0f; - m_diffuse=REAL_TO_INT(((Real)(m_color & 0xff) * fvalue)) - |REAL_TO_INT(((Real)((m_color >> 8) & 0xff) * fvalue)) - |REAL_TO_INT(((Real)((m_color >> 16) & 0xff) * fvalue)); - } - } -} - -inline void Shadow::setPosition(Real x, Real y, Real z) -{ - m_x=x; m_y=y; m_z=z; -} - -inline void Shadow::setAngle(Real angle) -{ - m_localAngle=angle; -} - -class Drawable; //forward ref. - -class ProjectedShadowManager -{ -public: - virtual ~ProjectedShadowManager() { }; - virtual Shadow *addDecal(RenderObjClass *, Shadow::ShadowTypeInfo *shadowInfo)=0; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Shell.h ////////////////////////////////////////////////////////////////////////////////// -// Author: Colin Day, September 2001 -// Description: Shell menu representations -// -// Using The Shell: -// ---------------- -// -// The Shell makes use of the window layouts to represent screens. You can push and -// pop screens on the stack so that you don't have to keep track of how you got -// to which screen. -// -// Here is what happens when you push a layout on the shell stack: -// 1) The layout name is stored as a "pending push" -// 2) The top of the stack has the Shutdown() method run -// 3) The Shutdown() method (or other mechanisms like Update()) will call -// Shell::shutdownComplete() when the shutdown process for that layout is "complete" -// 4) Shell::shutdownComplete() sees the "pending push" in the shell -// 5) "Pending push" layout is then loaded from disk and the pending push state is cleared -// 6) The new layout is put on the top of the stack -// 7) The new layout Init() method is called -// -// Here is what happens when you pop the top of the stack -// 1) The stack sets a "pending pop" as in progress -// 2) The top layout of the stack has the Shutdown() method called -// 3) The Shutdown() method (or other mechanisms like Update()) will call -// Shell::shutdownComplete() when the shutdown process for that layout is "complete" -// 4) Shell::shutdownComplete() sees the "pending pop" in the shell -// 5) The "pending pop" layout is then destroyed and removed from the stack -// 6) The new top of the stack has the Init() method run -// -// Window Layouts and the Shell: -// ----------------------------- -// -// Window Layouts in the shell need the following functions to work property, these -// can be assigned from the GUIEdit window layout tool: -// -// - Init() [OPTIONAL] -// This is called as a result of a push or pop operation (see above for more info) -// The window layout is loaded from disk and then this Init() -// method is run. All shell layout Init() methods should show -// the layout windows. At this point you could move windows -// to starting positions, set a state that the Update() method looks at to -// "animate" the windows to the desired positions. -// -// - Update() [OPTIONAL] -// This is called once at a rate of "shellUpdateDelay" for EVERY screen on the shell -// stack. It does not matter if the screen is on the top, or is hidden, or -// anything, this is always called. Each update is run starting with the screen -// at the top of the stack and progressing to the bottom of the stack. -// States could be set in the Init() or Shutdown() methods of the layout -// that the Update() looks at and reacts to appropriately if desired. -// -// - Shutdown() [REQUIRED] -// This is called when a layout is popped off the stack, or when a new layout -// is pushed on top of this one (see above for more detail on what happens -// during the push/pop process). You can switch into a "shutdown" state and -// animate the layout appropriately in the Update() method for the layout. -// When shutdown is actually complete you should hide the all windows in -// the layout and then you are REQUIRED to notify the shell by calling -// the Shell::shutdownComplete() method. -// -// Shutdown() is also required to be able to handle the parameter "immediatePop". -// If this parameter is TRUE it means that when control returns from the -// shutdown function that the layout will immediately be popped off the -// stack. We need to be able to handle this when in code we want to -// traverse back down the stack rapidly (like when we lose connection to -// an online service, we might pop all the way back to the login screen) -// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// - -// FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// -class WindowLayout; -class AnimateWindowManager; -class GameWindow; -class ShellMenuSchemeManager; - -enum AnimTypes CPP_11(: Int); - -//------------------------------------------------------------------------------------------------- -/** This is the interface to the shell system to load, display, and - * manage screen menu shell system layouts */ -//------------------------------------------------------------------------------------------------- -class Shell : public SubsystemInterface -{ - -public: - - Shell(); - virtual ~Shell() override; - - // Inhertited from subsystem ==================================================================== - virtual void init() override; - virtual void reset() override; - virtual void update() override; - //=============================================================================================== - - void recreateWindowLayouts(); - - void showShellMap(Bool useShellMap ); ///< access function to turn on and off the shell map - - void hide( Bool hide ); ///< show/hide all shell layouts - - // pseudo-stack operations for manipulating layouts - void push( AsciiString filename, Bool shutdownImmediate = FALSE ); ///< load new screen on top, optionally doing an immediate shutdown - void pop(); ///< pop top layout - void popImmediate(); ///< pop now, don't wait for shutdown - void showShell( Bool runInit = TRUE ); ///< init the top of stack - void hideShell(); ///< shutdown the top of stack - WindowLayout *top(); ///< return top layout - - void shutdownComplete( WindowLayout *layout, Bool impendingPush = FALSE ); ///< layout has completed shutdown - - WindowLayout *findScreenByFilename( AsciiString filename ); ///< find screen - Bool isShellActive() { return m_isShellActive; } ///< Returns true if the shell is active - - void registerWithAnimateManager( GameWindow *win, AnimTypes animType, Bool needsToFinish, UnsignedInt delayMS = 0); - Bool isAnimFinished(); - void reverseAnimatewindow(); - Bool isAnimReversed(); - - void loadScheme( AsciiString name ); - ShellMenuSchemeManager *getShellMenuSchemeManager() { return m_schemeManager; } - - Int getScreenCount() const { return m_screenCount; } ///< Return the current number of screens - WindowLayout *getScreenLayout( Int index ) const; - - WindowLayout *getSaveLoadMenuLayout(); ///< create if necessary and return layout for save load menu - WindowLayout *getPopupReplayLayout(); ///< create if necessary and return layout for replay save menu - WindowLayout *getOptionsLayout( Bool create ); ///< return layout for options menu, create if necessary and we are allowed to. - void destroyOptionsLayout(); ///< destroy the shell's options layout. - -protected: - - void construct(); - void deconstruct(); - - void linkScreen( WindowLayout *screen ); ///< link screen to list - void unlinkScreen( WindowLayout *screen ); ///< remove screen from list - - void doPush( AsciiString layoutFile ); ///< workhorse for push action - void doPop( Bool impendingPush ); ///< workhorse for pop action - - enum { MAX_SHELL_STACK = 16 }; ///< max simultaneous shell screens - WindowLayout *m_screenStack[ MAX_SHELL_STACK ]; ///< the screen layout stack - Int m_screenCount; ///< # of screens in screen stack - - WindowLayout *m_background; ///< The Background layout if the 3d shell isn't running - Bool m_clearBackground; ///< Flag if we're going to clear the background or not - - Bool m_pendingPush; ///< TRUE when a push is pending - Bool m_pendingPop; ///< TRUE when a pop is pending - AsciiString m_pendingPushName; ///< layout name to be pushed - Bool m_isShellActive; ///< TRUE when the shell is active - Bool m_shellMapOn; ///< TRUE when the shell map is on - AnimateWindowManager *m_animateWindowManager; ///< The animate Window Manager - ShellMenuSchemeManager *m_schemeManager; ///< The Shell Scheme Manager - - // - // we keep a pointer to this layout so that we can simply just hide/unhide this - // window layout. Why you ask? Well, as the result of pressing a button to start - // a save game load a super large set of operations will happen as the game - // loads. One of those operations is the destruction of the menu, which although - // it just destroys the windows and puts them on a destroyed list, that destroyed - // list is also processed before we are out of our own window procedure. - // This is a prime example why it's easier to just deal with windows by hiding and - // un-hiding them rather than actually creating and destroying them. - // - WindowLayout *m_saveLoadMenuLayout; ///< save/load menu layout - WindowLayout *m_popupReplayLayout; ///< replay save menu layout - WindowLayout *m_optionsLayout; ///< options menu layout - -}; - -// INLINING /////////////////////////////////////////////////////////////////////////////////////// - -// EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// -extern Shell *TheShell; ///< the shell external interface diff --git a/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h b/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h deleted file mode 100644 index d6fe0418607..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/ShellHooks.h +++ /dev/null @@ -1,81 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - - -// ShellHooks.h -// Author: Matthew D. Campbell, October 2002 - -#pragma once - -// -// This enumeration holds all the shell script hooks that we currently have, If you are going to -// add more, it's important to keep the enum lined up with the names in TheShellHookNames located -// in Scripts.cpp. -// -enum -{ - SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_SELECTED = 0, - SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_HIGHLIGHTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_CAMPAIGN_UNHIGHLIGHTED, - - SHELL_SCRIPT_HOOK_MAIN_MENU_SKIRMISH_SELECTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_SKIRMISH_HIGHLIGHTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_SKIRMISH_UNHIGHLIGHTED, - - SHELL_SCRIPT_HOOK_MAIN_MENU_OPTIONS_SELECTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_OPTIONS_HIGHLIGHTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_OPTIONS_UNHIGHLIGHTED, - - SHELL_SCRIPT_HOOK_MAIN_MENU_ONLINE_SELECTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_ONLINE_HIGHLIGHTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_ONLINE_UNHIGHLIGHTED, - - SHELL_SCRIPT_HOOK_MAIN_MENU_NETWORK_SELECTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_NETWORK_HIGHLIGHTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_NETWORK_UNHIGHLIGHTED, - - SHELL_SCRIPT_HOOK_MAIN_MENU_EXIT_SELECTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_EXIT_HIGHLIGHTED, - SHELL_SCRIPT_HOOK_MAIN_MENU_EXIT_UNHIGHLIGHTED, - - SHELL_SCRIPT_HOOK_GENERALS_ONLINE_LOGIN, - SHELL_SCRIPT_HOOK_GENERALS_ONLINE_LOGOUT, - SHELL_SCRIPT_HOOK_GENERALS_ONLINE_ENTERED_FROM_GAME, - - SHELL_SCRIPT_HOOK_OPTIONS_OPENED, - SHELL_SCRIPT_HOOK_OPTIONS_CLOSED, - - SHELL_SCRIPT_HOOK_SKIRMISH_OPENED, - SHELL_SCRIPT_HOOK_SKIRMISH_CLOSED, - SHELL_SCRIPT_HOOK_SKIRMISH_ENTERED_FROM_GAME, - - SHELL_SCRIPT_HOOK_LAN_OPENED, - SHELL_SCRIPT_HOOK_LAN_CLOSED, - SHELL_SCRIPT_HOOK_LAN_ENTERED_FROM_GAME, - - SHELL_SCRIPT_HOOK_TOTAL -}; - -extern const char *const TheShellHookNames[]; ///< Contains a list of the text representation of the shell hooks Used in WorldBuilder and in the shell. -void SignalUIInteraction(Int interaction); diff --git a/Generals/Code/GameEngine/Include/GameClient/ShellMenuScheme.h b/Generals/Code/GameEngine/Include/GameClient/ShellMenuScheme.h deleted file mode 100644 index b5d17347b46..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/ShellMenuScheme.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ShellMenuScheme.h ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Jul 2002 -// -// Filename: ShellMenuScheme.h -// -// author: Chris Huybregts -// -// purpose: -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "GameClient/Color.h" - -//----------------------------------------------------------------------------- -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class Image; - -//----------------------------------------------------------------------------- -// TYPE DEFINES /////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class ShellMenuSchemeLine -{ -public: - ShellMenuSchemeLine(); - ~ShellMenuSchemeLine(); - - ICoord2D m_startPos; - ICoord2D m_endPos; - Int m_width; - Color m_color; - -}; - -class ShellMenuSchemeImage -{ -public: - ShellMenuSchemeImage(); - ~ShellMenuSchemeImage(); - - AsciiString m_name; ///< Name of the image - ICoord2D m_position; ///< the position we'll draw it at - ICoord2D m_size; ///< the size of the image needed when we draw it - Image *m_image; ///< the actual pointer to the mapped image -}; - -class ShellMenuScheme -{ -public: - ShellMenuScheme(); - ~ShellMenuScheme(); - - void draw(); - void addImage( ShellMenuSchemeImage* schemeImage ); - void addLine( ShellMenuSchemeLine* schemeLine ); - - - AsciiString m_name; - - typedef std::list< ShellMenuSchemeImage* > ShellMenuSchemeImageList; - typedef ShellMenuSchemeImageList::iterator ShellMenuSchemeImageListIt; - ShellMenuSchemeImageList m_imageList; - - typedef std::list< ShellMenuSchemeLine* > ShellMenuSchemeLineList; - typedef ShellMenuSchemeLineList::iterator ShellMenuSchemeLineListIt; - ShellMenuSchemeLineList m_lineList; - - - - -}; - -class ShellMenuSchemeManager -{ -public: - ShellMenuSchemeManager(); - ~ShellMenuSchemeManager(); - - void init(); - void update(); - - void setShellMenuScheme( AsciiString name ); - - void draw(); - - // parse Functions for the INI file - const FieldParse *getFieldParse() const { return m_shellMenuSchemeFieldParseTable; } ///< returns the parsing fields - static const FieldParse m_shellMenuSchemeFieldParseTable[]; ///< the parse table - static void parseImagePart( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the image part of the INI file - static void parseLinePart( INI* ini, void *instance, void *store, const void *userData ); ///< Parse the line part of the INI file - - ShellMenuScheme *newShellMenuScheme(AsciiString name); - -private: - typedef std::list< ShellMenuScheme* > ShellMenuSchemeList; ///< list of Shell Menu schemes - typedef ShellMenuSchemeList::iterator ShellMenuSchemeListIt; - ShellMenuSchemeList m_schemeList; - ShellMenuScheme *m_currentScheme; - -}; - - -//----------------------------------------------------------------------------- -// INLINING /////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// EXTERNALS ////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/WindowXlat.h b/Generals/Code/GameEngine/Include/GameClient/WindowXlat.h deleted file mode 100644 index 52d384c532f..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/WindowXlat.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: WindowXlat.h /////////////////////////////////////////////////////////// -// Author: Steven Johnson, Dec 2001 - -#pragma once - -#include "GameClient/InGameUI.h" - -//----------------------------------------------------------------------------- -class WindowTranslator : public GameMessageTranslator -{ -private: - // nothing -public: - WindowTranslator(); - virtual ~WindowTranslator() override; - virtual GameMessageDisposition translateGameMessage(const GameMessage *msg) override; -}; diff --git a/Generals/Code/GameEngine/Source/GameClient/Display.cpp b/Generals/Code/GameEngine/Source/GameClient/Display.cpp deleted file mode 100644 index 770900814e1..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/Display.cpp +++ /dev/null @@ -1,389 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Display.cpp ////////////////////////////////////////////////////////// -// The implementation of the Display class -// Author: Michael S. Booth, March 2001 - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/Display.h" -#include "GameClient/Mouse.h" -#include "GameClient/VideoPlayer.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/GameText.h" -#include "GameClient/GlobalLanguage.h" -//#include "GameLogic/ScriptEngine.h" -//#include "GameLogic/GameLogic.h" - -/// The Display singleton instance. -Display *TheDisplay = nullptr; - - -Display::Display() -{ - m_viewList = nullptr; - m_width = 0; - m_height = 0; - m_bitDepth = 0; - m_windowed = FALSE; - m_videoBuffer = nullptr; - m_videoStream = nullptr; - m_debugDisplayCallback = nullptr; - m_debugDisplayUserData = nullptr; - m_debugDisplay = nullptr; - m_letterBoxFadeLevel = 0; - m_letterBoxEnabled = FALSE; - m_cinematicText = AsciiString::TheEmptyString; - m_cinematicFont = nullptr; - m_cinematicTextFrames = 0; - m_movieHoldTime = -1; - m_copyrightHoldTime = -1; - m_elapsedMovieTime = 0; - m_elapsedCopywriteTime = 0; - m_copyrightDisplayString = nullptr; - - m_currentlyPlayingMovie.clear(); - m_letterBoxFadeStartTime = 0; -} - -/** - * Destructor for the Display. Destroy all views attached to it. - */ -Display::~Display() -{ - - stopMovie(); - // delete all our views if present - deleteViews(); - -} - -/** - * Delete all views in the Display - */ -void Display::deleteViews() -{ - View *v, *next; - - for( v = m_viewList; v; v = next ) - { - next = v->getNextView(); - delete v; - } - m_viewList = nullptr; -} - -/** - * Attach the given view to the world - * @todo Rethink the "attachView" notion... - */ -void Display::attachView( View *view ) -{ - // prepend to head of list - m_viewList = view->prependViewToList( m_viewList ); -} - -/** - * Render all views of the world - */ -void Display::drawViews() -{ - - for( View *v = m_viewList; v; v = v->getNextView() ) - v->drawView(); - -} - -/** - * Updates all views of the world. This forces state variables - to refresh without actually drawing anything. - */ -void Display::updateViews() -{ - - for( View *v = m_viewList; v; v = v->getNextView() ) - v->updateView(); - -} - -void Display::stepViews() -{ - - for( View *v = m_viewList; v; v = v->getNextView() ) - v->stepView(); - -} - -/// Redraw the entire display -void Display::draw() -{ - // redraw all views - drawViews(); - - // redraw the in-game user interface - /// @todo Switch between in-game and shell interfaces - -} - -/** Sets screen resolution/mode*/ -Bool Display::setDisplayMode( UnsignedInt xres, UnsignedInt yres, UnsignedInt bitdepth, Bool windowed ) -{ - //Get old values - UnsignedInt oldDisplayHeight=getHeight(); - UnsignedInt oldDisplayWidth=getWidth(); - Int oldViewWidth=TheTacticalView->getWidth(); - Int oldViewHeight=TheTacticalView->getHeight(); - Int oldViewOriginX,oldViewOriginY; - TheTacticalView->getOrigin(&oldViewOriginX,&oldViewOriginY); - - setWidth(xres); - setHeight(yres); - - //Adjust view to match previous proportions - TheTacticalView->setWidth((Real)oldViewWidth/(Real)oldDisplayWidth*(Real)xres); - TheTacticalView->setHeight((Real)oldViewHeight/(Real)oldDisplayHeight*(Real)yres); - TheTacticalView->setOrigin((Real)oldViewOriginX/(Real)oldDisplayWidth*(Real)xres, - (Real)oldViewOriginY/(Real)oldDisplayHeight*(Real)yres); - return TRUE; -} - -// Display::setWidth ========================================================== -/** Set the width of the display */ -//============================================================================= -void Display::setWidth( UnsignedInt width ) -{ - - // set the new width - m_width = width; - - // set the new mouse limits - if( TheMouse ) - TheMouse->setMouseLimits(); - -} - -// Display::setHeight ========================================================= -/** Set the height of the display */ -//============================================================================= -void Display::setHeight( UnsignedInt height ) -{ - - // se the new height - m_height = height; - - // set the new mouse limits - if( TheMouse ) - TheMouse->setMouseLimits(); - -} - -//============================================================================ -// Display::playLogoMovie -// minMovieLength is in milliseconds -// minCopyrightLength -//============================================================================ - -void Display::playLogoMovie( AsciiString movieName, Int minMovieLength, Int minCopyrightLength ) -{ - - stopMovie(); - - m_videoStream = TheVideoPlayer->open( movieName ); - - if ( m_videoStream == nullptr ) - { - return; - } - - m_currentlyPlayingMovie = movieName; - m_movieHoldTime = minMovieLength; - m_copyrightHoldTime = minCopyrightLength; - m_elapsedMovieTime = timeGetTime(); // we're using time get time because legal wants actual "Seconds" - - m_videoBuffer = createVideoBuffer(); - if ( m_videoBuffer == nullptr || - !m_videoBuffer->allocate( m_videoStream->width(), - m_videoStream->height()) - ) - { - stopMovie(); - return; - } - -} - -//============================================================================ -// Display::playMovie -//============================================================================ - -void Display::playMovie( AsciiString movieName) -{ - - stopMovie(); - - - - m_videoStream = TheVideoPlayer->open( movieName ); - - if ( m_videoStream == nullptr ) - { - return; - } - - m_currentlyPlayingMovie = movieName; - - m_videoBuffer = createVideoBuffer(); - if ( m_videoBuffer == nullptr || - !m_videoBuffer->allocate( m_videoStream->width(), - m_videoStream->height()) - ) - { - stopMovie(); - return; - } - -} - -//============================================================================ -// Display::stopMovie -//============================================================================ - -void Display::stopMovie() -{ - delete m_videoBuffer; - m_videoBuffer = nullptr; - - if ( m_videoStream ) - { - m_videoStream->close(); - m_videoStream = nullptr; - } - - if (!m_currentlyPlayingMovie.isEmpty()) { - //TheScriptEngine->notifyOfCompletedVideo(m_currentlyPlayingMovie); // Removing this sync-error cause MDC - m_currentlyPlayingMovie = AsciiString::TheEmptyString; - } - if(m_copyrightDisplayString) - { - TheDisplayStringManager->freeDisplayString(m_copyrightDisplayString); - m_copyrightDisplayString = nullptr; - } - m_copyrightHoldTime = -1; - m_movieHoldTime = -1; -} - -//============================================================================ -// Display::update -//============================================================================ - -void Display::update() -{ - if ( m_videoStream && m_videoBuffer ) - { - if ( m_videoStream->isFrameReady()) - { - m_videoStream->frameDecompress(); - m_videoStream->frameRender( m_videoBuffer ); - if( m_videoStream->frameIndex() != m_videoStream->frameCount() - 1) - m_videoStream->frameNext(); - else if( m_copyrightHoldTime >= 0 ||m_movieHoldTime >= 0 ) - { - if( m_elapsedCopywriteTime == 0 && m_elapsedCopywriteTime >= 0) - { - //display the copyrighttext; - deleteInstance(m_copyrightDisplayString); - m_copyrightDisplayString = TheDisplayStringManager->newDisplayString(); - m_copyrightDisplayString->setText(TheGameText->fetch("GUI:EACopyright")); - if (TheGlobalLanguageData && TheGlobalLanguageData->m_copyrightFont.name.isNotEmpty()) - { FontDesc *fontdesc=&TheGlobalLanguageData->m_copyrightFont; - m_copyrightDisplayString->setFont(TheFontLibrary->getFont(fontdesc->name, - TheGlobalLanguageData->adjustFontSize(fontdesc->size), - fontdesc->bold)); - } - else - m_copyrightDisplayString->setFont(TheFontLibrary->getFont("Courier", - TheGlobalLanguageData->adjustFontSize(12), TRUE)); - m_elapsedCopywriteTime = timeGetTime(); - } - if(m_movieHoldTime + m_elapsedMovieTime < timeGetTime() && - m_copyrightHoldTime + m_elapsedCopywriteTime < timeGetTime()) - { - m_movieHoldTime = -1; - m_elapsedMovieTime = 0; - m_elapsedCopywriteTime = 0; - m_copyrightHoldTime = -1; - } - } - else - { - stopMovie(); - } - } - } -} - -//============================================================================ -// Display::reset -//============================================================================ - -void Display::reset() -{ - //Remove letterbox border that may have been enabled by a script - m_letterBoxFadeLevel = 0; - m_letterBoxEnabled = FALSE; - stopMovie(); - - // Reset all views that need resetting - for( View *v = m_viewList; v; v = v->getNextView() ) - v->reset(); -} - -//============================================================================ -// Display::isMoviePlaying -//============================================================================ - -Bool Display::isMoviePlaying() -{ - return m_videoStream != nullptr && m_videoBuffer != nullptr; -} - -//============================================================================ -// Display::setDebugDisplayCallback -//============================================================================ - -void Display::setDebugDisplayCallback( DebugDisplayCallback *callback, void *userData ) -{ - m_debugDisplayCallback = callback; - m_debugDisplayUserData = userData; -} - -//============================================================================ -// Display::getDebugDisplayCallback -//============================================================================ - -Display::DebugDisplayCallback *Display::getDebugDisplayCallback() -{ - return m_debugDisplayCallback; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp deleted file mode 100644 index b62700720b8..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: AnimatedParticleSysBoneClientUpdate.cpp ////////////////////////////////////////////////////////////////// -// Author: Mark Lorenzen, October 2002 -// Desc: client update module to translate particle systems with animation -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/Drawable.h" -#include "GameClient/Module/AnimatedParticleSysBoneClientUpdate.h" -#include "Common/Player.h" -#include "Common/PlayerList.h" -#include "Common/ThingFactory.h" -#include "Common/ThingTemplate.h" -#include "Common/RandomValue.h" -#include "Common/DrawModule.h" -#include "Common/PerfTimer.h" -#include "Common/Xfer.h" -#include "GameLogic/Object.h" -#include "GameLogic/ScriptEngine.h" - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -AnimatedParticleSysBoneClientUpdate::AnimatedParticleSysBoneClientUpdate( Thing *thing, const ModuleData* moduleData ) : - ClientUpdateModule( thing, moduleData ) -{ - m_life = 0; - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -AnimatedParticleSysBoneClientUpdate::~AnimatedParticleSysBoneClientUpdate() -{ - -} - - -//------------------------------------------------------------------------------------------------- -/** The client update callback. */ -//------------------------------------------------------------------------------------------------- -void AnimatedParticleSysBoneClientUpdate::clientUpdate() -{ - //THIS IS HAPPENING CLIENT-SIDE - // I CAN DO WHAT I NEED HERE AND NOT HAVE TO BE LOGIC SYNC-SAFE - - - ++m_life; - - Drawable *draw = getDrawable(); - if (draw) - { - - for (DrawModule** dm = draw->getDrawModules(); *dm; ++dm) - { - ObjectDrawInterface* di = (*dm)->getObjectDrawInterface(); - if (di) - { - if (di->updateBonesForClientParticleSystems()) - break; - } - } - - - } - - -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void AnimatedParticleSysBoneClientUpdate::crc( Xfer *xfer ) -{ - - // extend base class - ClientUpdateModule::crc( xfer ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void AnimatedParticleSysBoneClientUpdate::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // extend base class - ClientUpdateModule::xfer( xfer ); - - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void AnimatedParticleSysBoneClientUpdate::loadPostProcess() -{ - - // extend base class - ClientUpdateModule::loadPostProcess(); - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp deleted file mode 100644 index 7bd52413864..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: BeaconClientUpdate.cpp ////////////////////////////////////////////////////////////////// -// Author: Matthew D. Campbell, August 2002 -// Desc: Beacon client update module -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/Drawable.h" -#include "GameClient/ParticleSys.h" -#include "GameClient/Module/BeaconClientUpdate.h" -#include "Common/Player.h" -#include "Common/PlayerList.h" -#include "Common/Radar.h" -#include "Common/Xfer.h" -#include "GameLogic/GameLogic.h" - -//------------------------------------------------------------------------------------------------- -BeaconClientUpdateModuleData::BeaconClientUpdateModuleData() : - m_framesBetweenRadarPulses(30), - m_radarPulseDuration(15) -{ -} - -//------------------------------------------------------------------------------------------------- -BeaconClientUpdateModuleData::~BeaconClientUpdateModuleData() -{ -} - -//------------------------------------------------------------------------------------------------- -void BeaconClientUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) -{ - ClientUpdateModuleData::buildFieldParse(p); - - static const FieldParse dataFieldParse[] = - { - { "RadarPulseFrequency", INI::parseDurationUnsignedInt, nullptr, offsetof(BeaconClientUpdateModuleData, m_framesBetweenRadarPulses) }, - { "RadarPulseDuration", INI::parseDurationUnsignedInt, nullptr, offsetof(BeaconClientUpdateModuleData, m_radarPulseDuration) }, - { nullptr, nullptr, nullptr, 0 } - }; - p.add(dataFieldParse); -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -BeaconClientUpdate::BeaconClientUpdate( Thing *thing, const ModuleData* moduleData ) : - ClientUpdateModule( thing, moduleData ), - m_particleSystemID(INVALID_PARTICLE_SYSTEM_ID), - m_lastRadarPulse(TheGameLogic->getFrame()) -{ -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -BeaconClientUpdate::~BeaconClientUpdate() -{ - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -static ParticleSystem* createParticleSystem( Drawable *draw ) -{ - ParticleSystem *system = nullptr; - if (draw) - { - Object *obj = draw->getObject(); - if (obj) - { - AsciiString templateName; - templateName.format("BeaconSmoke%6.6X", (0xffffff & obj->getIndicatorColor())); - const ParticleSystemTemplate *particleTemplate = TheParticleSystemManager->findTemplate( templateName ); - - DEBUG_ASSERTCRASH(particleTemplate, ("Could not find particle system %s", templateName.str())); - - if (particleTemplate) - { - system = TheParticleSystemManager->createParticleSystem( particleTemplate ); - if (system) - system->attachToDrawable( draw ); - } - else// This is a failsafe... if someone has monkeyed with the particle system names, or the MP house colors - {// THis this will whip up a new particle system to match the house color provided - templateName.format("BeaconSmokeFFFFFF"); - const ParticleSystemTemplate *failsafeTemplate = TheParticleSystemManager->findTemplate( templateName ); - DEBUG_ASSERTCRASH(failsafeTemplate, ("Doh, this is bad \n I Could not even find the white particle system to make a failsafe system out of.")); - if (failsafeTemplate) - { - system = TheParticleSystemManager->createParticleSystem( failsafeTemplate ); - if (system) - { - system->attachToDrawable( draw ); - system->tintAllColors( obj->getIndicatorColor() ); - } - } - } - } - } - return system; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void BeaconClientUpdate::hideBeacon() -{ - Drawable *draw = getDrawable(); - if (draw) - { - draw->setDrawableHidden( true ); - draw->setShadowsEnabled( false ); - } - - ParticleSystem *system; - if (draw && m_particleSystemID == INVALID_PARTICLE_SYSTEM_ID) - { - system = createParticleSystem( draw ); - if (system) - m_particleSystemID = system->getSystemID(); - } - - // clean up particle system - if (m_particleSystemID != INVALID_PARTICLE_SYSTEM_ID) - { - ParticleSystem *system = TheParticleSystemManager->findParticleSystem( m_particleSystemID ); - - if( system ) - system->stop(); - - } - -// DEBUG_LOG(("in hideBeacon(): draw=%d, m_particleSystemID=%d", draw, m_particleSystemID)); - -} - -//------------------------------------------------------------------------------------------------- -/** The client update callback. */ -//------------------------------------------------------------------------------------------------- -void BeaconClientUpdate::clientUpdate() -{ - Drawable *draw = getDrawable(); - if (!draw) - return; - - if (m_particleSystemID == INVALID_PARTICLE_SYSTEM_ID) - { - ParticleSystem *system = createParticleSystem( draw ); - if( system ) - m_particleSystemID = system->getSystemID(); - } - - if (!draw->isDrawableEffectivelyHidden()) - { - BeaconClientUpdateModuleData *moduleData = (BeaconClientUpdateModuleData *)getModuleData(); - if (TheGameLogic->getFrame() > m_lastRadarPulse + moduleData->m_framesBetweenRadarPulses) - { - TheRadar->createEvent( draw->getPosition(), RADAR_EVENT_BEACON_PULSE, moduleData->m_radarPulseDuration * SECONDS_PER_LOGICFRAME_REAL ); - m_lastRadarPulse = TheGameLogic->getFrame(); - } - } -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void BeaconClientUpdate::crc( Xfer *xfer ) -{ - - // extend base class - ClientUpdateModule::crc( xfer ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void BeaconClientUpdate::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // extend base class - ClientUpdateModule::xfer( xfer ); - - // particle system ID - xfer->xferUser( &m_particleSystemID, sizeof( ParticleSystemID ) ); - - // last radar pulse - xfer->xferUnsignedInt( &m_lastRadarPulse ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void BeaconClientUpdate::loadPostProcess() -{ - - // extend base class - ClientUpdateModule::loadPostProcess(); - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp deleted file mode 100644 index 11b449b635c..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: SwayClientUpdate.cpp ////////////////////////////////////////////////////////////////// -// Author: Matthew D. Campbell, May 2002 -// Desc: Tree sway client update module -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/Drawable.h" -#include "GameClient/Module/SwayClientUpdate.h" -#include "Common/FramePacer.h" -#include "Common/Player.h" -#include "Common/PlayerList.h" -#include "Common/ThingFactory.h" -#include "Common/ThingTemplate.h" -#include "Common/RandomValue.h" -#include "Common/PerfTimer.h" -#include "Common/Xfer.h" -#include "GameLogic/Object.h" -#include "GameLogic/ScriptEngine.h" -#include "GameLogic/GameLogic.h" - - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -SwayClientUpdate::SwayClientUpdate( Thing *thing, const ModuleData* moduleData ) : - ClientUpdateModule( thing, moduleData ), - m_curDelta(0), - m_curValue(0), - m_curAngle(0), - m_curAngleLimit(0), - m_leanAngle(0), - m_swaying(true), - m_unused(false), - m_curVersion(-1) // so that we never match the first time -{ - - // don't do updateSway here; wait till the first time we go thru our update loop. - //updateSway(); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -SwayClientUpdate::~SwayClientUpdate() -{ - -} - -//------------------------------------------------------------------------------------------------- -// Update the sway parameters. -//------------------------------------------------------------------------------------------------- -void SwayClientUpdate::updateSway() -{ - const BreezeInfo& info = TheScriptEngine->getBreezeInfo(); - if (info.m_randomness == 0.0f) - { - m_curValue = 0; - } - Real delta = info.m_randomness * 0.5f; - m_curAngleLimit = info.m_intensity * GameClientRandomValueReal(1.0f-delta, 1.0f+delta); - m_curDelta = 2*PI/info.m_breezePeriod * GameClientRandomValueReal(1.0f-delta, 1.0f+delta); - m_leanAngle = info.m_lean * GameClientRandomValueReal(1.0f-delta, 1.0f+delta); - m_curVersion = info.m_breezeVersion; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- - -//------------------------------------------------------------------------------------------------- -/** The client update callback. */ -//------------------------------------------------------------------------------------------------- -void SwayClientUpdate::clientUpdate() -{ - if( !m_swaying ) - return; - - Drawable *draw = getDrawable(); - - // if breeze changes, always process the full update, even if not visible, - // so that things offscreen won't 'pop' when first viewed - const BreezeInfo& info = TheScriptEngine->getBreezeInfo(); - if (info.m_breezeVersion != m_curVersion) - { - updateSway(); - } - else - { - // Otherwise, only update visible drawables - if (!draw || !draw->isVisible()) - return; - } - - // TheSuperHackers @tweak The tree sway time step is now decoupled from the render update. - const Real timeScale = TheFramePacer->getActualLogicTimeScaleOverFpsRatio(); - - m_curValue += m_curDelta * timeScale; - if (m_curValue > 2*PI) - m_curValue -= 2*PI; - Real cosine = Cos(m_curValue); - - Real targetAngle = cosine * m_curAngleLimit + m_leanAngle; - Real deltaAngle = targetAngle - m_curAngle; - - Matrix3D xfrm = *draw->getInstanceMatrix(); - xfrm.In_Place_Pre_Rotate_X(-deltaAngle * info.m_directionVec.x); - xfrm.In_Place_Pre_Rotate_Y(deltaAngle * info.m_directionVec.y); - draw->setInstanceMatrix(&xfrm); - - m_curAngle = targetAngle; - - // burned things don't sway. - Object* obj = draw->getObject(); - if( obj && obj->getStatusBits().test( OBJECT_STATUS_BURNED ) ) - stopSway(); - -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void SwayClientUpdate::crc( Xfer *xfer ) -{ - - // extend base class - ClientUpdateModule::crc( xfer ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void SwayClientUpdate::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // extend base class - ClientUpdateModule::xfer( xfer ); - - // cur value - xfer->xferReal( &m_curValue ); - - // cur angle - xfer->xferReal( &m_curAngle ); - - // cur delta - xfer->xferReal( &m_curDelta ); - - // cur angle limit - xfer->xferReal( &m_curAngleLimit ); - - // lean angle - xfer->xferReal( &m_leanAngle ); - - // cur version - xfer->xferShort( &m_curVersion ); - - // swaying - xfer->xferBool( &m_swaying ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void SwayClientUpdate::loadPostProcess() -{ - - // extend base class - ClientUpdateModule::loadPostProcess(); - - updateSway(); - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp deleted file mode 100644 index c2b73a16b11..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp +++ /dev/null @@ -1,422 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: AnimateWindowManager.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Mar 2002 -// -// Filename: AnimateWindowManager.cpp -// -// author: Chris Huybregts -// -// purpose: This will contain the logic behind the different animations that -// can happen to a window. -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/AnimateWindowManager.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Display.h" -#include "GameClient/ProcessAnimateWindow.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// AnimateWindow PUBLIC FUNCTIONS ///////////////////////////////////////////// -//----------------------------------------------------------------------------- -namespace wnd -{ -AnimateWindow::AnimateWindow() -{ - m_delay = 0; - m_startPos.x = m_startPos.y = 0; - m_endPos.x = m_endPos.y = 0; - m_curPos.x = m_curPos.y = 0; - m_win = nullptr; - m_animType = WIN_ANIMATION_NONE; - - m_restPos.x = m_restPos.y = 0; - m_vel.x = m_vel.y = 0.0f; - m_needsToFinish = FALSE; - m_isFinished = FALSE; - m_endTime = 0; - m_startTime = 0; -} -AnimateWindow::~AnimateWindow() -{ - m_win = nullptr; -} - -void AnimateWindow::setAnimData( ICoord2D startPos, ICoord2D endPos, - ICoord2D curPos, ICoord2D restPos, - Coord2D vel, UnsignedInt startTime, - UnsignedInt endTime ) - -{ - m_startPos = startPos; - m_endPos = endPos; - m_curPos = curPos; - m_restPos = restPos; - m_vel = vel; - m_startTime = startTime; - m_endTime = endTime; - -} - -} // namespace wnd - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -static void clearWinList(AnimateWindowList &winList) -{ - while (!winList.empty()) - { - wnd::AnimateWindow *win = *(winList.begin()); - winList.pop_front(); - deleteInstance(win); - } -} - -AnimateWindowManager::AnimateWindowManager() -{ -// we don't allocate many of these, so no MemoryPools used - m_slideFromRight = NEW ProcessAnimateWindowSlideFromRight; - m_slideFromRightFast = NEW ProcessAnimateWindowSlideFromRightFast; - m_slideFromLeft = NEW ProcessAnimateWindowSlideFromLeft; - m_slideFromTop = NEW ProcessAnimateWindowSlideFromTop; - m_slideFromTopFast = NEW ProcessAnimateWindowSlideFromTopFast; - m_slideFromBottom = NEW ProcessAnimateWindowSlideFromBottom; - m_spiral = NEW ProcessAnimateWindowSpiral; - m_slideFromBottomTimed = NEW ProcessAnimateWindowSlideFromBottomTimed; - m_winList.clear(); - m_needsUpdate = FALSE; - m_reverse = FALSE; - m_winMustFinishList.clear(); -} -AnimateWindowManager::~AnimateWindowManager() -{ - delete m_slideFromRight; - delete m_slideFromRightFast; - delete m_slideFromLeft; - delete m_slideFromTop; - delete m_slideFromTopFast; - delete m_slideFromBottom; - delete m_spiral; - delete m_slideFromBottomTimed; - - m_slideFromRight = nullptr; - resetToRestPosition(); - clearWinList(m_winList); - clearWinList(m_winMustFinishList); -} - - -void AnimateWindowManager::init() -{ - clearWinList(m_winList); - clearWinList(m_winMustFinishList); - m_needsUpdate = FALSE; - m_reverse = FALSE; -} - -void AnimateWindowManager::reset() -{ - resetToRestPosition(); - clearWinList(m_winList); - clearWinList(m_winMustFinishList); - m_needsUpdate = FALSE; - m_reverse = FALSE; -} - -void AnimateWindowManager::update() -{ - - ProcessAnimateWindow *processAnim = nullptr; - - // if we need to update the windows that need to finish, update that list - if(m_needsUpdate) - { - AnimateWindowList::iterator it = m_winMustFinishList.begin(); - m_needsUpdate = FALSE; - - while (it != m_winMustFinishList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - processAnim = getProcessAnimate( animWin->getAnimType() ); - if(processAnim) - { - if(m_reverse) - { - if(!processAnim->reverseAnimateWindow(animWin)) - m_needsUpdate = TRUE; - } - else - { - if(!processAnim->updateAnimateWindow(animWin)) - m_needsUpdate = TRUE; - } - } - - it ++; - } - } - - AnimateWindowList::iterator it = m_winList.begin(); - - while (it != m_winList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - processAnim = getProcessAnimate( animWin->getAnimType() ); - if(m_reverse) - { - if(processAnim) - processAnim->reverseAnimateWindow(animWin); - } - else - { - if(processAnim) - processAnim->updateAnimateWindow(animWin); - } - it ++; - } -} - - -void AnimateWindowManager::registerGameWindow(GameWindow *win, AnimTypes animType, Bool needsToFinish, UnsignedInt ms, UnsignedInt delayMs) -{ - if(!win) - { - DEBUG_CRASH(("Win was null as it was passed into registerGameWindow... not good indeed")); - return; - } - if(animType <= WIN_ANIMATION_NONE || animType >= WIN_ANIMATION_COUNT ) - { - DEBUG_CRASH(("an Invalid WIN_ANIMATION type was passed into registerGameWindow... please fix me ")); - return; - } - - // Create a new AnimateWindow class and fill in it's data. - wnd::AnimateWindow *animWin = wnd::AnimateWindow::createNewInstance(); - animWin->setGameWindow(win); - animWin->setAnimType(animType); - animWin->setNeedsToFinish(needsToFinish); - animWin->setDelay(delayMs); - - // Run the window through the processAnim's init function. - ProcessAnimateWindow *processAnim = getProcessAnimate( animType ); - if(processAnim) - { - processAnim->setMaxDuration(ms); - processAnim->initAnimateWindow( animWin ); - } - - // Add the Window to the proper list - if(needsToFinish) - { - m_winMustFinishList.push_back(animWin); - m_needsUpdate = TRUE; - } - else - m_winList.push_back(animWin); -} - -ProcessAnimateWindow *AnimateWindowManager::getProcessAnimate( AnimTypes animType ) -{ - switch (animType) { - case WIN_ANIMATION_SLIDE_RIGHT: - { - return m_slideFromRight; - } - case WIN_ANIMATION_SLIDE_RIGHT_FAST: - { - return m_slideFromRightFast; - } - case WIN_ANIMATION_SLIDE_LEFT: - { - return m_slideFromLeft; - } - case WIN_ANIMATION_SLIDE_TOP: - { - return m_slideFromTop; - } - case WIN_ANIMATION_SLIDE_BOTTOM: - { - return m_slideFromBottom; - } - case WIN_ANIMATION_SPIRAL: - { - return m_spiral; - } - case WIN_ANIMATION_SLIDE_BOTTOM_TIMED: - { - return m_slideFromBottomTimed; - } - case WIN_ANIMATION_SLIDE_TOP_FAST: - { - return m_slideFromTopFast; - } - default: - return nullptr; - } -} - -void AnimateWindowManager::reverseAnimateWindow() -{ - - m_reverse = TRUE; - m_needsUpdate = TRUE; - ProcessAnimateWindow *processAnim = nullptr; - - UnsignedInt maxDelay = 0; - AnimateWindowList::iterator it = m_winMustFinishList.begin(); - while (it != m_winMustFinishList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - if(animWin->getDelay() > maxDelay) - maxDelay = animWin->getDelay(); - it ++; - } - - it = m_winMustFinishList.begin(); - while (it != m_winMustFinishList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - // Run the window through the processAnim's init function. - processAnim = getProcessAnimate( animWin->getAnimType() ); - if(processAnim) - { - processAnim->initReverseAnimateWindow( animWin, maxDelay ); - } - - animWin->setFinished(FALSE); - it ++; - } - - it = m_winList.begin(); - - while (it != m_winList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - processAnim = getProcessAnimate( animWin->getAnimType() ); - - if(processAnim) - processAnim->initReverseAnimateWindow(animWin); - animWin->setFinished(FALSE); - it ++; - } - -} - -void AnimateWindowManager::resetToRestPosition() -{ - - m_reverse = TRUE; - m_needsUpdate = TRUE; - - AnimateWindowList::iterator it = m_winMustFinishList.begin(); - while (it != m_winMustFinishList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - ICoord2D restPos = animWin->getRestPos(); - GameWindow *win = animWin->getGameWindow(); - if(win) - win->winSetPosition(restPos.x, restPos.y); - it ++; - } - it = m_winList.begin(); - while (it != m_winList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - ICoord2D restPos = animWin->getRestPos(); - GameWindow *win = animWin->getGameWindow(); - if(win) - win->winSetPosition(restPos.x, restPos.y); - it ++; - } - - -} - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - - - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp deleted file mode 100644 index 1cdda2b5253..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ControlBarMultiSelect.cpp //////////////////////////////////////////////////////////////// -// Author: Colin Day, March 2002 -// Desc: Context sensitive GUI for when you select multiple objects. What we do is show -// the commands that you can use between them all -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/ThingTemplate.h" -#include "GameClient/ControlBar.h" -#include "GameClient/Drawable.h" -#include "GameClient/GameClient.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/GameWindow.h" -#include "GameClient/InGameUI.h" -#include "GameLogic/Object.h" - - - - -//------------------------------------------------------------------------------------------------- -/** Reset the common command data */ -//------------------------------------------------------------------------------------------------- -void ControlBar::resetCommonCommandData() -{ - Int i; - - for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - m_commonCommands[ i ] = nullptr; - //Clear out any remnant overlays. - GadgetButtonDrawOverlayImage( m_commandWindows[ i ], nullptr ); - } - -} - -//------------------------------------------------------------------------------------------------- -/** add the common commands of this drawable to the common command set */ -//------------------------------------------------------------------------------------------------- -void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) -{ - Int i; - const CommandButton *command; - - // sanity - if( draw == nullptr ) - return; - - Object* obj = draw->getObject(); - if (!obj) - return; - - if (obj->isKindOf(KINDOF_IGNORED_IN_GUI)) // ignore these guys - return; - - // get the command set of this drawable - const CommandSet *commandSet = findCommandSet( obj->getCommandSetString() ); - if( commandSet == nullptr ) - { - - // - // if there is no command set for this drawable, none of the selected drawables - // can possibly have matching commands so we'll get rid of them all - // - for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - - m_commonCommands[ i ] = nullptr; - if (m_commandWindows[ i ]) - { - m_commandWindows[ i ]->winHide( TRUE ); - } - // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images - // removed from multiplayer branch - //showCommandMarkers(); - - } - - return; - - } - - - // - // easy case, if we're adding the first drawable we simply just add any of the commands - // in its set that can be multi-select commands to the common command set - // - if( firstDrawable == TRUE ) - { - - // just add each command that is classified as a common command - for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - // our implementation doesn't necessarily make use of the max possible command buttons - if (! m_commandWindows[ i ]) continue; - - // get command - command = commandSet->getCommandButton(i); - - // add if present and can be used in a multi select - if( command && BitIsSet( command->getOptions(), OK_FOR_MULTI_SELECT ) == TRUE ) - { - - // put it in the common command set - m_commonCommands[ i ] = command; - - // show and enable this control - m_commandWindows[ i ]->winHide( FALSE ); - m_commandWindows[ i ]->winEnable( TRUE ); - - // set the command into the control - setControlCommand( m_commandWindows[ i ], command ); - - } - - } - - } - else - { - - // go through each command one by one - for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - - // our implementation doesn't necessarily make use of the max possible command buttons - if (! m_commandWindows[ i ]) continue; - - // get the command - command = commandSet->getCommandButton(i); - - Bool attackMove = (command && command->getCommandType() == GUI_COMMAND_ATTACK_MOVE) || - (m_commonCommands[ i ] && m_commonCommands[ i ]->getCommandType() == GUI_COMMAND_ATTACK_MOVE); - - // Kris: When any units have attack move, they all get it. This is to allow - // combat units to be selected with the odd dozer or pilot and still retain that ability. - if( attackMove && !m_commonCommands[ i ] ) - { - // put it in the common command set - m_commonCommands[ i ] = command; - - // show and enable this control - m_commandWindows[ i ]->winHide( FALSE ); - m_commandWindows[ i ]->winEnable( TRUE ); - - // set the command into the control - setControlCommand( m_commandWindows[ i ], command ); - } - else if( command != m_commonCommands[ i ] && !attackMove ) - { - // - // if this command does not match the command that is in the common command set then - // *neither* this command OR the command in the common command set are really common - // commands, so we will remove the one that has been stored in the common set - // - - // remove the common command - m_commonCommands[ i ] = nullptr; - - // - // hide the window control cause it should have been made visible from a command - // that was placed in this common 'slot' earlier - // - m_commandWindows[ i ]->winHide( TRUE ); - } - - } - - } - - // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images - // removed from multiplayer branch - //showCommandMarkers(); - -} - -//------------------------------------------------------------------------------------------------- -/** Populate the visible command bar with commands that are common to all the objects - * that are selected in the UI */ -//------------------------------------------------------------------------------------------------- -void ControlBar::populateMultiSelect() -{ - Drawable *draw; - Bool firstDrawable = TRUE; - Bool portraitSet = FALSE; - const Image *portrait = nullptr; - Object *portraitObj = nullptr; - - // first reset the common command data - resetCommonCommandData(); - - // by default, hide all the controls in the command section - for( Int i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - if (m_commandWindows[ i ]) - { - m_commandWindows[ i ]->winHide( TRUE ); - } - } - - // sanity - DEBUG_ASSERTCRASH( TheInGameUI->getSelectCount() > 1, - ("populateMultiSelect: Can't populate multiselect context cause there are only '%d' things selected", - TheInGameUI->getSelectCount()) ); - - // get the list of drawable IDs from the in game UI - const DrawableList *selectedDrawables = TheInGameUI->getAllSelectedDrawables(); - - // sanity - DEBUG_ASSERTCRASH( selectedDrawables->empty() == FALSE, ("populateMultiSelect: Drawable list is empty") ); - - // loop through all the selected drawables - for( DrawableListCIt it = selectedDrawables->begin(); - it != selectedDrawables->end(); ++it ) - { - - // get the drawable - draw = *it; - - - if (draw->getObject()->isKindOf(KINDOF_IGNORED_IN_GUI)) // ignore these guys - continue; - - - // - // add command for this drawable, note that we also sanity check to make sure the - // drawable has an object as all interesting drawables that we can select should - // actually have an object underneath it so that we can do interesting things with - // it ... otherwise we should have never selected it. - // NOTE that we're not considering objects that are currently in the process of - // being sold as those objects can't be issued anymore commands - // - if( draw && draw->getObject() && - !draw->getObject()->getStatusBits().test( OBJECT_STATUS_SOLD ) ) - { - - // add the common commands of this drawable to the common command set - addCommonCommands( draw, firstDrawable ); - - // not adding the first drawable anymore - firstDrawable = FALSE; - - // - // keep track of the portrait images, if all units selected have the same portrait - // we will display it in the right HUD, otherwise we won't - // - if( portraitSet == FALSE ) - { - - portrait = draw->getTemplate()->getSelectedPortraitImage(); - portraitObj = draw->getObject(); - portraitSet = TRUE; - - } - else if( draw->getTemplate()->getSelectedPortraitImage() != portrait ) - portrait = nullptr; - - } - - } - - // set the portrait image - setPortraitByObject( portraitObj ); - -} - -//------------------------------------------------------------------------------------------------- -/** Update logic for the multi select context sensitive GUI */ -//------------------------------------------------------------------------------------------------- -void ControlBar::updateContextMultiSelect() -{ - Drawable *draw; - Object *obj; - const CommandButton *command; - GameWindow *win; - Int objectsThatCanDoCommand[ MAX_COMMANDS_PER_SET ]; - Int i; - - // zero the array that counts how many objects can do each command - memset( objectsThatCanDoCommand, 0, sizeof( objectsThatCanDoCommand ) ); - - // sanity - DEBUG_ASSERTCRASH( TheInGameUI->getSelectCount() > 1, - ("updateContextMultiSelect: TheInGameUI only has '%d' things selected", - TheInGameUI->getSelectCount()) ); - - // get the list of drawable IDs from the in game UI - const DrawableList *selectedDrawables = TheInGameUI->getAllSelectedDrawables(); - - // sanity - DEBUG_ASSERTCRASH( selectedDrawables->empty() == FALSE, ("populateMultiSelect: Drawable list is empty") ); - - // loop through all the selected drawable IDs - for( DrawableListCIt it = selectedDrawables->begin(); - it != selectedDrawables->end(); ++it ) - { - - // get the drawable from the ID - draw = *it; - - if (draw->getObject()->isKindOf(KINDOF_IGNORED_IN_GUI)) // ignore these guys - continue; - - - // get the object - obj = draw->getObject(); - - // sanity - if( obj == nullptr ) - continue; - - // for each of the visible command windows make sure the object can execute the command - for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - - // get the control window - win = m_commandWindows[ i ]; - - // our implementation doesn't necessarily make use of the max possible command buttons - if (!win) continue; - - // don't consider hidden windows - if( win->winIsHidden() == TRUE ) - continue; - - // get the command - command = (const CommandButton *)GadgetButtonGetData(win); - if( command == nullptr ) - continue; - - // can we do the command - CommandAvailability availability = getCommandAvailability( command, obj, win ); - - win->winClearStatus( WIN_STATUS_NOT_READY ); - win->winClearStatus( WIN_STATUS_ALWAYS_COLOR ); - - // enable/disable the window control - switch( availability ) - { - case COMMAND_HIDDEN: - win->winHide( TRUE ); - break; - case COMMAND_RESTRICTED: - win->winEnable( FALSE ); - break; - case COMMAND_NOT_READY: - win->winEnable( FALSE ); - win->winSetStatus( WIN_STATUS_NOT_READY ); - break; - case COMMAND_CANT_AFFORD: - win->winEnable( FALSE ); - win->winSetStatus( WIN_STATUS_ALWAYS_COLOR ); - break; - default: - win->winEnable( TRUE ); - break; - } - - //If button is a CHECK_LIKE, then update it's status now. - if( BitIsSet( command->getOptions(), CHECK_LIKE ) ) - { - GadgetCheckLikeButtonSetVisualCheck( win, availability == COMMAND_ACTIVE ); - } - - if( availability == COMMAND_AVAILABLE || availability == COMMAND_ACTIVE ) - objectsThatCanDoCommand[ i ]++; - - } - - } - - // - // for each command, if any objects can do the command we enable the window, otherwise - // we disable it - // - for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - // our implementation doesn't necessarily make use of the max possible command buttons - if (! m_commandWindows[ i ]) continue; - - // don't consider hidden commands - if( m_commandWindows[ i ]->winIsHidden() == TRUE ) - continue; - - // don't consider slots that don't have commands - if( m_commonCommands[ i ] == nullptr ) - continue; - - // check the count of objects that can do the command and enable/disable the control, - if( objectsThatCanDoCommand[ i ] > 0 ) - m_commandWindows[ i ]->winEnable( TRUE ); - else - m_commandWindows[ i ]->winEnable( FALSE ); - - } - - // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images - // removed from multiplayer branch - //showCommandMarkers(); - - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp deleted file mode 100644 index 56d8f878315..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ControlBarObserver.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Aug 2002 -// -// Filename: ControlBarObserver.cpp -// -// author: Chris Huybregts -// -// purpose: All things related to the Observer Control bar, are in here. -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameUtility.h" -#include "Common/NameKeyGenerator.h" -#include "Common/PlayerList.h" -#include "Common/Player.h" -#include "Common/PlayerTemplate.h" -#include "Common/KindOf.h" -#include "Common/Recorder.h" -#include "GameClient/ControlBar.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GameText.h" -#include "GameNetwork/NetworkDefs.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -enum { MAX_BUTTONS = 8}; -static NameKeyType buttonPlayerID[MAX_BUTTONS] = { NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID }; -static NameKeyType staticTextPlayerID[MAX_BUTTONS] = { NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID }; -static GameWindow *ObserverPlayerInfoWindow = nullptr; -static GameWindow *ObserverPlayerListWindow = nullptr; - -static GameWindow *buttonPlayer[MAX_BUTTONS] = {0}; -static GameWindow *staticTextPlayer[MAX_BUTTONS] = {0}; - - -static NameKeyType buttonCancelID = NAMEKEY_INVALID; - -static GameWindow *winFlag = nullptr; -static GameWindow *winGeneralPortrait = nullptr; -// TheSuperHackers @tweak Allow idle worker selection for observers. -static GameWindow *buttonIdleWorker = nullptr; -static GameWindow *staticTextNumberOfUnits = nullptr; -static GameWindow *staticTextNumberOfBuildings = nullptr; -static GameWindow *staticTextNumberOfUnitsKilled = nullptr; -static GameWindow *staticTextNumberOfUnitsLost = nullptr; -static GameWindow *staticTextPlayerName = nullptr; - -static NameKeyType s_replayObserverNameKey = NAMEKEY_INVALID; - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - - -void ControlBar::initObserverControls() -{ - ObserverPlayerInfoWindow = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ObserverPlayerInfoWindow")); - ObserverPlayerListWindow = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ObserverPlayerListWindow")); - - for (Int i = 0; i < MAX_BUTTONS; i++) - { - AsciiString tmpString; - tmpString.format("ControlBar.wnd:ButtonPlayer%d", i); - buttonPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); - buttonPlayer[i] = TheWindowManager->winGetWindowFromId( ObserverPlayerListWindow, buttonPlayerID[i] ); - tmpString.format("ControlBar.wnd:StaticTextPlayer%d", i); - staticTextPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); - staticTextPlayer[i] = TheWindowManager->winGetWindowFromId( ObserverPlayerListWindow, staticTextPlayerID[i] ); - } - - staticTextNumberOfUnits = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnits")); - staticTextNumberOfBuildings = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfBuildings")); - staticTextNumberOfUnitsKilled = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnitsKilled")); - staticTextNumberOfUnitsLost = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnitsLost")); - staticTextPlayerName = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextPlayerName")); - winFlag = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinFlag")); - winGeneralPortrait = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinGeneralPortrait")); - buttonIdleWorker = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); - - buttonCancelID = TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonCancel"); - - s_replayObserverNameKey = TheNameKeyGenerator->nameToKey("ReplayObserver"); -} - -//------------------------------------------------------------------------------------------------- -void ControlBar::setObserverLookAtPlayer(Player *player) -{ - if (player != nullptr && player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) - { - // Looking at the observer. Treat as not looking at player. - m_observerLookAtPlayer = nullptr; - } - else - { - m_observerLookAtPlayer = player; - } -} - -//------------------------------------------------------------------------------------------------- -void ControlBar::setObservedPlayer(Player *player) -{ - if (player != nullptr && player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) - { - // Looking at the observer. Treat as not observing player. - m_observedPlayer = nullptr; - } - else - { - m_observedPlayer = player; - } -} - -//------------------------------------------------------------------------------------------------- -/** System callback for the ControlBarObserverSystem */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - static NameKeyType buttonCommunicator = NAMEKEY_INVALID; - - switch( msg ) - { - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_MOUSE_ENTERING: - case GBM_MOUSE_LEAVING: - { - break; - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - case GBM_SELECTED_RIGHT: - { - GameWindow *control = (GameWindow *)mData1; - - Int controlID = control->winGetWindowId(); - if( controlID == buttonCancelID) - { - rts::changeObservedPlayer(nullptr); - - ObserverPlayerInfoWindow->winHide(TRUE); - ObserverPlayerListWindow->winHide(FALSE); - buttonIdleWorker->winHide(TRUE); - TheControlBar->populateObserverList(); - } - - for(Int i = 0; i (GadgetButtonGetData(buttonPlayer[i])); - rts::changeObservedPlayer(player); - - ObserverPlayerInfoWindow->winHide(FALSE); - ObserverPlayerListWindow->winHide(TRUE); - - if(TheControlBar->getObserverLookAtPlayer()) - TheControlBar->populateObserverInfoWindow(); - - return MSG_HANDLED; - } - } - - // if( controlID == buttonCommunicator && TheGameLogic->getGameMode() == GAME_INTERNET ) - /* - { - popupCommunicatorLayout = TheWindowManager->winCreateLayout( "Menus/PopupCommunicator.wnd" ); - popupCommunicatorLayout->runInit(); - popupCommunicatorLayout->hide( FALSE ); - popupCommunicatorLayout->bringForward(); - } -*/ - - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -void ControlBar::populateObserverList() -{ - Int currentButton = 0, i; - if(TheRecorder->isMultiplayer()) - { - - for (i = 0; i < MAX_SLOTS; ++i) - { - AsciiString name; - name.format("player%d", i); - Player *p = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(name)); - if(p) - { - if(p->isPlayerObserver()) - continue; - DEBUG_ASSERTCRASH(currentButton < MAX_BUTTONS, ("ControlBar::populateObserverList trying to populate more buttons then we have")); - GadgetButtonSetData(buttonPlayer[currentButton], (void *)p); - GadgetButtonSetEnabledImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getEnabledImage() ); - //GadgetButtonSetHiliteImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getHiliteImage() ); - //GadgetButtonSetHiliteSelectedImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getPushedImage() ); - //GadgetButtonSetDisabledImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getDisabledImage() ); - buttonPlayer[currentButton]->winSetTooltip(p->getPlayerDisplayName()); - buttonPlayer[currentButton]->winHide(FALSE); - buttonPlayer[currentButton]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES ); - - const GameSlot *slot = TheGameInfo->getConstSlot(i); - Color playerColor = p->getPlayerColor(); - Color backColor = GameMakeColor(0, 0, 0, 255); - staticTextPlayer[currentButton]->winSetEnabledTextColors( playerColor, backColor ); - staticTextPlayer[currentButton]->winHide(FALSE); - AsciiString teamStr; - teamStr.format("Team:%d", slot->getTeamNumber() + 1); - if (slot->isAI() && slot->getTeamNumber() == -1) - teamStr = "Team:AI"; - - UnicodeString text; - text.format(TheGameText->fetch("CONTROLBAR:ObsPlayerLabel"), p->getPlayerDisplayName().str(), - TheGameText->fetch(teamStr).str()); - - GadgetStaticTextSetText(staticTextPlayer[currentButton], text ); - - ++currentButton; - } - } - for(currentButton; currentButtonwinHide(TRUE); - staticTextPlayer[currentButton]->winHide(TRUE); - } - } - else - { - for(i =0; i < MAX_PLAYER_COUNT; ++i) - { - Player *p = ThePlayerList->getNthPlayer(i); - if(p && !p->isPlayerObserver() && p->getPlayerType() == PLAYER_HUMAN) - { - DEBUG_ASSERTCRASH(currentButton < MAX_BUTTONS, ("ControlBar::populateObserverList trying to populate more buttons then we have")); - GadgetButtonSetData(buttonPlayer[currentButton], (void *)p); - GadgetButtonSetEnabledImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getEnabledImage() ); - //GadgetButtonSetHiliteImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getHiliteImage() ); - //GadgetButtonSetHiliteSelectedImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getPushedImage() ); - //GadgetButtonSetDisabledImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getDisabledImage() ); - buttonPlayer[currentButton]->winSetTooltip(p->getPlayerDisplayName()); - buttonPlayer[currentButton]->winHide(FALSE); - buttonPlayer[currentButton]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES ); - - Color playerColor = p->getPlayerColor(); - Color backColor = GameMakeColor(0, 0, 0, 255); - staticTextPlayer[currentButton]->winSetEnabledTextColors( playerColor, backColor ); - staticTextPlayer[currentButton]->winHide(FALSE); - GadgetStaticTextSetText(staticTextPlayer[currentButton], p->getPlayerDisplayName()); - - ++currentButton; - break; - } - } - for(currentButton; currentButtonwinHide(TRUE); - staticTextPlayer[currentButton]->winHide(TRUE); - } - } -} - -void ControlBar::populateObserverInfoWindow () -{ - if(ObserverPlayerInfoWindow->winIsHidden()) - return; - - if( !m_observerLookAtPlayer ) - { - ObserverPlayerInfoWindow->winHide(TRUE); - ObserverPlayerListWindow->winHide(FALSE); - buttonIdleWorker->winHide(TRUE); - populateObserverList(); - return; - } - - UnicodeString uString; - KindOfMaskType mask,clearmask; - mask.set(KINDOF_SCORE); - clearmask.set(KINDOF_STRUCTURE); - - uString.format(L"%d",m_observerLookAtPlayer->countObjects(mask,clearmask)); - GadgetStaticTextSetText(staticTextNumberOfUnits, uString); - - Int numBuildings = 0; - mask.clear(); - mask.set(KINDOF_SCORE); - mask.set(KINDOF_STRUCTURE); - clearmask.clear(); - numBuildings = m_observerLookAtPlayer->countObjects(mask,clearmask); - mask.clear(); - mask.set(KINDOF_SCORE_CREATE); - mask.set(KINDOF_STRUCTURE); - numBuildings += m_observerLookAtPlayer->countObjects(mask,clearmask); - mask.clear(); - mask.set(KINDOF_SCORE_DESTROY); - mask.set(KINDOF_STRUCTURE); - numBuildings += m_observerLookAtPlayer->countObjects(mask,clearmask); - uString.format(L"%d",numBuildings); - GadgetStaticTextSetText(staticTextNumberOfBuildings, uString); - uString.format(L"%d",m_observerLookAtPlayer->getScoreKeeper()->getTotalUnitsDestroyed()); - GadgetStaticTextSetText(staticTextNumberOfUnitsKilled, uString); - uString.format(L"%d",m_observerLookAtPlayer->getScoreKeeper()->getTotalUnitsLost()); - GadgetStaticTextSetText(staticTextNumberOfUnitsLost, uString); - GadgetStaticTextSetText(staticTextPlayerName, m_observerLookAtPlayer->getPlayerDisplayName()); - Color color = m_observerLookAtPlayer->getPlayerColor(); - staticTextPlayerName->winSetEnabledTextColors(color, GameMakeColor(0,0,0,255)); - winFlag->winSetEnabledImage(0, m_observerLookAtPlayer->getPlayerTemplate()->getFlagWaterMarkImage()); - winGeneralPortrait->winHide(FALSE); - buttonIdleWorker->winHide(FALSE); -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp deleted file mode 100644 index 197205b5f47..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ControlBarPrintPositions.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Sep 2002 -// -// Filename: ControlBarPrintPositions.cpp -// -// author: Chris Huybregts -// -// purpose: Convenience function for degayifying the whole squished control bar -// process -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "GameClient/GameWindowManager.h" -#include "GameClient/WindowLayout.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -void PrintInfoRecursive( GameWindow *win, FILE *fp) -{ - if(!win) - return; - ICoord2D pos, size; - win->winGetSize(&size.x, &size.y); - win->winGetPosition(&pos.x, &pos.y); - fprintf(fp, "ControlBarResizer %s\n",win->winGetInstanceData()->m_decoratedNameString.str()); - fprintf(fp, " AltPosition = X:%d Y:%d\n",pos.x, pos.y); - fprintf(fp, " AltSize = X:%d Y:%d\n",size.x, size.y); - fprintf(fp, "END\n\n"); - - PrintInfoRecursive(win->winGetChild(),fp); - PrintInfoRecursive(win->winGetNext(),fp); - -} - -void PrintOffsetsFromControlBarParent() -{ - GameWindow *controlBarParent = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" )); - if(!controlBarParent) - return; - - WindowLayout *layout = TheWindowManager->winCreateLayout("controlBarHidden.wnd"); - if(!layout) - return; - FILE *fp = fopen("ControlBarEasier.txt", "w"); - if(!fp) - return; - - PrintInfoRecursive(layout->getFirstWindow(), fp); - - fclose(fp); - layout->destroyWindows(); - deleteInstance(layout); -} - - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp deleted file mode 100644 index f639cd61517..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ControlBarResizer.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Sep 2002 -// -// Filename: ControlBarResizer.cpp -// -// author: Chris Huybregts -// -// purpose: We want a "squished" control bar, this is the methods that will do it -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "GameClient/ControlBar.h" -#include "GameClient/ControlBarResizer.h" -#include "GameClient/GameWindow.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Display.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -const FieldParse ControlBarResizer::m_controlBarResizerParseTable[] = -{ - { "AltPosition", INI::parseICoord2D, nullptr, offsetof( ResizerWindow, m_altPos ) }, - { "AltSize", INI::parseICoord2D, nullptr, offsetof( ResizerWindow, m_altSize ) }, - { nullptr, nullptr, nullptr, 0 } - -}; -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -ResizerWindow::ResizerWindow() -{ - m_defaultPos.x = m_defaultPos.y = 0; - m_defaultSize.x = m_defaultSize.y = 0; - m_altSize.x = m_altSize.y = 0; - m_altPos.x = m_altPos.y = 0; -} - -ControlBarResizer::ControlBarResizer() -{ - -} -ControlBarResizer::~ControlBarResizer() -{ - ResizerWindowList::iterator it = m_resizerWindowsList.begin(); - while (it != m_resizerWindowsList.end()) - { - ResizerWindow *rWin = *it; - if( !rWin ) - { - it = m_resizerWindowsList.erase(it); - continue; - } - delete rWin; - it = m_resizerWindowsList.erase(it); - } - m_resizerWindowsList.clear(); -} - -void ControlBarResizer::init() -{ - INI ini; - // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\ControlBarResizer", INI_LOAD_OVERWRITE, nullptr ); - -} - - -ResizerWindow *ControlBarResizer::findResizerWindow( AsciiString name ) -{ - ResizerWindowList::iterator it = m_resizerWindowsList.begin(); - - while (it != m_resizerWindowsList.end()) - { - ResizerWindow *rWin = *it; - if( !rWin ) - { - DEBUG_CRASH(("There's no resizerWindow in ControlBarResizer::findResizerWindow")); - it++; - continue; - } - // find the scheme that best matches our resolution - if(rWin->m_name.compare(name) == 0) - { - return rWin; - } - it ++; - } - return nullptr; -} - -ResizerWindow *ControlBarResizer::newResizerWindow( AsciiString name ) -{ - ResizerWindow *newRwin = NEW ResizerWindow; - if(!newRwin) - return nullptr; - - newRwin->m_name = name; - GameWindow *win = nullptr; - win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(name)); - if( !win ) - { - DEBUG_ASSERTCRASH(win,("ControlBarResizer::newResizerWindow could not find window %s Are you sure that window is loaded yet?", name.str()) ); - delete newRwin; - return nullptr; - } - win->winGetPosition(&newRwin->m_defaultPos.x,&newRwin->m_defaultPos.y); - win->winGetSize(&newRwin->m_defaultSize.x,&newRwin->m_defaultSize.y); - m_resizerWindowsList.push_back(newRwin); - return newRwin; -} -void ControlBarResizer::sizeWindowsDefault() -{ - ResizerWindowList::iterator it = m_resizerWindowsList.begin(); - GameWindow *win = nullptr; - while (it != m_resizerWindowsList.end()) - { - ResizerWindow *rWin = *it; - if( !rWin ) - { - DEBUG_CRASH(("There's no resizerWindow in ControlBarResizer::sizeWindowsDefault")); - it++; - continue; - } - win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(rWin->m_name)); - if(!win) - { - it++; - continue; - } - win->winSetPosition(rWin->m_defaultPos.x, rWin->m_defaultPos.y); - win->winSetSize(rWin->m_defaultSize.x, rWin->m_defaultSize.y); - DEBUG_LOG(("sizeWindowsDefault:%s pos X:%d pos Y: %d size X:%d sizeY: %d",rWin->m_name.str(),rWin->m_defaultPos.x, rWin->m_defaultPos.y,rWin->m_defaultSize.x, rWin->m_defaultSize.y )); - it ++; - } -} -void ControlBarResizer::sizeWindowsAlt() -{ - ResizerWindowList::iterator it = m_resizerWindowsList.begin(); - GameWindow *win = nullptr; - Real x = (Real)TheDisplay->getWidth() / DEFAULT_DISPLAY_WIDTH; - Real y = (Real)TheDisplay->getHeight() / DEFAULT_DISPLAY_HEIGHT; - while (it != m_resizerWindowsList.end()) - { - ResizerWindow *rWin = *it; - if( !rWin ) - { - DEBUG_CRASH(("There's no resizerWindow in ControlBarResizer::sizeWindowsDefault")); - it++; - continue; - } - win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(rWin->m_name)); - if(!win) - { - it++; - continue; - } - - win->winSetPosition(rWin->m_altPos.x * x, rWin->m_altPos.y * y); - if(rWin->m_altSize.x >0 || rWin->m_altSize.y > 0) - win->winSetSize(rWin->m_altSize.x *x, rWin->m_altSize.y *y); - DEBUG_LOG(("sizeWindowsAlt:%s pos X:%d pos Y: %d size X:%d sizeY: %d",rWin->m_name.str(), rWin->m_altPos.x*x, rWin->m_altPos.y*y,rWin->m_altSize.x*x, rWin->m_altSize.y *y)); - it ++; - } -} - - -void INI::parseControlBarResizerDefinition( INI* ini ) -{ -// AsciiString name; -// ResizerWindow *rWin = nullptr; -// -// // read the name -// const char* c = ini->getNextToken(); -// name.set( c ); -// -//// ControlBarResizer *resizer = TheControlBar->getControlBarResizer(); -// if( !resizer ) -// { -// //We don't need it if we're in the builder... which doesn't have this. -// return; -// } -// rWin = resizer->findResizerWindow( name ); -// if( rWin == nullptr ) -// { -// -// // image not found, create a new one -// rWin = resizer->newResizerWindow(name); -// DEBUG_ASSERTCRASH( rWin, ("parseControlBarResizerDefinition: unable to allocate ResizerWindow for '%s'", -// name.str()) ); -// -// } // end if -// -// // parse the ini definition -// ini->initFromINI( rWin, resizer->getFieldParse()); -// -} - - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp deleted file mode 100644 index 5bbe5fe01ec..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ControlBarUnderConstruction.cpp ////////////////////////////////////////////////////////// -// Author: Colin Day, March 2002 -// Desc: Methods specific to the control bar under construction context -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/NameKeyGenerator.h" -#include "Common/ThingTemplate.h" - -#include "GameLogic/Object.h" -#include "GameLogic/Module/UpdateModule.h" - -#include "GameClient/Drawable.h" -#include "GameClient/GameText.h" -#include "GameClient/ControlBar.h" -#include "GameClient/GameWindow.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetStaticText.h" - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void ControlBar::updateConstructionTextDisplay( Object *obj ) -{ - UnicodeString text; - static UnsignedInt descID = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:UnderConstructionDesc" ); - GameWindow *descWindow = TheWindowManager->winGetWindowFromId( nullptr, descID ); - - // sanity - DEBUG_ASSERTCRASH( descWindow, ("Under construction window not found") ); - - // format the message - text.format( TheGameText->fetch( "CONTROLBAR:UnderConstructionDesc" ), - obj->getConstructionPercent() ); - GadgetStaticTextSetText( descWindow, text ); - - // record this as the last percentage displayed - m_displayedConstructPercent = obj->getConstructionPercent(); - -} - -//------------------------------------------------------------------------------------------------- -/** Populate the interface for an under construction context. */ -//------------------------------------------------------------------------------------------------- -void ControlBar::populateUnderConstruction( Object *objectUnderConstruction ) -{ - - // sanity - if( objectUnderConstruction == nullptr ) - return; - - // get our parent window - GameWindow *parent = m_contextParent[ CP_UNDER_CONSTRUCTION ]; - - // set the cancel construction button -/// @todo srj -- remove hard-coding here, please - const CommandButton *commandButton = findCommandButton( "Command_CancelConstruction" ); - NameKeyType id; - id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonCancelConstruction" ); - GameWindow *win = TheWindowManager->winGetWindowFromId( parent, id ); - - setControlCommand( win, commandButton ); - win->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES ); - - // set the text description of what is building - updateConstructionTextDisplay( objectUnderConstruction ); - - // set the portrait for the thing being constructed - setPortraitByObject( objectUnderConstruction ); - - // and show the rally point, if it should have one, - ExitInterface *exit = objectUnderConstruction->getObjectExitInterface(); - if( exit ) - showRallyPoint( exit->getRallyPoint() ); - - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void ControlBar::updateContextUnderConstruction() -{ - Object *obj = m_currentSelectedDrawable->getObject(); - - // if the object is no longer under construction switch to a new appropriate context - if( !obj->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) - { - - evaluateContextUI(); - return; - - } - - // if the construction percent has changed since what was last shown to the user update the text - if( m_displayedConstructPercent != obj->getConstructionPercent() ) - updateConstructionTextDisplay( obj ); - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp deleted file mode 100644 index ddafc23e33e..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//// EstablishConnectionsMenu.cpp ///////////////////////////////////// - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/GUICallbacks.h" -#include "GameClient/EstablishConnectionsMenu.h" -#include "Common/NameKeyGenerator.h" -#include "GameClient/GameWindow.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GameText.h" - -EstablishConnectionsMenu *TheEstablishConnectionsMenu = nullptr; - -const char *const EstablishConnectionsMenu::m_playerReadyControlNames[] = { - "EstablishConnectionsScreen.wnd:ButtonAccept1", - "EstablishConnectionsScreen.wnd:ButtonAccept2", - "EstablishConnectionsScreen.wnd:ButtonAccept3", - "EstablishConnectionsScreen.wnd:ButtonAccept4", - "EstablishConnectionsScreen.wnd:ButtonAccept5", - "EstablishConnectionsScreen.wnd:ButtonAccept6", - "EstablishConnectionsScreen.wnd:ButtonAccept7", - nullptr}; - -const char *const EstablishConnectionsMenu::m_playerNameControlNames[] = { - "EstablishConnectionsScreen.wnd:StaticPlayer1Name", - "EstablishConnectionsScreen.wnd:StaticPlayer2Name", - "EstablishConnectionsScreen.wnd:StaticPlayer3Name", - "EstablishConnectionsScreen.wnd:StaticPlayer4Name", - "EstablishConnectionsScreen.wnd:StaticPlayer5Name", - "EstablishConnectionsScreen.wnd:StaticPlayer6Name", - "EstablishConnectionsScreen.wnd:StaticPlayer7Name", - nullptr -}; - -const char *const EstablishConnectionsMenu::m_playerStatusControlNames[] = { - "EstablishConnectionsScreen.wnd:StaticPlayer1Status", - "EstablishConnectionsScreen.wnd:StaticPlayer2Status", - "EstablishConnectionsScreen.wnd:StaticPlayer3Status", - "EstablishConnectionsScreen.wnd:StaticPlayer4Status", - "EstablishConnectionsScreen.wnd:StaticPlayer5Status", - "EstablishConnectionsScreen.wnd:StaticPlayer6Status", - "EstablishConnectionsScreen.wnd:StaticPlayer7Status", - nullptr -}; - -/** - Constructor - */ -EstablishConnectionsMenu::EstablishConnectionsMenu() { -} - -/** - Destructor - */ -EstablishConnectionsMenu::~EstablishConnectionsMenu() { -} - -/** - Initialize the menu - */ -void EstablishConnectionsMenu::initMenu() { - ShowEstablishConnectionsWindow(); -} - -/** - Close down the menu - */ -void EstablishConnectionsMenu::endMenu() { - HideEstablishConnectionsWindow(); -} - -/** - Abort the game gracefully...ok, as gracefully as possible considering - the game was supposed to be started and now for some reason we have to - stop it. Its really sad that this game isn't going to be played - considering how difficult it is to even get a game going in the first - place, especially one with more than two players. - */ -void EstablishConnectionsMenu::abortGame() { -} - -// the slot number passed in is the index we are to use for the menu. -void EstablishConnectionsMenu::setPlayerName(Int slot, UnicodeString name) { - NameKeyType controlID = TheNameKeyGenerator->nameToKey(m_playerNameControlNames[slot]); - GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, controlID); - - if (control == nullptr) { - DEBUG_ASSERTCRASH(control != nullptr, ("player name control for slot %d is null", slot)); - return; - } - GadgetStaticTextSetText(control, name); -} - -void EstablishConnectionsMenu::setPlayerStatus(Int slot, NATConnectionState state) { - NameKeyType controlID = TheNameKeyGenerator->nameToKey(m_playerStatusControlNames[slot]); - GameWindow *control = TheWindowManager->winGetWindowFromId(nullptr, controlID); - - if (control == nullptr) { - DEBUG_ASSERTCRASH(control != nullptr, ("player status control for slot %d is null", slot)); - return; - } -// if (state == NATCONNECTIONSTATE_NETGEARDELAY) { -// GadgetStaticTextSetText(control, TheGameText->fetch("GUI:NetgearDelay")); - if (state == NATCONNECTIONSTATE_WAITINGFORMANGLERRESPONSE) { - GadgetStaticTextSetText(control, TheGameText->fetch("GUI:WaitingForManglerResponse")); - } else if (state == NATCONNECTIONSTATE_WAITINGFORMANGLEDPORT) { - GadgetStaticTextSetText(control, TheGameText->fetch("GUI:WaitingForMangledPort")); - } else if (state == NATCONNECTIONSTATE_WAITINGFORRESPONSE) { - GadgetStaticTextSetText(control, TheGameText->fetch("GUI:WaitingForResponse")); - } else if (state == NATCONNECTIONSTATE_DONE) { - GadgetStaticTextSetText(control, TheGameText->fetch("GUI:ConnectionDone")); - } else if (state == NATCONNECTIONSTATE_FAILED) { - GadgetStaticTextSetText(control, TheGameText->fetch("GUI:ConnectionFailed")); - } else if (state == NATCONNECTIONSTATE_WAITINGTOBEGIN) { - GadgetStaticTextSetText(control, TheGameText->fetch("GUI:WaitingToBeginConnection")); - } else { - GadgetStaticTextSetText(control, TheGameText->fetch("GUI:UnknownConnectionState")); - } -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp deleted file mode 100644 index 2dbfe6c95ca..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp +++ /dev/null @@ -1,597 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Diplomacy.cpp /////////////////////////////////////////////////////////////////////// -// Author: Matthew D. Campbell - August 2002 -// Desc: GUI callbacks for the diplomacy menu -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GlobalData.h" -#include "Common/MultiplayerSettings.h" -#include "Common/Player.h" -#include "Common/PlayerList.h" -#include "Common/PlayerTemplate.h" -#include "Common/Recorder.h" -#include "GameClient/AnimateWindowManager.h" -#include "GameClient/Diplomacy.h" -#include "GameClient/DisconnectMenu.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GadgetCheckBox.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GadgetRadioButton.h" -#include "GameClient/GameClient.h" -#include "GameClient/GameText.h" -#include "GameClient/GUICallbacks.h" -#include "GameClient/InGameUI.h" -#include "GameLogic/GameLogic.h" -#include "GameLogic/VictoryConditions.h" -#include "GameNetwork/GameInfo.h" -#include "GameNetwork/NetworkInterface.h" -#include "GameNetwork/GameSpy/BuddyDefs.h" -#include "GameNetwork/GameSpy/PeerDefs.h" - - -//------------------------------------------------------------------------------------------------- - -static NameKeyType staticTextPlayerID[MAX_SLOTS]; -static NameKeyType staticTextSideID[MAX_SLOTS]; -static NameKeyType staticTextTeamID[MAX_SLOTS]; -static NameKeyType staticTextStatusID[MAX_SLOTS]; -static NameKeyType buttonMuteID[MAX_SLOTS]; -static NameKeyType buttonUnMuteID[MAX_SLOTS]; -static NameKeyType radioButtonInGameID = NAMEKEY_INVALID; -static NameKeyType radioButtonBuddiesID = NAMEKEY_INVALID; -static GameWindow *radioButtonInGame = nullptr; -static GameWindow *radioButtonBuddies = nullptr; -static NameKeyType winInGameID = NAMEKEY_INVALID; -static NameKeyType winBuddiesID = NAMEKEY_INVALID; -static NameKeyType winSoloID = NAMEKEY_INVALID; -static GameWindow *winInGame = nullptr; -static GameWindow *winBuddies = nullptr; -static GameWindow *winSolo = nullptr; -static GameWindow *staticTextPlayer[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; -static GameWindow *staticTextSide[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; -static GameWindow *staticTextTeam[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; -static GameWindow *staticTextStatus[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; -static GameWindow *buttonMute[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; -static GameWindow *buttonUnMute[MAX_SLOTS] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; -static Int slotNumInRow[MAX_SLOTS]; - -//------------------------------------------------------------------------------------------------- - -static WindowLayout *theLayout = nullptr; -static GameWindow *theWindow = nullptr; -static AnimateWindowManager *theAnimateWindowManager = nullptr; -WindowMsgHandledType BuddyControlSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2); -void InitBuddyControls(Int type); -void updateBuddyInfo(); -static void grabWindowPointers() -{ - for (Int i=0; iwinGetWindowFromId(theWindow, staticTextPlayerID[i]); - staticTextSide[i] = TheWindowManager->winGetWindowFromId(theWindow, staticTextSideID[i]); - staticTextTeam[i] = TheWindowManager->winGetWindowFromId(theWindow, staticTextTeamID[i]); - staticTextStatus[i] = TheWindowManager->winGetWindowFromId(theWindow, staticTextStatusID[i]); - buttonMute[i] = TheWindowManager->winGetWindowFromId(theWindow, buttonMuteID[i]); - buttonUnMute[i] = TheWindowManager->winGetWindowFromId(theWindow, buttonUnMuteID[i]); - - slotNumInRow[i] = -1; - } -} - -static void releaseWindowPointers() -{ - for (Int i=0; im_animateWindows) - { - Bool wasFinished = theAnimateWindowManager->isFinished(); - theAnimateWindowManager->update(); - if (theAnimateWindowManager->isFinished() && !wasFinished && theAnimateWindowManager->isReversed()) - theWindow->winHide( TRUE ); - } -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -static BriefingList theBriefingList; - -//------------------------------------------------------------------------------------------------- -BriefingList* GetBriefingTextList() -{ - return &theBriefingList; -} - -//------------------------------------------------------------------------------------------------- -void UpdateDiplomacyBriefingText(AsciiString newText, Bool clear) -{ - GameWindow *listboxSolo = TheWindowManager->winGetWindowFromId(theWindow, NAMEKEY("Diplomacy.wnd:ListboxSolo")); - - if (clear) - { - theBriefingList.clear(); - if (listboxSolo) - GadgetListBoxReset(listboxSolo); - } - - if (newText.isEmpty()) - return; - - if (std::find(theBriefingList.begin(), theBriefingList.end(), newText) != theBriefingList.end()) - return; - - theBriefingList.push_back(newText); - if (!listboxSolo) - return; - - UnicodeString translated = TheGameText->fetch(newText); - - Int numEntries = GadgetListBoxGetNumEntries(listboxSolo); - GadgetListBoxAddEntryText(listboxSolo, translated, TheInGameUI->getMessageColor(numEntries%2), -1); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ShowDiplomacy( Bool immediate ) -{ - if (!TheInGameUI->getInputEnabled() || TheGameLogic->isIntroMoviePlaying() || - TheGameLogic->isLoadingMap()) - return; - - - if (TheInGameUI->isQuitMenuVisible()) - return; - - if (TheDisconnectMenu && TheDisconnectMenu->isScreenVisible()) - return; - - if (theWindow) - { - theWindow->winHide(FALSE); - theWindow->winEnable(TRUE); - } - else - { - theLayout = TheWindowManager->winCreateLayout( "Diplomacy.wnd" ); - theWindow = theLayout->getFirstWindow(); - theLayout->setUpdate(updateFunc); - theAnimateWindowManager = NEW AnimateWindowManager; - radioButtonInGameID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:RadioButtonInGame"); - radioButtonBuddiesID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:RadioButtonBuddies"); - radioButtonInGame = TheWindowManager->winGetWindowFromId(nullptr, radioButtonInGameID); - radioButtonBuddies = TheWindowManager->winGetWindowFromId(nullptr, radioButtonBuddiesID); - winInGameID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:InGameParent"); - winBuddiesID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:BuddiesParent"); - winSoloID = TheNameKeyGenerator->nameToKey("Diplomacy.wnd:SoloParent"); - winInGame = TheWindowManager->winGetWindowFromId(nullptr, winInGameID); - winBuddies = TheWindowManager->winGetWindowFromId(nullptr, winBuddiesID); - winSolo = TheWindowManager->winGetWindowFromId(nullptr, winSoloID); - - if (!TheRecorder->isMultiplayer()) - { - GameWindow *listboxSolo = TheWindowManager->winGetWindowFromId(theWindow, NAMEKEY("Diplomacy.wnd:ListboxSolo")); - if (listboxSolo) - { - for (BriefingList::iterator it = theBriefingList.begin(); it != theBriefingList.end(); ++it) - { - UnicodeString translated = TheGameText->fetch(*it); - Int numEntries = GadgetListBoxGetNumEntries(listboxSolo); - GadgetListBoxAddEntryText(listboxSolo, translated, TheInGameUI->getMessageColor(numEntries%2), -1); - } - } - } - } - theLayout->hide(FALSE); - - radioButtonInGame->winHide(TRUE); - radioButtonBuddies->winHide(TRUE); - GadgetRadioSetSelection(radioButtonInGame, FALSE); - if (TheRecorder->isMultiplayer()) - { - winInGame->winHide(FALSE); - winBuddies->winHide(TRUE); - winSolo->winHide(TRUE); - } - else - { - winInGame->winHide(TRUE); - winBuddies->winHide(TRUE); - winSolo->winHide(FALSE); - } - - theAnimateWindowManager->reset(); - if (!immediate && TheGlobalData->m_animateWindows) - theAnimateWindowManager->registerGameWindow( theWindow, WIN_ANIMATION_SLIDE_TOP, TRUE, 200 ); - - TheInGameUI->registerWindowLayout(theLayout); - grabWindowPointers(); - PopulateInGameDiplomacyPopup(); - - if(TheGameSpyInfo && TheGameSpyInfo->getLocalProfileID() != 0) - { - radioButtonInGame->winHide(FALSE); - radioButtonBuddies->winHide(FALSE); - InitBuddyControls(1); - PopulateOldBuddyMessages(); - updateBuddyInfo(); - } - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ResetDiplomacy() -{ - if(theLayout) - { - TheInGameUI->unregisterWindowLayout(theLayout); - theLayout->destroyWindows(); - deleteInstance(theLayout); - InitBuddyControls(-1); - theLayout = nullptr; - } - theWindow = nullptr; - - delete theAnimateWindowManager; - theAnimateWindowManager = nullptr; -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void HideDiplomacy( Bool immediate ) -{ - releaseWindowPointers(); - if (theWindow) - { - if (immediate || !TheGlobalData->m_animateWindows) - { - theWindow->winHide(TRUE); - theWindow->winEnable(FALSE); - } - else - { - if (theAnimateWindowManager->isFinished()) - theAnimateWindowManager->reverseAnimateWindow(); - } - } -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ToggleDiplomacy( Bool immediate ) -{ - // If we bring this up, let's hide the quit menu - HideQuitMenu(); - - if (theWindow) - { - Bool show = theWindow->winIsHidden(); - if (show) - ShowDiplomacy( immediate ); - else - HideDiplomacy( immediate ); - } - else - { - ShowDiplomacy( immediate ); - } -} - - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType DiplomacyInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; -// UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - HideDiplomacy(); - return MSG_HANDLED; - //return MSG_IGNORED; - } - - } - - return MSG_HANDLED; - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType DiplomacySystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - if(BuddyControlSystem(window, msg, mData1, mData2) == MSG_HANDLED) - { - return MSG_HANDLED; - } - switch( msg ) - { - //--------------------------------------------------------------------------------------------- - case GGM_FOCUS_CHANGE: - { -// Bool focus = (Bool) mData1; - //if (focus) - //TheWindowManager->winSetGrabWindow( chatTextEntry ); - break; - } - - //--------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - // if we're given the opportunity to take the keyboard focus we must say we don't want it - if( mData1 == TRUE ) - *(Bool *)mData2 = FALSE; - - return MSG_HANDLED; - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - NameKeyType controlID = (NameKeyType)control->winGetWindowId(); - static NameKeyType buttonHideID = NAMEKEY( "Diplomacy.wnd:ButtonHide" ); - if (controlID == buttonHideID) - { - HideDiplomacy( FALSE ); - } - else if( controlID == radioButtonInGameID) - { - winInGame->winHide(FALSE); - winBuddies->winHide(TRUE); - } - else if( controlID == radioButtonBuddiesID) - { - winInGame->winHide(TRUE); - winBuddies->winHide(FALSE); - } - - for (Int i=0; i= 0) - { - TheGameInfo->getSlot(slotNumInRow[i])->mute(TRUE); - PopulateInGameDiplomacyPopup(); - break; - } - if (controlID == buttonUnMuteID[i] && slotNumInRow[i] >= 0) - { - TheGameInfo->getSlot(slotNumInRow[i])->mute(FALSE); - PopulateInGameDiplomacyPopup(); - break; - } - } - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -void PopulateInGameDiplomacyPopup() -{ - if (!TheGameInfo) - return; - - Int rowNum = 0; - for (Int slotNum=0; slotNumgetConstSlot(slotNum); - if (slot && slot->isOccupied()) - { - Bool isInGame = false; - // Note - for skirmish, TheNetwork == nullptr. jba. - if (TheNetwork && TheNetwork->isPlayerConnected(slotNum)) { - isInGame = true; - } else if ((TheNetwork == nullptr) && slot->isHuman()) { - // this is a skirmish game and it is the human player. - isInGame = true; - } - if (slot->isAI()) - isInGame = true; - AsciiString playerName; - playerName.format("player%d", slotNum); - Player *player = ThePlayerList->findPlayerWithNameKey(NAMEKEY(playerName)); - Bool isAlive = !TheVictoryConditions->hasSinglePlayerBeenDefeated(player); - Bool isObserver = player->isPlayerObserver(); - - if (slot->isHuman() && TheGameInfo->getLocalSlotNum() != slotNum && isInGame) - { - // show mute button - if (buttonMute[rowNum]) - { - buttonMute[rowNum]->winHide(slot->isMuted()); - } - if (buttonUnMute[rowNum]) - { - buttonUnMute[rowNum]->winHide(!slot->isMuted()); - } - } - else - { - // can't mute self, AI players, or MIA humans - if (buttonMute[rowNum]) - buttonMute[rowNum]->winHide(TRUE); - if (buttonUnMute[rowNum]) - buttonUnMute[rowNum]->winHide(TRUE); - } - - Color playerColor = TheMultiplayerSettings->getColor(slot->getApparentColor())->getColor(); - Color backColor = GameMakeColor(0, 0, 0, 255); - Color aliveColor = GameMakeColor(0, 255, 0, 255); - Color deadColor = GameMakeColor(255, 0, 0, 255); - Color observerInGameColor = GameMakeColor(255, 255, 255, 255); - Color goneColor = GameMakeColor(196, 0, 0, 255); - Color observerGoneColor = GameMakeColor(196, 196, 196, 255); - - if (staticTextPlayer[rowNum]) - { - staticTextPlayer[rowNum]->winSetEnabledTextColors( playerColor, backColor ); - GadgetStaticTextSetText(staticTextPlayer[rowNum], slot->getName()); - } - if (staticTextSide[rowNum]) - { - staticTextSide[rowNum]->winSetEnabledTextColors( playerColor, backColor ); - GadgetStaticTextSetText(staticTextSide[rowNum], slot->getApparentPlayerTemplateDisplayName() ); - } - if (staticTextTeam[rowNum]) - { - staticTextTeam[rowNum]->winSetEnabledTextColors( playerColor, backColor ); - AsciiString teamStr; - teamStr.format("Team:%d", slot->getTeamNumber() + 1); - if (slot->isAI() && slot->getTeamNumber() == -1) - teamStr = "Team:AI"; - GadgetStaticTextSetText(staticTextTeam[rowNum], TheGameText->fetch(teamStr) ); - } - if (staticTextStatus[rowNum]) - { - staticTextStatus[rowNum]->winHide(FALSE); - if (isInGame) - { - if (isAlive) - { - staticTextStatus[rowNum]->winSetEnabledTextColors( aliveColor, backColor ); - GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerAlive")); - } - else - { - if (isObserver) - { - staticTextStatus[rowNum]->winSetEnabledTextColors( observerInGameColor, backColor ); - GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerObserver")); - } - else - { - staticTextStatus[rowNum]->winSetEnabledTextColors( deadColor, backColor ); - GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerDead")); - } - } - } - else - { - // not in game - if (isObserver) - { - staticTextStatus[rowNum]->winSetEnabledTextColors( observerGoneColor, backColor ); - GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerObserverGone")); - } - else - { - staticTextStatus[rowNum]->winSetEnabledTextColors( goneColor, backColor ); - GadgetStaticTextSetText(staticTextStatus[rowNum], TheGameText->fetch("GUI:PlayerGone")); - } - } - } - - slotNumInRow[rowNum++] = slotNum; - } - } - - while (rowNum < MAX_SLOTS) - { - slotNumInRow[rowNum] = -1; - if (staticTextPlayer[rowNum]) - staticTextPlayer[rowNum]->winHide(TRUE); - if (staticTextSide[rowNum]) - staticTextSide[rowNum]->winHide(TRUE); - if (staticTextTeam[rowNum]) - staticTextTeam[rowNum]->winHide(TRUE); - if (staticTextStatus[rowNum]) - staticTextStatus[rowNum]->winHide(TRUE); - if (buttonMute[rowNum]) - buttonMute[rowNum]->winHide(TRUE); - if (buttonUnMute[rowNum]) - buttonUnMute[rowNum]->winHide(TRUE); - - ++rowNum; - } -} - - - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp deleted file mode 100644 index ee2000cabae..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ExtendedMessageBox.cpp /////////////////////////////////////////////////////////////////// -// Author: Matt Campbell, January 2003 -// Description: We go quiet in 1 day, gold in 15. Poor time to rewrite message boxes, so -// we get this file instead. Phooey. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameEngine.h" -#include "Common/NameKeyGenerator.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/ExtendedMessageBox.h" - -WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ); - -//------------------------------------------------------------------------------------------------- -/** Create an extended Modal Message Box */ -//------------------------------------------------------------------------------------------------- -static GameWindow *gogoExMessageBox(Int x, Int y, Int width, Int height, UnsignedShort buttonFlags, - UnicodeString titleString, UnicodeString bodyString, void *userData, - MessageBoxFunc yesCallback, - MessageBoxFunc noCallback, - MessageBoxFunc okCallback, - MessageBoxFunc cancelCallback ) -{ - // first check to make sure we have some buttons to display - if(buttonFlags == 0 ) - { - return nullptr; - } - - GameWindow *parent = TheWindowManager->winCreateFromScript( "Menus/MessageBox.wnd" ); - TheWindowManager->winSetModal( parent ); - TheWindowManager->winSetFocus( nullptr ); // make sure we lose focus from other windows even if we refuse focus ourselves - TheWindowManager->winSetFocus( parent ); - - // If the user wants the size to be different then the default - float ratioX, ratioY = 1; - - if( width > 0 && height > 0 ) - { - ICoord2D temp; - //First grab the percent increase/decrease compared to the default size - parent->winGetSize( &temp.x, &temp.y); - ratioX = (float)width / (float)temp.x; - ratioY = (float)height / (float)temp.y; - //Set the window's new size - parent->winSetSize( width, height); - - //Resize/reposition all the children windows based off the ratio - GameWindow *child; - for( child = parent->winGetChild(); child; child = child->winGetNext() ) - { - child->winGetSize(&temp.x, &temp.y); - temp.x =Int(temp.x * ratioX); - temp.y =Int(temp.y * ratioY); - child->winSetSize(temp.x, temp.y); - - child->winGetPosition(&temp.x, &temp.y); - temp.x =Int(temp.x * ratioX); - temp.y =Int(temp.y * ratioY); - child->winSetPosition(temp.x, temp.y); - } - } - - // If the user wants to position the message box somewhere other then default - if( x >= 0 && y >= 0) - parent->winSetPosition(x, y); - - // Reposition the buttons - Int buttonX[3], buttonY[3]; - - //In the layout, buttonOk will be in the first button position - NameKeyType buttonOkID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonOk" ); - GameWindow *buttonOk = TheWindowManager->winGetWindowFromId(parent, buttonOkID); - buttonOk->winGetPosition(&buttonX[0], &buttonY[0]); - - NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonYes" ); - GameWindow *buttonYes = TheWindowManager->winGetWindowFromId(parent, buttonYesID); - //buttonNo in the second position - NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonNo" ); - GameWindow *buttonNo = TheWindowManager->winGetWindowFromId(parent, buttonNoID); - buttonNo->winGetPosition(&buttonX[1], &buttonY[1]); - - //and buttonCancel in the third - NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonCancel" ); - GameWindow *buttonCancel = TheWindowManager->winGetWindowFromId(parent, buttonCancelID); - buttonCancel->winGetPosition(&buttonX[2], &buttonY[2]); - - //we shouldn't have button OK and Yes on the same dialog - if((buttonFlags & (MSG_BOX_OK | MSG_BOX_YES)) == (MSG_BOX_OK | MSG_BOX_YES) ) - { - DEBUG_CRASH(("Passed in MSG_BOX_OK and MSG_BOX_YES. Big No No.")); - } - - //Position the OK button if we have one - if( (buttonFlags & MSG_BOX_OK) == MSG_BOX_OK) - { - buttonOk->winSetPosition(buttonX[0], buttonY[0]); - buttonOk->winHide(FALSE); - } - else if( (buttonFlags & MSG_BOX_YES) == MSG_BOX_YES) - { - //Position the Yes if we have one - buttonYes->winSetPosition(buttonX[0], buttonY[0]); - buttonYes->winHide(FALSE); - } - - if((buttonFlags & (MSG_BOX_NO | MSG_BOX_CANCEL)) == (MSG_BOX_NO | MSG_BOX_CANCEL) ) - { - //If we have both the No and Cancel button, then the no should go in the middle position - buttonNo->winSetPosition(buttonX[1], buttonY[1]); - buttonCancel->winSetPosition(buttonX[2], buttonY[2]); - buttonNo->winHide(FALSE); - buttonCancel->winHide(FALSE); - } - else if( (buttonFlags & MSG_BOX_NO) == MSG_BOX_NO) - { - //if we just have the no button, then position it in the right most spot - buttonNo->winSetPosition(buttonX[2], buttonY[2]); - buttonNo->winHide(FALSE); - } - else if( (buttonFlags & MSG_BOX_CANCEL) == MSG_BOX_CANCEL) - { - //else if we just have the Cancel button, well, it should always go in the right spot - buttonCancel->winSetPosition(buttonX[2], buttonY[2]); - buttonCancel->winHide(FALSE); - } - - // Fill the text into the text boxes - NameKeyType staticTextTitleID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:StaticTextTitle" ); - GameWindow *staticTextTitle = TheWindowManager->winGetWindowFromId(parent, staticTextTitleID); - GadgetStaticTextSetText(staticTextTitle,titleString); - - NameKeyType staticTextMessageID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:StaticTextMessage" ); - GameWindow *staticTextMessage = TheWindowManager->winGetWindowFromId(parent, staticTextMessageID); - GadgetStaticTextSetText(staticTextMessage,bodyString); - - // create a structure that will pass the functions to - WindowExMessageBoxData *MsgBoxCallbacks = NEW WindowExMessageBoxData; - MsgBoxCallbacks->cancelCallback = cancelCallback; - MsgBoxCallbacks->noCallback = noCallback; - MsgBoxCallbacks->okCallback = okCallback; - MsgBoxCallbacks->yesCallback = yesCallback; - MsgBoxCallbacks->userData = userData; - //pass the structure to the dialog - parent->winSetUserData( MsgBoxCallbacks ); - - parent->winSetSystemFunc(ExtendedMessageBoxSystem); - - //make sure the dialog is showing and bring it to the top - parent->winHide(FALSE); - parent->winBringToTop(); - - return parent; -} - -GameWindow *ExMessageBoxYesNo (UnicodeString titleString,UnicodeString bodyString, void *userData, - MessageBoxFunc yesCallback, MessageBoxFunc noCallback) -{ - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, userData, yesCallback, noCallback, nullptr, nullptr); -} - -GameWindow *ExMessageBoxYesNoCancel (UnicodeString titleString,UnicodeString bodyString, void *userData, - MessageBoxFunc yesCallback, MessageBoxFunc noCallback, MessageBoxFunc cancelCallback) -{ - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES | MSG_BOX_CANCEL , titleString, bodyString, userData, yesCallback, noCallback, nullptr, cancelCallback); -} - -GameWindow *ExMessageBoxOkCancel (UnicodeString titleString,UnicodeString bodyString, void *userData, - MessageBoxFunc okCallback, MessageBoxFunc cancelCallback) -{ - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_OK | MSG_BOX_CANCEL , titleString, bodyString, userData, nullptr, nullptr, okCallback, cancelCallback); -} - -GameWindow *ExMessageBoxOk (UnicodeString titleString,UnicodeString bodyString, void *userData, - MessageBoxFunc okCallback) -{ - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_OK, titleString, bodyString, userData, nullptr, nullptr, okCallback, nullptr); -} - -GameWindow *ExMessageBoxCancel (UnicodeString titleString,UnicodeString bodyString, void *userData, - MessageBoxFunc cancelCallback) -{ - return gogoExMessageBox(-1,-1,-1,-1, MSG_BOX_CANCEL, titleString, bodyString, userData, nullptr, nullptr, nullptr, cancelCallback); -} - - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// - - - -//------------------------------------------------------------------------------------------------- -/** Message Box window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - - switch( msg ) - { - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - delete (WindowExMessageBoxData *)window->winGetUserData(); - window->winSetUserData( nullptr ); - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - static NameKeyType buttonOkID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonOk" ); - static NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonYes" ); - static NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonNo" ); - static NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonCancel" ); - WindowExMessageBoxData *MsgBoxCallbacks = (WindowExMessageBoxData *)window->winGetUserData(); - - MessageBoxReturnType ret = MB_RETURN_CLOSE; - - if( controlID == buttonOkID ) - { - if (MsgBoxCallbacks->okCallback) - ret = MsgBoxCallbacks->okCallback(MsgBoxCallbacks->userData); - } - else if( controlID == buttonYesID ) - { - if (MsgBoxCallbacks->yesCallback) - ret = MsgBoxCallbacks->yesCallback(MsgBoxCallbacks->userData); - } - else if( controlID == buttonNoID ) - { - if (MsgBoxCallbacks->noCallback) - ret = MsgBoxCallbacks->noCallback(MsgBoxCallbacks->userData); - } - else if( controlID == buttonCancelID ) - { - if (MsgBoxCallbacks->cancelCallback) - ret = MsgBoxCallbacks->cancelCallback(MsgBoxCallbacks->userData); - } - - if (ret == MB_RETURN_CLOSE) - TheWindowManager->winDestroy(window); - - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp deleted file mode 100644 index 8b38afef512..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GeneralsExpPoints.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Oct 2002 -// -// Filename: GeneralsExpPoints.cpp -// -// author: Chris Huybregts -// -// purpose: File used to populate/update/show/hide the generals exp screen -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "GameClient/ControlBar.h" -#include "GameClient/GUICallbacks.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/InGameUI.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType GeneralsExpPointsInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_MOUSE_ENTERING: - //Get rid of any building placement mode! - if( TheInGameUI ) - { - TheInGameUI->placeBuildAvailable( nullptr, nullptr ); - } - break; - - case GWM_CHAR: - { - UnsignedByte key = mData1; -// UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - TheControlBar->hidePurchaseScience(); - return MSG_HANDLED; - //return MSG_IGNORED; - } - - } - - return MSG_HANDLED; - - } - - } - - return MSG_HANDLED; - -} - - - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -WindowMsgHandledType GeneralsExpPointsSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - //--------------------------------------------------------------------------------------------- - case GGM_FOCUS_CHANGE: - { - // Bool focus = (Bool) mData1; - //if (focus) - //TheWindowManager->winSetGrabWindow( chatTextEntry ); - break; - } - - //--------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - // if we're given the opportunity to take the keyboard focus we must say we don't want it - if( mData1 == TRUE ) - *(Bool *)mData2 = FALSE; - - return MSG_HANDLED; - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - NameKeyType controlID = (NameKeyType)control->winGetWindowId(); - static NameKeyType buttonExitID = NAMEKEY( "GeneralsExpPoints.wnd:ButtonExit" ); - if (controlID == buttonExitID) - { - TheControlBar->hidePurchaseScience(); - } - else - TheControlBar->processContextSensitiveButtonClick( control, (GadgetGameMessage)msg ); - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp deleted file mode 100644 index 513c0292dbb..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: IMECandidate.cpp ///////////////////////////////////////////////////////////////////////// -// Author: TR November 2001 -// Desc: IME Candidate window callbacks -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/IMEManager.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/DisplayString.h" -#include "GameClient/DisplayStringManager.h" - - -Int IMECandidateWindowLineSpacing = 2; - -static DisplayString *Dstring = nullptr; - -//------------------------------------------------------------------------------------------------- -/** Input procedure for the candidate window */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType IMECandidateWindowInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - return MSG_HANDLED; - -} - -//------------------------------------------------------------------------------------------------- -/** System callback for the IME Candidate window */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType IMECandidateWindowSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - case GWM_CREATE: - if ( Dstring == nullptr ) - { - Dstring = TheDisplayStringManager->newDisplayString(); - } - break; - - case GWM_DESTROY: - - if ( Dstring != nullptr ) - { - TheDisplayStringManager->freeDisplayString( Dstring ); - Dstring = nullptr; - } - - break; - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// IMECandidateDraw ================================================================ -/** Draw function for the IME candidate window */ -//============================================================================= -void IMECandidateTextAreaDraw( GameWindow *window, WinInstanceData *instData ) -{ - // set up for rendering - ICoord2D origin, size, start, end; - Color textColor, - textBorder, - textSelectColor, - textSelectBorder; - IRegion2D textRegion; - Color black = GameMakeColor( 0, 0, 0, 255); - - // get window position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get a nice region from the positions - textRegion.lo.x = origin.x; - textRegion.lo.y = origin.y; - textRegion.hi.x = origin.x + size.x; - textRegion.hi.y = origin.y + size.y; - - // get the right colors for drawing - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - textSelectColor = window->winGetDisabledTextColor(); - textSelectBorder = window->winGetDisabledTextBorderColor(); - textColor = window->winGetDisabledTextColor(); - textBorder = window->winGetDisabledTextBorderColor(); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - textColor = window->winGetEnabledTextColor(); - textBorder = window->winGetEnabledTextBorderColor(); - textSelectColor = window->winGetHiliteTextColor(); - textSelectBorder = window->winGetHiliteTextBorderColor(); - - } - else - { - - textSelectColor = window->winGetHiliteTextColor(); - textSelectBorder = window->winGetHiliteTextBorderColor(); - textColor = window->winGetEnabledTextColor(); - textBorder = window->winGetEnabledTextBorderColor(); - - } - - - { - Real borderWidth = 1.0f; - - start.x = origin.x; - start.y = origin.y; - end.x = start.x + size.x; - end.y = start.y + size.y; - TheWindowManager->winOpenRect( black, borderWidth, - start.x, start.y, end.x, end.y ); - } - - if ( Dstring == nullptr ) - { - return; - } - - IMEManagerInterface *ime = (IMEManagerInterface*)window->winGetUserData(); - - if ( ime == nullptr ) - { - return; - } - - GameFont *font = window->winGetFont(); - - // set the font - Dstring->setFont( font ); - - // calculate line height - Int fontHeight = font ? font->height : 0; - Int height = fontHeight + IMECandidateWindowLineSpacing; - - // set the clip region - Dstring->setClipRegion( &textRegion ); - - Int first = ime->getCandidatePageStart(); - Int total = ime->getCandidateCount(); - Int pageSize = ime->getCandidatePageSize(); - Int selected = ime->getSelectedCandidateIndex(); - - Int count = pageSize; - - if ( count + first > total ) - { - count = total - first; - } - - selected = selected - first; - UnicodeString number; - - // calculate the widest number text - Int width; - Dstring->setText(L"00:"); - width = Dstring->getWidth(); - - // calc y start pos - Int y = origin.y; - Int leftEdge = origin.x + 10 + width; - - for ( Int i = 0; i < count; i++, y+= height ) - { - const UnicodeString *candidate = ime->getCandidate( first + i ); - Int tcolor, bcolor; - - if ( i == selected ) - { - tcolor = textSelectColor; - bcolor = textSelectBorder; - } - else - { - tcolor = textColor; - bcolor = textBorder; - } - - // draw number tab first - number.format( L"%d:", i + ime->getIndexBase()); - Dstring->setText( number ); - width = Dstring->getWidth(); - Dstring->draw( leftEdge - width, y, tcolor, black); - - // draw candidate - Dstring->setText( *candidate ); - Dstring->draw( leftEdge, y, tcolor, black ); - } -} - -// IMECandidateDraw ================================================================ -/** Draw function for the IME candidate window */ -//============================================================================= -void IMECandidateMainDraw( GameWindow *window, WinInstanceData *instData ) -{ - // set up for rendering - ICoord2D origin, size, start, end; - Color backColor, - backBorder; - Real borderWidth = 1.0f; - - // get window position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get the right colors for drawing - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - backColor = window->winGetDisabledColor( 0 ); - backBorder = window->winGetDisabledBorderColor( 0 ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - backColor = window->winGetHiliteColor( 0 ); - backBorder = window->winGetHiliteBorderColor( 0 ); - - } - else - { - - backColor = window->winGetEnabledColor( 0 ); - backBorder = window->winGetEnabledBorderColor( 0 ); - - } - - // draw the back border - if( backBorder != WIN_COLOR_UNDEFINED ) - { - - start.x = origin.x; - start.y = origin.y; - end.x = start.x + size.x; - end.y = start.y + size.y; - TheWindowManager->winOpenRect( backBorder, borderWidth, - start.x, start.y, end.x, end.y ); - } - - // draw the filled back - if( backColor != WIN_COLOR_UNDEFINED ) - { - - start.x = origin.x + 1; - start.y = origin.y + 1; - end.x = start.x + size.x - 2; - end.y = start.y + size.y - 2; - TheWindowManager->winFillRect( backColor, 0, start.x, start.y, end.x, end.y ); - - } -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp deleted file mode 100644 index 0080b64a8dd..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp +++ /dev/null @@ -1,361 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: InGameChat.cpp /////////////////////////////////////////////////////////////////////// -// Author: Matthew D. Campbell - June 2002 -// Desc: GUI callbacks for the in-game chat entry -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/Player.h" -#include "Common/PlayerList.h" -#include "GameClient/DisconnectMenu.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GameClient.h" -#include "GameClient/GameText.h" -#include "GameClient/GUICallbacks.h" -#include "GameClient/InGameUI.h" -#include "GameClient/LanguageFilter.h" -#include "GameLogic/GameLogic.h" -#include "GameNetwork/GameInfo.h" -#include "GameNetwork/NetworkInterface.h" - -static GameWindow *chatWindow = nullptr; -static GameWindow *chatTextEntry = nullptr; -static GameWindow *chatTypeStaticText = nullptr; -static UnicodeString s_savedChat; -static InGameChatType inGameChatType; - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ShowInGameChat( Bool immediate ) -{ - if (TheGameLogic->isInReplayGame()) - return; - - if (TheInGameUI->isQuitMenuVisible()) - return; - - if (TheDisconnectMenu && TheDisconnectMenu->isScreenVisible()) - return; - - if (chatWindow) - { - chatWindow->winHide(FALSE); - chatWindow->winEnable(TRUE); - chatTextEntry->winHide(FALSE); - chatTextEntry->winEnable(TRUE); - GadgetTextEntrySetText( chatTextEntry, s_savedChat ); - s_savedChat.clear(); - } - else - { - chatWindow = TheWindowManager->winCreateFromScript( "InGameChat.wnd" ); - - static NameKeyType textEntryChatID = TheNameKeyGenerator->nameToKey( "InGameChat.wnd:TextEntryChat" ); - chatTextEntry = TheWindowManager->winGetWindowFromId( nullptr, textEntryChatID ); - GadgetTextEntrySetText( chatTextEntry, UnicodeString::TheEmptyString ); - - static NameKeyType chatTypeStaticTextID = TheNameKeyGenerator->nameToKey( "InGameChat.wnd:StaticTextChatType" ); - chatTypeStaticText = TheWindowManager->winGetWindowFromId( nullptr, chatTypeStaticTextID ); - } - TheWindowManager->winSetFocus( chatTextEntry ); - SetInGameChatType( INGAME_CHAT_EVERYONE ); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ResetInGameChat() -{ - if(chatWindow) - TheWindowManager->winDestroy( chatWindow ); - chatWindow = nullptr; - chatTextEntry = nullptr; - chatTypeStaticText = nullptr; - s_savedChat.clear(); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void HideInGameChat( Bool immediate ) -{ - if (chatWindow) - { - s_savedChat = GadgetTextEntryGetText( chatTextEntry ); - chatWindow->winHide(TRUE); - chatWindow->winEnable(FALSE); - chatTextEntry->winHide(TRUE); - chatTextEntry->winEnable(FALSE); - TheWindowManager->winSetFocus( nullptr ); - } - TheWindowManager->winSetFocus( nullptr ); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void SetInGameChatType( InGameChatType chatType ) -{ - inGameChatType = chatType; - if (chatTypeStaticText) - { - switch (inGameChatType) - { - case INGAME_CHAT_EVERYONE: - if (ThePlayerList->getLocalPlayer()->isPlayerActive()) - GadgetStaticTextSetText( chatTypeStaticText, TheGameText->fetch("Chat:Everyone") ); - else - GadgetStaticTextSetText( chatTypeStaticText, TheGameText->fetch("Chat:Observers") ); - break; - case INGAME_CHAT_ALLIES: - GadgetStaticTextSetText( chatTypeStaticText, TheGameText->fetch("Chat:Allies") ); - break; - case INGAME_CHAT_PLAYERS: - GadgetStaticTextSetText( chatTypeStaticText, TheGameText->fetch("Chat:Players") ); - break; - } - } -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -Bool IsInGameChatActive() { - if (chatWindow != nullptr) { - if (chatWindow->winIsHidden() == FALSE) { - return TRUE; - } - } - return FALSE; -} - -// Slash commands ------------------------------------------------------------------------- -extern "C" { -int getQR2HostingStatus(); -} -extern int isThreadHosting; - -Bool handleInGameSlashCommands(UnicodeString uText) -{ - AsciiString message; - message.translate(uText); - - if (message.getCharAt(0) != '/') - { - return FALSE; // not a slash command - } - - AsciiString remainder = message.str() + 1; - AsciiString token; - remainder.nextToken(&token); - token.toLower(); - - if (token == "host") - { - UnicodeString s; - s.format(L"Hosting qr2:%d thread:%d", getQR2HostingStatus(), isThreadHosting); - TheInGameUI->message(s); - return TRUE; // was a slash command - } - - return FALSE; // not a slash command -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ToggleInGameChat( Bool immediate ) -{ - static Bool justHid = false; - if (justHid) - { - justHid = false; - return; - } - - if (TheGameLogic->isInReplayGame()) - return; - - if (!TheGameInfo->isMultiPlayer() && TheGlobalData->m_netMinPlayers) - return; - - if (chatWindow) - { - Bool show = chatWindow->winIsHidden(); - if (show) - ShowInGameChat( immediate ); - else - { - if (chatTextEntry) - { - // Send what is there, clear it out, and hide the window - UnicodeString msg = GadgetTextEntryGetText( chatTextEntry ); - msg.trim(); - if (!msg.isEmpty() && !handleInGameSlashCommands(msg)) - { - const Player *localPlayer = ThePlayerList->getLocalPlayer(); - AsciiString playerName; - Int playerMask = 0; - - for (Int i=0; ifindPlayerWithNameKey( TheNameKeyGenerator->nameToKey( playerName ) ); - if (player && localPlayer) - { - switch (inGameChatType) - { - case INGAME_CHAT_EVERYONE: - if (!TheGameInfo->getConstSlot(i)->isMuted()) - playerMask |= (1<getRelationship(localPlayer->getDefaultTeam()) == ALLIES && - localPlayer->getRelationship(player->getDefaultTeam()) == ALLIES) || player==localPlayer ) - playerMask |= (1<filterLine(msg); - TheNetwork->sendChat(msg, playerMask); - } - GadgetTextEntrySetText( chatTextEntry, UnicodeString::TheEmptyString ); - HideInGameChat( immediate ); - justHid = true; - } - } - } - else - { - ShowInGameChat( immediate ); - } -} - - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType InGameChatInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; -// UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - HideInGameChat(); - return MSG_HANDLED; - //return MSG_IGNORED; - } - - } - - return MSG_HANDLED; - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType InGameChatSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - //--------------------------------------------------------------------------------------------- - case GGM_FOCUS_CHANGE: - { -// Bool focus = (Bool) mData1; - //if (focus) - //TheWindowManager->winSetGrabWindow( chatTextEntry ); - break; - } - - //--------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - } - - //--------------------------------------------------------------------------------------------- - case GEM_EDIT_DONE: - { - ToggleInGameChat(); - //HideInGameChat(); - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - static NameKeyType buttonClearID = TheNameKeyGenerator->nameToKey( "InGameChat.wnd:ButtonClear" ); - if (control && control->winGetWindowId() == buttonClearID) - { - if (chatTextEntry) - GadgetTextEntrySetText( chatTextEntry, UnicodeString::TheEmptyString ); - s_savedChat.clear(); - } - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp deleted file mode 100644 index e2013ac2748..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: InGamePopupMessage.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Jul 2002 -// -// Filename: InGamePopupMessage.cpp -// -// author: Chris Huybregts -// -// purpose: Init, input, and system for the in game message popup -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GlobalData.h" -#include "Common/NameKeyGenerator.h" -#include "Common/version.h" -#include "Common/MessageStream.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/InGameUI.h" -#include "GameClient/DisplayStringManager.h" - -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -static NameKeyType parentID = NAMEKEY_INVALID; -static NameKeyType staticTextMessageID = NAMEKEY_INVALID; -static NameKeyType buttonOkID = NAMEKEY_INVALID; - - -static GameWindow *parent = nullptr; -static GameWindow *staticTextMessage = nullptr; -static GameWindow *buttonOk = nullptr; - - -static Bool pause = FALSE; -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//------------------------------------------------------------------------------------------------- -/** Initialize the InGamePopupMessageInit menu */ -//------------------------------------------------------------------------------------------------- -void InGamePopupMessageInit( WindowLayout *layout, void *userData ) -{ - - parentID = TheNameKeyGenerator->nameToKey("InGamePopupMessage.wnd:InGamePopupMessageParent"); - parent = TheWindowManager->winGetWindowFromId(nullptr, parentID); - - staticTextMessageID = TheNameKeyGenerator->nameToKey("InGamePopupMessage.wnd:StaticTextMessage"); - staticTextMessage = TheWindowManager->winGetWindowFromId(parent, staticTextMessageID); - buttonOkID = TheNameKeyGenerator->nameToKey("InGamePopupMessage.wnd:ButtonOk"); - buttonOk = TheWindowManager->winGetWindowFromId(parent, buttonOkID); - - PopupMessageData *pMData = TheInGameUI->getPopupMessageData(); - - if(!pMData) - { - DEBUG_ASSERTCRASH(pMData, ("We're in InGamePopupMessage without a pointer to pMData") ); - ///< @todo: add a call to the close this bitch method when I implement it CLH - return; - } - - DisplayString *tempString = TheDisplayStringManager->newDisplayString(); - tempString->setText(pMData->message); - tempString->setFont(staticTextMessage->winGetFont()); - tempString->setWordWrap(pMData->width - 14); - Int width, height; - tempString->getSize(&width, &height); - TheDisplayStringManager->freeDisplayString(tempString); - - GadgetStaticTextSetText(staticTextMessage, pMData->message); - // set the positions/sizes - Int widthOk, heightOk; - buttonOk->winGetSize(&widthOk, &heightOk); - parent->winSetPosition( pMData->x, pMData->y); - parent->winSetSize( pMData->width, height + 7 + 2 + 2 + heightOk + 2 ); - staticTextMessage->winSetPosition( 2, 2); - staticTextMessage->winSetSize( pMData->width - 4, height + 7); - buttonOk->winSetPosition(pMData->width - widthOk - 2, height + 7 + 2 + 2); - staticTextMessage->winSetEnabledTextColors(pMData->textColor, 0); - pause = pMData->pause; - if(pMData->pause) - TheWindowManager->winSetModal( parent ); - - TheWindowManager->winSetFocus( parent ); - - parent->winHide(FALSE); - parent->winBringToTop(); -} - -//------------------------------------------------------------------------------------------------- -/** InGamePopupMessageInput callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType InGamePopupMessageInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - // if (buttonPushed) - // break; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ENTER: - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonOk, buttonOkID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - return MSG_IGNORED; - - -} - -//------------------------------------------------------------------------------------------------- -/** InGamePopupMessageSystem callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType InGamePopupMessageSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - break; - - } - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - //---------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == buttonOkID ) - { - if(!pause) - TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_INGAME_POPUP_MESSAGE ); - else - TheInGameUI->clearPopupMessageData(); - } - break; - } - default: - return MSG_IGNORED; - - } - - - return MSG_HANDLED; - -} - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp deleted file mode 100644 index 6f2c4de1e08..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: CreditsMenu.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Dec 2002 -// -// Filename: CreditsMenu.cpp -// -// author: Chris Huybregts -// -// purpose: The credits screen...yay -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "Common/GameAudio.h" -#include "Common/AudioEventRTS.h" -#include "Common/AudioHandleSpecialValues.h" - -#include "GameClient/Credits.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" - -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -static NameKeyType parentMainMenuID = NAMEKEY_INVALID; - -// window pointers -------------------------------------------------------------------------------- -static GameWindow *parentMainMenu = nullptr; - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -/** Initialize the single player menu */ -//------------------------------------------------------------------------------------------------- -void CreditsMenuInit( WindowLayout *layout, void *userData ) -{ - TheShell->showShellMap(FALSE); - - delete TheCredits; - TheCredits = new CreditsManager; - TheCredits->load(); - TheCredits->init(); - - parentMainMenuID = TheNameKeyGenerator->nameToKey( "CreditsMenu.wnd:ParentCreditsWindow" ); - parentMainMenu = TheWindowManager->winGetWindowFromId( nullptr, parentMainMenuID ); - - - // show menu - layout->hide( FALSE ); - - // set keyboard focus to main parent - TheWindowManager->winSetFocus( parentMainMenu ); - - - - TheAudio->removeAudioEvent( AHSV_StopTheMusicFade ); - AudioEventRTS event( "Credits" ); - event.setShouldFade( TRUE ); - TheAudio->addAudioEvent( &event ); - - -} - -//------------------------------------------------------------------------------------------------- -/** single player menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void CreditsMenuShutdown( WindowLayout *layout, void *userData ) -{ - TheCredits->reset(); - delete TheCredits; - TheCredits = nullptr; - TheShell->showShellMap(TRUE); - - // hide menu - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout ); - - TheAudio->removeAudioEvent( AHSV_StopTheMusicFade ); - -} - -//------------------------------------------------------------------------------------------------- -/** single player menu update method */ -//------------------------------------------------------------------------------------------------- -void CreditsMenuUpdate( WindowLayout *layout, void *userData ) -{ - - if(TheCredits) - { - TheWindowManager->winSetFocus( parentMainMenu ); - TheCredits->update(); - if(TheCredits->isFinished()) - TheShell->pop(); - } - else - TheShell->pop(); - -} - -//------------------------------------------------------------------------------------------------- -/** Replay menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType CreditsMenuInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - - TheShell->pop(); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** single player menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType CreditsMenuSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - - } - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - - break; - } - - default: - return MSG_IGNORED; - } - - return MSG_HANDLED; -} - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp deleted file mode 100644 index 017da844eec..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp +++ /dev/null @@ -1,309 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: DifficultySelect.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Nov 2002 -// -// Filename: DifficultySelect.cpp -// -// author: Chris Huybregts -// -// purpose: The popup campaign difficulty select -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "Common/OptionPreferences.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/GadgetRadioButton.h" -#include "GameClient/CampaignManager.h" - -#include "GameLogic/ScriptEngine.h" - -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -static GameDifficulty s_AIDiff = DIFFICULTY_NORMAL; -static NameKeyType buttonOkID = NAMEKEY_INVALID; -static GameWindow * buttonOk = nullptr; -static NameKeyType buttonCancelID = NAMEKEY_INVALID; -static GameWindow * buttonCancel = nullptr; -static NameKeyType radioButtonEasyAIID = NAMEKEY_INVALID; -static NameKeyType radioButtonMediumAIID = NAMEKEY_INVALID; -static NameKeyType radioButtonHardAIID = NAMEKEY_INVALID; -static GameWindow * radioButtonEasyAI = nullptr; -static GameWindow * radioButtonMediumAI = nullptr; -static GameWindow * radioButtonHardAI = nullptr; - -void setupGameStart(AsciiString mapName, GameDifficulty diff); -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -static void SetDifficultyRadioButton() -{ - OptionPreferences pref; - if (!TheScriptEngine) - { - s_AIDiff = DIFFICULTY_NORMAL; - } - else - { - switch (pref.getCampaignDifficulty()) - { - case DIFFICULTY_EASY: - { - GadgetRadioSetSelection(radioButtonEasyAI, FALSE); - s_AIDiff = DIFFICULTY_EASY; - break; - } - case DIFFICULTY_NORMAL: - { - GadgetRadioSetSelection(radioButtonMediumAI, FALSE); - s_AIDiff = DIFFICULTY_NORMAL; - break; - } - case DIFFICULTY_HARD: - { - GadgetRadioSetSelection(radioButtonHardAI, FALSE); - s_AIDiff = DIFFICULTY_HARD; - break; - } - - default: - { - DEBUG_CRASH(("unrecognized difficulty level in the script engine")); - } - - } - } - -} - - -void DifficultySelectInit( WindowLayout *layout, void *userData ) -{ - NameKeyType parentID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:DifficultySelectParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); - - buttonOkID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:ButtonOk" ); - buttonOk = TheWindowManager->winGetWindowFromId( parent, buttonOkID ); - buttonCancelID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:ButtonCancel" ); - buttonCancel = TheWindowManager->winGetWindowFromId( parent, buttonCancelID ); - radioButtonEasyAIID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:RadioButtonEasy" ); - radioButtonEasyAI = TheWindowManager->winGetWindowFromId( parent, radioButtonEasyAIID ); - radioButtonMediumAIID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:RadioButtonMedium" ); - radioButtonMediumAI = TheWindowManager->winGetWindowFromId( parent, radioButtonMediumAIID ); - radioButtonHardAIID = TheNameKeyGenerator->nameToKey( "DifficultySelect.wnd:RadioButtonHard" ); - radioButtonHardAI = TheWindowManager->winGetWindowFromId( parent, radioButtonHardAIID ); - - s_AIDiff = DIFFICULTY_NORMAL; - SetDifficultyRadioButton(); - // set keyboard focus to main parent -// AsciiString parentName( "SkirmishMapSelectMenu.wnd:SkrimishMapSelectMenuParent" ); -// NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName ); -// parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); -// -// TheWindowManager->winSetFocus( parent ); -// - parent->winBringToTop(); - TheWindowManager->winSetModal(parent); - -} - - -//------------------------------------------------------------------------------------------------- -/** Map select menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType DifficultySelectInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - -// switch( msg ) -// { -// -// // -------------------------------------------------------------------------------------------- -// case GWM_CHAR: -// { -// UnsignedByte key = mData1; -// UnsignedByte state = mData2; -// -// switch( key ) -// { -// -// // ---------------------------------------------------------------------------------------- -// case KEY_ESC: -// { -// -// // -// // send a simulated selected event to the parent window of the -// // back/exit button -// // -// if( BitIsSet( state, KEY_STATE_UP ) ) -// { -// AsciiString buttonName( "SkirmishMapSelectMenu.wnd:ButtonBack" ); -// NameKeyType buttonID = TheNameKeyGenerator->nameToKey( buttonName ); -// GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); -// -// TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, -// (WindowMsgData)button, buttonID ); -// -// } // end if -// -// // don't let key fall through anywhere else -// return MSG_HANDLED; -// -// } // end escape -// -// } // end switch( key ) -// -// } // end char -// -// } // end switch( msg ) - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** MapSelect menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType DifficultySelectSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - break; - - } - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - // this isn't fixed yet - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if ( controlID == buttonOkID ) - { - OptionPreferences pref; - pref.setCampaignDifficulty(s_AIDiff); - pref.write(); - //TheScriptEngine->setGlobalDifficulty(s_AIDiff); // CANNOT DO THIS! REPLAYS WILL BREAK! - WindowLayout *layout = window->winGetLayout(); - if (layout) - { - layout->destroyWindows(); - deleteInstance(layout); - } - - setupGameStart(TheCampaignManager->getCurrentMap(), s_AIDiff); - // start the game - } - else if ( controlID == buttonCancelID ) - { - TheCampaignManager->setCampaign( AsciiString::TheEmptyString ); - TheWindowManager->winUnsetModal(window); - WindowLayout *layout = window->winGetLayout(); - if (layout) - { - layout->destroyWindows(); - deleteInstance(layout); - } - - } - else if ( controlID == radioButtonEasyAIID ) - { - s_AIDiff = DIFFICULTY_EASY; - } - else if ( controlID == radioButtonMediumAIID ) - { - s_AIDiff = DIFFICULTY_NORMAL; - } - else if ( controlID == radioButtonHardAIID ) - { - s_AIDiff = DIFFICULTY_HARD; - } - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp deleted file mode 100644 index 497bcd95ede..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +++ /dev/null @@ -1,434 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: DownloadMenu.cpp ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: DownloadMenu.cpp -// -// Created: Matthew D. Campbell, July 2002 -// -// Desc: the Patch Download window control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameEngine.h" -#include "Common/NameKeyGenerator.h" -#include "GameClient/GUICallbacks.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GadgetProgressBar.h" -#include "GameClient/GameText.h" -#include "GameClient/MessageBox.h" - -#include "GameLogic/GameLogic.h" - -#include "GameNetwork/DownloadManager.h" -#include "GameNetwork/GameSpy/MainMenuUtils.h" - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -static NameKeyType buttonCancelID = NAMEKEY_INVALID; -static NameKeyType staticTextSizeID = NAMEKEY_INVALID; -static NameKeyType staticTextTimeID = NAMEKEY_INVALID; -static NameKeyType staticTextFileID = NAMEKEY_INVALID; -static NameKeyType staticTextStatusID = NAMEKEY_INVALID; -static NameKeyType progressBarMunkeeID = NAMEKEY_INVALID; - -static GameWindow * staticTextSize = nullptr; -static GameWindow * staticTextTime = nullptr; -static GameWindow * staticTextFile = nullptr; -static GameWindow * staticTextStatus = nullptr; -static GameWindow * progressBarMunkee = nullptr; - -static GameWindow *parent = nullptr; - -static void closeDownloadWindow() -{ - DEBUG_ASSERTCRASH(parent, ("No Parent")); - if (!parent) - return; - - WindowLayout *menuLayout = parent->winGetLayout(); - if (menuLayout) - { - menuLayout->runShutdown(); - menuLayout->destroyWindows(); - deleteInstance(menuLayout); - menuLayout = nullptr; - } - - GameWindow *mainWin = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("MainMenu.wnd:MainMenuParent") ); - if (mainWin) - TheWindowManager->winSetFocus( mainWin ); -} - -static void errorCallback() -{ - HandleCanceledDownload(); - closeDownloadWindow(); -} - -static void successQuitCallback() -{ - TheGameEngine->setQuitting( TRUE ); - closeDownloadWindow(); - - // Clean up game data. No crashy-crash for you! - if (TheGameLogic->isInGame()) - TheGameLogic->exitGame(); -} - -static void successNoQuitCallback() -{ - HandleCanceledDownload(); - closeDownloadWindow(); -} - -class DownloadManagerMunkee : public DownloadManager -{ -public: - DownloadManagerMunkee() {m_shouldQuitOnSuccess = true; m_shouldQuitOnSuccess = false;} - virtual HRESULT OnError( Int error ) override; - virtual HRESULT OnEnd() override; - virtual HRESULT OnProgressUpdate( Int bytesread, Int totalsize, Int timetaken, Int timeleft ) override; - virtual HRESULT OnStatusUpdate( Int status ) override; - virtual HRESULT downloadFile( AsciiString server, AsciiString username, AsciiString password, AsciiString file, AsciiString localfile, AsciiString regkey, Bool tryResume ) override; - -private: - Bool m_shouldQuitOnSuccess; -}; - -HRESULT DownloadManagerMunkee::downloadFile( AsciiString server, AsciiString username, AsciiString password, AsciiString file, AsciiString localfile, AsciiString regkey, Bool tryResume ) -{ - // see if we'll need to restart - if (strstr(localfile.str(), "patches\\") != nullptr) - { - m_shouldQuitOnSuccess = true; - } - - if (staticTextFile) - { - AsciiString bob = file; - - // just get the filename, not the pathname - const char *tmp = bob.reverseFind('/'); - if (tmp) - bob = tmp+1; - tmp = bob.reverseFind('\\'); - if (tmp) - bob = tmp+1; - - UnicodeString fileString; - fileString.translate(bob); - GadgetStaticTextSetText(staticTextFile, fileString); - } - - password.format("-%s", password.str()); - return DownloadManager::downloadFile( server, username, password, file, localfile, regkey, tryResume ); -} -HRESULT DownloadManagerMunkee::OnError( Int error ) -{ - HRESULT ret = DownloadManager::OnError( error ); - - MessageBoxOk(TheGameText->fetch("GUI:DownloadErrorTitle"), getErrorString(), errorCallback); - return ret; -} -HRESULT DownloadManagerMunkee::OnEnd() -{ - HRESULT ret = DownloadManager::OnEnd(); - - if (isFileQueuedForDownload()) - { - return downloadNextQueuedFile(); - } - if (m_shouldQuitOnSuccess) - MessageBoxOk(TheGameText->fetch("GUI:DownloadSuccessTitle"), TheGameText->fetch("GUI:DownloadSuccessMustQuit"), successQuitCallback); - else - MessageBoxOk(TheGameText->fetch("GUI:DownloadSuccessTitle"), TheGameText->fetch("GUI:DownloadSuccess"), successNoQuitCallback); - return ret; -} - -static time_t lastUpdate = 0; -static Int timeLeft = 0; -HRESULT DownloadManagerMunkee::OnProgressUpdate( Int bytesread, Int totalsize, Int timetaken, Int timeleft ) -{ - HRESULT ret = DownloadManager::OnProgressUpdate( bytesread, totalsize, timetaken, timeleft ); - - if (progressBarMunkee) - { - Int percent = bytesread * 100 / totalsize; - GadgetProgressBarSetProgress( progressBarMunkee, percent ); - } - - if (staticTextSize) - { - UnicodeString sizeString; - sizeString.format(TheGameText->fetch("GUI:DownloadBytesRatio"), bytesread, totalsize); - GadgetStaticTextSetText(staticTextSize, sizeString); - } - timeLeft = timeleft; - if (staticTextTime && GadgetStaticTextGetText(staticTextTime).isEmpty()) // only update immediately the first time - { - lastUpdate = time(nullptr); - UnicodeString timeString; - if (timeleft) - { - DEBUG_ASSERTCRASH(timeleft > 0, ("Time left is negative!")); - timeleft = max(1, timeleft); - Int takenHour, takenMin, takenSec; - takenHour = timeleft / 60 / 60; - takenMin = timeleft / 60; - takenSec = timeleft % 60; - timeString.format(TheGameText->fetch("GUI:DownloadTimeLeft"), takenHour, takenMin, takenSec); - } - else - { - timeString = TheGameText->fetch("GUI:DownloadUnknownTime"); - } - GadgetStaticTextSetText(staticTextTime, timeString); - } - return ret; -} - -HRESULT DownloadManagerMunkee::OnStatusUpdate( Int status ) -{ - HRESULT ret = DownloadManager::OnStatusUpdate( status ); - - if (staticTextStatus) - { - GadgetStaticTextSetText(staticTextStatus, getStatusString()); - } - return ret; -} - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -/** Initialize the menu */ -//------------------------------------------------------------------------------------------------- -void DownloadMenuInit( WindowLayout *layout, void *userData ) -{ - - //set keyboard focus to main parent and set modal - NameKeyType parentID = TheNameKeyGenerator->nameToKey("DownloadMenu.wnd:ParentDownload"); - parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); - - // get ids for our children controls - buttonCancelID = TheNameKeyGenerator->nameToKey( "DownloadMenu.wnd:ButtonCancel" ); - staticTextSizeID = TheNameKeyGenerator->nameToKey( "DownloadMenu.wnd:StaticTextSize" ); - staticTextTimeID = TheNameKeyGenerator->nameToKey( "DownloadMenu.wnd:StaticTextTime" ); - staticTextFileID = TheNameKeyGenerator->nameToKey( "DownloadMenu.wnd:StaticTextFile" ); - staticTextStatusID = TheNameKeyGenerator->nameToKey( "DownloadMenu.wnd:StaticTextStatus" ); - progressBarMunkeeID = TheNameKeyGenerator->nameToKey( "DownloadMenu.wnd:ProgressBarMunkee" ); - - staticTextSize = TheWindowManager->winGetWindowFromId( parent, staticTextSizeID ); - staticTextTime = TheWindowManager->winGetWindowFromId( parent, staticTextTimeID ); - staticTextFile = TheWindowManager->winGetWindowFromId( parent, staticTextFileID ); - staticTextStatus = TheWindowManager->winGetWindowFromId( parent, staticTextStatusID ); - progressBarMunkee = TheWindowManager->winGetWindowFromId( parent, progressBarMunkeeID ); - - DEBUG_ASSERTCRASH(!TheDownloadManager, ("Download manager already exists")); - - delete TheDownloadManager; - TheDownloadManager = NEW DownloadManagerMunkee; - -} - -//------------------------------------------------------------------------------------------------- -/** menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void DownloadMenuShutdown( WindowLayout *layout, void *userData ) -{ - DEBUG_ASSERTCRASH(TheDownloadManager, ("No download manager")); - - delete TheDownloadManager; - TheDownloadManager = nullptr; - - staticTextSize = nullptr; - staticTextTime = nullptr; - staticTextFile = nullptr; - staticTextStatus = nullptr; - progressBarMunkee = nullptr; - parent = nullptr; - -} - -//------------------------------------------------------------------------------------------------- -/** menu update method */ -//------------------------------------------------------------------------------------------------- -void DownloadMenuUpdate( WindowLayout *layout, void *userData ) -{ - if (staticTextTime && !GadgetStaticTextGetText(staticTextTime).isEmpty()) - { - time_t now = time(nullptr); - if (now <= lastUpdate) - return; - - lastUpdate = now; - - UnicodeString timeString; - if (timeLeft) - { - DEBUG_ASSERTCRASH(timeLeft > 0, ("Time left is negative!")); - timeLeft = max(1, timeLeft); - Int takenHour, takenMin, takenSec; - takenHour = timeLeft / 60 / 60; - takenMin = timeLeft / 60; - takenSec = timeLeft % 60; - timeString.format(TheGameText->fetch("GUI:DownloadTimeLeft"), takenHour, takenMin, takenSec); - } - else - { - timeString = TheGameText->fetch("GUI:DownloadUnknownTime"); - } - GadgetStaticTextSetText(staticTextTime, timeString); - } - -} - -//------------------------------------------------------------------------------------------------- -/** menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType DownloadMenuInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "DownloadMenu.wnd:ButtonCancel" ); - GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); - - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)button, buttonID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType DownloadMenuSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - break; - - } - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - //---------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == buttonCancelID ) - { - HandleCanceledDownload(); - closeDownloadWindow(); - } - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp deleted file mode 100644 index 0f18591b0d6..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp +++ /dev/null @@ -1,194 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -///// EstablishConnectionsWindow.cpp ///////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - - -#include "GameClient/GameWindowManager.h" -#include "Common/NameKeyGenerator.h" -#include "GameClient/EstablishConnectionsMenu.h" -#include "GameNetwork/GUIUtil.h" -#include "GameNetwork/GameSpy/StagingRoomGameInfo.h" - -static WindowLayout *establishConnectionsLayout; - -static NameKeyType buttonQuitID = NAMEKEY_INVALID; -static NameKeyType staticPlayer1NameID = NAMEKEY_INVALID; -static NameKeyType staticPlayer2NameID = NAMEKEY_INVALID; -static NameKeyType staticPlayer3NameID = NAMEKEY_INVALID; -static NameKeyType staticPlayer4NameID = NAMEKEY_INVALID; -static NameKeyType staticPlayer5NameID = NAMEKEY_INVALID; -static NameKeyType staticPlayer6NameID = NAMEKEY_INVALID; -static NameKeyType staticPlayer7NameID = NAMEKEY_INVALID; - -static NameKeyType staticPlayer1StatusID = NAMEKEY_INVALID; -static NameKeyType staticPlayer2StatusID = NAMEKEY_INVALID; -static NameKeyType staticPlayer3StatusID = NAMEKEY_INVALID; -static NameKeyType staticPlayer4StatusID = NAMEKEY_INVALID; -static NameKeyType staticPlayer5StatusID = NAMEKEY_INVALID; -static NameKeyType staticPlayer6StatusID = NAMEKEY_INVALID; -static NameKeyType staticPlayer7StatusID = NAMEKEY_INVALID; - -static GameWindow *buttonQuitWindow = nullptr; -static GameWindow *staticPlayer1Name = nullptr; -static GameWindow *staticPlayer2Name = nullptr; -static GameWindow *staticPlayer3Name = nullptr; -static GameWindow *staticPlayer4Name = nullptr; -static GameWindow *staticPlayer5Name = nullptr; -static GameWindow *staticPlayer6Name = nullptr; -static GameWindow *staticPlayer7Name = nullptr; - -static GameWindow *staticPlayer1Status = nullptr; -static GameWindow *staticPlayer2Status = nullptr; -static GameWindow *staticPlayer3Status = nullptr; -static GameWindow *staticPlayer4Status = nullptr; -static GameWindow *staticPlayer5Status = nullptr; -static GameWindow *staticPlayer6Status = nullptr; -static GameWindow *staticPlayer7Status = nullptr; - -static const char *layoutFilename = "GameSpyGameOptionsMenu.wnd"; -static const char *parentName = "GameSpyGameOptionsMenuParent"; -static const char *gadgetsToHide[] = -{ - "MapWindow", - "StaticTextGameName", - "StaticTextTeam", - "StaticTextFaction", - "StaticTextColor", - "StaticTextPlayers", - "TextEntryMapDisplay", - "ButtonSelectMap", - "ButtonStart", - "StaticTextMapPreview", - nullptr -}; -static const char *perPlayerGadgetsToHide[] = -{ - "ComboBoxTeam", - "ComboBoxColor", - "ComboBoxPlayerTemplate", - "ComboBoxPlayer", - "ButtonAccept", - "GenericPing", - //"ButtonStartPosition", - nullptr -}; - -static const char *qmlayoutFilename = "WOLQuickMatchMenu.wnd"; -static const char *qmparentName = "WOLQuickMatchMenuParent"; -static const char *qmgadgetsToHide[] = -{ - "StaticTextTitle", - "ButtonBack", - "ButtonOptions", - "ButtonBuddies", - "ButtonWiden", - "ButtonStop", - "ButtonStart", - nullptr -}; -static const char *qmperPlayerGadgetsToHide[] = -{ - //"ButtonStartPosition", - nullptr -}; - -static void showGameSpyGameOptionsUnderlyingGUIElements( Bool show ) -{ - ShowUnderlyingGUIElements( show, layoutFilename, parentName, gadgetsToHide, perPlayerGadgetsToHide ); - -} -static void showGameSpyQMUnderlyingGUIElements( Bool show ) -{ - ShowUnderlyingGUIElements( show, qmlayoutFilename, qmparentName, qmgadgetsToHide, qmperPlayerGadgetsToHide ); -} - -static void InitEstablishConnectionsDialog() { - buttonQuitID = TheNameKeyGenerator->nameToKey( "EstablishConnectionsScreen.wnd:ButtonQuit" ); - buttonQuitWindow = TheWindowManager->winGetWindowFromId(nullptr, buttonQuitID); -} - -void ShowEstablishConnectionsWindow() { - if (establishConnectionsLayout == nullptr) { - establishConnectionsLayout = TheWindowManager->winCreateLayout( "Menus/EstablishConnectionsScreen.wnd" ); - InitEstablishConnectionsDialog(); - } - establishConnectionsLayout->hide(FALSE); - TheWindowManager->winSetFocus(establishConnectionsLayout->getFirstWindow()); - if (!TheGameSpyGame->isQMGame()) - { - showGameSpyGameOptionsUnderlyingGUIElements(FALSE); - } - else - { - showGameSpyQMUnderlyingGUIElements(FALSE); - } -} - -void HideEstablishConnectionsWindow() { - if (establishConnectionsLayout == nullptr) { -// establishConnectionsLayout = TheWindowManager->winCreateLayout( "Menus/EstablishConnectionsScreen.wnd" ); -// InitEstablishConnectionsDialog(); - return; - } -// establishConnectionsLayout->hide(TRUE); -// establishConnectionsLayout->hide(TRUE); -// TheWindowManager->winDestroy(establishConnectionsLayout); - establishConnectionsLayout->destroyWindows(); - deleteInstance(establishConnectionsLayout); - establishConnectionsLayout = nullptr; - if (!TheGameSpyGame->isQMGame()) - { - showGameSpyGameOptionsUnderlyingGUIElements(TRUE); - } - else - { - showGameSpyQMUnderlyingGUIElements(TRUE); - } -} - -WindowMsgHandledType EstablishConnectionsControlInput(GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2) { - - return MSG_IGNORED; -} - -WindowMsgHandledType EstablishConnectionsControlSystem(GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2) { - - switch (msg) { - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if (controlID == buttonQuitID) { - TheEstablishConnectionsMenu->abortGame(); - } - break; - } - } - return MSG_HANDLED; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp deleted file mode 100644 index 466b9caebd6..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GameInfoWindow.cpp //////////////////////////////////////////////////////////////////////// -// Author: Chris Huybregts, Feb 2002 -// Description: Game Info window callbacks -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/WindowLayout.h" -#include "GameClient/MapUtil.h" -#include "GameClient/Shell.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetStaticText.h" - -#include "GameClient/GameText.h" -#include "GameClient/GameInfoWindow.h" -#include "Common/MultiplayerSettings.h" -#include "Common/PlayerTemplate.h" -#include "GameNetwork/GameInfo.h" -#include "GameNetwork/LANAPI.h" - - -static GameWindow *parent = nullptr; -static GameWindow *staticTextGameName = nullptr; -static GameWindow *staticTextMapName = nullptr; -static GameWindow *listBoxPlayers = nullptr; -static GameWindow *winCrates = nullptr; -static GameWindow *winSuperWeapons = nullptr; -static GameWindow *winFreeForAll = nullptr; - -static NameKeyType parentID = NAMEKEY_INVALID; -static NameKeyType staticTextGameNameID = NAMEKEY_INVALID; -static NameKeyType staticTextMapNameID = NAMEKEY_INVALID; -static NameKeyType listBoxPlayersID = NAMEKEY_INVALID; -static NameKeyType winCratesID = NAMEKEY_INVALID; -static NameKeyType winSuperWeaponsID = NAMEKEY_INVALID; -static NameKeyType winFreeForAllID = NAMEKEY_INVALID; - -static WindowLayout *gameInfoWindowLayout = nullptr; -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// - -void CreateLANGameInfoWindow( GameWindow *sizeAndPosWin ) -{ - if( !gameInfoWindowLayout ) - gameInfoWindowLayout = TheWindowManager->winCreateLayout( "Menus/GameInfoWindow.wnd" ); - - gameInfoWindowLayout->runInit(); - gameInfoWindowLayout->bringForward(); - gameInfoWindowLayout->hide( TRUE ); - - if( !parent || !sizeAndPosWin ) - return; - Int x, y, width, height; - sizeAndPosWin->winGetScreenPosition(&x,&y); - parent->winSetPosition(x,y); - - sizeAndPosWin->winGetSize( &width, &height ); - parent->winSetSize(width, height); - -} - -void DestroyGameInfoWindow() -{ - if (gameInfoWindowLayout) - { - gameInfoWindowLayout->destroyWindows(); - deleteInstance(gameInfoWindowLayout); - gameInfoWindowLayout = nullptr; - } -} - -void RefreshGameInfoWindow(GameInfo *gameInfo, UnicodeString gameName) -{ - static const Image *randomIcon = TheMappedImageCollection->findImageByName("GameinfoRANDOM"); - static const Image *observerIcon = TheMappedImageCollection->findImageByName("GameinfoOBSRVR"); - if(!gameInfoWindowLayout || !gameInfo ) - return; - - parent->winHide( FALSE ); - parent->winBringToTop(); - - // Set the game name - GadgetStaticTextSetText(staticTextGameName, ((LANGameInfo *)gameInfo)->getPlayerName(0)); - // set the map name - UnicodeString map; - AsciiString asciiMap = gameInfo->getMap(); - asciiMap.toLower(); - std::map::iterator it = TheMapCache->find(asciiMap); - if (it != TheMapCache->end()) - { - map = it->second.m_displayName; - } - else - { - // can happen if the map will have to be transferred... so use the leaf name (srj) - const char *noPath = gameInfo->getMap().reverseFind('\\'); - if (noPath) - { - ++noPath; - } - else - { - noPath = gameInfo->getMap().str(); - } - map.translate(noPath); - } - GadgetStaticTextSetText(staticTextMapName,map); - - // fill in the player list - - GadgetListBoxReset(listBoxPlayers); - - Int numColors = TheMultiplayerSettings->getNumColors(); - Color white = GameMakeColor(255,255,255,255); -// Color grey = GameMakeColor(188,188,188,255); - for (Int i = 0; i < MAX_SLOTS; i ++) - { - Color playerColor = white; - Int color = -1; - Int addedRow; - GameSlot *slot = gameInfo->getSlot(i); - if(!slot || (slot->isOccupied() == FALSE)) - continue; - color = slot->getColor(); - if(color > -1 && color < numColors) - { - MultiplayerColorDefinition *def = TheMultiplayerSettings->getColor(color); - playerColor = def->getColor(); - } - if(slot->isAI()) - { - switch(slot->getState()) - { - case SLOT_EASY_AI: - { - addedRow = GadgetListBoxAddEntryText(listBoxPlayers,TheGameText->fetch("GUI:EasyAI"),playerColor,-1, 1); - break; - } - case SLOT_MED_AI: - { - addedRow = GadgetListBoxAddEntryText(listBoxPlayers,TheGameText->fetch("GUI:MediumAI"),playerColor,-1, 1); - break; - } - case SLOT_BRUTAL_AI: - { - addedRow = GadgetListBoxAddEntryText(listBoxPlayers,TheGameText->fetch("GUI:HardAI"),playerColor,-1, 1); - break; - } - default: - break; - } - } - else if(slot->isHuman()) - { - addedRow = GadgetListBoxAddEntryText(listBoxPlayers, slot->getName(),playerColor,-1,1); - } - Int playerTemplate = slot->getPlayerTemplate(); - if(playerTemplate == PLAYERTEMPLATE_OBSERVER) - { - GadgetListBoxAddEntryImage(listBoxPlayers, observerIcon,addedRow, 0, 22,25); - } - else if(playerTemplate < 0 || playerTemplate >= ThePlayerTemplateStore->getPlayerTemplateCount()) - { - ///< @todo: When we get art that shows player's side, then we'll actually draw the art instead of putting in text - GadgetListBoxAddEntryImage(listBoxPlayers, randomIcon,addedRow, 0, 22,25); - //GadgetListBoxAddEntryText(listBoxPlayers,TheGameText->fetch("GUI:???"),playerColor,addedRow, 0); - } - else - { - const PlayerTemplate *fact = ThePlayerTemplateStore->getNthPlayerTemplate(playerTemplate); - GadgetListBoxAddEntryImage(listBoxPlayers, fact->getSideIconImage(),addedRow, 0, 22,25); - //GadgetListBoxAddEntryText(listBoxPlayers,fact->getDisplayName(),playerColor,addedRow, 0); - } - - } -} - -void HideGameInfoWindow(Bool hide) -{ - if(!parent) - return; - parent->winHide(hide); - -} - -//------------------------------------------------------------------------------------------------- -/** Initialize the GameInfoWindow */ -//------------------------------------------------------------------------------------------------- -void GameInfoWindowInit( WindowLayout *layout, void *userData ) -{ - - parentID = TheNameKeyGenerator->nameToKey( "GameInfoWindow.wnd:ParentGameInfo" ); - staticTextGameNameID = TheNameKeyGenerator->nameToKey( "GameInfoWindow.wnd:StaticTextGameName" ); - staticTextMapNameID = TheNameKeyGenerator->nameToKey( "GameInfoWindow.wnd:StaticTextMapName" ); - listBoxPlayersID = TheNameKeyGenerator->nameToKey( "GameInfoWindow.wnd:ListBoxPlayers" ); - winCratesID = TheNameKeyGenerator->nameToKey( "GameInfoWindow.wnd:WinCrates" ); - winSuperWeaponsID = TheNameKeyGenerator->nameToKey( "GameInfoWindow.wnd:WinSuperWeapons" ); - winFreeForAllID = TheNameKeyGenerator->nameToKey( "GameInfoWindow.wnd:WinFreeForAll" ); - - parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); - staticTextGameName = TheWindowManager->winGetWindowFromId( parent, staticTextGameNameID ); - staticTextMapName = TheWindowManager->winGetWindowFromId( parent, staticTextMapNameID ); - listBoxPlayers = TheWindowManager->winGetWindowFromId( parent, listBoxPlayersID ); - winCrates = TheWindowManager->winGetWindowFromId( parent, winCratesID ); - winSuperWeapons = TheWindowManager->winGetWindowFromId( parent, winSuperWeaponsID ); - winFreeForAll = TheWindowManager->winGetWindowFromId( parent, winFreeForAllID ); - - GadgetStaticTextSetText(staticTextGameName,UnicodeString::TheEmptyString); - GadgetStaticTextSetText(staticTextMapName,UnicodeString::TheEmptyString); - GadgetListBoxReset(listBoxPlayers); - -} - - -//------------------------------------------------------------------------------------------------- -/** GameInfo window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType GameInfoWindowSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { -// might use these later -// GameWindow *control = (GameWindow *)mData1; -// Int controlID = control->winGetWindowId(); - - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp deleted file mode 100644 index 837a3c72e08..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp +++ /dev/null @@ -1,1161 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: KeyboardOptionsMenu.cpp ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: Command & Conquer: Generals -// -// File name: KeyboardOptionsMenu.cpp -// -// Created: Chris Brue, July 2002 -// -// Desc: the Keyboard options window control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameAudio.h" -#include "Common/GameEngine.h" -#include "Common/UserPreferences.h" - -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/GadgetCheckBox.h" -#include "GameClient/GadgetComboBox.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetSlider.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/IMEManager.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Mouse.h" -#include "GameClient/GameText.h" -#include "GameClient/MetaEvent.h" - -#include "GameNetwork/FirewallHelper.h" -#include "GameNetwork/IPEnumeration.h" - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -WindowMsgHandledType KeyboardTextEntryInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ); - -static NameKeyType buttonBackID = NAMEKEY_INVALID; -static GameWindow *buttonBack = nullptr; - -static NameKeyType parentKeyboardOptionsMenuID = NAMEKEY_INVALID; -static GameWindow *parentKeyboardOptionsMenu = nullptr; - -static NameKeyType comboBoxCategoryListID = NAMEKEY_INVALID; -static GameWindow *comboBoxCategoryList = nullptr; - -static NameKeyType listBoxCommandListID = NAMEKEY_INVALID; -static GameWindow *listBoxCommandList = nullptr; - -static NameKeyType staticTextDescriptionID = NAMEKEY_INVALID; -static GameWindow *staticTextDescription = nullptr; - -static NameKeyType staticTextCurrentHotkeyID = NAMEKEY_INVALID; -static GameWindow *staticTextCurrentHotkey = nullptr; - -static NameKeyType buttonResetAllID = NAMEKEY_INVALID; -static GameWindow *buttonResetAll = nullptr; - -static NameKeyType textEntryAssignHotkeyID = NAMEKEY_INVALID; -static GameWindow *textEntryAssignHotkey = nullptr; - -static NameKeyType buttonAssignID = NAMEKEY_INVALID; -static GameWindow *buttonAssign = nullptr; - -//use Bools to test if modifiers are used - -Bool shiftDown = false; -Bool altDown = false; -Bool ctrlDown = false; - -// shows whether or not a correctly formatted hotkey assignment is in the text area -Bool absolute = false; - -// initialize these, they will be used a lot -UnicodeString alt; -UnicodeString ctrl; -UnicodeString shift; - - - -void populateCategoryBox() -{ - Int i; - Int index; - Color color = GameMakeColor(255,255,255,255); - AsciiString temp; - UnicodeString str; - GadgetComboBoxReset(comboBoxCategoryList); - for ( i = 0; i < CATEGORY_NUM_CATEGORIES; ++i) - { - temp.format("GUI:%s", CategoryListName[i]); - str = TheGameText->fetch( temp ); - index = GadgetComboBoxAddEntry(comboBoxCategoryList, str, color); - } - - GadgetComboBoxSetSelectedPos(comboBoxCategoryList, 0); -} - -// keeps track of whether or not each text modifier is being currently displayed in the text entry field -void setKeyDown( UnicodeString mod, Bool b ) -{ - if( mod == TheGameText->fetch( "KEYBOARD:Shift+" ) ) - shiftDown = b; - else if( mod == TheGameText->fetch( "KEYBOARD:Ctrl+" ) ) - ctrlDown = b; - else - altDown = b; -} - -// initialized the command list box -void fillCommandListBox( MappableKeyCategories cat ) -{ - if(!listBoxCommandList) - return; - - GadgetListBoxReset(listBoxCommandList); - Color color = GameMakeColor(255,255,255,255); - - for(const MetaMapRec *rec = TheMetaMap->getFirstMetaMapRec(); rec; rec = rec->m_next) - { - if(rec->m_category == cat) - GadgetListBoxAddEntryText(listBoxCommandList, rec->m_displayName, color, -1, -1 ); - - } -} - -void doKeyUp(EntryData *e, UnicodeString mod ) -{ - char c = e->text->getText().getCharAt( e->text->getTextLength() - 1); - // if there are modifiers, check which ones exist and act accordingly - if( c == '+' ) - { - // if all of the mods are down, make string out of other two - if( altDown && ctrlDown && shiftDown ) - { - if( mod == shift ) - { - UnicodeString temp = alt; - temp.concat( ctrl ); - e->text->setText( temp ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, false ); - } - else if( mod == alt ) - { - UnicodeString temp = ctrl; - temp.concat( shift ); - e->text->setText( temp ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, false ); - } - else if( mod == ctrl ) - { - UnicodeString temp = alt; - temp.concat( shift ); - e->text->setText( temp ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, false ); - } - } - // if alt and ctrl are both down - else if( altDown && ctrlDown ) - { - if( mod == alt ) - { - e->text->setText( ctrl ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, false ); - } - else if( mod == ctrl ) - { - e->text->setText( ctrl ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, false ); - } - } - // if alt and shift are both down - else if( altDown && shiftDown ) - { - if( mod == alt ) - { - e->text->setText( shift ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, false ); - } - else if( mod == shift ) - { - e->text->setText( alt ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, false ); - } - } - // if ctrl and shift are both down - else if( ctrlDown && shiftDown ) - { - if( mod == ctrl ) - { - e->text->setText( shift ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, false ); - } - else if( mod == shift ) - { - e->text->setText( ctrl ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, false ); - } - } - // else only one mod, just clear everything - else - { - e->text->setText( UnicodeString::TheEmptyString ); - e->sText->setText( UnicodeString::TheEmptyString ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, false ); - } - } - else - { - // this absolute thang will/might need more than one test - absolute = true; - } -} - -// preforms the correct action when a modifier key is pressed down -void doKeyDown(EntryData *e, UnicodeString mod ) -{ - // simple cases if there are no mods present - //sanity check - if( e->text->getTextLength() <= 1 ) - { - // reset text - e->text->setText( mod ); - e->sText->setText( mod ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, true ); - } - - else //if( e->text->getTextLength() ) - { - char c = e->text->getText().getCharAt( e->text->getTextLength() - 1); - if( c != '+' && absolute) - { - e->text->setText( mod ); - e->sText->setText( mod ); - e->charPos = e->text->getTextLength(); - // try resetting all mods first - setKeyDown( shift, false ); - setKeyDown( alt, false ); - setKeyDown( ctrl, false ); - - setKeyDown( mod, true ); - absolute = false; - - } - //else only allow modifiers are present - else - { - if( mod == shift && shiftDown ) - { - } - else if( mod == ctrl && ctrlDown ) - { - } - else if( mod == alt && altDown ) - { - } - else - { - //figure out the cases for which mod goes first - - // puts shift at the end of the mods - if( altDown && ctrlDown) - { - UnicodeString temp = alt; - temp.concat( ctrl ); - temp.concat( mod ); - e->text->setText(temp); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, true ); - } - // if alt and shift are down, puts ctrl in the middle - else if( altDown && shiftDown ) - { - UnicodeString temp = alt; - temp.concat( ctrl ); - temp.concat( shift ); - e->text->setText( temp ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, true ); - } - // puts either shift or ctrl after alt - else if( altDown ) - { - UnicodeString temp = alt; - temp.concat( mod ); - e->text->setText(temp); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, true ); - } - // puts alt infront of these two - else if( ctrlDown && shiftDown ) - { - UnicodeString temp = alt; - temp.concat( ctrl ); - temp.concat( shift ); - e->text->setText( temp ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, true ); - } - // if only ctrl+ is currently being displayed - else if( ctrlDown ) - { - // if it's alt, put it in front - if( mod == alt ) - { - UnicodeString temp = mod; - temp.concat( ctrl ); - e->text->setText( temp ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, true ); - } - //else put shift after ctrl - else - { - UnicodeString temp = ctrl; - temp.concat( mod ); - e->text->setText( temp ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, true ); - } - } - // else put alt or ctrl in front of shift - else if( shiftDown ) - { - UnicodeString temp = mod; - temp.concat( shift ); - e->text->setText( temp ); - e->charPos = e->text->getTextLength(); - setKeyDown( mod, true ); - } - - } - - } - } -} - - -//------------------------------------------------------------------------------------------------- -/** Initialize the options menu */ -//------------------------------------------------------------------------------------------------- -void KeyboardOptionsMenuInit( WindowLayout *layout, void *userData ) -{ - - //set keyboard focus to main parent - parentKeyboardOptionsMenuID = TheNameKeyGenerator->nameToKey("KeyboardOptionsMenu.wnd:ParentKeyboardOptionsMenu"); - parentKeyboardOptionsMenu = TheWindowManager->winGetWindowFromId( nullptr, parentKeyboardOptionsMenuID ); - - // get ids for our children controls - buttonBackID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ButtonBack" ); - buttonBack = TheWindowManager->winGetWindowFromId( parentKeyboardOptionsMenu, buttonBackID ); - - comboBoxCategoryListID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ComboBoxCategoryList" ); - comboBoxCategoryList = TheWindowManager->winGetWindowFromId( /*parentKeyboardOptionsMenu*/nullptr, comboBoxCategoryListID ); - - listBoxCommandListID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ListBoxCommandList" ); - listBoxCommandList = TheWindowManager->winGetWindowFromId( nullptr, listBoxCommandListID ); - - staticTextDescriptionID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:StaticTextDescription" ); - staticTextDescription = TheWindowManager->winGetWindowFromId( nullptr, staticTextDescriptionID ); - - staticTextCurrentHotkeyID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:StaticTextCurrentHotkey" ); - staticTextCurrentHotkey = TheWindowManager->winGetWindowFromId( nullptr, staticTextCurrentHotkeyID ); - - buttonResetAllID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ButtonResetAll" ); - buttonResetAll = TheWindowManager->winGetWindowFromId( nullptr, buttonResetAllID ); - - textEntryAssignHotkeyID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:TextEntryAssignHotkey" ); - textEntryAssignHotkey = TheWindowManager->winGetWindowFromId( nullptr, textEntryAssignHotkeyID ); - - buttonAssignID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ButtonAssign" ); - buttonAssign = TheWindowManager->winGetWindowFromId( nullptr, buttonAssignID ); - - - - //special text entry box that needs its own function - textEntryAssignHotkey->winSetInputFunc( KeyboardTextEntryInput ); - - // populate category combo box - populateCategoryBox(); - - // populate command list - fillCommandListBox(CATEGORY_CONTROL); - - //disable textEntry until specific command is chosen - textEntryAssignHotkey->winEnable( false ); - - //clear textEntry field - EntryData *e = (EntryData *)textEntryAssignHotkey->winGetUserData(); - e->text->setText( UnicodeString::TheEmptyString ); - e->charPos = e->text->getTextLength(); - - // set up these strings because they will be called a lot - alt = TheGameText->fetch( "KEYBOARD:Alt+" ); - ctrl = TheGameText->fetch( "KEYBOARD:Ctrl+" ); - shift = TheGameText->fetch( "KEYBOARD:Shift+" ); - - // show menu - layout->hide( FALSE ); - - // set keyboard focus to main parent - TheWindowManager->winSetFocus( parentKeyboardOptionsMenu ); -} - -//------------------------------------------------------------------------------------------------- -/** options menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void KeyboardOptionsMenuShutdown( WindowLayout *layout, void *userData ) -{ - // hide menu - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout ); -} - -//------------------------------------------------------------------------------------------------- -/** options menu update method */ -//------------------------------------------------------------------------------------------------- -void KeyboardOptionsMenuUpdate( WindowLayout *layout, void *userData ) -{ - -} - -//------------------------------------------------------------------------------------------------- -/** Options menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType KeyboardOptionsMenuInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "KeyboardOptionsMenu.wnd:ButtonBack" ); - GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); - - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)button, buttonID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** options menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType KeyboardOptionsMenuSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - - } - - //--------------------------------------------------------------------------------------------- - case GCM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if(controlID == comboBoxCategoryListID ) - { - Int selected; - GadgetComboBoxGetSelectedPos(comboBoxCategoryList, &selected); - - LookupListRec rec; - rec = CategoryListName[selected]; - MappableKeyCategories cat = (MappableKeyCategories)(rec.value); - fillCommandListBox( cat ); - - //reset current hotkey description - GadgetStaticTextSetText( staticTextDescription, TheGameText->fetch( "GUI:NULL" ) ); - - //reset current hotkey text - GadgetStaticTextSetText( staticTextCurrentHotkey, TheGameText->fetch( "GUI:NULL" ) ); - - //clear textEntry field - EntryData *e = (EntryData *)textEntryAssignHotkey->winGetUserData(); - e->text->setText( UnicodeString::TheEmptyString ); - e->charPos = e->text->getTextLength(); - - //disable textEntry until specific command is chosen - textEntryAssignHotkey->winEnable( false ); - - } - break; - - } - - // --------------------------------------------------------------------------------------------- - case GLM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == listBoxCommandListID ) - { - Int selected; - GadgetListBoxGetSelected( listBoxCommandList, &selected ); - UnicodeString str; - str = GadgetListBoxGetText( listBoxCommandList, selected/*, Int column = 0*/ ); - for(const MetaMapRec *rec = TheMetaMap->getFirstMetaMapRec(); rec; rec = rec->m_next) - { - if(rec->m_displayName == str) - { - //set text in description window - GadgetStaticTextSetText( staticTextDescription, rec->m_description ); - //set text in current hotkey text - MappableKeyType type = rec->m_key; - //enable text entry for assigning different hotkey - textEntryAssignHotkey->winEnable( true ); - - for (const LookupListRec* keyName = KeyNames; keyName->name; keyName++) - { - if( keyName->value == type ) - { - const char *cptr = keyName->name; - AsciiString aStr; - aStr.format( cptr ); - UnicodeString uStr; - uStr.translate( aStr ); - - GadgetStaticTextSetText( staticTextCurrentHotkey, uStr ); - break; - } - } - - break; - } - } - - } - - break; - - } - - // --------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == buttonBackID ) - { - - // go back one screen - TheShell->pop(); - - } - else if( controlID == buttonAssignID ) - { - // check grammar in text field - } - else if( controlID == buttonResetAllID ) - { - // populate category combo box - populateCategoryBox(); - - // populate command list - fillCommandListBox(CATEGORY_CONTROL); - - //reset current hotkey text - GadgetStaticTextSetText( staticTextCurrentHotkey, TheGameText->fetch( "GUI:NULL" ) ); - - //clear textEntry field - EntryData *e = (EntryData *)textEntryAssignHotkey->winGetUserData(); - e->text->setText( UnicodeString::TheEmptyString ); - e->charPos = e->text->getTextLength(); - - //set all mods to false - setKeyDown(alt, false ); - setKeyDown(ctrl, false ); - setKeyDown(shift, false ); - - //disable text entry - textEntryAssignHotkey->winEnable( false ); - - } - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// KeyboardTextEntryInput ======================================================= -/** Handle input for text entry field */ -//============================================================================= -WindowMsgHandledType KeyboardTextEntryInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - EntryData *e = (EntryData *)window->winGetUserData(); - - WinInstanceData *instData = window->winGetInstanceData(); - - if ( TheIMEManager && TheIMEManager->isAttachedTo( window) && TheIMEManager->isComposing()) - { - // ignore input while IME has focus - return MSG_HANDLED; - } - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_IME_CHAR: - { - WideChar ch = (WideChar) mData1; - - // -------------------------------------------------------------------- - if ( ch == VK_RETURN ) - { - // Done with this edit - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_EDIT_DONE, - (WindowMsgData)window, - 0 ); - return MSG_HANDLED; - }; - - if( ch ) - { - // Constrain keys based on rules for entry box. - if( e->numericalOnly ) - { - if( TheWindowManager->winIsDigit( ch ) == 0 ) - return MSG_HANDLED; - } - else if( e->alphaNumericalOnly ) - { - if( TheWindowManager->winIsAlNum( ch ) == 0 ) - return MSG_HANDLED; - } - else if ( e->aSCIIOnly ) - { - if ( TheWindowManager->winIsAscii( ch ) == 0 ) - { - return MSG_HANDLED; - } - } - - if( e->text->getTextLength() <= 1 ) - { - e->text->setText( UnicodeString::TheEmptyString ); - e->text->appendChar( ch ); - e->charPos = e->text->getTextLength(); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - return MSG_HANDLED; - } - //else check is modifiers are present - else - { - char c = e->text->getText().getCharAt(e->text->getTextLength() - 1 ); - if(c == '+' ) - { - e->text->appendChar( ch ); - e->charPos++; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - return MSG_HANDLED; - } - // if not, reset textEntry - else - { - //if any of the modifiers are down, just replace letter - if( ( shiftDown | ctrlDown | altDown ) && ( !absolute ) ) - { - char test = e->text->getText().getCharAt(e->text->getTextLength() - 1); - // only replace letter if not the same as last char of string (removes flickering) - if( test != ch ) - { - e->text->removeLastChar(); - e->text->appendChar( ch ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - } - } - //else reset textEntry - else - { - e->text->setText( UnicodeString::TheEmptyString ); - e->text->appendChar( ch ); - e->charPos = 1; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - } - return MSG_HANDLED; - } - } - - - } - break; - } - // ------------------------------------------------------------------------ - case GWM_CHAR: - - switch( mData1 ) - { - /* - // -------------------------------------------------------------------- - case KEY_KPENTER: - case KEY_ENTER: - // Done with this edit - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - if( e->receivedUnichar == FALSE ) - { - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_EDIT_DONE, - (WindowMsgData)window, - 0 ); - } - } - - break; - */ - - // ------------------------------------------------------------------------------------------- - // modifier cases - - case KEY_LCTRL: - { - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - UnicodeString mod = ctrl; - doKeyDown( e, mod ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - - return MSG_HANDLED; - } - if( BitIsSet(mData2, KEY_STATE_UP ) ) - { - UnicodeString mod = ctrl; - doKeyUp( e, mod ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - - return MSG_HANDLED; - } - break; - } - - case KEY_RSHIFT: - case KEY_LSHIFT: - { - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - UnicodeString mod = shift; - doKeyDown( e, mod ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - - return MSG_HANDLED; - - } - if( BitIsSet( mData2, KEY_STATE_UP ) ) - { - UnicodeString mod = shift; - doKeyUp(e, mod ); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - - - return MSG_HANDLED; - } - break; - } - - case KEY_LALT: - { - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - UnicodeString mod = alt; - doKeyDown( e, mod ); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - - return MSG_HANDLED; - - } - if( BitIsSet(mData2, KEY_STATE_UP ) ) - { - UnicodeString mod = alt; - doKeyUp( e, mod ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - - return MSG_HANDLED; - } - break; - } - - // ------------------------------------------------------------------------------------------- - - - // -------------------------------------------------------------------- - // Don't process these keys - case KEY_ESC: - case KEY_PGUP: - case KEY_PGDN: - case KEY_HOME: - case KEY_END: - case KEY_F1: - case KEY_F2: - case KEY_F3: - case KEY_F4: - case KEY_F5: - case KEY_F6: - case KEY_F7: - case KEY_F8: - case KEY_F9: - case KEY_F10: - case KEY_F11: - case KEY_F12: - case KEY_CAPS: - return MSG_IGNORED; - - // -------------------------------------------------------------------- - case KEY_DOWN: - case KEY_RIGHT: - case KEY_TAB: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winNextTab(); - break; - - // -------------------------------------------------------------------- - case KEY_UP: - case KEY_LEFT: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winPrevTab(); - break; - - // -------------------------------------------------------------------- - case KEY_BACKSPACE: - { - e->text->setText( UnicodeString::TheEmptyString ); - e->charPos = e->text->getTextLength(); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - setKeyDown(shift, false ); - setKeyDown(ctrl, false ); - setKeyDown(alt, false ); - return MSG_HANDLED; - - break; - } - case KEY_DEL: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - // if conCharPos != 0 this will fall through to next case. - // it should be noted that conCharPos can only != 0 in Jap & Kor - if( e->conCharPos == 0 ) - { - if( e->charPos > 0 ) - { - - e->text->removeLastChar(); - e->sText->removeLastChar(); - e->charPos--; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - } - } - } - break; - } - - // ---------------------------------------------------------------------------------------- - // doing research to see if this will fix the keyboard stuff - /*default: - { - char ch = mData1; - if( ch && ( BitIsSet( mData2, KEY_STATE_DOWN ) ) ) - { - // Constrain keys based on rules for entry box. - if( e->numericalOnly ) - { - if( TheWindowManager->winIsDigit( ch ) == 0 ) - return MSG_HANDLED; - } - else if( e->alphaNumericalOnly ) - { - if( TheWindowManager->winIsAlNum( ch ) == 0 ) - return MSG_HANDLED; - } - else if ( e->aSCIIOnly ) - { - if ( TheWindowManager->winIsAscii( ch ) == 0 ) - { - return MSG_HANDLED; - } - } - - if( e->text->getTextLength() <= 1 ) - { - e->text->setText( UnicodeString::TheEmptyString ); - e->text->appendChar( ch ); - e->charPos = e->text->getTextLength(); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - return MSG_HANDLED; - } - //else check is modifiers are present - else - { - char c = e->text->getText().getCharAt(e->text->getTextLength() - 1 ); - if(c == '+' ) - { - e->text->appendChar( ch ); - e->charPos++; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - return MSG_HANDLED; - } - // if not, reset textEntry - else - { - //if any of the modifiers are down, just replace letter - if( ( shiftDown | ctrlDown | altDown ) && ( !absolute ) ) - { - char test = e->text->getText().getCharAt(e->text->getTextLength() - 1); - // only replace letter if not the same as last char of string (removes flickering) - if( test != ch ) - { - e->text->removeLastChar(); - e->text->appendChar( ch ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - } - } - //else reset textEntry - else - { - e->text->setText( UnicodeString::TheEmptyString ); - e->text->appendChar( ch ); - e->charPos = 1; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - } - return MSG_HANDLED; - } - } - - - } - }*/ - - - } - - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSetFocus( window ); - break; - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - - if (BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, 0 ); - TheWindowManager->winSetFocus( window ); - } - - break; - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, 0 ); - } - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, 0 ); - break; - - // ------------------------------------------------------------------------ - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp deleted file mode 100644 index 9283219f788..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp +++ /dev/null @@ -1,929 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////// -// FILE: LanLobbyMenu.cpp -// Author: Chris Huybregts, October 2001 -// Description: Lan Lobby Menu -/////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Lib/BaseType.h" -#include "Common/crc.h" -#include "Common/GameEngine.h" -#include "Common/GlobalData.h" -#include "Common/MultiplayerSettings.h" -#include "Common/NameKeyGenerator.h" -#include "Common/Player.h" -#include "Common/PlayerTemplate.h" -#include "Common/QuotedPrintable.h" -#include "Common/OptionPreferences.h" -#include "GameClient/AnimateWindowManager.h" -#include "GameClient/ClientInstance.h" -#include "GameClient/GameText.h" -#include "GameClient/MapUtil.h" -#include "GameClient/Mouse.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/ShellHooks.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameInfoWindow.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/MessageBox.h" -#include "GameClient/GameWindowTransitions.h" -#include "GameLogic/GameLogic.h" -#include "GameNetwork/IPEnumeration.h" -#include "GameNetwork/LANAPICallbacks.h" -#include "GameNetwork/LANGameInfo.h" - -Bool LANisShuttingDown = false; -Bool LANbuttonPushed = false; -Bool LANSocketErrorDetected = FALSE; -char *LANnextScreen = nullptr; - -static Int initialGadgetDelay = 2; -static Bool justEntered = FALSE; - - - -LANPreferences::LANPreferences() -{ - loadFromIniFile(); -} - -LANPreferences::~LANPreferences() -{ -} - -Bool LANPreferences::loadFromIniFile() -{ - if (rts::ClientInstance::getInstanceId() > 1u) - { - AsciiString fname; - fname.format("Network_Instance%.2u.ini", rts::ClientInstance::getInstanceId()); - return load(fname); - } - - return load("Network.ini"); -} - -UnicodeString LANPreferences::getUserName() -{ - UnicodeString ret; - - LANPreferences::const_iterator it = find("UserName"); - if (it != end()) - { - // Found an user name. Use it if valid. - ret = QuotedPrintableToUnicodeString(it->second); - ret.trim(); - if (!ret.isEmpty()) - { - return ret; - } - } - - if (rts::ClientInstance::getInstanceId() > 1u) - { - // TheSuperHackers @feature Use the instance id as default user name - // to avoid duplicate names for multiple client instances. - ret.format(L"Instance%.2d", rts::ClientInstance::getInstanceId()); - return ret; - } - - // Use machine name as default user name. - IPEnumeration IPs; - ret.translate(IPs.getMachineName()); - return ret; -} - -Int LANPreferences::getPreferredColor() -{ - Int ret; - LANPreferences::const_iterator it = find("Color"); - if (it == end()) - { - return -1; - } - - ret = atoi(it->second.str()); - if (ret < -1 || ret >= TheMultiplayerSettings->getNumColors()) - ret = -1; - - return ret; -} - -Int LANPreferences::getPreferredFaction() -{ - Int ret; - LANPreferences::const_iterator it = find("PlayerTemplate"); - if (it == end()) - { - return PLAYERTEMPLATE_RANDOM; - } - - ret = atoi(it->second.str()); - if (ret == PLAYERTEMPLATE_OBSERVER || ret < PLAYERTEMPLATE_MIN || ret >= ThePlayerTemplateStore->getPlayerTemplateCount()) - ret = PLAYERTEMPLATE_RANDOM; - - if (ret >= 0) - { - const PlayerTemplate *fac = ThePlayerTemplateStore->getNthPlayerTemplate(ret); - if (!fac) - ret = PLAYERTEMPLATE_RANDOM; - else if (fac->getStartingBuilding().isEmpty()) - ret = PLAYERTEMPLATE_RANDOM; - } - - return ret; -} - -Bool LANPreferences::usesSystemMapDir() -{ - OptionPreferences::const_iterator it = find("UseSystemMapDir"); - if (it == end()) - return TRUE; - - if (stricmp(it->second.str(), "yes") == 0) { - return TRUE; - } - return FALSE; -} - -AsciiString LANPreferences::getPreferredMap() -{ - AsciiString ret; - LANPreferences::const_iterator it = find("Map"); - if (it == end()) - { - ret = getDefaultMap(TRUE); - return ret; - } - - ret = QuotedPrintableToAsciiString(it->second); - ret.trim(); - if (ret.isEmpty() || !isValidMap(ret, TRUE)) - { - ret = getDefaultMap(TRUE); - return ret; - } - - return ret; -} - -Int LANPreferences::getNumRemoteIPs() -{ - Int ret; - LANPreferences::const_iterator it = find("NumRemoteIPs"); - if (it == end()) - { - ret = 0; - return ret; - } - - ret = atoi(it->second.str()); - return ret; -} - -UnicodeString LANPreferences::getRemoteIPEntry(Int i) -{ - UnicodeString ret; - AsciiString key; - key.format("RemoteIP%d", i); - - AsciiString ipstr; - AsciiString asciientry; - - LANPreferences::const_iterator it = find(key.str()); - if (it == end()) - { - asciientry = ""; - return ret; - } - - asciientry = it->second; - - asciientry.nextToken(&ipstr, ":"); - asciientry.set(asciientry.str() + 1); // skip the ':' - - ret.translate(ipstr); - if (!asciientry.isEmpty()) - { - ret.concat(L"("); - ret.concat(QuotedPrintableToUnicodeString(asciientry)); - ret.concat(L")"); - } - - return ret; -} - -static const char superweaponRestrictionKey[] = "SuperweaponRestrict"; - -Bool LANPreferences::getSuperweaponRestricted() const -{ - LANPreferences::const_iterator it = find(superweaponRestrictionKey); - if (it == end()) - { - return false; - } - - return ( it->second.compareNoCase( "yes" ) == 0 ); -} - -void LANPreferences::setSuperweaponRestricted( Bool superweaponRestricted ) -{ - (*this)[superweaponRestrictionKey] = superweaponRestricted ? "Yes" : "No"; -} - -static const char startingCashKey[] = "StartingCash"; -Money LANPreferences::getStartingCash() const -{ - LANPreferences::const_iterator it = find(startingCashKey); - if (it == end()) - { - return TheMultiplayerSettings->getDefaultStartingMoney(); - } - - Money money; - money.deposit( strtoul( it->second.str(), nullptr, 10 ), FALSE, FALSE ); - - return money; -} - -void LANPreferences::setStartingCash( const Money & startingCash ) -{ - AsciiString option; - - option.format( "%d", startingCash.countMoney() ); - - (*this)[startingCashKey] = option; -} - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// - - -// window ids ------------------------------------------------------------------------------ -static NameKeyType parentLanLobbyID = NAMEKEY_INVALID; -static NameKeyType buttonBackID = NAMEKEY_INVALID; -static NameKeyType buttonClearID = NAMEKEY_INVALID; -static NameKeyType buttonHostID = NAMEKEY_INVALID; -static NameKeyType buttonJoinID = NAMEKEY_INVALID; -static NameKeyType buttonDirectConnectID = NAMEKEY_INVALID; -static NameKeyType buttonEmoteID = NAMEKEY_INVALID; -static NameKeyType staticToolTipID = NAMEKEY_INVALID; -static NameKeyType textEntryPlayerNameID = NAMEKEY_INVALID; -static NameKeyType textEntryChatID = NAMEKEY_INVALID; -static NameKeyType listboxPlayersID = NAMEKEY_INVALID; -static NameKeyType staticTextGameInfoID = NAMEKEY_INVALID; - - -// Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentLanLobby = nullptr; -static GameWindow *buttonBack = nullptr; -static GameWindow *buttonClear = nullptr; -static GameWindow *buttonHost = nullptr; -static GameWindow *buttonJoin = nullptr; -static GameWindow *buttonDirectConnect = nullptr; -static GameWindow *buttonEmote = nullptr; -static GameWindow *staticToolTip = nullptr; -static GameWindow *textEntryPlayerName = nullptr; -static GameWindow *textEntryChat = nullptr; -static GameWindow *staticTextGameInfo = nullptr; - -//external declarations of the Gadgets the callbacks can use -NameKeyType listboxChatWindowID = NAMEKEY_INVALID; -GameWindow *listboxChatWindow = nullptr; -GameWindow *listboxPlayers = nullptr; -NameKeyType listboxGamesID = NAMEKEY_INVALID; -GameWindow *listboxGames = nullptr; - -// hack to disable framerate limiter in LAN games -//static Bool shellmapOn; -static Bool useFpsLimit; -static UnicodeString defaultName; - -static void playerTooltip(GameWindow *window, - WinInstanceData *instData, - UnsignedInt mouse) -{ - Int x, y, row, col; - x = LOLONGTOSHORT(mouse); - y = HILONGTOSHORT(mouse); - - GadgetListBoxGetEntryBasedOnXY(window, x, y, row, col); - - if (row == -1 || col == -1) - { - //TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:LobbyPlayers") ); - return; - } - - UnsignedInt playerIP = (UnsignedInt)GadgetListBoxGetItemData( window, row, col ); - LANPlayer *player = TheLAN->LookupPlayer(playerIP); - if (!player) - { - DEBUG_CRASH(("No player info in listbox!")); - //TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:LobbyPlayers") ); - return; - } - - setLANPlayerTooltip(player); -} - - -//------------------------------------------------------------------------------------------------- -/** Initialize the Lan Lobby Menu */ -//------------------------------------------------------------------------------------------------- -void LanLobbyMenuInit( WindowLayout *layout, void *userData ) -{ - LANnextScreen = nullptr; - LANbuttonPushed = false; - LANisShuttingDown = false; - - // get the ids for our controls - parentLanLobbyID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:LanLobbyMenuParent" ); - buttonBackID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:ButtonBack" ); - buttonClearID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:ButtonClear" ); - buttonHostID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:ButtonHost" ); - buttonJoinID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:ButtonJoin" ); - buttonDirectConnectID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:ButtonDirectConnect" ); - buttonEmoteID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:ButtonEmote" ); - staticToolTipID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:StaticToolTip" ); - textEntryPlayerNameID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:TextEntryPlayerName" ); - textEntryChatID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:TextEntryChat" ); - listboxPlayersID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:ListboxPlayers" ); - listboxChatWindowID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:ListboxChatWindowLanLobby" ); - listboxGamesID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:ListboxGames" ); - staticTextGameInfoID = TheNameKeyGenerator->nameToKey( "LanLobbyMenu.wnd:StaticTextGameInfo" ); - - - // Get pointers to the window buttons - parentLanLobby = TheWindowManager->winGetWindowFromId( nullptr, parentLanLobbyID ); - buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); - buttonClear = TheWindowManager->winGetWindowFromId( nullptr, buttonClearID); - buttonHost = TheWindowManager->winGetWindowFromId( nullptr, buttonHostID ); - buttonJoin = TheWindowManager->winGetWindowFromId( nullptr, buttonJoinID ); - buttonDirectConnect = TheWindowManager->winGetWindowFromId( nullptr, buttonDirectConnectID ); - buttonEmote = TheWindowManager->winGetWindowFromId( nullptr,buttonEmoteID ); - staticToolTip = TheWindowManager->winGetWindowFromId( nullptr, staticToolTipID ); - textEntryPlayerName = TheWindowManager->winGetWindowFromId( nullptr, textEntryPlayerNameID ); - textEntryChat = TheWindowManager->winGetWindowFromId( nullptr, textEntryChatID ); - listboxPlayers = TheWindowManager->winGetWindowFromId( nullptr, listboxPlayersID ); - listboxChatWindow = TheWindowManager->winGetWindowFromId( nullptr, listboxChatWindowID ); - listboxGames = TheWindowManager->winGetWindowFromId( nullptr, listboxGamesID ); - staticTextGameInfo = TheWindowManager->winGetWindowFromId( nullptr, staticTextGameInfoID ); - listboxPlayers->winSetTooltipFunc(playerTooltip); - - // Show Menu - layout->hide( FALSE ); - - // Init LAN API Singleton - if (!TheLAN) - { - TheLAN = NEW LANAPI(); /// @todo clh delete TheLAN and - useFpsLimit = TheGlobalData->m_useFpsLimit; - } - else - { - TheWritableGlobalData->m_useFpsLimit = useFpsLimit; - TheLAN->reset(); - } - - // Choose an IP address, then initialize the LAN singleton - UnsignedInt IP = TheGlobalData->m_defaultIP; - IPEnumeration IPs; - const WideChar* IPSource; - if (!IP) - { - EnumeratedIP *IPlist = IPs.getAddresses(); - /* - while (IPlist && IPlist->getNext()) - { - IPlist = IPlist->getNext(); - } - */ - DEBUG_ASSERTCRASH(IPlist, ("No IP addresses found!")); - if (!IPlist) - { - /// @todo: display error and exit lan lobby if no IPs are found - } - - IPSource = L"Local IP chosen"; - IP = IPlist->getIP(); - } - else - { - IPSource = L"Default local IP"; - } -#if defined(RTS_DEBUG) - UnicodeString str; - str.format(L"%s: %d.%d.%d.%d", IPSource, PRINTF_IP_AS_4_INTS(IP)); - GadgetListBoxAddEntryText(listboxChatWindow, str, chatSystemColor, -1, 0); -#endif - - // TheLAN->init() sets us to be in a LAN menu screen automatically. - TheLAN->init(); - if (TheLAN->SetLocalIP(IP) == FALSE) { - LANSocketErrorDetected = TRUE; - } - - //Initialize the gadgets on the window - //UnicodeString txtInput; - //txtInput.translate(IPs.getMachineName()); - LANPreferences prefs; - defaultName = prefs.getUserName(); - defaultName.truncateTo(g_lanPlayerNameLength); - - GadgetTextEntrySetText( textEntryPlayerName, defaultName); - // Clear the text entry line - GadgetTextEntrySetText(textEntryChat, UnicodeString::TheEmptyString); - - GadgetListBoxReset(listboxPlayers); - GadgetListBoxReset(listboxGames); - - defaultName.truncateTo(g_lanPlayerNameLength); - TheLAN->RequestSetName(defaultName); - TheLAN->RequestLocations(); - - /* - UnicodeString unicodeChat; - - unicodeChat = L"Local IP list:"; - GadgetListBoxAddEntryText(listboxChatWindow, unicodeChat, chatSystemColor, -1, 0); - - IPlist = IPs.getAddresses(); - while (IPlist) - { - unicodeChat.translate(IPlist->getIPstring()); - GadgetListBoxAddEntryText(listboxChatWindow, unicodeChat, chatSystemColor, -1, 0); - IPlist = IPlist->getNext(); - } - */ - - // Set Keyboard to Main Parent - //TheWindowManager->winSetFocus( parentLanLobby ); - TheWindowManager->winSetFocus( textEntryChat ); - CreateLANGameInfoWindow(staticTextGameInfo); - - //TheShell->showShellMap(FALSE); - //shellmapOn = FALSE; - // coming out of a game, re-load the shell map - TheShell->showShellMap(TRUE); - - // check for MOTD - TheLAN->checkMOTD(); - layout->hide(FALSE); - layout->bringForward(); - - justEntered = TRUE; - initialGadgetDelay = 2; - GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("LanLobbyMenu.wnd:GadgetParent")); - if(win) - win->winHide(TRUE); - - - // animate controls - //TheShell->registerWithAnimateManager(parentLanLobby, WIN_ANIMATION_SLIDE_TOP, TRUE); -// TheShell->registerWithAnimateManager(buttonHost, WIN_ANIMATION_SLIDE_LEFT, TRUE, 600); -// TheShell->registerWithAnimateManager(buttonJoin, WIN_ANIMATION_SLIDE_LEFT, TRUE, 400); -// TheShell->registerWithAnimateManager(buttonDirectConnect, WIN_ANIMATION_SLIDE_LEFT, TRUE, 200); -// //TheShell->registerWithAnimateManager(buttonOptions, WIN_ANIMATION_SLIDE_LEFT, TRUE, 1); -// TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_RIGHT, TRUE, 1); - -} - -//------------------------------------------------------------------------------------------------- -/** This is called when a shutdown is complete for this menu */ -//------------------------------------------------------------------------------------------------- -static void shutdownComplete( WindowLayout *layout ) -{ - - LANisShuttingDown = false; - - // hide the layout - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout, (LANnextScreen != nullptr) ); - - if (LANnextScreen != nullptr) - { - TheShell->push(LANnextScreen); - } - - LANnextScreen = nullptr; - -} - -//------------------------------------------------------------------------------------------------- -/** Lan Lobby menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void LanLobbyMenuShutdown( WindowLayout *layout, void *userData ) -{ - LANPreferences prefs; - prefs["UserName"] = UnicodeStringToQuotedPrintable(GadgetTextEntryGetText( textEntryPlayerName )); - prefs.write(); - - DestroyGameInfoWindow(); - // hide menu - //layout->hide( TRUE ); - - TheLAN->RequestLobbyLeave( true ); - - // Reset the LAN singleton - //TheLAN->reset(); - - // our shutdown is complete - //TheShell->shutdownComplete( layout ); - TheWritableGlobalData->m_useFpsLimit = useFpsLimit; - - LANisShuttingDown = true; - - // if we are shutting down for an immediate pop, skip the animations - Bool popImmediate = *(Bool *)userData; - - LANSocketErrorDetected = FALSE; - - if( popImmediate ) - { - - shutdownComplete( layout ); - return; - - } - - TheShell->reverseAnimatewindow(); - TheTransitionHandler->reverse("LanLobbyFade"); - //if( shellmapOn) -// TheShell->showShellMap(TRUE); -} - - -//------------------------------------------------------------------------------------------------- -/** Lan Lobby menu update method */ -//------------------------------------------------------------------------------------------------- -void LanLobbyMenuUpdate( WindowLayout * layout, void *userData) -{ - if (TheGameLogic->isInShellGame() && TheGameLogic->getFrame() == 1) - { - SignalUIInteraction(SHELL_SCRIPT_HOOK_LAN_ENTERED_FROM_GAME); - } - - if(justEntered) - { - if(initialGadgetDelay == 1) - { - TheTransitionHandler->setGroup("LanLobbyFade"); - initialGadgetDelay = 2; - justEntered = FALSE; - } - else - initialGadgetDelay--; - } - - if(LANisShuttingDown && TheShell->isAnimFinished() && TheTransitionHandler->isFinished()) - shutdownComplete(layout); - - if (TheShell->isAnimFinished() && !LANbuttonPushed && TheLAN) - TheLAN->update(); - - if (LANSocketErrorDetected == TRUE) { - LANSocketErrorDetected = FALSE; - DEBUG_LOG(("SOCKET ERROR! BAILING!")); - MessageBoxOk(TheGameText->fetch("GUI:NetworkError"), TheGameText->fetch("GUI:SocketError"), nullptr); - - // we have a socket problem, back out to the main menu. - TheWindowManager->winSendSystemMsg(buttonBack->winGetParent(), GBM_SELECTED, - (WindowMsgData)buttonBack, buttonBackID); - } - - -} - -//------------------------------------------------------------------------------------------------- -/** Lan Lobby menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType LanLobbyMenuInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - if (LANbuttonPushed) - break; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonBack, buttonBackID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; -} - -//------------------------------------------------------------------------------------------------- -/** Lan Lobby menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType LanLobbyMenuSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - UnicodeString txtInput; - - switch( msg ) - { - - - case GWM_CREATE: - { - SignalUIInteraction(SHELL_SCRIPT_HOOK_LAN_OPENED); - break; - } - - case GWM_DESTROY: - { - SignalUIInteraction(SHELL_SCRIPT_HOOK_LAN_CLOSED); - break; - } - - case GWM_INPUT_FOCUS: - { - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - } - case GLM_DOUBLE_CLICKED: - { - if (LANbuttonPushed) - break; - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if( controlID == listboxGamesID ) - { - int rowSelected = mData2; - - if (rowSelected >= 0) - { - LANGameInfo * theGame = TheLAN->LookupGameByListOffset(rowSelected); - if (theGame) - { - TheLAN->RequestGameJoin(theGame); - } - } - } - break; - } - case GLM_SELECTED: - { - if (LANbuttonPushed) - break; - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if( controlID == listboxGamesID ) - { - int rowSelected = mData2; - if( rowSelected < 0 ) - { - HideGameInfoWindow(TRUE); - break; - } - LANGameInfo * theGame = TheLAN->LookupGameByListOffset(rowSelected); - if (theGame) - RefreshGameInfoWindow(theGame, theGame->getName()); - else - HideGameInfoWindow(TRUE); - - } - break; - } - case GBM_SELECTED: - { - if (LANbuttonPushed) - break; - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if ( controlID == buttonBackID ) - { - //shellmapOn = TRUE; - LANbuttonPushed = true; - DEBUG_LOG(("Back was hit - popping to main menu")); - TheShell->pop(); - delete TheLAN; - TheLAN = nullptr; - //TheTransitionHandler->reverse("LanLobbyFade"); - - } - else if ( controlID == buttonHostID ) - { - TheLAN->RequestGameCreate( L"", FALSE); - - } - else if ( controlID == buttonClearID ) - { - GadgetTextEntrySetText(textEntryPlayerName, UnicodeString::TheEmptyString); - TheWindowManager->winSendSystemMsg( window, - GEM_UPDATE_TEXT, - (WindowMsgData)textEntryPlayerName, - 0 ); - - } - else if ( controlID == buttonJoinID ) - { - - //TheShell->push( "Menus/LanGameOptionsMenu.wnd" ); - - int rowSelected = -1; - GadgetListBoxGetSelected( listboxGames, &rowSelected ); - - if (rowSelected >= 0) - { - LANGameInfo * theGame = TheLAN->LookupGameByListOffset(rowSelected); - if (theGame) - { - TheLAN->RequestGameJoin(theGame); - } - } - else - { - GadgetListBoxAddEntryText(listboxChatWindow, TheGameText->fetch("LAN:ErrorNoGameSelected") , chatSystemColor, -1, 0); - } - - } - else if ( controlID == buttonEmoteID ) - { - // read the user's input - txtInput.set(GadgetTextEntryGetText( textEntryChat )); - // Clear the text entry line - GadgetTextEntrySetText(textEntryChat, UnicodeString::TheEmptyString); - // Clean up the text (remove leading/trailing chars, etc) - txtInput.trim(); - // Echo the user's input to the chat window - if (!txtInput.isEmpty()) { -// TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_EMOTE); - TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_NORMAL); - } - } - else if (controlID == buttonDirectConnectID) - { - TheLAN->RequestLobbyLeave( false ); - TheShell->push("Menus/NetworkDirectConnect.wnd"); - } - - break; - } - - case GEM_UPDATE_TEXT: - { - if (LANbuttonPushed) - break; - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if ( controlID == textEntryPlayerNameID ) - { - // grab the user's name - txtInput.set(GadgetTextEntryGetText( textEntryPlayerName )); - - // Clean up the text (remove leading/trailing chars, etc) - const WideChar *c = txtInput.str(); - while (c && (iswspace(*c))) - c++; - - if (c) - txtInput = UnicodeString(c); - else - txtInput = UnicodeString::TheEmptyString; - - txtInput.truncateTo(g_lanPlayerNameLength); - - if (!txtInput.isEmpty() && txtInput.getCharAt(txtInput.getLength()-1) == L',') - txtInput.removeLastChar(); // we use , for strtok's so we can't allow them in names. :( - - if (!txtInput.isEmpty() && txtInput.getCharAt(txtInput.getLength()-1) == L':') - txtInput.removeLastChar(); // we use : for strtok's so we can't allow them in names. :( - - if (!txtInput.isEmpty() && txtInput.getCharAt(txtInput.getLength()-1) == L';') - txtInput.removeLastChar(); // we use ; for strtok's so we can't allow them in names. :( - - // send it over the network - if (!txtInput.isEmpty()) - TheLAN->RequestSetName(txtInput); - else - { - TheLAN->RequestSetName(defaultName); - } - - // Put the whitespace-free version in the box - GadgetTextEntrySetText( textEntryPlayerName, txtInput ); - - } - break; - } - case GEM_EDIT_DONE: - { - if (LANbuttonPushed) - break; - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - // Take the user's input and echo it into the chat window as well as - // send it to the other clients on the lan - if ( controlID == textEntryChatID ) - { - - // read the user's input - txtInput.set(GadgetTextEntryGetText( textEntryChat )); - // Clear the text entry line - GadgetTextEntrySetText(textEntryChat, UnicodeString::TheEmptyString); - // Clean up the text (remove leading/trailing chars, etc) - while (!txtInput.isEmpty() && iswspace(txtInput.getCharAt(0))) - txtInput = UnicodeString(txtInput.str()+1); - - // Echo the user's input to the chat window - if (!txtInput.isEmpty()) - TheLAN->RequestChat(txtInput, LANAPIInterface::LANCHAT_NORMAL); - - } - /* - else if ( controlID == textEntryPlayerNameID ) - { - // grab the user's name - txtInput.set(GadgetTextEntryGetText( textEntryPlayerName )); - - // Clean up the text (remove leading/trailing chars, etc) - txtInput.trim(); - - // send it over the network - if (!txtInput.isEmpty()) - TheLAN->RequestSetName(txtInput); - - // Put the whitespace-free version in the box - GadgetTextEntrySetText( textEntryPlayerName, txtInput ); - - } - */ - break; - } - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp deleted file mode 100644 index 87dfe8b7b51..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp +++ /dev/null @@ -1,462 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: LanMapSelectMenu.cpp //////////////////////////////////////////////////////////////////////// -// Author: Colin Day, October 2001 -// Description: MapSelect menu window callbacks -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameEngine.h" -#include "Common/NameKeyGenerator.h" -#include "Common/MessageStream.h" -#include "Common/UserPreferences.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetRadioButton.h" -#include "GameNetwork/LANAPICallbacks.h" -#include "GameClient/MapUtil.h" -#include "GameNetwork/GUIUtil.h" - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -static NameKeyType buttonBack = NAMEKEY_INVALID; -static NameKeyType buttonOK = NAMEKEY_INVALID; -static NameKeyType listboxMap = NAMEKEY_INVALID; -static NameKeyType winMapPreviewID = NAMEKEY_INVALID; -static GameWindow *parent = nullptr; -static GameWindow *mapList = nullptr; -static GameWindow *winMapPreview = nullptr; -static NameKeyType radioButtonSystemMapsID = NAMEKEY_INVALID; -static NameKeyType radioButtonUserMapsID = NAMEKEY_INVALID; - -static GameWindow *buttonMapStartPosition[MAX_SLOTS] = {0}; -static NameKeyType buttonMapStartPositionID[MAX_SLOTS] = { NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID }; - - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// -void positionStartSpots( AsciiString mapName, GameWindow *buttonMapStartPositions[], GameWindow *mapWindow); -static const char *layoutFilename = "LanGameOptionsMenu.wnd"; -static const char *parentName = "LanGameOptionsMenuParent"; -static const char *gadgetsToHide[] = -{ - "MapWindow", - //"StaticTextTitle", - "StaticTextTeam", - "StaticTextFaction", - "StaticTextColor", - "TextEntryMapDisplay", - "ButtonSelectMap", - "ButtonStart", - "StaticTextMapPreview", - - nullptr -}; -static const char *perPlayerGadgetsToHide[] = -{ - "ComboBoxTeam", - "ComboBoxColor", - "ComboBoxPlayerTemplate", - nullptr -}; - -static void showLANGameOptionsUnderlyingGUIElements( Bool show ) -{ - ShowUnderlyingGUIElements( show, layoutFilename, parentName, gadgetsToHide, perPlayerGadgetsToHide ); - GameWindow *win = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey("LanGameOptionsMenu.wnd:ButtonBack") ); - if(win) - win->winEnable( show ); - -} - -static void NullifyControls() -{ - parent = nullptr; - mapList = nullptr; - if (winMapPreview) - { - winMapPreview->winSetUserData(nullptr); - winMapPreview = nullptr; - } - for (Int i=0; inameToKey( "LanMapSelectMenu.wnd:LanMapSelectMenuParent" ); - parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); - - TheWindowManager->winSetFocus( parent ); - - LANPreferences pref; - Bool usesSystemMapDir = pref.usesSystemMapDir(); - - const MapMetaData *mmd = TheMapCache->findMap(TheLAN->GetMyGame()->getMap()); - if (mmd) - { - usesSystemMapDir = mmd->m_isOfficial; - } - - - buttonBack = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:ButtonBack" ); - buttonOK = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:ButtonOK" ); - listboxMap = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:ListboxMap" ); - winMapPreviewID = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:WinMapPreview" ); - - radioButtonSystemMapsID = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:RadioButtonSystemMaps" ); - radioButtonUserMapsID = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:RadioButtonUserMaps" ); - GameWindow *radioButtonSystemMaps = TheWindowManager->winGetWindowFromId( parent, radioButtonSystemMapsID ); - GameWindow *radioButtonUserMaps = TheWindowManager->winGetWindowFromId( parent, radioButtonUserMapsID ); - winMapPreview = TheWindowManager->winGetWindowFromId(parent, winMapPreviewID); - if (usesSystemMapDir) - GadgetRadioSetSelection( radioButtonSystemMaps, FALSE ); - else - GadgetRadioSetSelection( radioButtonUserMaps, FALSE ); - - AsciiString tmpString; - for (Int i = 0; i < MAX_SLOTS; i++) - { - tmpString.format("LanMapSelectMenu.wnd:ButtonMapStartPosition%d", i); - buttonMapStartPositionID[i] = TheNameKeyGenerator->nameToKey( tmpString ); - buttonMapStartPosition[i] = TheWindowManager->winGetWindowFromId( winMapPreview, buttonMapStartPositionID[i] ); - DEBUG_ASSERTCRASH(buttonMapStartPosition[i], ("Could not find the ButtonMapStartPosition[%d]",i )); - buttonMapStartPosition[i]->winHide(TRUE); - buttonMapStartPosition[i]->winEnable(FALSE); - } - - // get the listbox window - NameKeyType mapListID = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:ListboxMap" ); - mapList = TheWindowManager->winGetWindowFromId( parent, mapListID ); - if( mapList ) - { - if (TheMapCache) - TheMapCache->updateCache(); - populateMapListbox( mapList, usesSystemMapDir, TRUE, TheLAN->GetMyGame()->getMap() ); - } -} - -//------------------------------------------------------------------------------------------------- -/** MapSelect menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void LanMapSelectMenuShutdown( WindowLayout *layout, void *userData ) -{ - - // hide menu - layout->hide( TRUE ); - - NullifyControls(); - - // our shutdown is complete - TheShell->shutdownComplete( layout ); -} - -//------------------------------------------------------------------------------------------------- -/** MapSelect menu update method */ -//------------------------------------------------------------------------------------------------- -void LanMapSelectMenuUpdate( WindowLayout *layout, void *userData ) -{ - -} - -//------------------------------------------------------------------------------------------------- -/** Map select menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType LanMapSelectMenuInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "LanMapSelectMenu.wnd:ButtonBack" ); - GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); - - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)button, buttonID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** MapSelect menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType LanMapSelectMenuSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - GameWindow *mapWindow = nullptr; - if (listboxMap != NAMEKEY_INVALID) - { - mapWindow = TheWindowManager->winGetWindowFromId( parent, listboxMap ); - } - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - NullifyControls(); - - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - - } - - //--------------------------------------------------------------------------------------------- - case GLM_DOUBLE_CLICKED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if( controlID == listboxMap ) - { - int rowSelected = mData2; - - if (rowSelected >= 0) - { - GadgetListBoxSetSelected( control, rowSelected ); - GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonOK ); - - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)button, buttonOK ); - } - } - break; - } - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if ( controlID == radioButtonSystemMapsID ) - { - if (TheMapCache) - TheMapCache->updateCache(); - populateMapListbox( mapList, TRUE, TRUE, TheLAN->GetMyGame()->getMap() ); - LANPreferences pref; - pref["UseSystemMapDir"] = "yes"; - pref.write(); - } - else if ( controlID == radioButtonUserMapsID ) - { - if (TheMapCache) - TheMapCache->updateCache(); - populateMapListbox( mapList, FALSE, TRUE, TheLAN->GetMyGame()->getMap() ); - LANPreferences pref; - pref["UseSystemMapDir"] = "no"; - pref.write(); - } - else if ( controlID == buttonBack ) - { - - if (mapSelectLayout) - { - mapSelectLayout->destroyWindows(); - deleteInstance(mapSelectLayout); - mapSelectLayout = nullptr; - } - - // set the controls to nullptr since they've been destroyed. - NullifyControls(); - showLANGameOptionsUnderlyingGUIElements(TRUE); - PostToLanGameOptions( MAP_BACK ); - } - else if ( controlID == buttonOK ) - { - Int selected = -1; - UnicodeString map; - - // get the selected index - if (mapWindow != nullptr) - { - GadgetListBoxGetSelected( mapWindow, &selected ); - } - - if( selected != -1 ) - { - // get text of the map to load - map = GadgetListBoxGetText( mapWindow, selected, 0 ); - - // set the map name in the global data map name - AsciiString asciiMap; - const char *mapFname = (const char *)GadgetListBoxGetItemData( mapWindow, selected ); - DEBUG_ASSERTCRASH(mapFname, ("No map item data")); - if (mapFname) - asciiMap = mapFname; - else - asciiMap.translate( map ); - TheLAN->GetMyGame()->setMap( asciiMap ); - asciiMap.toLower(); - std::map::iterator it = TheMapCache->find(asciiMap); - if (it != TheMapCache->end()) - { - TheLAN->GetMyGame()->getSlot(0)->setMapAvailability(true); - TheLAN->GetMyGame()->setMapCRC( it->second.m_CRC ); - TheLAN->GetMyGame()->setMapSize( it->second.m_filesize ); - - TheLAN->GetMyGame()->resetStartSpots(); - TheLAN->GetMyGame()->adjustSlotsForMap(); // BGC- adjust the slots for the new map. - } - - - if (mapSelectLayout) - { - mapSelectLayout->destroyWindows(); - deleteInstance(mapSelectLayout); - mapSelectLayout = nullptr; - } - - // set the controls to nullptr since they've been destroyed. - NullifyControls(); - - showLANGameOptionsUnderlyingGUIElements(TRUE); - PostToLanGameOptions(SEND_GAME_OPTS); - - } - } - - break; - - } - - case GLM_SELECTED: - { - - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if( controlID == listboxMap ) - { - int rowSelected = mData2; - if( rowSelected < 0 ) - { - positionStartSpots( AsciiString::TheEmptyString, buttonMapStartPosition, winMapPreview); -// winMapPreview->winClearStatus(WIN_STATUS_IMAGE); - break; - } - winMapPreview->winSetStatus(WIN_STATUS_IMAGE); - UnicodeString map; - // get text of the map to load - map = GadgetListBoxGetText( mapWindow, rowSelected, 0 ); - - // set the map name in the global data map name - AsciiString asciiMap; - const char *mapFname = (const char *)GadgetListBoxGetItemData( mapWindow, rowSelected ); - DEBUG_ASSERTCRASH(mapFname, ("No map item data")); - if (mapFname) - asciiMap = mapFname; - else - asciiMap.translate( map ); - asciiMap.toLower(); - Image *image = getMapPreviewImage(asciiMap); - winMapPreview->winSetUserData((void *)TheMapCache->findMap(asciiMap)); - if(image) - { - winMapPreview->winSetEnabledImage(0, image); - } - else - { - winMapPreview->winClearStatus(WIN_STATUS_IMAGE); - } - positionStartSpots( asciiMap, buttonMapStartPosition, winMapPreview); - } - break; - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp deleted file mode 100644 index 06867720afa..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: MapSelectMenu.cpp //////////////////////////////////////////////////////////////////////// -// Author: Colin Day, October 2001 -// Description: MapSelect menu window callbacks -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameEngine.h" -#include "Common/MessageStream.h" -#include "Common/RandomValue.h" -#include "Common/OptionPreferences.h" -#include "GameLogic/GameLogic.h" -#include "GameLogic/ScriptEngine.h" -#include "GameClient/AnimateWindowManager.h" -#include "GameClient/CampaignManager.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetRadioButton.h" -#include "GameClient/MapUtil.h" -#include "GameClient/Mouse.h" - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// -static NameKeyType radioButtonSystemMapsID = NAMEKEY_INVALID; -static NameKeyType radioButtonUserMapsID = NAMEKEY_INVALID; -static GameWindow *mapList = nullptr; - -static Bool showSoloMaps = true; -static Bool isShuttingDown = false; -static Bool startGame = false; -static Bool buttonPushed = false; -static GameDifficulty s_AIDiff = DIFFICULTY_NORMAL; -static void setupGameStart(AsciiString mapName) -{ - startGame = true; - TheWritableGlobalData->m_pendingFile = mapName; - TheShell->reverseAnimatewindow(); -} - -static void doGameStart() -{ - startGame = false; - - if (TheGameLogic->isInGame()) - TheGameLogic->clearGameData(); - //TheScriptEngine->setGlobalDifficulty(s_AIDiff); // CANNOT DO THIS! REPLAYS WILL BREAK!!! - // send a message to the logic for a new game - GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_NEW_GAME ); - msg->appendIntegerArgument(GAME_SINGLE_PLAYER); - msg->appendIntegerArgument(s_AIDiff); - msg->appendIntegerArgument(0); - - InitRandom(0); - - isShuttingDown = true; -} - - -//------------------------------------------------------------------------------------------------- -/** This is called when a shutdown is complete for this menu */ -//------------------------------------------------------------------------------------------------- -static void shutdownComplete( WindowLayout *layout ) -{ - - isShuttingDown = false; - - // hide the layout - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout ); - -} - -void SetDifficultyRadioButton() -{ - NameKeyType parentID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:MapSelectMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); - - if (!TheScriptEngine) - { - s_AIDiff = DIFFICULTY_EASY; - } - else - { - switch (TheScriptEngine->getGlobalDifficulty()) - { - case DIFFICULTY_EASY: - { - NameKeyType radioButtonEasyAIID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:RadioButtonEasyAI" ); - GameWindow *radioButtonEasyAI = TheWindowManager->winGetWindowFromId( parent, radioButtonEasyAIID ); - GadgetRadioSetSelection(radioButtonEasyAI, FALSE); - s_AIDiff = DIFFICULTY_EASY; - break; - } - case DIFFICULTY_NORMAL: - { - NameKeyType radioButtonMediumAIID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:RadioButtonMediumAI" ); - GameWindow *radioButtonMediumAI = TheWindowManager->winGetWindowFromId( parent, radioButtonMediumAIID ); - GadgetRadioSetSelection(radioButtonMediumAI, FALSE); - s_AIDiff = DIFFICULTY_NORMAL; - break; - } - case DIFFICULTY_HARD: - { - NameKeyType radioButtonHardAIID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:RadioButtonHardAI" ); - GameWindow *radioButtonHardAI = TheWindowManager->winGetWindowFromId( parent, radioButtonHardAIID ); - GadgetRadioSetSelection(radioButtonHardAI, FALSE); - s_AIDiff = DIFFICULTY_HARD; - break; - } - - default: - { - DEBUG_CRASH(("unrecognized difficulty level in the script engine")); - } - - } - } -} - -//------------------------------------------------------------------------------------------------- -/** Initialize the MapSelect menu */ -//------------------------------------------------------------------------------------------------- -void MapSelectMenuInit( WindowLayout *layout, void *userData ) -{ - showSoloMaps = true; - buttonPushed = false; - isShuttingDown = false; - startGame = false; - TheShell->showShellMap(TRUE); - // show menu - layout->hide( FALSE ); - - OptionPreferences pref; - Bool usesSystemMapDir = pref.usesSystemMapDir(); - - // get the listbox window - NameKeyType mapListID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ListboxMap" ); - mapList = TheWindowManager->winGetWindowFromId( nullptr, mapListID ); - if( mapList ) - { - if (TheMapCache) - TheMapCache->updateCache(); - populateMapListbox( mapList, usesSystemMapDir, !showSoloMaps ); - } - - - // set keyboard focus to main parent - NameKeyType parentID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:MapSelectMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); - TheWindowManager->winSetFocus( parent ); - - NameKeyType buttonBackID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonBack" ); - GameWindow *buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID ); - - NameKeyType buttonOKID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonOK" ); - GameWindow *buttonOK = TheWindowManager->winGetWindowFromId( nullptr, buttonOKID ); - - - TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_RIGHT, TRUE,0); - TheShell->registerWithAnimateManager(buttonOK, WIN_ANIMATION_SLIDE_LEFT, TRUE, 0); - - SetDifficultyRadioButton(); - - radioButtonSystemMapsID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:RadioButtonSystemMaps" ); - radioButtonUserMapsID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:RadioButtonUserMaps" ); - GameWindow *radioButtonSystemMaps = TheWindowManager->winGetWindowFromId( parent, radioButtonSystemMapsID ); - GameWindow *radioButtonUserMaps = TheWindowManager->winGetWindowFromId( parent, radioButtonUserMapsID ); - if (usesSystemMapDir) - GadgetRadioSetSelection( radioButtonSystemMaps, FALSE ); - else - GadgetRadioSetSelection( radioButtonUserMaps, FALSE ); -} - -//------------------------------------------------------------------------------------------------- -/** MapSelect menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void MapSelectMenuShutdown( WindowLayout *layout, void *userData ) -{ - if (!startGame) - isShuttingDown = true; - - // if we are shutting down for an immediate pop, skip the animations - Bool popImmediate = *(Bool *)userData; - if( popImmediate ) - { - - shutdownComplete( layout ); - return; - - } - - if (!startGame) - TheShell->reverseAnimatewindow(); - -} - -//------------------------------------------------------------------------------------------------- -/** MapSelect menu update method */ -//------------------------------------------------------------------------------------------------- -void MapSelectMenuUpdate( WindowLayout *layout, void *userData ) -{ - - if (startGame && TheShell->isAnimFinished()) - doGameStart(); - - // We'll only be successful if we've requested to - if(isShuttingDown && TheShell->isAnimFinished()) - shutdownComplete(layout); - - -} - -//------------------------------------------------------------------------------------------------- -/** Map select menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType MapSelectMenuInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - if (buttonPushed) - break; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonBack" ); - GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); - - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)button, buttonID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** MapSelect menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType MapSelectMenuSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - static NameKeyType buttonBack = NAMEKEY_INVALID; - static NameKeyType buttonOK = NAMEKEY_INVALID; - static NameKeyType listboxMap = NAMEKEY_INVALID; - static NameKeyType radioButtonEasyAI = NAMEKEY_INVALID; - static NameKeyType radioButtonMediumAI = NAMEKEY_INVALID; - static NameKeyType radioButtonHardAI = NAMEKEY_INVALID; - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - // get ids for our children controls - buttonBack = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonBack" ); - buttonOK = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonOK" ); - listboxMap = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ListboxMap" ); - radioButtonEasyAI = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:RadioButtonEasyAI" ); - radioButtonMediumAI = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:RadioButtonMediumAI" ); - radioButtonHardAI = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:RadioButtonHardAI" ); - break; - - } - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - if (buttonPushed) - break; - - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - static NameKeyType singlePlayerID = NAMEKEY("MapSelectMenu.wnd:ButtonSinglePlayer"); - static NameKeyType multiplayerID = NAMEKEY("MapSelectMenu.wnd:ButtonMultiplayer"); - if ( controlID == singlePlayerID ) - { - showSoloMaps = true; - OptionPreferences pref; - populateMapListbox( mapList, pref.usesSystemMapDir(), !showSoloMaps ); - } - else if ( controlID == multiplayerID ) - { - showSoloMaps = false; - OptionPreferences pref; - populateMapListbox( mapList, pref.usesSystemMapDir(), !showSoloMaps ); - } - else if ( controlID == radioButtonSystemMapsID ) - { - if (TheMapCache) - TheMapCache->updateCache(); - populateMapListbox( mapList, TRUE, !showSoloMaps ); - OptionPreferences pref; - pref["UseSystemMapDir"] = "yes"; - pref.write(); - } - else if ( controlID == radioButtonUserMapsID ) - { - if (TheMapCache) - TheMapCache->updateCache(); - populateMapListbox( mapList, FALSE, !showSoloMaps ); - OptionPreferences pref; - pref["UseSystemMapDir"] = "no"; - pref.write(); - } - else if( controlID == buttonBack ) - { - - // go back one screen - TheShell->pop(); - buttonPushed = true; - - } - else if( controlID == buttonOK ) - { - - Int selected; - UnicodeString map; - GameWindow *mapWindow = TheWindowManager->winGetWindowFromId( nullptr, listboxMap ); - - // get the selected index - GadgetListBoxGetSelected( mapWindow, &selected ); - - if( selected != -1 ) - { - buttonPushed = true; - // reset the campaign manager to empty - if( TheCampaignManager ) - TheCampaignManager->setCampaign( "" ); - // get text of the map to load - const char *mapFname = (const char *)GadgetListBoxGetItemData( mapWindow, selected ); - DEBUG_ASSERTCRASH(mapFname, ("No map item data")); - if (mapFname) - setupGameStart(mapFname); - } - - } - else if( controlID == radioButtonEasyAI) - { - s_AIDiff = DIFFICULTY_EASY; - } - else if( controlID == radioButtonMediumAI) - { - s_AIDiff = DIFFICULTY_NORMAL; - } - else if( controlID == radioButtonHardAI) - { - s_AIDiff = DIFFICULTY_HARD; - } - break; - - } - case GLM_DOUBLE_CLICKED: - { - if (buttonPushed) - break; - - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if( controlID == listboxMap ) - { - int rowSelected = mData2; - - if (rowSelected >= 0) - { - //buttonPushed = true; - GadgetListBoxSetSelected( control, rowSelected ); - NameKeyType buttonOKID = TheNameKeyGenerator->nameToKey( "MapSelectMenu.wnd:ButtonOK" ); - GameWindow *buttonOK = TheWindowManager->winGetWindowFromId( nullptr, buttonOKID ); - - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonOK, buttonOKID ); - } - } - break; - } - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp deleted file mode 100644 index 1412088c582..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp +++ /dev/null @@ -1,527 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////// -// FILE: NetworkDirectConnect.cpp -// Author: Bryan Cleveland, November 2001 -// Description: Lan Lobby Menu -/////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "gamespy/peer/peer.h" - -#include "Common/QuotedPrintable.h" -#include "Common/OptionPreferences.h" -#include "GameClient/AnimateWindowManager.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameText.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetComboBox.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/Shell.h" -#include "GameClient/GameWindowTransitions.h" - -#include "GameNetwork/IPEnumeration.h" -#include "GameNetwork/LANAPI.h" -#include "GameNetwork/LANAPICallbacks.h" - - -// window ids ------------------------------------------------------------------------------ - -// Window Pointers ------------------------------------------------------------------------ - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// - -extern Bool LANbuttonPushed; -extern Bool LANisShuttingDown; - -static Bool isShuttingDown = false; -static Bool buttonPushed = false; - -static NameKeyType buttonBackID = NAMEKEY_INVALID; -static NameKeyType buttonHostID = NAMEKEY_INVALID; -static NameKeyType buttonJoinID = NAMEKEY_INVALID; -static NameKeyType editPlayerNameID = NAMEKEY_INVALID; -static NameKeyType comboboxRemoteIPID = NAMEKEY_INVALID; -static NameKeyType staticLocalIPID = NAMEKEY_INVALID; - -static GameWindow *buttonBack = nullptr; -static GameWindow *buttonHost = nullptr; -static GameWindow *buttonJoin = nullptr; -static GameWindow *editPlayerName = nullptr; -static GameWindow *comboboxRemoteIP = nullptr; -static GameWindow *staticLocalIP = nullptr; - -void PopulateRemoteIPComboBox() -{ - LANPreferences userprefs; - GadgetComboBoxReset(comboboxRemoteIP); - - Int numRemoteIPs = userprefs.getNumRemoteIPs(); - Color white = GameMakeColor(255,255,255,255); - - for (Int i = 0; i < numRemoteIPs; ++i) - { - UnicodeString entry; - entry = userprefs.getRemoteIPEntry(i); - GadgetComboBoxAddEntry(comboboxRemoteIP, entry, white); - } - - if (numRemoteIPs > 0) - { - GadgetComboBoxSetSelectedPos(comboboxRemoteIP, 0, TRUE); - } - userprefs.write(); -} - -void UpdateRemoteIPList() -{ - Int n1[4], n2[4]; - LANPreferences prefs; - Int numEntries = GadgetComboBoxGetLength(comboboxRemoteIP); - Int currentSelection = -1; - GadgetComboBoxGetSelectedPos(comboboxRemoteIP, ¤tSelection); - UnicodeString unisel = GadgetComboBoxGetText(comboboxRemoteIP); - AsciiString sel; - sel.translate(unisel); - -// UnicodeString newEntry = prefs.getRemoteIPEntry(0); - UnicodeString newEntry = unisel; - UnicodeString newIP; - newEntry.nextToken(&newIP, L":"); - Int numFields = swscanf(newIP.str(), L"%d.%d.%d.%d", &(n1[0]), &(n1[1]), &(n1[2]), &(n1[3])); - - if (numFields != 4) { - // this is not a properly formatted IP, don't change a thing. - return; - } - - prefs["RemoteIP0"] = sel; - - Int currentINIEntry = 1; - - for (Int i = 0; i < numEntries; ++i) - { - if (i != currentSelection) - { - GadgetComboBoxSetSelectedPos(comboboxRemoteIP, i, FALSE); - UnicodeString uni; - uni = GadgetComboBoxGetText(comboboxRemoteIP); - AsciiString ascii; - ascii.translate(uni); - - // prevent more than one copy of an IP address from being put in the list. - if (currentSelection == -1) - { - UnicodeString oldEntry = uni; - UnicodeString oldIP; - oldEntry.nextToken(&oldIP, L":"); - - swscanf(oldIP.str(), L"%d.%d.%d.%d", &(n2[0]), &(n2[1]), &(n2[2]), &(n2[3])); - - Bool isEqual = TRUE; - for (Int i = 0; (i < 4) && (isEqual == TRUE); ++i) { - if (n1[i] != n2[i]) { - isEqual = FALSE; - } - } - // check to see if this is a duplicate or if this is not a properly formatted IP address. - if (isEqual == TRUE) - { - --numEntries; - continue; - } - } - AsciiString temp; - temp.format("RemoteIP%d", currentINIEntry); - ++currentINIEntry; - prefs[temp.str()] = ascii; - } - } - - if (currentSelection == -1) - { - ++numEntries; - } - - AsciiString numRemoteIPs; - numRemoteIPs.format("%d", numEntries); - - prefs["NumRemoteIPs"] = numRemoteIPs; - - prefs.write(); -} - -void HostDirectConnectGame() -{ - // Init LAN API Singleton - DEBUG_ASSERTCRASH(TheLAN != nullptr, ("TheLAN is null!")); - if (!TheLAN) - { - TheLAN = NEW LANAPI(); - } - - UnsignedInt localIP = TheLAN->GetLocalIP(); - UnicodeString localIPString; - localIPString.format(L"%d.%d.%d.%d", PRINTF_IP_AS_4_INTS(localIP)); - - UnicodeString name; - name = GadgetTextEntryGetText(editPlayerName); - - LANPreferences prefs; - prefs["UserName"] = UnicodeStringToQuotedPrintable(name); - prefs.write(); - - name.truncateTo(g_lanPlayerNameLength); - TheLAN->RequestSetName(name); - TheLAN->RequestGameCreate(localIPString, TRUE); -} - -void JoinDirectConnectGame() -{ - // Init LAN API Singleton - - if (!TheLAN) - { - TheLAN = NEW LANAPI(); - } - - UnsignedInt ipaddress = 0; - UnicodeString ipunistring = GadgetComboBoxGetText(comboboxRemoteIP); - AsciiString asciientry; - asciientry.translate(ipunistring); - - AsciiString ipstring; - asciientry.nextToken(&ipstring, "("); - - Int ip1, ip2, ip3, ip4; - Int numFields = sscanf(ipstring.str(), "%d.%d.%d.%d", &ip1, &ip2, &ip3, &ip4); - (void)numFields; DEBUG_ASSERTCRASH(numFields == 4, ("JoinDirectConnectGame - invalid IP address format: %s", ipstring.str())); - - DEBUG_LOG(("JoinDirectConnectGame - joining at %d.%d.%d.%d", ip1, ip2, ip3, ip4)); - - ipaddress = (ip1 << 24) + (ip2 << 16) + (ip3 << 8) + ip4; -// ipaddress = htonl(ipaddress); - - UnicodeString name; - name = GadgetTextEntryGetText(editPlayerName); - - LANPreferences prefs; - prefs["UserName"] = UnicodeStringToQuotedPrintable(name); - prefs.write(); - - UpdateRemoteIPList(); - PopulateRemoteIPComboBox(); - - name.truncateTo(g_lanPlayerNameLength); - TheLAN->RequestSetName(name); - - TheLAN->RequestGameJoinDirectConnect(ipaddress); -} - -//------------------------------------------------------------------------------------------------- -/** Initialize the WOL Welcome Menu */ -//------------------------------------------------------------------------------------------------- -void NetworkDirectConnectInit( WindowLayout *layout, void *userData ) -{ - LANbuttonPushed = false; - LANisShuttingDown = false; - - if (TheLAN == nullptr) - { - TheLAN = NEW LANAPI(); - TheLAN->init(); - } - TheLAN->reset(); - - buttonPushed = false; - isShuttingDown = false; - TheShell->showShellMap(TRUE); - buttonBackID = TheNameKeyGenerator->nameToKey( "NetworkDirectConnect.wnd:ButtonBack" ); - buttonHostID = TheNameKeyGenerator->nameToKey( "NetworkDirectConnect.wnd:ButtonHost" ); - buttonJoinID = TheNameKeyGenerator->nameToKey( "NetworkDirectConnect.wnd:ButtonJoin" ); - editPlayerNameID = TheNameKeyGenerator->nameToKey( "NetworkDirectConnect.wnd:EditPlayerName" ); - comboboxRemoteIPID = TheNameKeyGenerator->nameToKey( "NetworkDirectConnect.wnd:ComboboxRemoteIP" ); - staticLocalIPID = TheNameKeyGenerator->nameToKey( "NetworkDirectConnect.wnd:StaticLocalIP" ); - - buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); - buttonHost = TheWindowManager->winGetWindowFromId( nullptr, buttonHostID); - buttonJoin = TheWindowManager->winGetWindowFromId( nullptr, buttonJoinID); - editPlayerName = TheWindowManager->winGetWindowFromId( nullptr, editPlayerNameID); - comboboxRemoteIP = TheWindowManager->winGetWindowFromId( nullptr, comboboxRemoteIPID); - staticLocalIP = TheWindowManager->winGetWindowFromId( nullptr, staticLocalIPID); - -// // animate controls -// TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_LEFT, TRUE, 800); -// TheShell->registerWithAnimateManager(buttonHost, WIN_ANIMATION_SLIDE_LEFT, TRUE, 600); -// TheShell->registerWithAnimateManager(buttonJoin, WIN_ANIMATION_SLIDE_LEFT, TRUE, 200); -// - LANPreferences userprefs; - UnicodeString name; - name = userprefs.getUserName(); - - if (name.isEmpty()) - { - name = TheGameText->fetch("GUI:Player"); - } - - GadgetTextEntrySetText(editPlayerName, name); - - PopulateRemoteIPComboBox(); - - UnicodeString ipstr; - - delete TheLAN; - TheLAN = nullptr; - - if (TheLAN == nullptr) { -// DEBUG_ASSERTCRASH(TheLAN != nullptr, ("TheLAN is null initializing the direct connect screen.")); - TheLAN = NEW LANAPI(); - - OptionPreferences prefs; - UnsignedInt IP = prefs.getOnlineIPAddress(); - - IPEnumeration IPs; - -// if (!IP) -// { - EnumeratedIP *IPlist = IPs.getAddresses(); - DEBUG_ASSERTCRASH(IPlist, ("No IP addresses found!")); - if (!IPlist) - { - /// @todo: display error and exit lan lobby if no IPs are found - } - - Bool foundIP = FALSE; - EnumeratedIP *tempIP = IPlist; - while ((tempIP != nullptr) && (foundIP == FALSE)) { - if (IP == tempIP->getIP()) { - foundIP = TRUE; - } - tempIP = tempIP->getNext(); - } - - if (foundIP == FALSE) { - // The IP that we had no longer exists, we need to pick a new one. - IP = IPlist->getIP(); - } - -// IP = IPlist->getIP(); -// } - TheLAN->init(); - TheLAN->SetLocalIP(IP); - } - - UnsignedInt ip = TheLAN->GetLocalIP(); - ipstr.format(L"%d.%d.%d.%d", PRINTF_IP_AS_4_INTS(ip)); - GadgetStaticTextSetText(staticLocalIP, ipstr); - - TheLAN->RequestLobbyLeave(true); - layout->hide(FALSE); - layout->bringForward(); - TheTransitionHandler->setGroup("NetworkDirectConnectFade"); - - -} - -//------------------------------------------------------------------------------------------------- -/** This is called when a shutdown is complete for this menu */ -//------------------------------------------------------------------------------------------------- -static void shutdownComplete( WindowLayout *layout ) -{ - - isShuttingDown = false; - - // hide the layout - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout ); - -} - -//------------------------------------------------------------------------------------------------- -/** WOL Welcome Menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void NetworkDirectConnectShutdown( WindowLayout *layout, void *userData ) -{ - isShuttingDown = true; - - // if we are shutting down for an immediate pop, skip the animations - Bool popImmediate = *(Bool *)userData; - if( popImmediate ) - { - - shutdownComplete( layout ); - return; - - } - - TheShell->reverseAnimatewindow(); - - TheTransitionHandler->reverse("NetworkDirectConnectFade"); -} - - -//------------------------------------------------------------------------------------------------- -/** WOL Welcome Menu update method */ -//------------------------------------------------------------------------------------------------- -void NetworkDirectConnectUpdate( WindowLayout * layout, void *userData) -{ - // We'll only be successful if we've requested to - if(isShuttingDown && TheShell->isAnimFinished() && TheTransitionHandler->isFinished()) - shutdownComplete(layout); -} - -//------------------------------------------------------------------------------------------------- -/** WOL Welcome Menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType NetworkDirectConnectInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - if (buttonPushed) - break; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonBack, buttonBackID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; -} - -//------------------------------------------------------------------------------------------------- -/** WOL Welcome Menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType NetworkDirectConnectSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - UnicodeString txtInput; - - switch( msg ) - { - - - case GWM_CREATE: - { - - break; - } - - case GWM_DESTROY: - { - break; - } - - case GWM_INPUT_FOCUS: - { - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - } - - case GBM_SELECTED: - { - if (buttonPushed) - break; - - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if ( controlID == buttonBackID ) - { - UnicodeString name; - name = GadgetTextEntryGetText(editPlayerName); - - LANPreferences prefs; - prefs["UserName"] = UnicodeStringToQuotedPrintable(name); - prefs.write(); - - name.truncateTo(g_lanPlayerNameLength); - TheLAN->RequestSetName(name); - - buttonPushed = true; - LANbuttonPushed = true; - TheShell->pop(); - } - else if (controlID == buttonHostID) - { - HostDirectConnectGame(); - } - else if (controlID == buttonJoinID) - { - JoinDirectConnectGame(); - } - break; - } - - case GEM_EDIT_DONE: - { - break; - } - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp deleted file mode 100644 index 1a4cb024866..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: PopupCommunicator.cpp ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: PopupCommunicator.cpp -// -// Created: Chris Brue, July 2002 -// -// Desc: Electronic Arts instant messaging system -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/GUICallbacks.h" -#include "GameClient/GameWindowManager.h" - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -static NameKeyType buttonOkID = NAMEKEY_INVALID; -static GameWindow *buttonOk = nullptr; -static GameWindow *parent = nullptr; - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -/** Initialize the Popup Communicator */ -//------------------------------------------------------------------------------------------------- -void PopupCommunicatorInit( WindowLayout *layout, void *userData ) -{ - - //set keyboard focus to main parent and set modal - NameKeyType parentID = TheNameKeyGenerator->nameToKey("PopupCommunicator.wnd:PopupCommunicator"); - parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); - TheWindowManager->winSetFocus( parent ); - TheWindowManager->winSetModal( parent ); - - // get ids for our children controls - buttonOkID = TheNameKeyGenerator->nameToKey( "PopupCommunicator.wnd:ButtonOk" ); - buttonOk = TheWindowManager->winGetWindowFromId( parent, buttonOkID ); - -} - -//------------------------------------------------------------------------------------------------- -/** Popup Communicator shutdown method */ -//------------------------------------------------------------------------------------------------- -void PopupCommunicatorShutdown( WindowLayout *layout, void *userData ) -{ - -} - -//------------------------------------------------------------------------------------------------- -/** Popup Communicator update method */ -//------------------------------------------------------------------------------------------------- -void PopupcommunicatorUpdate( WindowLayout *layout, void *userData ) -{ - -} - -//------------------------------------------------------------------------------------------------- -/** Popup Communicator input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PopupCommunicatorInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonOk, buttonOkID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** Popup Communicator window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - break; - - } - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - //---------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == buttonOkID ) - { - WindowLayout *popupCommunicatorLayout = window->winGetLayout(); - if (popupCommunicatorLayout) - { - popupCommunicatorLayout->destroyWindows(); - deleteInstance(popupCommunicatorLayout); - popupCommunicatorLayout = nullptr; - } - } - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp deleted file mode 100644 index 193183b0665..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: PopupJoinGame.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Jul 2002 -// -// Filename: PopupJoinGame.cpp -// -// author: Matthew D. Campbell -// -// purpose: Contains the Callbacks for the Join Game Popup -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GlobalData.h" -#include "Common/NameKeyGenerator.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/GadgetStaticText.h" -#include "GameNetwork/GameSpy/PeerDefs.h" -#include "GameNetwork/GameSpy/PeerThread.h" -#include "GameNetwork/GameSpyOverlay.h" - - -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -static NameKeyType parentPopupID = NAMEKEY_INVALID; -static NameKeyType textEntryGamePasswordID = NAMEKEY_INVALID; -static NameKeyType buttonCancelID = NAMEKEY_INVALID; - -static GameWindow *parentPopup = nullptr; -static GameWindow *textEntryGamePassword = nullptr; - -static void joinGame( AsciiString password ); - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//------------------------------------------------------------------------------------------------- -/** Initialize the PopupHostGameInit menu */ -//------------------------------------------------------------------------------------------------- -void PopupJoinGameInit( WindowLayout *layout, void *userData ) -{ - parentPopupID = TheNameKeyGenerator->nameToKey("PopupJoinGame.wnd:ParentJoinPopUp"); - parentPopup = TheWindowManager->winGetWindowFromId(nullptr, parentPopupID); - - textEntryGamePasswordID = TheNameKeyGenerator->nameToKey("PopupJoinGame.wnd:TextEntryGamePassword"); - textEntryGamePassword = TheWindowManager->winGetWindowFromId(parentPopup, textEntryGamePasswordID); - GadgetTextEntrySetText(textEntryGamePassword, UnicodeString::TheEmptyString); - - NameKeyType staticTextGameNameID = TheNameKeyGenerator->nameToKey("PopupJoinGame.wnd:StaticTextGameName"); - GameWindow *staticTextGameName = TheWindowManager->winGetWindowFromId(parentPopup, staticTextGameNameID); - GadgetStaticTextSetText(staticTextGameName, UnicodeString::TheEmptyString); - - buttonCancelID = NAMEKEY("PopupJoinGame.wnd:ButtonCancel"); - - GameSpyStagingRoom *ourRoom = TheGameSpyInfo->findStagingRoomByID(TheGameSpyInfo->getCurrentStagingRoomID()); - if (ourRoom) - GadgetStaticTextSetText(staticTextGameName, ourRoom->getGameName()); - - TheWindowManager->winSetFocus( parentPopup ); - TheWindowManager->winSetModal( parentPopup ); - -} - -//------------------------------------------------------------------------------------------------- -/** PopupHostGameInput callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PopupJoinGameInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; -// if (buttonPushed) -// break; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); - SetLobbyAttemptHostJoin( FALSE ); - parentPopup = nullptr; - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** PopupHostGameSystem callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PopupJoinGameSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - break; - - } - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if (controlID == buttonCancelID) - { - GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); - SetLobbyAttemptHostJoin( FALSE ); - parentPopup = nullptr; - } - break; - } - - //---------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - //--------------------------------------------------------------------------------------------- - case GEM_EDIT_DONE: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == textEntryGamePasswordID ) - { - // read the user's input and clear the entry box - UnicodeString txtInput; - txtInput.set(GadgetTextEntryGetText( textEntryGamePassword )); - GadgetTextEntrySetText(textEntryGamePassword, UnicodeString::TheEmptyString); - txtInput.trim(); - if (!txtInput.isEmpty()) - { - AsciiString munkee; - munkee.translate(txtInput); - joinGame(munkee); - } - } - break; - } - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -static void joinGame( AsciiString password ) -{ - GameSpyStagingRoom *ourRoom = TheGameSpyInfo->findStagingRoomByID(TheGameSpyInfo->getCurrentStagingRoomID()); - if (!ourRoom) - { - GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); - SetLobbyAttemptHostJoin( FALSE ); - parentPopup = nullptr; - return; - } - PeerRequest req; - req.peerRequestType = PeerRequest::PEERREQUEST_JOINSTAGINGROOM; - req.text = ourRoom->getGameName().str(); - req.stagingRoom.id = ourRoom->getID(); - req.password = password.str(); - TheGameSpyPeerMessageQueue->addRequest(req); - DEBUG_LOG(("Attempting to join game %d(%ls) with password [%s]", ourRoom->getID(), ourRoom->getGameName().str(), password.str())); - GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); - parentPopup = nullptr; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp deleted file mode 100644 index d1a5d1e96af..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp +++ /dev/null @@ -1,678 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: PopupLadderSelect.cpp //////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: August 2002 -// -// Filename: PopupLadderSelect.cpp -// -// author: Matthew D. Campbell -// -// purpose: Contains the Callbacks for the Ladder Select Popup -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GlobalData.h" -#include "Common/encrypt.h" -#include "Common/NameKeyGenerator.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameText.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/MapUtil.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameNetwork/GameSpy/LadderDefs.h" -#include "GameNetwork/GameSpy/PeerDefs.h" -//#include "GameNetwork/GameSpy/PeerThread.h" -#include "GameNetwork/GameSpyOverlay.h" - - -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -static NameKeyType parentID = NAMEKEY_INVALID; -static NameKeyType listboxLadderSelectID = NAMEKEY_INVALID; -static NameKeyType listboxLadderDetailsID = NAMEKEY_INVALID; -static NameKeyType staticTextLadderNameID = NAMEKEY_INVALID; -static NameKeyType buttonOkID = NAMEKEY_INVALID; -static NameKeyType buttonCancelID = NAMEKEY_INVALID; - -static GameWindow *parent = nullptr; -static GameWindow *listboxLadderSelect = nullptr; -static GameWindow *listboxLadderDetails = nullptr; -static GameWindow *staticTextLadderName = nullptr; -static GameWindow *buttonOk = nullptr; -static GameWindow *buttonCancel = nullptr; - -// password entry popup -static NameKeyType passwordParentID = NAMEKEY_INVALID; -static NameKeyType buttonPasswordOkID = NAMEKEY_INVALID; -static NameKeyType buttonPasswordCancelID = NAMEKEY_INVALID; -static NameKeyType textEntryPasswordID = NAMEKEY_INVALID; -static GameWindow *passwordParent = nullptr; -static GameWindow *textEntryPassword = nullptr; - -// incorrect password popup -static NameKeyType badPasswordParentID = NAMEKEY_INVALID; -static NameKeyType buttonBadPasswordOkID = NAMEKEY_INVALID; -static GameWindow *badPasswordParent = nullptr; - -static void updateLadderDetails( Int ladderID, GameWindow *staticTextLadderName, GameWindow *listboxLadderDetails ); - -void PopulateQMLadderComboBox(); -void PopulateCustomLadderComboBox(); - -void PopulateQMLadderListBox( GameWindow *win ); -void PopulateCustomLadderListBox( GameWindow *win ); - -void HandleQMLadderSelection(Int ladderID); -void HandleCustomLadderSelection(Int ladderID); - -void CustomMatchHideHostPopup(Bool hide); - -static void populateLadderComboBox() -{ - // only one of these will do any work... - PopulateQMLadderComboBox(); - PopulateCustomLadderComboBox(); -} - -static void populateLadderListBox() -{ - // only one of these will do any work... - PopulateQMLadderListBox(listboxLadderSelect); - PopulateCustomLadderListBox(listboxLadderSelect); - - Int selIndex, selID; - GadgetListBoxGetSelected(listboxLadderSelect, &selIndex); - if (selIndex < 0) - return; - selID = (Int)GadgetListBoxGetItemData(listboxLadderSelect, selIndex); - if (!selID) - return; - updateLadderDetails(selID, staticTextLadderName, listboxLadderDetails); -} - -static void handleLadderSelection( Int ladderID ) -{ - // only one of these will do any work... - HandleQMLadderSelection(ladderID); - HandleCustomLadderSelection(ladderID); -} - - -enum PasswordMode CPP_11(: Int) -{ - PASS_NONE, - PASS_ENTRY, - PASS_ERROR -}; - -static PasswordMode s_currentMode = PASS_NONE; -static void setPasswordMode(PasswordMode mode) -{ - s_currentMode = mode; - switch(mode) - { - case PASS_NONE: - if (passwordParent) - passwordParent->winHide(TRUE); - if (badPasswordParent) - badPasswordParent->winHide(TRUE); - if (buttonOk) - buttonOk->winEnable(TRUE); - if (buttonCancel) - buttonCancel->winEnable(TRUE); - if (textEntryPassword) - textEntryPassword->winEnable(FALSE); - if (listboxLadderSelect) - listboxLadderSelect->winEnable(TRUE); - TheWindowManager->winSetFocus(listboxLadderSelect); - break; - case PASS_ENTRY: - if (passwordParent) - passwordParent->winHide(FALSE); - if (badPasswordParent) - badPasswordParent->winHide(TRUE); - if (buttonOk) - buttonOk->winEnable(FALSE); - if (buttonCancel) - buttonCancel->winEnable(FALSE); - if (textEntryPassword) - { - textEntryPassword->winEnable(TRUE); - GadgetTextEntrySetText(textEntryPassword, UnicodeString::TheEmptyString); - } - if (listboxLadderSelect) - listboxLadderSelect->winEnable(FALSE); - TheWindowManager->winSetFocus(textEntryPassword); - break; - case PASS_ERROR: - if (passwordParent) - passwordParent->winHide(TRUE); - if (badPasswordParent) - badPasswordParent->winHide(FALSE); - if (buttonOk) - buttonOk->winEnable(FALSE); - if (buttonCancel) - buttonCancel->winEnable(FALSE); - if (textEntryPassword) - textEntryPassword->winEnable(FALSE); - if (listboxLadderSelect) - listboxLadderSelect->winEnable(FALSE); - TheWindowManager->winSetFocus(parent); - break; - } -} - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//------------------------------------------------------------------------------------------------- -/** Initialize the menu */ -//------------------------------------------------------------------------------------------------- -void PopupLadderSelectInit( WindowLayout *layout, void *userData ) -{ - parentID = NAMEKEY("PopupLadderSelect.wnd:Parent"); - parent = TheWindowManager->winGetWindowFromId(nullptr, parentID); - - listboxLadderSelectID = NAMEKEY("PopupLadderSelect.wnd:ListBoxLadderSelect"); - listboxLadderSelect = TheWindowManager->winGetWindowFromId(parent, listboxLadderSelectID); - - listboxLadderDetailsID = NAMEKEY("PopupLadderSelect.wnd:ListBoxLadderDetails"); - listboxLadderDetails = TheWindowManager->winGetWindowFromId(parent, listboxLadderDetailsID); - - staticTextLadderNameID = NAMEKEY("PopupLadderSelect.wnd:StaticTextLadderName"); - staticTextLadderName = TheWindowManager->winGetWindowFromId(parent, staticTextLadderNameID); - - buttonOkID = NAMEKEY("PopupLadderSelect.wnd:ButtonOk"); - buttonCancelID = NAMEKEY("PopupLadderSelect.wnd:ButtonCancel"); - - buttonOk = TheWindowManager->winGetWindowFromId(parent, buttonOkID); - buttonCancel = TheWindowManager->winGetWindowFromId(parent, buttonCancelID); - - TheWindowManager->winSetFocus( parent ); - TheWindowManager->winSetModal( parent ); - - // password entry popup - passwordParentID = NAMEKEY("PopupLadderSelect.wnd:PasswordParent"); - passwordParent = TheWindowManager->winGetWindowFromId(parent, passwordParentID); - buttonPasswordOkID = NAMEKEY("PopupLadderSelect.wnd:ButtonPasswordOk"); - buttonPasswordCancelID = NAMEKEY("PopupLadderSelect.wnd:ButtonPasswordCancel"); - textEntryPasswordID = NAMEKEY("PopupLadderSelect.wnd:PasswordEntry"); - textEntryPassword = TheWindowManager->winGetWindowFromId(parent, textEntryPasswordID); - - // bad password popup - badPasswordParentID = NAMEKEY("PopupLadderSelect.wnd:BadPasswordParent"); - badPasswordParent = TheWindowManager->winGetWindowFromId(parent, badPasswordParentID); - buttonBadPasswordOkID = NAMEKEY("PopupLadderSelect.wnd:ButtonBadPasswordOk"); - - setPasswordMode(PASS_NONE); - - CustomMatchHideHostPopup(TRUE); - - // populate list box (based on whether we're in custom or quickmatch) - populateLadderListBox(); -} - -//------------------------------------------------------------------------------------------------- -/** Input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PopupLadderSelectInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; -// if (buttonPushed) -// break; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - switch (s_currentMode) - { - case PASS_NONE: - // re-select whatever was chosen before - populateLadderComboBox(); - GameSpyCloseOverlay(GSOVERLAY_LADDERSELECT); - break; - case PASS_ENTRY: - case PASS_ERROR: - setPasswordMode(PASS_NONE); - break; - } - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -static Int ladderIndex = 0; -void ladderSelectedCallback() -{ - handleLadderSelection( ladderIndex ); - - // update combo box - populateLadderComboBox(); - - // tear down overlay - GameSpyCloseOverlay( GSOVERLAY_LADDERSELECT ); -} - -//------------------------------------------------------------------------------------------------- -/** System callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PopupLadderSelectSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - break; - } - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - parent = nullptr; - listboxLadderSelect = nullptr; - listboxLadderDetails = nullptr; - CustomMatchHideHostPopup(FALSE); - break; - } - - //---------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - // if we're given the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - break; - } - //---------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if (controlID == buttonOkID) - { - // save selection - Int selectPos = -1; - GadgetListBoxGetSelected( listboxLadderSelect, &selectPos ); - if (selectPos < 0) - break; - - ladderIndex = (Int)GadgetListBoxGetItemData( listboxLadderSelect, selectPos, 0 ); - const LadderInfo *li = TheLadderList->findLadderByIndex( ladderIndex ); - if (li && li->cryptedPassword.isNotEmpty()) - { - // need password asking - setPasswordMode(PASS_ENTRY); - } - else - { - ladderSelectedCallback(); - } - } - else if (controlID == buttonCancelID) - { - // reset what had been - populateLadderComboBox(); - - // tear down overlay - GameSpyCloseOverlay( GSOVERLAY_LADDERSELECT ); - } - else if (controlID == buttonPasswordOkID) - { - const LadderInfo *li = TheLadderList->findLadderByIndex( ladderIndex ); - if (!li || li->cryptedPassword.isEmpty()) - { - // eh? something's not right. just pretend they typed something wrong... - setPasswordMode(PASS_ERROR); - break; - } - - AsciiString pass; - pass.translate(GadgetTextEntryGetText(textEntryPassword)); - if ( pass.isNotEmpty() ) // password ok - { - AsciiString cryptPass = EncryptString(pass.str()); - DEBUG_LOG(("pass is %s, crypted pass is %s, comparing to %s", - pass.str(), cryptPass.str(), li->cryptedPassword.str())); - if (cryptPass == li->cryptedPassword) - ladderSelectedCallback(); - else - setPasswordMode(PASS_ERROR); - } - else - { - setPasswordMode(PASS_ERROR); - } - } - else if (controlID == buttonPasswordCancelID) - { - setPasswordMode(PASS_NONE); - } - else if (controlID == buttonBadPasswordOkID) - { - setPasswordMode(PASS_NONE); - } - break; - } - - //--------------------------------------------------------------------------------------------- - case GLM_SELECTED: - { - Int selIndex, selID; - GadgetListBoxGetSelected(listboxLadderSelect, &selIndex); - if (selIndex < 0) - break; - - selID = (Int)GadgetListBoxGetItemData(listboxLadderSelect, selIndex); - if (!selID) - break; - - updateLadderDetails(selID, staticTextLadderName, listboxLadderDetails); - break; - } - - //--------------------------------------------------------------------------------------------- - case GLM_DOUBLE_CLICKED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - Int selectPos = (Int)mData2; - GadgetListBoxSetSelected(control, &selectPos); - - if( controlID == listboxLadderSelectID ) - { - TheWindowManager->winSendSystemMsg( parent, GBM_SELECTED, - (WindowMsgData)buttonOk, buttonOk->winGetWindowId() ); - } - break; - } - - //--------------------------------------------------------------------------------------------- - case GEM_EDIT_DONE: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if (controlID == textEntryPasswordID) - { - TheWindowManager->winSendSystemMsg( parent, GBM_SELECTED, - (WindowMsgData)(TheWindowManager->winGetWindowFromId(passwordParent, buttonPasswordOkID)), buttonPasswordOkID ); - } - break; - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -static void updateLadderDetails( Int selID, GameWindow *staticTextLadderName, GameWindow *listboxLadderDetails ) -{ - if (!staticTextLadderName || !listboxLadderDetails) - return; - - GadgetStaticTextSetText(staticTextLadderName, UnicodeString::TheEmptyString); - GadgetListBoxReset(listboxLadderDetails); - - const LadderInfo *info = TheLadderList->findLadderByIndex(selID); - if (!info) - return; - - UnicodeString line; - Color color = GameMakeColor( 255, 255, 255, 255 ); - Color captionColor = GameMakeColor( 0, 255, 255, 255 ); - - // name - line.format(TheGameText->fetch("GUI:LadderNameAndSize"), info->name.str(), info->playersPerTeam, info->playersPerTeam); - GadgetStaticTextSetText(staticTextLadderName, line); - - // location - if (!info->location.isEmpty()) - GadgetListBoxAddEntryText(listboxLadderDetails, info->location, captionColor, -1); - - // homepage - line.format(TheGameText->fetch("GUI:LadderURL"), info->homepageURL.str()); - GadgetListBoxAddEntryText(listboxLadderDetails, line, captionColor, -1); - - // description - if (!info->description.isEmpty()) - GadgetListBoxAddEntryText(listboxLadderDetails, info->description, color, -1); - - // requires password? - if (info->cryptedPassword.isNotEmpty()) - { - GadgetListBoxAddEntryText(listboxLadderDetails, TheGameText->fetch("GUI:LadderHasPassword"), captionColor, -1); - } - - // wins limits - if (info->minWins) - { - line.format(TheGameText->fetch("GUI:LadderMinWins"), info->minWins); - GadgetListBoxAddEntryText(listboxLadderDetails, line, captionColor, -1); - } - if (info->maxWins) - { - line.format(TheGameText->fetch("GUI:LadderMaxWins"), info->maxWins); - GadgetListBoxAddEntryText(listboxLadderDetails, line, captionColor, -1); - } - - // random factions? - if (info->randomFactions) - { - GadgetListBoxAddEntryText(listboxLadderDetails, TheGameText->fetch("GUI:LadderRandomFactions"), captionColor, -1); - } - else - { - GadgetListBoxAddEntryText(listboxLadderDetails, TheGameText->fetch("GUI:LadderFactions"), captionColor, -1); - } - - // factions - AsciiStringList validFactions = info->validFactions; - AsciiStringListIterator it = validFactions.begin(); - for (; it != validFactions.end(); ++it) - { - AsciiString marker; - marker.format("INI:Faction%s", it->str()); - GadgetListBoxAddEntryText(listboxLadderDetails, TheGameText->fetch(marker), color, -1); - } - - // random maps? - if (info->randomMaps) - { - GadgetListBoxAddEntryText(listboxLadderDetails, TheGameText->fetch("GUI:LadderRandomMaps"), captionColor, -1); - } - else - { - GadgetListBoxAddEntryText(listboxLadderDetails, TheGameText->fetch("GUI:LadderMaps"), captionColor, -1); - } - - // maps - AsciiStringList validMaps = info->validMaps; - for (it = validMaps.begin(); it != validMaps.end(); ++it) - { - const MapMetaData *md = TheMapCache->findMap(*it); - if (md) - { - GadgetListBoxAddEntryText(listboxLadderDetails, md->m_displayName, color, -1); - } - } -} - -static void closeRightClickMenu(GameWindow *win) -{ - - if(win) - { - WindowLayout *winLay = win->winGetLayout(); - if(!winLay) - return; - winLay->destroyWindows(); - deleteInstance(winLay); - winLay = nullptr; - - } -} -void RCGameDetailsMenuInit( WindowLayout *layout, void *userData ) -{ -} - -WindowMsgHandledType RCGameDetailsMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - - static NameKeyType ladderInfoID = NAMEKEY_INVALID; - static NameKeyType buttonOkID = NAMEKEY_INVALID; - switch( msg ) - { - - case GWM_CREATE: - { - ladderInfoID = NAMEKEY("RCGameDetailsMenu.wnd:ButtonLadderDetails"); - buttonOkID = NAMEKEY("PopupLadderDetails.wnd:ButtonOk"); - break; - } - - case GGM_CLOSE: - { - closeRightClickMenu(window); - //rcMenu = nullptr; - break; - } - - case GWM_DESTROY: - { - break; - } - - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - Int selectedID = (Int)window->winGetUserData(); - if(!selectedID) - break; - closeRightClickMenu(window); - - if (controlID == ladderInfoID) - { - StagingRoomMap *srm = TheGameSpyInfo->getStagingRoomList(); - StagingRoomMap::iterator srmIt = srm->find(selectedID); - if (srmIt != srm->end()) - { - GameSpyStagingRoom *theRoom = srmIt->second; - if (!theRoom) - break; - const LadderInfo *linfo = TheLadderList->findLadder(theRoom->getLadderIP(), theRoom->getLadderPort()); - if (linfo) - { - WindowLayout *rcLayout = TheWindowManager->winCreateLayout("Menus/PopupLadderDetails.wnd"); - if (!rcLayout) - break; - - GameWindow *rcMenu = rcLayout->getFirstWindow(); - rcMenu->winGetLayout()->runInit(); - rcMenu->winBringToTop(); - rcMenu->winHide(FALSE); - - rcMenu->winSetUserData((void *)selectedID); - TheWindowManager->winSetLoneWindow(rcMenu); - - GameWindow *st = TheWindowManager->winGetWindowFromId(nullptr, - NAMEKEY("PopupLadderDetails.wnd:StaticTextLadderName")); - GameWindow *lb = TheWindowManager->winGetWindowFromId(nullptr, - NAMEKEY("PopupLadderDetails.wnd:ListBoxLadderDetails")); - updateLadderDetails(selectedID, st, lb); - } - } - } - break; - } - default: - return MSG_IGNORED; - - } - return MSG_HANDLED; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp deleted file mode 100644 index fbce261d6a1..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp +++ /dev/null @@ -1,485 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: PopupReplay.cpp ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: Generals -// -// File name: PopupReplay.cpp -// -// Created: Matthew D. Campbell, November 2002 -// -// Desc: the Replay Save window control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/LocalFileSystem.h" -#include "Common/MessageStream.h" -#include "Common/Recorder.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/GameText.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GUICallbacks.h" -#include "GameClient/MessageBox.h" -#include "GameClient/Shell.h" -#include "GameLogic/GameLogic.h" - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -static NameKeyType buttonBackKey = NAMEKEY_INVALID; -static NameKeyType buttonSaveKey = NAMEKEY_INVALID; -static NameKeyType listboxGamesKey = NAMEKEY_INVALID; -static NameKeyType textEntryReplayNameKey = NAMEKEY_INVALID; - -static GameWindow *parent = nullptr; -static GameWindow *replaySavedParent = nullptr; - -static time_t s_fileSavePopupStartTime = 0; -static const time_t s_fileSavePopupDuration = 1000; - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// -extern void PopulateReplayFileListbox(GameWindow *listbox); -extern void ScoreScreenEnableControls(Bool enable); -extern UnicodeString GetReplayFilenameFromListbox(GameWindow *listbox, Int index); -extern std::string LastReplayFileName; - -//------------------------------------------------------------------------------------------------- -/** Show or hide the "Replay Saved" popup */ -//------------------------------------------------------------------------------------------------- -void ShowReplaySavedPopup(Bool show) -{ - if (replaySavedParent != nullptr) { - if (show) { - replaySavedParent->winHide(FALSE); - } else { - replaySavedParent->winHide(TRUE); - } - } -} - -// ------------------------------------------------------------------------------------------------ -/** Close the save/load menu */ -// ------------------------------------------------------------------------------------------------ -static void closeSaveMenu( GameWindow *window ) -{ - WindowLayout *layout = window->winGetLayout(); - - if( layout ) - layout->hide( TRUE ); - -} - -//------------------------------------------------------------------------------------------------- -/** Initialize the SaveLoad menu */ -//------------------------------------------------------------------------------------------------- -void PopupReplayInit( WindowLayout *layout, void *userData ) -{ - - // get ids for our children controls - buttonBackKey = NAMEKEY( "PopupReplay.wnd:ButtonBack" ); - buttonSaveKey = NAMEKEY( "PopupReplay.wnd:ButtonSave" ); - listboxGamesKey = NAMEKEY( "PopupReplay.wnd:ListboxGames" ); - textEntryReplayNameKey = NAMEKEY( "PopupReplay.wnd:TextEntryReplayName" ); - - //set keyboard focus to main parent and set modal - NameKeyType parentID = TheNameKeyGenerator->nameToKey("PopupReplay.wnd:PopupReplayMenu"); - parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); - TheWindowManager->winSetFocus( parent ); - - NameKeyType replaySavedParentID = TheNameKeyGenerator->nameToKey("PopupReplay.wnd:PopupReplaySaved"); - replaySavedParent = TheWindowManager->winGetWindowFromId( nullptr, replaySavedParentID); - if (replaySavedParent == nullptr) { - DEBUG_CRASH(("replaySavedParent == nullptr")); - } - - ShowReplaySavedPopup(FALSE); - - // enable the menu action buttons - GameWindow *buttonFrame = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( "PopupReplay.wnd:MenuButtonFrame" ) ); - buttonFrame->winEnable( TRUE ); - - // get the listbox that will have the save games in it - GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( nullptr, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != nullptr, ("PopupReplayInit - Unable to find games listbox") ); - - // populate the listbox with the save games on disk - PopulateReplayFileListbox(listboxGames); - - GameWindow *textEntryReplayName = TheWindowManager->winGetWindowFromId( parent, textEntryReplayNameKey ); - GadgetTextEntrySetText(textEntryReplayName, UnicodeString::TheEmptyString); - TheWindowManager->winSetFocus( textEntryReplayName ); - - //Disable the button immediately as the code above us starts off with an empty string. - GameWindow *control = TheWindowManager->winGetWindowFromId( parent, buttonSaveKey ); - if( control ) - { - control->winEnable( FALSE ); - } - -} - -//------------------------------------------------------------------------------------------------- -/** SaveLoad menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void PopupReplayShutdown( WindowLayout *layout, void *userData ) -{ - parent = nullptr; - -} - -//------------------------------------------------------------------------------------------------- -/** SaveLoad menu update method */ -//------------------------------------------------------------------------------------------------- -void PopupReplayUpdate( WindowLayout *layout, void *userData ) -{ - - if (s_fileSavePopupStartTime != 0) - { - // the replay save confirmation popup is up - // check to see if its time to take it down. - if ((timeGetTime() - s_fileSavePopupStartTime) >= s_fileSavePopupDuration) - { - ShowReplaySavedPopup(FALSE); - - // close the save/load menu - closeSaveMenu( parent ); - ScoreScreenEnableControls(TRUE); - - // reset the timer to 0 cause we have to. - s_fileSavePopupStartTime = 0; - } - } -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -WindowMsgHandledType PopupReplayInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - GameWindow *button = TheWindowManager->winGetWindowFromId( parent, buttonBackKey ); - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)button, buttonBackKey ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; -} - -static void reallySaveReplay(); -static std::string replayPath; - -// ------------------------------------------------------------------------------------------------ -/** Save the replay */ -// ------------------------------------------------------------------------------------------------ -static GameWindow *messageBoxWin = nullptr; -static void saveReplay( UnicodeString filename ) -{ - AsciiString translated; - if (filename == TheGameText->fetch("GUI:LastReplay")) - { - translated = TheRecorder->getLastReplayFileName(); - } - else - { - translated.translate(filename); - } - - AsciiString fullPath = TheRecorder->getReplayDir(); - fullPath.concat(translated); - fullPath.concat(TheRecorder->getReplayExtention()); - - replayPath = fullPath.str(); - messageBoxWin = nullptr; - if (TheLocalFileSystem->doesFileExist(fullPath.str())) - { - messageBoxWin = MessageBoxOkCancel(TheGameText->fetch("GUI:OverwriteReplayTitle"), TheGameText->fetch("GUI:OverwriteReplay"), reallySaveReplay, nullptr); - } - else - { - reallySaveReplay(); - } -} -void reallySaveReplay() -{ - AsciiString filename = replayPath.c_str(); - - AsciiString oldFilename; - oldFilename = TheRecorder->getReplayDir(); - oldFilename.concat(LastReplayFileName.c_str()); - oldFilename.concat(TheRecorder->getReplayExtention()); - - if (oldFilename == filename) - return; - - if (TheLocalFileSystem->doesFileExist(filename.str())) - { - if(DeleteFile(filename.str()) == 0) - { - wchar_t buffer[1024]; - FormatMessageW ( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), nullptr); - UnicodeString errorStr; - errorStr.set(buffer); - errorStr.trim(); - if(messageBoxWin) - { - TheWindowManager->winUnsetModal(messageBoxWin); - messageBoxWin = nullptr; - } - MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, nullptr); - - // get the listbox that will have the save games in it - GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( parent, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != nullptr, ("reallySaveReplay - Unable to find games listbox") ); - - // populate the listbox with the save games on disk - PopulateReplayFileListbox(listboxGames); - return; - } - } - - // copy the replay to the right place - if(CopyFile(oldFilename.str(),filename.str(), FALSE) == 0) - { - wchar_t buffer[1024]; - FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), nullptr); - UnicodeString errorStr; - errorStr.set(buffer); - errorStr.trim(); - if(messageBoxWin) - { - TheWindowManager->winUnsetModal(messageBoxWin); - messageBoxWin = nullptr; - } - MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, nullptr); - return; - } - - // get the listbox that will have the save games in it - GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( parent, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != nullptr, ("reallySaveReplay - Unable to find games listbox") ); - - // populate the listbox with the save games on disk - PopulateReplayFileListbox(listboxGames); - - ShowReplaySavedPopup(TRUE); - s_fileSavePopupStartTime = timeGetTime(); -} - -//------------------------------------------------------------------------------------------------- -/** SaveLoad menu system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PopupReplaySystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - break; - - } - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - //---------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - - // -------------------------------------------------------------------------------------------- - case GLM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - - GameWindow *listboxGames = TheWindowManager->winGetWindowFromId( window, listboxGamesKey ); - DEBUG_ASSERTCRASH( listboxGames != nullptr, ("PopupReplaySystem - Unable to find games listbox") ); - - // - // handle games listbox, when certain items are selected in the listbox only some - // commands are available - // - if( control == listboxGames ) - { - int rowSelected = mData2; - if (rowSelected >= 0) - { - UnicodeString filename; - filename = GadgetListBoxGetText(listboxGames, rowSelected); - GameWindow *textEntryReplayName = TheWindowManager->winGetWindowFromId( window, textEntryReplayNameKey ); - DEBUG_ASSERTCRASH( textEntryReplayName != nullptr, ("PopupReplaySystem - Unable to find text entry") ); - GadgetTextEntrySetText(textEntryReplayName, filename); - } - } - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GEM_EDIT_DONE: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == textEntryReplayNameKey ) - { - UnicodeString filename = GadgetTextEntryGetText( control ); - if (filename.isEmpty()) - break; - - saveReplay(filename); - - } - - break; - - } - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == buttonSaveKey ) - { - // get the filename, and see if we are overwriting - GameWindow *textEntryReplayName = TheWindowManager->winGetWindowFromId( window, textEntryReplayNameKey ); - DEBUG_ASSERTCRASH( textEntryReplayName != nullptr, ("PopupReplaySystem - Unable to find text entry") ); - - UnicodeString filename = GadgetTextEntryGetText( textEntryReplayName ); - if (filename.isEmpty()) - break; - - saveReplay(filename); - - } - else if( controlID == buttonBackKey ) - { - - // close the save/load menu - closeSaveMenu( window ); - ScoreScreenEnableControls(TRUE); - - } - - break; - - } - - case GEM_UPDATE_TEXT: - { - //Kris: - //Enable or disable the save button -- disabled when empty. - GameWindow *control = TheWindowManager->winGetWindowFromId( parent, textEntryReplayNameKey ); - if( control ) - { - UnicodeString filename; - filename.set( GadgetTextEntryGetText( control ) ); - control = TheWindowManager->winGetWindowFromId( parent, buttonSaveKey ); - if( control ) - { - if( filename.isEmpty() ) - { - control->winEnable( FALSE ); - } - else - { - control->winEnable( TRUE ); - } - } - } - - break; - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp deleted file mode 100644 index d5b957f7dfb..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +++ /dev/null @@ -1,555 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: QuitMenu.cpp ///////////////////////////////////////////////////////////////////////////// -// Author: Colin Day, October 2001 -// Description: Quit menu window callbacks -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/FramePacer.h" -#include "Common/GameEngine.h" -#include "Common/GameState.h" -#include "Common/MessageStream.h" -#include "Common/Player.h" -#include "Common/PlayerList.h" -#include "Common/RandomValue.h" -#include "Common/Recorder.h" -#include "GameClient/GUICallbacks.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Gadget.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/GameText.h" -#include "GameClient/MessageBox.h" -#include "GameClient/Shell.h" -#include "GameClient/InGameUI.h" -#include "GameLogic/GameLogic.h" -#include "GameLogic/VictoryConditions.h" -#include "GameClient/ControlBar.h" -#include "GameClient/GameWindowTransitions.h" -#include "GameClient/DisconnectMenu.h" -#include "GameLogic/ScriptEngine.h" - - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -static WindowLayout *quitMenuLayout = nullptr; -static WindowLayout *fullQuitMenuLayout = nullptr; -static WindowLayout *noSaveLoadQuitMenuLayout = nullptr; - -static Bool isVisible = FALSE; - -static GameWindow *quitConfirmationWindow = nullptr; - -//external declarations of the Gadgets the callbacks can use -static WindowLayout *saveLoadMenuLayout = nullptr; - -static GameWindow *buttonRestartWin = nullptr; -static GameWindow *buttonSaveLoadWin = nullptr; -static GameWindow *buttonOptionsWin = nullptr; -static GameWindow *buttonExitWin = nullptr; - -static NameKeyType buttonExit = NAMEKEY_INVALID; -static NameKeyType buttonRestart = NAMEKEY_INVALID; -static NameKeyType buttonReturn = NAMEKEY_INVALID; -static NameKeyType buttonOptions = NAMEKEY_INVALID; -static NameKeyType buttonSaveLoad = NAMEKEY_INVALID; - -static void initGadgetsFullQuit() -{ - buttonExit = TheNameKeyGenerator->nameToKey( "QuitMenu.wnd:ButtonExit" ); - buttonRestart = TheNameKeyGenerator->nameToKey( "QuitMenu.wnd:ButtonRestart" ); - buttonReturn = TheNameKeyGenerator->nameToKey( "QuitMenu.wnd:ButtonReturn" ); - buttonOptions = TheNameKeyGenerator->nameToKey( "QuitMenu.wnd:ButtonOptions" ); - buttonSaveLoad = TheNameKeyGenerator->nameToKey( "QuitMenu.wnd:ButtonSaveLoad" ); - - buttonRestartWin = TheWindowManager->winGetWindowFromId( nullptr, buttonRestart ); - buttonSaveLoadWin = TheWindowManager->winGetWindowFromId( nullptr, buttonSaveLoad ); - buttonOptionsWin = TheWindowManager->winGetWindowFromId( nullptr, buttonOptions ); - buttonExitWin = TheWindowManager->winGetWindowFromId( nullptr, buttonExit ); -} - -static void initGadgetsNoSaveQuit() -{ - buttonExit = TheNameKeyGenerator->nameToKey( "QuitNoSave.wnd:ButtonExit" ); - buttonRestart = TheNameKeyGenerator->nameToKey( "QuitNoSave.wnd:ButtonRestart" ); - buttonReturn = TheNameKeyGenerator->nameToKey( "QuitNoSave.wnd:ButtonReturn" ); - buttonOptions = TheNameKeyGenerator->nameToKey( "QuitNoSave.wnd:ButtonOptions" ); - buttonSaveLoad = NAMEKEY_INVALID; - - buttonRestartWin = TheWindowManager->winGetWindowFromId( nullptr, buttonRestart ); - buttonOptionsWin = TheWindowManager->winGetWindowFromId( nullptr, buttonOptions ); - buttonSaveLoadWin = nullptr; - buttonExitWin = TheWindowManager->winGetWindowFromId( nullptr, buttonExit ); - -} - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// - -void destroyQuitMenu() -{ - // destroy the quit menu - quitConfirmationWindow = nullptr; - if(fullQuitMenuLayout) - { - fullQuitMenuLayout->destroyWindows(); - deleteInstance(fullQuitMenuLayout); - fullQuitMenuLayout = nullptr; - } - if(noSaveLoadQuitMenuLayout) - { - noSaveLoadQuitMenuLayout->destroyWindows(); - deleteInstance(noSaveLoadQuitMenuLayout); - noSaveLoadQuitMenuLayout = nullptr; - } - quitMenuLayout = nullptr; - isVisible = FALSE; - - TheInGameUI->setQuitMenuVisible(FALSE); -} - -/** - * quits the program - */ -static void exitQuitMenu() -{ - // destroy the quit menu - destroyQuitMenu(); - - // clear out all the game data - if ( TheGameLogic->isInMultiplayerGame() && !TheGameLogic->isInSkirmishGame() && !TheGameInfo->isSandbox() ) - { - GameMessage *msg = TheMessageStream->appendMessage(GameMessage::MSG_SELF_DESTRUCT); - msg->appendBooleanArgument(TRUE); - } - TheGameLogic->exitGame(); - // TheGameLogic->clearGameData(); - // display the menu on top of the shell stack - // TheShell->showShell(); - - // this will trigger an exit - // TheGameEngine->setQuitting( TRUE ); - TheInGameUI->setClientQuiet( TRUE ); -} -static void noExitQuitMenu() -{ - quitConfirmationWindow = nullptr; -} - -static void quitToDesktopQuitMenu() -{ - // destroy the quit menu - destroyQuitMenu(); - - if (TheGameLogic->isInGame()) - { - if (TheRecorder->getMode() == RECORDERMODETYPE_RECORD) - { - TheRecorder->stopRecording(); - } - TheGameLogic->clearGameData(); - } - TheGameEngine->setQuitting(TRUE); - TheInGameUI->setClientQuiet( TRUE ); - -} - -static void surrenderQuitMenu() -{ - // destroy the quit menu - destroyQuitMenu(); - - if (TheVictoryConditions->isLocalAlliedVictory()) - return; - - GameMessage *msg = TheMessageStream->appendMessage(GameMessage::MSG_SELF_DESTRUCT); - msg->appendBooleanArgument(TRUE); - - TheInGameUI->setClientQuiet( TRUE ); -} - -static void restartMissionMenu() -{ - // destroy the quit menu - destroyQuitMenu(); - - Int gameMode = TheGameLogic->getGameMode(); - AsciiString mapName = TheGlobalData->m_mapName; - - // TheSuperHackers @bugfix Caball009 07/02/2026 Reuse the previous seed value for the new skirmish match to prevent mismatches. - // Campaign, challenge, and skirmish single-player scenarios all use GAME_SINGLE_PLAYER and are expected to use 0 as seed value. - DEBUG_ASSERTCRASH((TheSkirmishGameInfo != nullptr) == (gameMode == GAME_SKIRMISH), ("Unexpected game mode on map / mission restart")); - const Int seed = TheSkirmishGameInfo ? TheSkirmishGameInfo->getSeed() : 0; - - // - // if the map name was from a save game it will have "Save/" at the front of it, - // we want to go back to the original pristine map string for the map name when restarting - // - if (TheGameState->isInSaveDirectory(mapName)) - mapName = TheGameState->getPristineMapName(); - - // End the current game - AsciiString replayFile = TheRecorder->getCurrentReplayFilename(); - if (TheRecorder->getMode() == RECORDERMODETYPE_RECORD) - { - TheRecorder->stopRecording(); - } - - Int rankPointsStartedWith = TheGameLogic->getRankPointsToAddAtGameStart();// must write down before reset - GameDifficulty diff = TheScriptEngine->getGlobalDifficulty(); - Int fps = TheFramePacer->getFramesPerSecondLimit(); - - TheGameLogic->clearGameData(FALSE); - TheGameEngine->setQuitting(FALSE); - - if (replayFile.isNotEmpty()) - { - TheRecorder->playbackFile(replayFile); - } - else - { - // send a message to the logic for a new game - TheWritableGlobalData->m_pendingFile = mapName; - GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_NEW_GAME ); - msg->appendIntegerArgument(gameMode); - msg->appendIntegerArgument(diff); - msg->appendIntegerArgument(rankPointsStartedWith); - msg->appendIntegerArgument(fps); - DEBUG_LOG(("Restarting game mode %d, Diff=%d, RankPoints=%d", gameMode, - TheScriptEngine->getGlobalDifficulty(), - rankPointsStartedWith) - ); - - InitRandom(seed); - } - //TheTransitionHandler->remove("QuitFull"); //KRISMORNESS ADD - //quitMenuLayout = nullptr; //KRISMORNESS ADD - //isVisible = TRUE; //KRISMORNESS ADD - //HideQuitMenu(); //KRISMORNESS ADD - TheInGameUI->setClientQuiet( TRUE ); -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void HideQuitMenu() -{ - // Note: This is called as a safety a lot, without checking for the prescence of the quit menu. - // So don't do anything that counts on that menu actually being here. - if(!isVisible) - return; - if(quitMenuLayout && quitMenuLayout == noSaveLoadQuitMenuLayout) - TheTransitionHandler->reverse("QuitNoSaveBack"); - else if( quitMenuLayout && quitMenuLayout == fullQuitMenuLayout) - TheTransitionHandler->reverse("QuitFullBack"); - - TheInGameUI->setQuitMenuVisible( FALSE ); - isVisible = FALSE; - if (quitConfirmationWindow) - TheWindowManager->winDestroy(quitConfirmationWindow); - quitConfirmationWindow = nullptr; - if ( !TheGameLogic->isInMultiplayerGame() ) - TheGameLogic->setGamePaused(FALSE); - -} - -//------------------------------------------------------------------------------------------------- -/** Toggle visibility of the quit menu */ -//------------------------------------------------------------------------------------------------- -void ToggleQuitMenu() -{ - if (TheGameLogic->isIntroMoviePlaying() || TheGameLogic->isLoadingMap() ||TheScriptEngine->isGameEnding()) - return; - - // BGC- If we are currently in the disconnect screen, don't let the quit menu come up. - if (TheDisconnectMenu != nullptr) { - if (TheDisconnectMenu->isScreenVisible() == TRUE) { - return; - } - } - - // BGC- this is kind of hackish, but its the safest way to do it I think. - // Basically we're seeing if either the save/load window or the options window is up - // and if one of them is, we quit out of them rather than toggle the quit menu. - if (TheShell->getOptionsLayout(FALSE) != FALSE) { - WindowLayout *optLayout = TheShell->getOptionsLayout(FALSE); - GameWindow *optionsParent = optLayout->getFirstWindow(); - DEBUG_ASSERTCRASH(optionsParent != nullptr, ("Not able to get the options layout parent window")); - GameWindow *optionsBack = TheWindowManager->winGetWindowFromId(optionsParent, TheNameKeyGenerator->nameToKey( "OptionsMenu.wnd:ButtonBack" )); - DEBUG_ASSERTCRASH(optionsBack != nullptr, ("Not able to get the back button window from the options menu")); - TheWindowManager->winSendSystemMsg(optLayout->getFirstWindow(), GBM_SELECTED, (WindowMsgData)optionsBack, 0); - return; - } - if ((saveLoadMenuLayout != nullptr) && (saveLoadMenuLayout->isHidden() == FALSE)) - { - GameWindow *saveLoadParent = saveLoadMenuLayout->getFirstWindow(); - DEBUG_ASSERTCRASH(saveLoadParent != nullptr, ("Not able to get the save/load layout parent window")); - GameWindow *saveLoadBack = TheWindowManager->winGetWindowFromId(saveLoadParent, TheNameKeyGenerator->nameToKey( "PopupSaveLoad.wnd:ButtonBack" )); - DEBUG_ASSERTCRASH(saveLoadBack != nullptr, ("Not able to get the back button window from the save/load menu")); - TheWindowManager->winSendSystemMsg(saveLoadMenuLayout->getFirstWindow(), GBM_SELECTED, (WindowMsgData)saveLoadBack, 0); - saveLoadMenuLayout = nullptr; - return; - } - - // if we're visible hide our quit menu - if(isVisible && quitMenuLayout) - { - - isVisible = FALSE; - - if (quitConfirmationWindow) - TheWindowManager->winDestroy(quitConfirmationWindow); - quitConfirmationWindow = nullptr; - - if ( !TheGameLogic->isInMultiplayerGame() ) - TheGameLogic->setGamePaused(FALSE); - if(quitMenuLayout && quitMenuLayout == noSaveLoadQuitMenuLayout) - TheTransitionHandler->reverse("QuitNoSaveBack"); - else if( quitMenuLayout && quitMenuLayout == fullQuitMenuLayout ) - { - TheTransitionHandler->reverse("QuitFullBack"); - //begin KRISMORNESS - //TheTransitionHandler->reverse("QuitFull"); - //if( TheTransitionHandler->areTransitionsEnabled() ) - //else - //{ - // TheTransitionHandler->remove("QuitFull"); - // quitMenuLayout = nullptr; - // isVisible = TRUE; - // HideQuitMenu(); - //} - //end KRISMORNESS - } - } - else - { - - TheMouse->setCursor( Mouse::ARROW ); - - TheControlBar->hidePurchaseScience(); - if ( TheGameLogic->isInMultiplayerGame() || TheGameLogic->isInReplayGame() ) - { - // we don't want to show the save load button. - if(!noSaveLoadQuitMenuLayout) - noSaveLoadQuitMenuLayout = TheWindowManager->winCreateLayout( "Menus/QuitNoSave.wnd" ); - quitMenuLayout = noSaveLoadQuitMenuLayout; - initGadgetsNoSaveQuit(); - TheTransitionHandler->remove("QuitNoSave"); - TheTransitionHandler->setGroup("QuitNoSave"); - } - else - { - if(!fullQuitMenuLayout) - fullQuitMenuLayout= TheWindowManager->winCreateLayout( "Menus/QuitMenu.wnd" ); - quitMenuLayout = fullQuitMenuLayout; - initGadgetsFullQuit(); - TheTransitionHandler->remove("QuitFull"); - TheTransitionHandler->setGroup("QuitFull"); - } - - // load the quit menu from the layout file if needed - if( quitMenuLayout == nullptr ) - { - DEBUG_CRASH(("Could not load a quit menu layout")); - isVisible = FALSE; - TheInGameUI->setQuitMenuVisible(FALSE); - return; - } - - //quitMenuLayout->hide(FALSE); - - // if we are watching a cinematic, we need to disable the save/load button - // because the save load window doesn't fit in the screen in letterbox mode. - if (TheInGameUI->getInputEnabled() == FALSE) { - if(buttonSaveLoadWin) - buttonSaveLoadWin->winEnable(FALSE); - buttonOptionsWin->winEnable(FALSE); - } else if (buttonSaveLoadWin) - { - if(buttonSaveLoadWin) - buttonSaveLoadWin->winEnable(TRUE); - buttonOptionsWin->winEnable(TRUE); - } - - // Disable the restart, load, save, etc buttons in network games - if ( TheGameLogic->isInMultiplayerGame() || TheGameLogic->isInSkirmishGame() ) - { - buttonRestartWin->winEnable(TRUE); - if (TheGameLogic->isInSkirmishGame() == FALSE) { - GadgetButtonSetText(buttonRestartWin, TheGameText->fetch("GUI:Surrender")); - - } - - if (TheGameLogic->isInSkirmishGame() == TRUE) { - TheGameLogic->setGamePaused(TRUE); - } - - if ((!ThePlayerList->getLocalPlayer()->isPlayerActive() || TheVictoryConditions->isLocalAlliedVictory()) && - (TheGameLogic->isInSkirmishGame() == FALSE)) - { - buttonRestartWin->winEnable(FALSE); // can't surrender when you're dead - } - } - else - { - buttonRestartWin->winEnable(TRUE); - if(!TheGameLogic->isInReplayGame()) - { - GadgetButtonSetText(buttonRestartWin, TheGameText->fetch("GUI:RestartMission")); - GadgetButtonSetText(buttonExitWin, TheGameText->fetch("GUI:ExitMission")); - - } - //if we're not in a multiplayer game, pause the game - TheGameLogic->setGamePaused(TRUE); - } - - - if (quitConfirmationWindow) - TheWindowManager->winDestroy(quitConfirmationWindow); - quitConfirmationWindow = nullptr; - HideDiplomacy(); - HideInGameChat(); - TheControlBar->hidePurchaseScience(); - isVisible = TRUE; - } - - TheInGameUI->setQuitMenuVisible(isVisible); - -} - -//------------------------------------------------------------------------------------------------- -/** Quit menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType QuitMenuSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == buttonSaveLoad ) - { - - // - // these commented lines (12-11-2002) will allow access to load only when were - // viewing an in-game cinema ... but it's brittle, so I'm disableing it for - // now and just using the grey button for the whole save/load button for now - // during a cinema - // - -// SaveLoadLayoutType layoutType = SLLT_SAVE_AND_LOAD; - - // - // if input is disabled we are in an in-game cinematic and can load only, since we - // are in the quit menu we are paused and therefore input is disabled all - // the time ... in order to figure out if the *game* has input disabled we need - // to query for the input enabled memory in the game logic which represents the - // input enabled status of the game if we were not currently paused - // -// if( TheGameLogic->getInputEnabledMemory() == FALSE ) -// layoutType = SLLT_LOAD_ONLY; - - saveLoadMenuLayout = TheShell->getSaveLoadMenuLayout(); -// saveLoadMenuLayout->runInit( &layoutType ); - saveLoadMenuLayout->runInit(); - saveLoadMenuLayout->hide( FALSE ); - saveLoadMenuLayout->bringForward(); - } - else if( controlID == buttonExit ) - { - quitConfirmationWindow = QuitMessageBoxYesNo(TheGameText->fetch("GUI:QuitPopupTitle"), TheGameText->fetch("GUI:QuitPopupMessage"),/*quitCallback*/exitQuitMenu,noExitQuitMenu); - } - else if( controlID == buttonReturn ) - { - - // hide this menu - ToggleQuitMenu(); - - } - else if( buttonOptions == controlID ) - { - WindowLayout *optLayout = TheShell->getOptionsLayout(TRUE); - DEBUG_ASSERTCRASH(optLayout != nullptr, ("options menu layout is null")); - optLayout->runInit(); - optLayout->hide(FALSE); - optLayout->bringForward(); - } -// else if( controlID == buttonQuitToDesktop ) -// { -// quitConfirmationWindow = MessageBoxYesNo(TheGameText->fetch("GUI:QuitPopupTitle"), TheGameText->fetch("GUI:QuitToDesktopConf"),/*quitCallback*/quitToDesktopQuitMenu,noExitQuitMenu); -// -// } // end else if - else if( controlID == buttonRestart ) - { - if ( TheGameLogic->isInMultiplayerGame() ) - { - // we really want to surrender - quitConfirmationWindow = MessageBoxYesNo(TheGameText->fetch("GUI:SurrenderConfirmationTitle"), - TheGameText->fetch("GUI:SurrenderConfirmation"), - /*quitCallback*/surrenderQuitMenu,noExitQuitMenu); - } - else - { - //we really want to restart - quitConfirmationWindow = MessageBoxYesNo(TheGameText->fetch("GUI:RestartConfirmationTitle"), - TheGameText->fetch("GUI:RestartConfirmation"), - /*quitCallback*/restartMissionMenu,noExitQuitMenu); - } - } - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp deleted file mode 100644 index 4b02271bfb7..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp +++ /dev/null @@ -1,829 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ReplayMenu.cpp ///////////////////////////////////////////////////////////////////// -// Author: Chris The masta Huybregts, December 2001 -// Description: Replay Menus -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - - -#include "Lib/BaseType.h" -#include "Common/FileSystem.h" -#include "Common/GameEngine.h" -#include "Common/GameState.h" -#include "Common/Recorder.h" -#include "Common/version.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/MessageBox.h" -#include "GameClient/MapUtil.h" -#include "GameClient/Mouse.h" -#include "GameClient/GameText.h" -#include "GameClient/GameWindowTransitions.h" - -typedef UnicodeString ReplayName; -typedef UnicodeString TooltipString; -typedef std::map ReplayTooltipMap; - -static ReplayTooltipMap replayTooltipCache; - -// window ids ------------------------------------------------------------------------------------- -static NameKeyType parentReplayMenuID = NAMEKEY_INVALID; -static NameKeyType buttonLoadID = NAMEKEY_INVALID; -static NameKeyType buttonBackID = NAMEKEY_INVALID; -static NameKeyType listboxReplayFilesID = NAMEKEY_INVALID; -static NameKeyType buttonDeleteID = NAMEKEY_INVALID; -static NameKeyType buttonCopyID = NAMEKEY_INVALID; - -static Bool isShuttingDown = false; - -// window pointers -------------------------------------------------------------------------------- -static GameWindow *parentReplayMenu = nullptr; -static GameWindow *buttonLoad = nullptr; -static GameWindow *buttonBack = nullptr; -static GameWindow *listboxReplayFiles = nullptr; -static GameWindow *buttonDelete = nullptr; -static GameWindow *buttonCopy = nullptr; -static Int initialGadgetDelay = 2; -static Bool justEntered = FALSE; - - -#if defined(RTS_DEBUG) -static GameWindow *buttonAnalyzeReplay = nullptr; -#endif - -void deleteReplay(); -void copyReplay(); -static Bool callCopy = FALSE; -static Bool callDelete = FALSE; -void deleteReplayFlag() { callDelete = TRUE;} -void copyReplayFlag() { callCopy = TRUE;} - -UnicodeString GetReplayFilenameFromListbox(GameWindow *listbox, Int index) -{ - UnicodeString fname = GadgetListBoxGetText(listbox, index); - - if (fname == TheGameText->fetch("GUI:LastReplay")) - { - fname.translate(TheRecorder->getLastReplayFileName()); - } - - UnicodeString ext; - ext.translate(TheRecorder->getReplayExtention()); - fname.concat(ext); - - return fname; -} - -//------------------------------------------------------------------------------------------------- - -static Bool readReplayMapInfo(const AsciiString& filename, RecorderClass::ReplayHeader &header, ReplayGameInfo &info, const MapMetaData *&mapData) -{ - header.forPlayback = FALSE; - header.filename = filename; - - if (TheRecorder != nullptr && TheRecorder->readReplayHeader(header)) - { - if (ParseAsciiStringToGameInfo(&info, header.gameOptions)) - { - if (TheMapCache != nullptr) - mapData = TheMapCache->findMap(info.getMap()); - else - mapData = nullptr; - - return true; - } - } - return false; -} - -//------------------------------------------------------------------------------------------------- - -static void removeReplayExtension(UnicodeString& replayName) -{ - const Int extensionLength = TheRecorder->getReplayExtention().getLength(); - replayName.truncateBy(extensionLength); -} - -//------------------------------------------------------------------------------------------------- - -static UnicodeString createReplayName(const AsciiString& filename) -{ - AsciiString lastReplayFName = TheRecorder->getLastReplayFileName(); - lastReplayFName.concat(TheRecorder->getReplayExtention()); - UnicodeString replayName; - - if (lastReplayFName.compareNoCase(filename) == 0) - { - replayName = TheGameText->fetch("GUI:LastReplay"); - } - else - { - replayName.translate(filename); - removeReplayExtension(replayName); - } - return replayName; -} - -//------------------------------------------------------------------------------------------------- - -static UnicodeString createMapName(const AsciiString& filename, const ReplayGameInfo& info, const MapMetaData *mapData) -{ - UnicodeString mapName; - if (!mapData) - { - // TheSuperHackers @bugfix helmutbuhler 08/03/2025 Just use the filename. - // Displaying a long map path string would break the map list gui. - const char* filename = info.getMap().reverseFind('\\'); - mapName.translate(filename ? filename + 1 : info.getMap()); - } - else - { - mapName = mapData->m_displayName; - } - return mapName; -} - -//------------------------------------------------------------------------------------------------- -// TheSuperHackers @feature Stubbjax 21/10/2025 Show extra info tooltip when hovering over a replay. - -static void showReplayTooltip(GameWindow* window, WinInstanceData* instData, UnsignedInt mouse) -{ - Int x, y, row, col; - x = LOLONGTOSHORT(mouse); - y = HILONGTOSHORT(mouse); - - GadgetListBoxGetEntryBasedOnXY(window, x, y, row, col); - - if (row == -1 || col == -1) - { - TheMouse->setCursorTooltip(UnicodeString::TheEmptyString); - return; - } - - UnicodeString replayFileName = GetReplayFilenameFromListbox(window, row); - - ReplayTooltipMap::const_iterator it = replayTooltipCache.find(replayFileName); - if (it != replayTooltipCache.end()) - TheMouse->setCursorTooltip(it->second, -1, nullptr, 1.5f); - else - TheMouse->setCursorTooltip(UnicodeString::TheEmptyString); -} - -static UnicodeString buildReplayTooltip(RecorderClass::ReplayHeader header, ReplayGameInfo info) -{ - UnicodeString tooltipStr; - - if (header.endTime < header.startTime) - header.startTime = header.endTime; - - time_t totalSeconds = header.endTime - header.startTime; - UnsignedInt hours = totalSeconds / 3600; - UnsignedInt mins = (totalSeconds % 3600) / 60; - UnsignedInt secs = totalSeconds % 60; - Real fps = totalSeconds > 0 ? header.frameCount / totalSeconds : 0; - tooltipStr.format(L"%02u:%02u:%02u (%g fps)", hours, mins, secs, fps); - - if (header.localPlayerIndex >= 0) - { - // MP game - for (Int i = 0; i < MAX_SLOTS; ++i) - { - const GameSlot* slot = info.getConstSlot(i); - if (slot && slot->isHuman()) - { - tooltipStr.concat(L"\n"); - tooltipStr.concat(info.getConstSlot(i)->getName()); - } - } - } - - return tooltipStr; -} - -//------------------------------------------------------------------------------------------------- -/** Populate the listbox with the names of the available replay files */ -//------------------------------------------------------------------------------------------------- -void PopulateReplayFileListbox(GameWindow *listbox) -{ - replayTooltipCache.clear(); - - if (!TheMapCache) - return; - - GadgetListBoxReset(listbox); - const Int listboxLength = GadgetListBoxGetListLength(listbox); - const Int columns = GadgetListBoxGetNumColumns(listbox); - - // TheSuperHackers @tweak xezon 08/06/2025 Now shows missing maps in red color. - enum { - COLOR_SP = 0, - COLOR_SP_CRC_MISMATCH, - COLOR_MP, - COLOR_MP_CRC_MISMATCH, - COLOR_MISSING_MAP, - COLOR_MISSING_MAP_CRC_MISMATCH, - COLOR_MAX - }; - Color colors[] = { - GameMakeColor( 255, 255, 255, 255 ), - GameMakeColor( 128, 128, 128, 255 ), - GameMakeColor( 255, 255, 255, 255 ), - GameMakeColor( 128, 128, 128, 255 ), - GameMakeColor( 243, 24, 24, 255 ), - GameMakeColor( 128, 32, 32, 255 ) - }; - static_assert(ARRAY_SIZE(colors) == COLOR_MAX, "Mismatch between colors array size and COLOR_MAX"); - - AsciiString asciistr; - AsciiString asciisearch; - asciisearch = "*"; - asciisearch.concat(TheRecorder->getReplayExtention()); - - FilenameList replayFilenames; - FilenameListIter it; - - TheFileSystem->getFileListInDirectory(TheRecorder->getReplayDir(), asciisearch, replayFilenames, FALSE); - - TheMapCache->updateCache(); - - for (it = replayFilenames.begin(); it != replayFilenames.end(); ++it) - { - // just want the filename - asciistr.set((*it).reverseFind('\\') + 1); - - RecorderClass::ReplayHeader header; - ReplayGameInfo info; - const MapMetaData *mapData; - - if (readReplayMapInfo(asciistr, header, info, mapData)) - { - // columns are: name, date, version, map, extra - - // name - UnicodeString replayNameToShow = createReplayName(asciistr); - - // TheSuperHackers @tweak Caball009 07/02/2026 Display both time and date instead of only time. - const UnicodeString displayTimeBuffer = getUnicodeTimeBuffer(header.timeVal); - const UnicodeString displayDateBuffer = getUnicodeDateBuffer(header.timeVal); - - // version (no-op) - - // map - UnicodeString mapStr = createMapName(asciistr, info, mapData); - - // tooltip - UnicodeString tooltipStr = buildReplayTooltip(header, info); - - UnicodeString key; - key.translate(asciistr); - replayTooltipCache[key] = tooltipStr; - - // pick a color - Color color; - Color mapColor; - - const Bool hasMap = mapData != nullptr; - - const Bool isCrcCompatible = RecorderClass::replayMatchesGameVersion(header); - - if (isCrcCompatible) - { - if (header.localPlayerIndex >= 0) - { - // MP - color = colors[COLOR_MP]; - } - else - { - // SP - color = colors[COLOR_SP]; - } - - if (hasMap) - mapColor = color; - else - mapColor = colors[COLOR_MISSING_MAP]; - } - else - { - if (header.localPlayerIndex >= 0) - { - // MP - color = colors[COLOR_MP_CRC_MISMATCH]; - } - else - { - // SP - color = colors[COLOR_SP_CRC_MISMATCH]; - } - - if (hasMap) - mapColor = color; - else - mapColor = colors[COLOR_MISSING_MAP_CRC_MISMATCH]; - } - - const Int insertionIndex = GadgetListBoxAddEntryText(listbox, replayNameToShow, color, -1, 0); - DEBUG_ASSERTCRASH(insertionIndex >= 0, ("Expects valid index")); - - // TheSuperHackers @info Caball009 09/02/2026 Original replay menu has 4 columns; the code now supports a future 5-column layout. - // If there aren't two columns for time and date, concatenate them for a single column. - if (columns == 4) - { - UnicodeString displayDateTimeBuffer; - displayDateTimeBuffer.format(L"%s %s", displayTimeBuffer.str(), displayDateBuffer.str()); - - GadgetListBoxAddEntryText(listbox, displayDateTimeBuffer, color, insertionIndex, 1); - GadgetListBoxAddEntryText(listbox, header.versionString, color, insertionIndex, 2); - GadgetListBoxAddEntryText(listbox, mapStr, mapColor, insertionIndex, 3); - } - else if (columns == 5) - { - GadgetListBoxAddEntryText(listbox, displayTimeBuffer, color, insertionIndex, 1); - GadgetListBoxAddEntryText(listbox, displayDateBuffer, color, insertionIndex, 2); - GadgetListBoxAddEntryText(listbox, header.versionString, color, insertionIndex, 3); - GadgetListBoxAddEntryText(listbox, mapStr, mapColor, insertionIndex, 4); - } - else - { - DEBUG_CRASH(("Replay menu uses %d columns; expected either 4 or 5", columns)); - } - - // TheSuperHackers @performance Now stops processing when the list is full. - if (insertionIndex == listboxLength - 1) - break; - } - } - GadgetListBoxSetSelected(listbox, 0); -} - -//------------------------------------------------------------------------------------------------- -/** Initialize the single player menu */ -//------------------------------------------------------------------------------------------------- -void ReplayMenuInit( WindowLayout *layout, void *userData ) -{ - TheShell->showShellMap(TRUE); - - // get ids for our children controls - parentReplayMenuID = TheNameKeyGenerator->nameToKey( "ReplayMenu.wnd:ParentReplayMenu" ); - buttonLoadID = TheNameKeyGenerator->nameToKey( "ReplayMenu.wnd:ButtonLoadReplay" ); - buttonBackID = TheNameKeyGenerator->nameToKey( "ReplayMenu.wnd:ButtonBack" ); - listboxReplayFilesID = TheNameKeyGenerator->nameToKey( "ReplayMenu.wnd:ListboxReplayFiles" ); - buttonDeleteID = TheNameKeyGenerator->nameToKey( "ReplayMenu.wnd:ButtonDeleteReplay" ); - buttonCopyID = TheNameKeyGenerator->nameToKey( "ReplayMenu.wnd:ButtonCopyReplay" ); - - parentReplayMenu = TheWindowManager->winGetWindowFromId( nullptr, parentReplayMenuID ); - buttonLoad = TheWindowManager->winGetWindowFromId( parentReplayMenu, buttonLoadID ); - buttonBack = TheWindowManager->winGetWindowFromId( parentReplayMenu, buttonBackID ); - listboxReplayFiles = TheWindowManager->winGetWindowFromId( parentReplayMenu, listboxReplayFilesID ); - listboxReplayFiles->winSetTooltipFunc(showReplayTooltip); - buttonDelete = TheWindowManager->winGetWindowFromId( parentReplayMenu, buttonDeleteID ); - buttonCopy = TheWindowManager->winGetWindowFromId( parentReplayMenu, buttonCopyID ); - -#if ENABLE_GUI_HACKS - // TheSuperHackers @tweak Caball009 07/02/2026 The version column is wider than the time / date column. - // Switch them so that there's enough space to show both time and date without a line break. - ListboxData* list = static_cast(listboxReplayFiles->winGetUserData()); - - if (list->columns == 4 && list->columnWidth[1] < list->columnWidth[2]) - std::swap(list->columnWidth[1], list->columnWidth[2]); -#endif - - //Load the listbox shiznit - GadgetListBoxReset(listboxReplayFiles); - PopulateReplayFileListbox(listboxReplayFiles); - -#if defined(RTS_DEBUG) - WinInstanceData instData; - instData.init(); - BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); - instData.m_textLabelString = "Debug: Analyze Replay"; - instData.setTooltipText(L"Only Used in Debug and Internal!"); - buttonAnalyzeReplay = TheWindowManager->gogoGadgetPushButton( parentReplayMenu, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 4, 4, - 180, 26, - &instData, nullptr, TRUE ); -#endif - - // show menu - layout->hide( FALSE ); - - // set keyboard focus to main parent - TheWindowManager->winSetFocus( parentReplayMenu ); - justEntered = TRUE; - initialGadgetDelay = 2; - GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ReplayMenu.wnd:GadgetParent")); - if(win) - win->winHide(TRUE); - isShuttingDown = FALSE; - -} - -//------------------------------------------------------------------------------------------------- -/** single player menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void ReplayMenuShutdown( WindowLayout *layout, void *userData ) -{ - - Bool popImmediate = *(Bool *)userData; - if( popImmediate ) - { - - layout->hide( TRUE ); - TheShell->shutdownComplete( layout ); - return; - - } - - // our shutdown is complete - TheTransitionHandler->reverse("ReplayMenuFade"); - isShuttingDown = TRUE; -} - -//------------------------------------------------------------------------------------------------- -/** single player menu update method */ -//------------------------------------------------------------------------------------------------- -void ReplayMenuUpdate( WindowLayout *layout, void *userData ) -{ - if(justEntered) - { - if(initialGadgetDelay == 1) - { - TheTransitionHandler->remove("MainMenuDefaultMenuLogoFade"); - TheTransitionHandler->setGroup("ReplayMenuFade"); - initialGadgetDelay = 2; - justEntered = FALSE; - } - else - initialGadgetDelay--; - } - - if(callCopy) - copyReplay(); - if(callDelete) - deleteReplay(); - // We'll only be successful if we've requested to - if(isShuttingDown && TheShell->isAnimFinished()&& TheTransitionHandler->isFinished()) - TheShell->shutdownComplete( layout ); - -} - -//------------------------------------------------------------------------------------------------- -/** Replay menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType ReplayMenuInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonBack, buttonBackID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -void reallyLoadReplay() -{ - UnicodeString filename; - Int selected; - GadgetListBoxGetSelected( listboxReplayFiles, &selected ); - if(selected < 0) - { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); - return; - } - - filename = GetReplayFilenameFromListbox(listboxReplayFiles, selected); - - AsciiString asciiFilename; - asciiFilename.translate(filename); - - TheRecorder->playbackFile(asciiFilename); - - if(parentReplayMenu != nullptr) - { - parentReplayMenu->winHide(TRUE); - } -} - -static void loadReplay(UnicodeString filename) -{ - AsciiString asciiFilename; - asciiFilename.translate(filename); - - RecorderClass::ReplayHeader header; - ReplayGameInfo info; - const MapMetaData *mapData; - - if(!readReplayMapInfo(asciiFilename, header, info, mapData)) - { - // TheSuperHackers @bugfix Prompts a message box when the replay was deleted by the user while the Replay Menu was opened. - - UnicodeString title = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayFileNotFoundTitle", L"REPLAY NOT FOUND"); - UnicodeString body = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayFileNotFound", L"This replay cannot be loaded because the file no longer exists on this device."); - - MessageBoxOk(title, body, nullptr); - } - else if(mapData == nullptr) - { - // TheSuperHackers @bugfix Prompts a message box when the map used by the replay was not found. - - UnicodeString title = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayMapNotFoundTitle", L"MAP NOT FOUND"); - UnicodeString body = TheGameText->FETCH_OR_SUBSTITUTE("GUI:ReplayMapNotFound", L"This replay cannot be loaded because the map was not found on this device."); - - MessageBoxOk(title, body, nullptr); - } - else if(!TheRecorder->replayMatchesGameVersion(header)) - { - // Pressing OK loads the replay. - - MessageBoxOkCancel(TheGameText->fetch("GUI:OlderReplayVersionTitle"), TheGameText->fetch("GUI:OlderReplayVersion"), reallyLoadReplay, nullptr); - } - else - { - TheRecorder->playbackFile(asciiFilename); - - if(parentReplayMenu != nullptr) - { - parentReplayMenu->winHide(TRUE); - } - } -} - -//------------------------------------------------------------------------------------------------- -/** single player menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType ReplayMenuSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're given the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - - } - //--------------------------------------------------------------------------------------------- - case GLM_DOUBLE_CLICKED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if( controlID == listboxReplayFilesID ) - { - int rowSelected = mData2; - - if (rowSelected >= 0) - { - UnicodeString filename = GetReplayFilenameFromListbox(listboxReplayFiles, rowSelected); - loadReplay(filename); - } - } - break; - } - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - UnicodeString filename; - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - -#if defined(RTS_DEBUG) - if( controlID == buttonAnalyzeReplay->winGetWindowId() ) - { - if(listboxReplayFiles) - { - Int selected; - GadgetListBoxGetSelected( listboxReplayFiles, &selected ); - if(selected < 0) - { - MessageBoxOk(L"Blah Blah",L"Please select something munkee boy", nullptr); - break; - } - - filename = GetReplayFilenameFromListbox(listboxReplayFiles, selected); - - AsciiString asciiFilename; - asciiFilename.translate(filename); - if (TheRecorder->analyzeReplay(asciiFilename)) - { - do - { - TheRecorder->update(); - } while (TheRecorder->isPlaybackInProgress()); - } - } - } - else -#endif - if( controlID == buttonLoadID ) - { - if(listboxReplayFiles) - { - Int selected; - GadgetListBoxGetSelected( listboxReplayFiles, &selected ); - if(selected < 0) - { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); - break; - } - - filename = GetReplayFilenameFromListbox(listboxReplayFiles, selected); - loadReplay(filename); - } - } - else if( controlID == buttonBackID ) - { - - // thou art directed to return to thy known solar system immediately! - TheShell->pop(); - - } - else if( controlID == buttonDeleteID ) - { - Int selected; - GadgetListBoxGetSelected( listboxReplayFiles, &selected ); - if(selected < 0) - { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); - break; - } - filename = GetReplayFilenameFromListbox(listboxReplayFiles, selected); - MessageBoxYesNo(TheGameText->fetch("GUI:DeleteFile"), TheGameText->fetch("GUI:AreYouSureDelete"), deleteReplayFlag, nullptr); - } - else if( controlID == buttonCopyID ) - { - Int selected; - GadgetListBoxGetSelected( listboxReplayFiles, &selected ); - if(selected < 0) - { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); - break; - } - filename = GetReplayFilenameFromListbox(listboxReplayFiles, selected); - MessageBoxYesNo(TheGameText->fetch("GUI:CopyReplay"), TheGameText->fetch("GUI:AreYouSureCopy"), copyReplayFlag, nullptr); - } - break; - } - - default: - return MSG_IGNORED; - } - - return MSG_HANDLED; -} - -void deleteReplay() -{ - callDelete = FALSE; - Int selected; - GadgetListBoxGetSelected( listboxReplayFiles, &selected ); - if(selected < 0) - { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); - return; - } - AsciiString filename, translate; - filename = TheRecorder->getReplayDir(); - translate.translate(GetReplayFilenameFromListbox(listboxReplayFiles, selected)); - filename.concat(translate); - if(DeleteFile(filename.str()) == 0) - { - char buffer[1024]; - FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, buffer, sizeof(buffer), nullptr); - UnicodeString errorStr; - translate.set(buffer); - errorStr.translate(translate); - MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, nullptr); - } - //Load the listbox shiznit - GadgetListBoxReset(listboxReplayFiles); - PopulateReplayFileListbox(listboxReplayFiles); -} - - -void copyReplay() -{ - callCopy = FALSE; - Int selected; - GadgetListBoxGetSelected( listboxReplayFiles, &selected ); - if(selected < 0) - { - MessageBoxOk(TheGameText->fetch("GUI:NoFileSelected"),TheGameText->fetch("GUI:PleaseSelectAFile"), nullptr); - return; - } - AsciiString filename, translate; - filename = TheRecorder->getReplayDir(); - translate.translate(GetReplayFilenameFromListbox(listboxReplayFiles, selected)); - filename.concat(translate); - - char path[1024]; - LPITEMIDLIST pidl; - SHGetSpecialFolderLocation(nullptr, CSIDL_DESKTOPDIRECTORY, &pidl); - SHGetPathFromIDList(pidl,path); - AsciiString newFilename; - newFilename.set(path); - newFilename.concat("\\"); - newFilename.concat(translate); - if(CopyFile(filename.str(),newFilename.str(), FALSE) == 0) - { - wchar_t buffer[1024]; - FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM, nullptr, GetLastError(), 0, buffer, ARRAY_SIZE(buffer), nullptr); - UnicodeString errorStr; - errorStr.set(buffer); - errorStr.trim(); - MessageBoxOk(TheGameText->fetch("GUI:Error"),errorStr, nullptr); - } - -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp deleted file mode 100644 index b9bc05763f5..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: SinglePlayerMenu.cpp ///////////////////////////////////////////////////////////////////// -// Author: Colin Day, October 2001 -// Description: Single Player Menus -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameEngine.h" -#include "GameClient/AnimateWindowManager.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" - -static Bool isShuttingDown = false; -static Bool buttonPushed = false; -//------------------------------------------------------------------------------------------------- -/** This is called when a shutdown is complete for this menu */ -//------------------------------------------------------------------------------------------------- -static void shutdownComplete( WindowLayout *layout ) -{ - - isShuttingDown = false; - - // hide the layout - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout ); - -} - -//------------------------------------------------------------------------------------------------- -/** Initialize the single player menu */ -//------------------------------------------------------------------------------------------------- -void SinglePlayerMenuInit( WindowLayout *layout, void *userData ) -{ - TheShell->showShellMap(TRUE); - buttonPushed = false; - isShuttingDown = false; - - // show menu - layout->hide( FALSE ); - - // set keyboard focus to main parent - NameKeyType parentID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:SinglePlayerMenuParent" ); - GameWindow *parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); - TheWindowManager->winSetFocus( parent ); - - NameKeyType buttonNewID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonNew" ); - GameWindow *buttonNew = TheWindowManager->winGetWindowFromId( nullptr, buttonNewID ); - TheShell->registerWithAnimateManager(buttonNew, WIN_ANIMATION_SLIDE_LEFT, TRUE,1); - - NameKeyType buttonLoadID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonLoad" ); - GameWindow *buttonLoad = TheWindowManager->winGetWindowFromId( nullptr, buttonLoadID ); - TheShell->registerWithAnimateManager(buttonLoad, WIN_ANIMATION_SLIDE_LEFT, TRUE,200); - - NameKeyType buttonBackID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonBack" ); - GameWindow *buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID ); - TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_RIGHT, TRUE,1); - - - //TheShell->registerWithAnimateManager(parent, WIN_ANIMATION_SLIDE_TOP, TRUE); - -} - -//------------------------------------------------------------------------------------------------- -/** single player menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void SinglePlayerMenuShutdown( WindowLayout *layout, void *userData ) -{ - isShuttingDown = true; - - // if we are shutting down for an immediate pop, skip the animations - Bool popImmediate = *(Bool *)userData; - if( popImmediate ) - { - - shutdownComplete( layout ); - return; - - } - - TheShell->reverseAnimatewindow(); - -} - -//------------------------------------------------------------------------------------------------- -/** single player menu update method */ -//------------------------------------------------------------------------------------------------- -void SinglePlayerMenuUpdate( WindowLayout *layout, void *userData ) -{ - - // We'll only be successful if we've requested to - if(isShuttingDown && TheShell->isAnimFinished()) - shutdownComplete(layout); - -} - -//------------------------------------------------------------------------------------------------- -/** SinglePlayer menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType SinglePlayerMenuInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - if (buttonPushed) - break; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - NameKeyType buttonID = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonBack" ); - GameWindow *button = TheWindowManager->winGetWindowFromId( window, buttonID ); - - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)button, buttonID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** single player menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType SinglePlayerMenuSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - static NameKeyType buttonNew = NAMEKEY_INVALID; - static NameKeyType buttonLoad = NAMEKEY_INVALID; - static NameKeyType buttonBack = NAMEKEY_INVALID; - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - // get ids for our children controls - buttonNew = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonNew" ); - buttonLoad = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonLoad" ); - buttonBack = TheNameKeyGenerator->nameToKey( "SinglePlayerMenu.wnd:ButtonBack" ); - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if (buttonPushed) - break; - - if( controlID == buttonNew ) - { - - // open up the map select menu - TheShell->push( "Menus/MapSelectMenu.wnd" ); - buttonPushed = true; - - } - else if( controlID == buttonLoad ) - { - - } - else if( controlID == buttonBack ) - { - - // thou art directed to return to thy known solar system immediately! - TheShell->pop(); - buttonPushed = true; - - } - - break; - - } - - default: - return MSG_IGNORED; - } - - return MSG_HANDLED; -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp deleted file mode 100644 index c1b7a4058d1..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ /dev/null @@ -1,1438 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////// -// FILE: WOLBuddyOverlay.cpp -// Author: Chris Huybregts, November 2001 -// Description: Lan Lobby Menu -/////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/AudioEventRTS.h" -#include "Common/PlayerList.h" -#include "Common/Player.h" -#include "GameClient/GameText.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/GadgetRadioButton.h" -#include "GameClient/Display.h" -#include "GameNetwork/GameSpyOverlay.h" -#include "GameNetwork/GameSpy/PeerDefs.h" -#include "GameNetwork/GameSpy/BuddyDefs.h" -#include "GameNetwork/GameSpy/BuddyThread.h" -#include "GameNetwork/GameSpy/LobbyUtils.h" -#include "GameNetwork/GameSpy/PersistentStorageDefs.h" -#include "GameNetwork/GameSpy/PersistentStorageThread.h" -#include "GameNetwork/GameSpy/ThreadUtils.h" - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// - - -// window ids ------------------------------------------------------------------------------ -static NameKeyType parentID = NAMEKEY_INVALID; -static NameKeyType buttonHideID = NAMEKEY_INVALID; -static NameKeyType buttonAddBuddyID = NAMEKEY_INVALID; -static NameKeyType buttonDeleteBuddyID = NAMEKEY_INVALID; -static NameKeyType textEntryID = NAMEKEY_INVALID; -static NameKeyType listboxBuddyID = NAMEKEY_INVALID; -static NameKeyType listboxChatID = NAMEKEY_INVALID; -static NameKeyType buttonAcceptBuddyID = NAMEKEY_INVALID; -static NameKeyType buttonDenyBuddyID = NAMEKEY_INVALID; -static NameKeyType radioButtonBuddiesID = NAMEKEY_INVALID; -static NameKeyType radioButtonIgnoreID = NAMEKEY_INVALID; -static NameKeyType parentBuddiesID = NAMEKEY_INVALID; -static NameKeyType parentIgnoreID = NAMEKEY_INVALID; -static NameKeyType listboxIgnoreID = NAMEKEY_INVALID; -static NameKeyType buttonNotificationID = NAMEKEY_INVALID; - - -// Window Pointers ------------------------------------------------------------------------ -static GameWindow *parent = nullptr; -static GameWindow *buttonHide = nullptr; -static GameWindow *buttonAddBuddy = nullptr; -static GameWindow *buttonDeleteBuddy = nullptr; -static GameWindow *textEntry = nullptr; -static GameWindow *listboxBuddy = nullptr; -static GameWindow *listboxChat = nullptr; -static GameWindow *buttonAcceptBuddy = nullptr; -static GameWindow *buttonDenyBuddy = nullptr; -static GameWindow *radioButtonBuddies = nullptr; -static GameWindow *radioButtonIgnore = nullptr; -static GameWindow *parentBuddies = nullptr; -static GameWindow *parentIgnore = nullptr; -static GameWindow *listboxIgnore = nullptr; - -static Bool isOverlayActive = false; -void insertChat( BuddyMessage msg ); -// RightClick pointers --------------------------------------------------------------------- -static GameWindow *rcMenu = nullptr; -static WindowLayout *noticeLayout = nullptr; -static UnsignedInt noticeExpires = 0; -enum { NOTIFICATION_EXPIRES = 3000 }; - -void setUnignoreText( WindowLayout *layout, AsciiString nick, GPProfile id); -void refreshIgnoreList(); -void showNotificationBox( AsciiString nick, UnicodeString message); -void deleteNotificationBox(); -static Bool lastNotificationWasStatus = FALSE; -static Int numOnlineInNotification = 0; - -class BuddyControls -{ -public: - BuddyControls(); - GameWindow *listboxChat; - NameKeyType listboxChatID; - - GameWindow *listboxBuddies; - NameKeyType listboxBuddiesID; - - GameWindow *textEntryEdit; - NameKeyType textEntryEditID; - Bool isInit; -}; - -static BuddyControls buddyControls; -BuddyControls::BuddyControls( ) -{ - listboxChat = nullptr; - listboxChatID = NAMEKEY_INVALID; - listboxBuddies = nullptr; - listboxBuddiesID = NAMEKEY_INVALID; - textEntryEdit = nullptr; - textEntryEditID = NAMEKEY_INVALID; - isInit = FALSE; -} -// At this point I don't give a damn about how good this way is. I'm doing it anyway. -enum -{ - BUDDY_RESETALL_CRAP = -1, - BUDDY_WINDOW_BUDDIES = 0, - BUDDY_WINDOW_DIPLOMACY, - BUDDY_WINDOW_WELCOME_SCREEN, -}; - -void InitBuddyControls(Int type) -{ - if(!TheGameSpyInfo) - { - buddyControls.textEntryEditID = NAMEKEY_INVALID; - buddyControls.textEntryEdit = nullptr; - buddyControls.listboxBuddiesID = NAMEKEY_INVALID; - buddyControls.listboxChatID = NAMEKEY_INVALID; - buddyControls.listboxBuddies = nullptr; - buddyControls.listboxChat = nullptr; - buddyControls.isInit = FALSE; - return; - } - switch (type) { - case BUDDY_RESETALL_CRAP: - buddyControls.textEntryEditID = NAMEKEY_INVALID; - buddyControls.textEntryEdit = nullptr; - buddyControls.listboxBuddiesID = NAMEKEY_INVALID; - buddyControls.listboxChatID = NAMEKEY_INVALID; - buddyControls.listboxBuddies = nullptr; - buddyControls.listboxChat = nullptr; - buddyControls.isInit = FALSE; - break; - case BUDDY_WINDOW_BUDDIES: - buddyControls.textEntryEditID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:TextEntryChat" ); - buddyControls.textEntryEdit = TheWindowManager->winGetWindowFromId(nullptr, buddyControls.textEntryEditID); - buddyControls.listboxBuddiesID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ListboxBuddies" ); - buddyControls.listboxChatID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ListboxBuddyChat" ); - buddyControls.listboxBuddies = TheWindowManager->winGetWindowFromId( nullptr, buddyControls.listboxBuddiesID ); - buddyControls.listboxChat = TheWindowManager->winGetWindowFromId( nullptr, buddyControls.listboxChatID); - GadgetTextEntrySetText(buddyControls.textEntryEdit, UnicodeString::TheEmptyString); - buddyControls.isInit = TRUE; - break; - case BUDDY_WINDOW_DIPLOMACY: - buddyControls.textEntryEditID = TheNameKeyGenerator->nameToKey( "Diplomacy.wnd:TextEntryChat" ); - buddyControls.textEntryEdit = TheWindowManager->winGetWindowFromId(nullptr, buddyControls.textEntryEditID); - buddyControls.listboxBuddiesID = TheNameKeyGenerator->nameToKey( "Diplomacy.wnd:ListboxBuddies" ); - buddyControls.listboxChatID = TheNameKeyGenerator->nameToKey( "Diplomacy.wnd:ListboxBuddyChat" ); - buddyControls.listboxBuddies = TheWindowManager->winGetWindowFromId( nullptr, buddyControls.listboxBuddiesID ); - buddyControls.listboxChat = TheWindowManager->winGetWindowFromId( nullptr, buddyControls.listboxChatID); - GadgetTextEntrySetText(buddyControls.textEntryEdit, UnicodeString::TheEmptyString); - buddyControls.isInit = TRUE; - break; - case BUDDY_WINDOW_WELCOME_SCREEN: - break; - default: - DEBUG_CRASH(("Well, you really shouldn't have gotten here, if you really care about GUI Bugs, search for this string, you you don't care, call chris (who probably doesn't care either")); - } - -} - -WindowMsgHandledType BuddyControlSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2) -{ - if(!TheGameSpyInfo || TheGameSpyInfo->getLocalProfileID() == 0 || !buddyControls.isInit) - { - return MSG_IGNORED; - } - - switch( msg ) - { - case GLM_RIGHT_CLICKED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == buddyControls.listboxBuddiesID ) - { - RightClickStruct *rc = (RightClickStruct *)mData2; - WindowLayout *rcLayout; - if(rc->pos < 0) - break; - - GPProfile profileID = (GPProfile)GadgetListBoxGetItemData(control, rc->pos, 0); - RCItemType itemType = (RCItemType)(Int)GadgetListBoxGetItemData(control, rc->pos, 1); - UnicodeString nick = GadgetListBoxGetText(control, rc->pos); - - GadgetListBoxSetSelected(control, rc->pos); - if (itemType == ITEM_BUDDY) - rcLayout = TheWindowManager->winCreateLayout("Menus/RCBuddiesMenu.wnd"); - else if (itemType == ITEM_REQUEST) - rcLayout = TheWindowManager->winCreateLayout("Menus/RCBuddyRequestMenu.wnd"); - else - rcLayout = TheWindowManager->winCreateLayout("Menus/RCNonBuddiesMenu.wnd"); - rcMenu = rcLayout->getFirstWindow(); - rcMenu->winGetLayout()->runInit(); - rcMenu->winBringToTop(); - rcMenu->winHide(FALSE); - - - ICoord2D rcSize, rcPos; - rcMenu->winGetSize(&rcSize.x, &rcSize.y); - rcPos.x = rc->mouseX; - rcPos.y = rc->mouseY; - if(rc->mouseX + rcSize.x > TheDisplay->getWidth()) - rcPos.x = TheDisplay->getWidth() - rcSize.x; - if(rc->mouseY + rcSize.y > TheDisplay->getHeight()) - rcPos.y = TheDisplay->getHeight() - rcSize.y; - rcMenu->winSetPosition(rcPos.x, rcPos.y); - - - GameSpyRCMenuData *rcData = NEW GameSpyRCMenuData; - rcData->m_id = profileID; - rcData->m_nick.translate(nick); - rcData->m_itemType = itemType; - setUnignoreText(rcLayout, rcData->m_nick, rcData->m_id); - rcMenu->winSetUserData((void *)rcData); - TheWindowManager->winSetLoneWindow(rcMenu); - } - else - return MSG_IGNORED; - break; - } - case GEM_EDIT_DONE: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if(controlID != buddyControls.textEntryEditID) - return MSG_IGNORED; - - // see if someone's selected - Int selected = -1; - GadgetListBoxGetSelected(buddyControls.listboxBuddies, &selected); - if (selected >= 0) - { - GPProfile selectedProfile = (GPProfile)GadgetListBoxGetItemData(buddyControls.listboxBuddies, selected); - BuddyInfoMap *m = TheGameSpyInfo->getBuddyMap(); - BuddyInfoMap::iterator recipIt = m->find(selectedProfile); - if (recipIt == m->end()) - break; - - DEBUG_LOG(("Trying to send a buddy message to %d.", selectedProfile)); - if (TheGameSpyGame && TheGameSpyGame->isInGame() && TheGameSpyGame->isGameInProgress() && - !ThePlayerList->getLocalPlayer()->isPlayerActive()) - { - DEBUG_LOG(("I'm dead - gotta look for cheats.")); - for (Int i=0; igetGameSpySlot(i)->getProfileID())); - if (TheGameSpyGame->getGameSpySlot(i)->getProfileID() == selectedProfile) - { - // can't send to someone in our game if we're dead/observing. security breach and all that. no seances for you. - if (buddyControls.listboxChat) - { - GadgetListBoxAddEntryText( buddyControls.listboxChat, TheGameText->fetch("Buddy:CantTalkToIngameBuddy"), - GameSpyColor[GSCOLOR_DEFAULT], -1, -1 ); - } - return MSG_HANDLED; - } - } - } - - // read the user's input and clear the entry box - UnicodeString txtInput; - txtInput.set(GadgetTextEntryGetText( buddyControls.textEntryEdit )); - GadgetTextEntrySetText(buddyControls.textEntryEdit, UnicodeString::TheEmptyString); - txtInput.trim(); - if (!txtInput.isEmpty()) - { - // Send the message - BuddyRequest req; - req.buddyRequestType = BuddyRequest::BUDDYREQUEST_MESSAGE; - wcslcpy(req.arg.message.text, txtInput.str(), MAX_BUDDY_CHAT_LEN); - req.arg.message.recipient = selectedProfile; - TheGameSpyBuddyMessageQueue->addRequest(req); - - // save message for future incarnations of the buddy window - BuddyMessageList *messages = TheGameSpyInfo->getBuddyMessages(); - BuddyMessage message; - message.m_timestamp = time(nullptr); - message.m_senderID = TheGameSpyInfo->getLocalProfileID(); - message.m_senderNick = TheGameSpyInfo->getLocalBaseName(); - message.m_recipientID = selectedProfile; - message.m_recipientNick = recipIt->second.m_name; - message.m_message = UnicodeString(req.arg.message.text); - messages->push_back(message); - - // put message on screen - insertChat(message); - } - } - else - { - // nobody selected. Prompt the user. - if (buddyControls.listboxChat) - { - GadgetListBoxAddEntryText( buddyControls.listboxChat, TheGameText->fetch("Buddy:SelectBuddyToChat"), - GameSpyColor[GSCOLOR_DEFAULT], -1, -1 ); - } - } - break; - } - default: - return MSG_IGNORED; - } - return MSG_HANDLED; -} - - -void insertChat( BuddyMessage msg ) -{ - if (buddyControls.listboxChat) - { - BuddyInfoMap *m = TheGameSpyInfo->getBuddyMap(); - BuddyInfoMap::iterator senderIt = m->find(msg.m_senderID); - BuddyInfoMap::iterator recipientIt = m->find(msg.m_recipientID); - Bool localSender = (msg.m_senderID == TheGameSpyInfo->getLocalProfileID()); - UnicodeString s; - //UnicodeString timeStr = UnicodeString(_wctime( (const time_t *)&msg.m_timestamp )); - UnicodeString timeStr; - if (localSender /*&& recipientIt != m->end()*/) - { - s.format(L"[%hs -> %hs] %s", TheGameSpyInfo->getLocalBaseName().str(), msg.m_recipientNick.str(), msg.m_message.str()); - Int index = GadgetListBoxAddEntryText( buddyControls.listboxChat, s, GameSpyColor[GSCOLOR_PLAYER_SELF], -1, -1 ); - GadgetListBoxAddEntryText( buddyControls.listboxChat, timeStr, GameSpyColor[GSCOLOR_PLAYER_SELF], index, 1); - } - else if (!localSender /*&& senderIt != m->end()*/) - { - if (!msg.m_senderID) - { - s = msg.m_message; - Int index = GadgetListBoxAddEntryText( buddyControls.listboxChat, s, GameSpyColor[GSCOLOR_DEFAULT], -1, -1 ); - GadgetListBoxAddEntryText( buddyControls.listboxChat, timeStr, GameSpyColor[GSCOLOR_DEFAULT], index, 1); - } - else - { - s.format(L"[%hs] %s", msg.m_senderNick.str(), msg.m_message.str()); - Int index = GadgetListBoxAddEntryText( buddyControls.listboxChat, s, GameSpyColor[GSCOLOR_PLAYER_BUDDY], -1, -1 ); - GadgetListBoxAddEntryText( buddyControls.listboxChat, timeStr, GameSpyColor[GSCOLOR_PLAYER_BUDDY], index, 1); - } - } - } -} - -void updateBuddyInfo() -{ - if (!TheGameSpyBuddyMessageQueue->isConnected()) - { - GadgetListBoxReset(buddyControls.listboxBuddies); - return; - } - - if (!buddyControls.isInit) - return; - - int selected; - GPProfile selectedProfile = 0; - int visiblePos = GadgetListBoxGetTopVisibleEntry(buddyControls.listboxBuddies); - - GadgetListBoxGetSelected(buddyControls.listboxBuddies, &selected); - if (selected >= 0) - selectedProfile = (GPProfile)GadgetListBoxGetItemData(buddyControls.listboxBuddies, selected); - - selected = -1; - GadgetListBoxReset(buddyControls.listboxBuddies); - - // Add buddies - BuddyInfoMap *buddies = TheGameSpyInfo->getBuddyMap(); - BuddyInfoMap::iterator bIt; - for (bIt = buddies->begin(); bIt != buddies->end(); ++bIt) - { - BuddyInfo info = bIt->second; - GPProfile profileID = bIt->first; - - // insert name into box - UnicodeString formatStr; - formatStr.translate(info.m_name.str());//, info.m_status, info.m_statusString.str(), info.m_locationString.str()); - Color nameColor = (TheGameSpyInfo->isSavedIgnored(profileID)) ? - GameSpyColor[GSCOLOR_PLAYER_IGNORED] : GameSpyColor[GSCOLOR_PLAYER_BUDDY]; - int index = GadgetListBoxAddEntryText(buddyControls.listboxBuddies, formatStr, nameColor, -1, -1); - - // insert status into box - AsciiString marker; - marker.format("Buddy:%ls", info.m_statusString.str()); - if (!info.m_statusString.compareNoCase(L"Offline") || - !info.m_statusString.compareNoCase(L"Online") || - !info.m_statusString.compareNoCase(L"Matching")) - { - formatStr = TheGameText->fetch(marker); - } - else if (!info.m_statusString.compareNoCase(L"Staging") || - !info.m_statusString.compareNoCase(L"Loading") || - !info.m_statusString.compareNoCase(L"Playing")) - { - formatStr.format(TheGameText->fetch(marker), info.m_locationString.str()); - } - else if (!info.m_statusString.compareNoCase(L"Chatting")) - { - UnicodeString roomName; - GroupRoomMap::iterator gIt = TheGameSpyInfo->getGroupRoomList()->find( _wtoi(info.m_locationString.str()) ); - if (gIt != TheGameSpyInfo->getGroupRoomList()->end()) - { - AsciiString s; - s.format("GUI:%s", gIt->second.m_name.str()); - roomName = TheGameText->fetch(s); - } - formatStr.format(TheGameText->fetch(marker), roomName.str()); - } - else - { - formatStr = info.m_statusString; - } - GadgetListBoxAddEntryText(buddyControls.listboxBuddies, formatStr, GameSpyColor[GSCOLOR_DEFAULT], index, 1); - GadgetListBoxSetItemData(buddyControls.listboxBuddies, (void *)(profileID), index, 0 ); - GadgetListBoxSetItemData(buddyControls.listboxBuddies, (void *)(ITEM_BUDDY), index, 1 ); - - if (profileID == selectedProfile) - selected = index; - } - - // add requests - buddies = TheGameSpyInfo->getBuddyRequestMap(); - for (bIt = buddies->begin(); bIt != buddies->end(); ++bIt) - { - BuddyInfo info = bIt->second; - GPProfile profileID = bIt->first; - - // insert name into box - UnicodeString formatStr; - formatStr.translate(info.m_name.str()); - int index = GadgetListBoxAddEntryText(buddyControls.listboxBuddies, formatStr, GameSpyColor[GSCOLOR_DEFAULT], -1, -1); - GadgetListBoxSetItemData(buddyControls.listboxBuddies, (void *)(profileID), index, 0 ); - - // insert status into box - formatStr = TheGameText->fetch("GUI:BuddyAddReq"); - GadgetListBoxAddEntryText(buddyControls.listboxBuddies, formatStr, GameSpyColor[GSCOLOR_DEFAULT], index, 1); - GadgetListBoxSetItemData(buddyControls.listboxBuddies, (void *)(ITEM_REQUEST), index, 1 ); - - if (profileID == selectedProfile) - selected = index; - } - - - // select the same guy - if (selected >= 0) - { - GadgetListBoxSetSelected(buddyControls.listboxBuddies, selected); - } - - // view the same spot - GadgetListBoxSetTopVisibleEntry(buddyControls.listboxBuddies, visiblePos); -} - -void HandleBuddyResponses() -{ - if (TheGameSpyBuddyMessageQueue) - { - BuddyResponse resp; - if (TheGameSpyBuddyMessageQueue->getResponse( resp )) - { - switch (resp.buddyResponseType) - { - case BuddyResponse::BUDDYRESPONSE_LOGIN: - { - deleteNotificationBox(); - } - break; - case BuddyResponse::BUDDYRESPONSE_DISCONNECT: - { - lastNotificationWasStatus = FALSE; - numOnlineInNotification = 0; - showNotificationBox(AsciiString::TheEmptyString, TheGameText->fetch("Buddy:MessageDisconnected")); - } - break; - case BuddyResponse::BUDDYRESPONSE_MESSAGE: - { - if ( wcscmp(resp.arg.message.text, L"I have authorized your request to add me to your list") == 0 ) - break; - - if (TheGameSpyInfo->isSavedIgnored(resp.profile)) - { - //DEBUG_CRASH(("Player is ignored!")); - break; // no buddy messages from ignored people - } - - // save message for future incarnations of the buddy window - BuddyMessageList *messages = TheGameSpyInfo->getBuddyMessages(); - BuddyMessage message; - message.m_timestamp = resp.arg.message.date; - message.m_senderID = resp.profile; - message.m_recipientID = TheGameSpyInfo->getLocalProfileID(); - message.m_recipientNick = TheGameSpyInfo->getLocalBaseName(); - message.m_message = resp.arg.message.text; - // insert status into box - BuddyInfoMap *m = TheGameSpyInfo->getBuddyMap(); - BuddyInfoMap::iterator senderIt = m->find(message.m_senderID); - AsciiString nick; - if (senderIt != m->end()) - nick = senderIt->second.m_name.str(); - else - nick = resp.arg.message.nick; - message.m_senderNick = nick; - messages->push_back(message); - - DEBUG_LOG(("Inserting buddy chat from '%s'/'%s'", nick.str(), resp.arg.message.nick)); - - // put message on screen - insertChat(message); - - // play audio notification - AudioEventRTS buddyMsgAudio("GUIMessageReceived"); - if( TheAudio ) - { - TheAudio->addAudioEvent( &buddyMsgAudio ); - } - - UnicodeString snippet = message.m_message; - snippet.truncateTo(11); - UnicodeString s; - s.format(TheGameText->fetch("Buddy:MessageNotification"), nick.str(), snippet.str()); - lastNotificationWasStatus = FALSE; - numOnlineInNotification = 0; - showNotificationBox(AsciiString::TheEmptyString, s); - } - break; - case BuddyResponse::BUDDYRESPONSE_REQUEST: - { - // save request for future incarnations of the buddy window - BuddyInfoMap *m = TheGameSpyInfo->getBuddyRequestMap(); - BuddyInfo info; - info.m_countryCode = resp.arg.request.countrycode; - info.m_email = resp.arg.request.email; - info.m_name = resp.arg.request.nick; - info.m_id = resp.profile; - info.m_status = (GPEnum)0; - info.m_statusString = resp.arg.request.text; - (*m)[resp.profile] = info; - - // TODO: put request on screen - updateBuddyInfo(); - // insert status into box - lastNotificationWasStatus = FALSE; - numOnlineInNotification = 0; - showNotificationBox(info.m_name, TheGameText->fetch("Buddy:AddNotification")); - } - break; - case BuddyResponse::BUDDYRESPONSE_STATUS: - { - BuddyInfoMap *m = TheGameSpyInfo->getBuddyMap(); - BuddyInfoMap::const_iterator bit = m->find(resp.profile); - Bool seenPreviously = FALSE; - GPEnum oldStatus = GP_OFFLINE; - GPEnum newStatus = resp.arg.status.status; - if (bit != m->end()) - { - seenPreviously = TRUE; - oldStatus = (*m)[resp.profile].m_status; - } - BuddyInfo info; - info.m_countryCode = resp.arg.status.countrycode; - info.m_email = resp.arg.status.email; - info.m_name = resp.arg.status.nick; - info.m_id = resp.profile; - info.m_status = newStatus; - info.m_statusString = UnicodeString(MultiByteToWideCharSingleLine(resp.arg.status.statusString).c_str()); - info.m_locationString = UnicodeString(MultiByteToWideCharSingleLine(resp.arg.status.location).c_str()); - (*m)[resp.profile] = info; - - updateBuddyInfo(); - PopulateLobbyPlayerListbox(); - RefreshGameListBoxes(); - if ( (newStatus == GP_OFFLINE && seenPreviously) || - (newStatus == GP_ONLINE && (oldStatus == GP_OFFLINE || !seenPreviously)) ) - //if (!info.m_statusString.compareNoCase(L"Offline") || - //!info.m_statusString.compareNoCase(L"Online")) - { - // insert status into box - AsciiString marker; - marker.format("Buddy:%lsNotification", info.m_statusString.str()); - - lastNotificationWasStatus = TRUE; - if (newStatus != GP_OFFLINE) - ++numOnlineInNotification; - - showNotificationBox(info.m_name, TheGameText->fetch(marker)); - } - else if( newStatus == GP_RECV_GAME_INVITE && !seenPreviously) - { - lastNotificationWasStatus = TRUE; - if (newStatus != GP_OFFLINE) - ++numOnlineInNotification; - - showNotificationBox(info.m_name, TheGameText->fetch("Buddy:OnlineNotification")); - } - } - break; - } - } - } - else - { - DEBUG_CRASH(("No buddy message queue!")); - } - if(noticeLayout && timeGetTime() > noticeExpires) - { - deleteNotificationBox(); - } -} - -void showNotificationBox( AsciiString nick, UnicodeString message) -{ -// if(!GameSpyIsOverlayOpen(GSOVERLAY_BUDDY)) -// return; - if( !noticeLayout ) - noticeLayout = TheWindowManager->winCreateLayout( "Menus/PopupBuddyListNotification.wnd" ); - noticeLayout->hide( FALSE ); - if (buttonNotificationID == NAMEKEY_INVALID) - { - buttonNotificationID = TheNameKeyGenerator->nameToKey("PopupBuddyListNotification.wnd:ButtonNotification"); - } - GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr,buttonNotificationID); - if(!win) - { - deleteNotificationBox(); - return; - } - - if (lastNotificationWasStatus && numOnlineInNotification > 1) - { - message = TheGameText->fetch("Buddy:MultipleOnlineNotification"); - } - - if (nick.isNotEmpty()) - message.format(message, nick.str()); - GadgetButtonSetText(win, message); - //GadgetStaticTextSetText(win, message); - noticeExpires = timeGetTime() + NOTIFICATION_EXPIRES; - noticeLayout->bringForward(); - - AudioEventRTS buttonClick("GUICommunicatorIncoming"); - - if( TheAudio ) - { - TheAudio->addAudioEvent( &buttonClick ); - } - -} - -void deleteNotificationBox() -{ - lastNotificationWasStatus = FALSE; - numOnlineInNotification = 0; - if(noticeLayout) - { - noticeLayout->destroyWindows(); - deleteInstance(noticeLayout); - noticeLayout = nullptr; - } -} - -void PopulateOldBuddyMessages() -{ - // show previous messages - BuddyMessageList *messages = TheGameSpyInfo->getBuddyMessages(); - for (BuddyMessageList::iterator mIt = messages->begin(); mIt != messages->end(); ++mIt) - { - BuddyMessage message = *mIt; - insertChat(message); - } -} - -//------------------------------------------------------------------------------------------------- -/** Initialize the WOL Buddy Overlay */ -//------------------------------------------------------------------------------------------------- -void WOLBuddyOverlayInit( WindowLayout *layout, void *userData ) -{ - parentID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:BuddyMenuParent" ); - buttonHideID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ButtonHide" ); - buttonAddBuddyID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ButtonAdd" ); - buttonDeleteBuddyID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ButtonDelete" ); - //textEntryID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:TextEntryChat" ); - //listboxBuddyID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ListboxBuddies" ); - //listboxChatID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ListboxBuddyChat" ); - buttonAcceptBuddyID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ButtonYes" ); - buttonDenyBuddyID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ButtonNo" ); - radioButtonBuddiesID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:RadioButtonBuddies" ); - radioButtonIgnoreID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:RadioButtonIgnore" ); - parentBuddiesID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:BuddiesParent" ); - parentIgnoreID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:IgnoreParent" ); - listboxIgnoreID = TheNameKeyGenerator->nameToKey( "WOLBuddyOverlay.wnd:ListboxIgnore" ); - - - parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); - buttonHide = TheWindowManager->winGetWindowFromId( parent, buttonHideID); - buttonAddBuddy = TheWindowManager->winGetWindowFromId( parent, buttonAddBuddyID); - buttonDeleteBuddy = TheWindowManager->winGetWindowFromId( parent, buttonDeleteBuddyID); - // textEntry = TheWindowManager->winGetWindowFromId( parent, textEntryID); - //listboxBuddy = TheWindowManager->winGetWindowFromId( parent, listboxBuddyID); - //listboxChat = TheWindowManager->winGetWindowFromId( parent, listboxChatID); - buttonAcceptBuddy = TheWindowManager->winGetWindowFromId( parent, buttonAcceptBuddyID); - buttonDenyBuddy = TheWindowManager->winGetWindowFromId( parent, buttonDenyBuddyID); - radioButtonBuddies = TheWindowManager->winGetWindowFromId( parent, radioButtonBuddiesID); - radioButtonIgnore = TheWindowManager->winGetWindowFromId( parent, radioButtonIgnoreID); - parentBuddies = TheWindowManager->winGetWindowFromId( parent, parentBuddiesID); - parentIgnore = TheWindowManager->winGetWindowFromId( parent, parentIgnoreID); - listboxIgnore = TheWindowManager->winGetWindowFromId( parent, listboxIgnoreID); - - InitBuddyControls(BUDDY_WINDOW_BUDDIES); - - GadgetRadioSetSelection(radioButtonBuddies,FALSE); - parentBuddies->winHide(FALSE); - parentIgnore->winHide(TRUE); - - //GadgetTextEntrySetText(textEntry, UnicodeString::TheEmptyString); - - PopulateOldBuddyMessages(); - - // Show Menu - layout->hide( FALSE ); - - // Set Keyboard to Main Parent - TheWindowManager->winSetFocus( parent ); - - isOverlayActive = true; - updateBuddyInfo(); - -} - -//------------------------------------------------------------------------------------------------- -/** WOL Buddy Overlay shutdown method */ -//------------------------------------------------------------------------------------------------- -void WOLBuddyOverlayShutdown( WindowLayout *layout, void *userData ) -{ - listboxIgnore = nullptr; - - // hide menu - layout->hide( TRUE ); - - // our shutdown is complete - //TheShell->shutdownComplete( layout ); - - isOverlayActive = false; - - InitBuddyControls(BUDDY_RESETALL_CRAP); - -} - - -//------------------------------------------------------------------------------------------------- -/** WOL Buddy Overlay update method */ -//------------------------------------------------------------------------------------------------- -void WOLBuddyOverlayUpdate( WindowLayout * layout, void *userData) -{ - if (!TheGameSpyBuddyMessageQueue || !TheGameSpyBuddyMessageQueue->isConnected()) - GameSpyCloseOverlay(GSOVERLAY_BUDDY); -} - -//------------------------------------------------------------------------------------------------- -/** WOL Buddy Overlay input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLBuddyOverlayInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonHide, buttonHideID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; -} - -//------------------------------------------------------------------------------------------------- -/** WOL Buddy Overlay window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLBuddyOverlaySystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - UnicodeString txtInput; - if(BuddyControlSystem(window, msg, mData1, mData2) == MSG_HANDLED) - { - return MSG_HANDLED; - } - switch( msg ) - { - - - case GWM_CREATE: - { - - break; - } - - case GWM_DESTROY: - { - break; - } - - case GWM_INPUT_FOCUS: - { - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - } - case GLM_RIGHT_CLICKED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == listboxIgnoreID ) - { - RightClickStruct *rc = (RightClickStruct *)mData2; - WindowLayout *rcLayout; - if(rc->pos < 0) - break; - - Bool isBuddy = false, isRequest = false; - GPProfile profileID = (GPProfile)GadgetListBoxGetItemData(control, rc->pos); - UnicodeString nick = GadgetListBoxGetText(control, rc->pos); - BuddyInfoMap *buddies = TheGameSpyInfo->getBuddyMap(); - BuddyInfoMap::iterator bIt; - bIt = buddies->find(profileID); - if (bIt != buddies->end()) - { - isBuddy = true; - } - else - { - buddies = TheGameSpyInfo->getBuddyRequestMap(); - bIt = buddies->find(profileID); - if (bIt != buddies->end()) - { - isRequest = true; - } - else - { - // neither buddy nor request - //break; - } - } - - GadgetListBoxSetSelected(control, rc->pos); - if (isBuddy) - rcLayout = TheWindowManager->winCreateLayout("Menus/RCBuddiesMenu.wnd"); - else if (isRequest) - rcLayout = TheWindowManager->winCreateLayout("Menus/RCBuddyRequestMenu.wnd"); - else - rcLayout = TheWindowManager->winCreateLayout("Menus/RCNonBuddiesMenu.wnd"); - rcMenu = rcLayout->getFirstWindow(); - rcMenu->winGetLayout()->runInit(); - rcMenu->winBringToTop(); - rcMenu->winHide(FALSE); - - - - rcMenu->winSetPosition(rc->mouseX, rc->mouseY); - GameSpyRCMenuData *rcData = NEW GameSpyRCMenuData; - rcData->m_id = profileID; - rcData->m_nick.translate(nick); - rcData->m_itemType = (isBuddy)?ITEM_BUDDY:((isRequest)?ITEM_REQUEST:ITEM_NONBUDDY); - setUnignoreText(rcLayout, rcData->m_nick, rcData->m_id); - rcMenu->winSetUserData((void *)rcData); - TheWindowManager->winSetLoneWindow(rcMenu); - } - break; - } - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if (controlID == buttonHideID) - { - GameSpyCloseOverlay( GSOVERLAY_BUDDY ); - } - else if (controlID == radioButtonBuddiesID) - { - parentBuddies->winHide(FALSE); - parentIgnore->winHide(TRUE); - } - else if (controlID == radioButtonIgnoreID) - { - parentBuddies->winHide(TRUE); - parentIgnore->winHide(FALSE); - refreshIgnoreList(); - } - else if (controlID == buttonAddBuddyID) - { - /* - UnicodeString uName = GadgetTextEntryGetText(textEntry); - AsciiString aName; - aName.translate(uName); - if (!aName.isEmpty()) - { - TheWOLBuddyList->requestBuddyAdd(aName); - } - GadgetTextEntrySetText(textEntry, UnicodeString::TheEmptyString); - */ - } - else if (controlID == buttonDeleteBuddyID) - { - /* - int selected; - AsciiString selectedName = AsciiString::TheEmptyString; - - GadgetListBoxGetSelected(listbox, &selected); - if (selected >= 0) - selectedName = TheNameKeyGenerator->keyToName((NameKeyType)(int)GadgetListBoxGetItemData(listbox, selected)); - - if (!selectedName.isEmpty()) - { - TheWOLBuddyList->requestBuddyDelete(selectedName); - } - */ - } - break; - } - case GLM_DOUBLE_CLICKED: - { - /* - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if( controlID == listboxBuddyID ) - { - int rowSelected = mData2; - - if (rowSelected >= 0) - { - UnicodeString buddyName; - GameWindow *listboxWindow = TheWindowManager->winGetWindowFromId( parent, listboxBuddyID ); - - // get text of buddy name - buddyName = GadgetListBoxGetText( listboxWindow, rowSelected,0 ); - GPProfile buddyID = (GPProfile)GadgetListBoxGetItemData( listboxWindow, rowSelected, 0 ); - - Int index = -1; - gpGetBuddyIndex(TheGPConnection, buddyID, &index); - if (index >= 0) - { - GPBuddyStatus status; - gpGetBuddyStatus(TheGPConnection, rowSelected, &status); - - UnicodeString string; - string.format(L"To join %s in %hs:", buddyName.str(), status.locationString); - GameSpyAddText(string, GSCOLOR_DEFAULT); - - if (status.status == GP_CHATTING) - { - AsciiString location = status.locationString; - AsciiString val; - location.nextToken(&val, "/"); - location.nextToken(&val, "/"); - location.nextToken(&val, "/"); - - string.format(L" ???"); - if (!val.isEmpty()) - { - Int groupRoom = atoi(val.str()); - if (TheGameSpyChat->getCurrentGroupRoomID() == groupRoom) - { - // already there - string.format(L" nothing"); - GameSpyAddText(string, GSCOLOR_DEFAULT); - } - else - { - GroupRoomMap *rooms = TheGameSpyChat->getGroupRooms(); - if (rooms) - { - Bool needToJoin = true; - GroupRoomMap::iterator it = rooms->find(groupRoom); - if (it != rooms->end()) - { - // he's in a different room - if (TheGameSpyChat->getCurrentGroupRoomID()) - { - string.format(L" leave group room"); - GameSpyAddText(string, GSCOLOR_DEFAULT); - - TheGameSpyChat->leaveRoom(GroupRoom); - } - else if (TheGameSpyGame->isInGame()) - { - if (TheGameSpyGame->isGameInProgress()) - { - string.format(L" can't leave game in progress"); - GameSpyAddText(string, GSCOLOR_DEFAULT); - needToJoin = false; - } - else - { - string.format(L" leave game setup"); - GameSpyAddText(string, GSCOLOR_DEFAULT); - - TheGameSpyChat->leaveRoom(StagingRoom); - TheGameSpyGame->leaveGame(); - } - } - if (needToJoin) - { - string.format(L" join lobby %d", groupRoom); - TheGameSpyChat->joinGroupRoom(groupRoom); - GameSpyAddText(string, GSCOLOR_DEFAULT); - } - } - } - } - } - } - } - else - { - DEBUG_CRASH(("No buddy associated with that ProfileID")); - GameSpyUpdateBuddyOverlay(); - } - } - } - */ - break; - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; -} - -WindowMsgHandledType PopupBuddyNotificationSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - case GWM_CREATE: - { - break; - } - - case GWM_DESTROY: - { - break; - } - - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if (controlID == buttonNotificationID) - { - GameSpyOpenOverlay( GSOVERLAY_BUDDY ); - } - break; - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; -} - -/* -static NameKeyType buttonAcceptBuddyID = NAMEKEY_INVALID; -static NameKeyType buttonDenyBuddyID = NAMEKEY_INVALID; -*/ -static NameKeyType buttonAddID = NAMEKEY_INVALID; -static NameKeyType buttonDeleteID = NAMEKEY_INVALID; -static NameKeyType buttonPlayID = NAMEKEY_INVALID; -static NameKeyType buttonIgnoreID = NAMEKEY_INVALID; -static NameKeyType buttonStatsID = NAMEKEY_INVALID; -// Window Pointers ------------------------------------------------------------------------ -//static GameWindow *rCparent = nullptr; - - -//------------------------------------------------------------------------------------------------- -/** WOL Buddy Overlay Right Click menu callbacks */ -//------------------------------------------------------------------------------------------------- -void WOLBuddyOverlayRCMenuInit( WindowLayout *layout, void *userData ) -{ - AsciiString controlName; - controlName.format("%s:ButtonAdd",layout->getFilename().str()+6); - buttonAddID = TheNameKeyGenerator->nameToKey( controlName ); - controlName.format("%s:ButtonDelete",layout->getFilename().str()+6); - buttonDeleteID = TheNameKeyGenerator->nameToKey( controlName ); - controlName.format("%s:ButtonPlay",layout->getFilename().str()+6); - buttonPlayID = TheNameKeyGenerator->nameToKey( controlName ); - controlName.format("%s:ButtonIgnore",layout->getFilename().str()+6); - buttonIgnoreID = TheNameKeyGenerator->nameToKey( controlName ); - controlName.format("%s:ButtonStats",layout->getFilename().str()+6); - buttonStatsID = TheNameKeyGenerator->nameToKey( controlName ); -} -static void closeRightClickMenu(GameWindow *win) -{ - - if(win) - { - WindowLayout *winLay = win->winGetLayout(); - if(!winLay) - return; - winLay->destroyWindows(); - deleteInstance(winLay); - winLay = nullptr; - - } -} - -void RequestBuddyAdd(Int profileID, AsciiString nick) -{ - // request to add a buddy - BuddyRequest req; - req.buddyRequestType = BuddyRequest::BUDDYREQUEST_ADDBUDDY; - req.arg.addbuddy.id = profileID; - UnicodeString buddyAddstr; - buddyAddstr = TheGameText->fetch("GUI:BuddyAddReq"); - wcslcpy(req.arg.addbuddy.text, buddyAddstr.str(), MAX_BUDDY_CHAT_LEN); - TheGameSpyBuddyMessageQueue->addRequest(req); - - UnicodeString s; - Bool exists = TRUE; - s.format(TheGameText->fetch("Buddy:InviteSent", &exists)); - if (!exists) - { - // no string yet. don't display. - return; - } - - // save message for future incarnations of the buddy window - BuddyMessageList *messages = TheGameSpyInfo->getBuddyMessages(); - BuddyMessage message; - message.m_timestamp = time(nullptr); - message.m_senderID = 0; - message.m_senderNick = ""; - message.m_recipientID = TheGameSpyInfo->getLocalProfileID(); - message.m_recipientNick = TheGameSpyInfo->getLocalBaseName(); - message.m_message.format(TheGameText->fetch("Buddy:InviteSentToPlayer"), nick.str()); - - // insert status into box - messages->push_back(message); - - DEBUG_LOG(("Inserting buddy add request")); - - // put message on screen - insertChat(message); - - // play audio notification - AudioEventRTS buddyMsgAudio("GUIMessageReceived"); - if( TheAudio ) - { - TheAudio->addAudioEvent( &buddyMsgAudio ); - } - - lastNotificationWasStatus = FALSE; - numOnlineInNotification = 0; - showNotificationBox(AsciiString::TheEmptyString, s); -} - -WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - case GWM_CREATE: - { - - break; - } - - case GWM_DESTROY: - { - rcMenu = nullptr; - break; - } - - case GGM_CLOSE: - { - closeRightClickMenu(window); - //rcMenu = nullptr; - break; - } - - - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - GameSpyRCMenuData *rcData = (GameSpyRCMenuData*)window->winGetUserData(); - if(!rcData) - break; - DEBUG_ASSERTCRASH(rcData, ("WOLBuddyOverlayRCMenuSystem GBM_SELECTED:: we're attempting to read the GameSpyRCMenuData from the window, but the data's not there")); - GPProfile profileID = rcData->m_id; - AsciiString nick = rcData->m_nick; - - Bool isBuddy = false, isRequest = false; - Bool isGameSpyUser = profileID > 0; - if (rcData->m_itemType == ITEM_BUDDY) - isBuddy = TRUE; - else if (rcData->m_itemType == ITEM_REQUEST) - isRequest = TRUE; - - delete rcData; - rcData = nullptr; - - window->winSetUserData(nullptr); - //DEBUG_ASSERTCRASH(profileID > 0, ("Bad profile ID in user data!")); - - if( controlID == buttonAddID ) - { - if(!isGameSpyUser) - break; - DEBUG_LOG(("ButtonAdd was pushed")); - if (isRequest) - { - // ok the request - BuddyRequest req; - req.buddyRequestType = BuddyRequest::BUDDYREQUEST_OKADD; - req.arg.profile.id = profileID; - TheGameSpyBuddyMessageQueue->addRequest(req); - - BuddyInfoMap *m = TheGameSpyInfo->getBuddyRequestMap(); - m->erase( profileID ); - // if the profile ID is not from a buddy and we're okaying his request, then - // request to add him to our list automatically CLH 2-18-03 - if(!TheGameSpyInfo->isBuddy(profileID)) - { - RequestBuddyAdd(profileID, nick); - } - updateBuddyInfo(); - } - else if (!isBuddy) - { - RequestBuddyAdd(profileID, nick); - } - } - else if( controlID == buttonDeleteID ) - { - if(!isGameSpyUser) - break; - if (isBuddy) - { - // delete the buddy - BuddyRequest req; - req.buddyRequestType = BuddyRequest::BUDDYREQUEST_DELBUDDY; - req.arg.profile.id = profileID; - TheGameSpyBuddyMessageQueue->addRequest(req); - } - else - { - // delete the request - BuddyRequest req; - req.buddyRequestType = BuddyRequest::BUDDYREQUEST_DENYADD; - req.arg.profile.id = profileID; - TheGameSpyBuddyMessageQueue->addRequest(req); - BuddyInfoMap *m = TheGameSpyInfo->getBuddyRequestMap(); - m->erase( profileID ); - } - BuddyInfoMap *buddies = (isBuddy)?TheGameSpyInfo->getBuddyMap():TheGameSpyInfo->getBuddyRequestMap(); - buddies->erase(profileID); - updateBuddyInfo(); - DEBUG_LOG(("ButtonDelete was pushed")); - PopulateLobbyPlayerListbox(); - } - else if( controlID == buttonPlayID ) - { - DEBUG_LOG(("buttonPlayID was pushed")); - } - else if( controlID == buttonIgnoreID ) - { - DEBUG_LOG(("%s is isGameSpyUser %d", nick.str(), isGameSpyUser)); - if( isGameSpyUser ) - { - if(TheGameSpyInfo->isSavedIgnored(profileID)) - { - TheGameSpyInfo->removeFromSavedIgnoreList(profileID); - } - else - { - TheGameSpyInfo->addToSavedIgnoreList(profileID, nick); - } - } - else - { - if(TheGameSpyInfo->isIgnored(nick)) - { - TheGameSpyInfo->removeFromIgnoreList(nick); - } - else - { - TheGameSpyInfo->addToIgnoreList(nick); - } - } - updateBuddyInfo(); - refreshIgnoreList(); - // repopulate our player listboxes now - PopulateLobbyPlayerListbox(); - } - else if( controlID == buttonStatsID ) - { - DEBUG_LOG(("buttonStatsID was pushed")); - GameSpyCloseOverlay(GSOVERLAY_PLAYERINFO); - SetLookAtPlayer(profileID,nick ); - GameSpyOpenOverlay(GSOVERLAY_PLAYERINFO); - PSRequest req; - req.requestType = PSRequest::PSREQUEST_READPLAYERSTATS; - req.player.id = profileID; - TheGameSpyPSMessageQueue->addRequest(req); - } - closeRightClickMenu(window); - break; - } - default: - return MSG_IGNORED; - - } - return MSG_HANDLED; -} - - -void setUnignoreText( WindowLayout *layout, AsciiString nick, GPProfile id) -{ - AsciiString controlName; - controlName.format("%s:ButtonIgnore",layout->getFilename().str()+6); - NameKeyType ID = TheNameKeyGenerator->nameToKey( controlName ); - GameWindow *win = TheWindowManager->winGetWindowFromId(layout->getFirstWindow(), ID); - if(win) - { - if(TheGameSpyInfo->isSavedIgnored(id) || TheGameSpyInfo->isIgnored(nick)) - GadgetButtonSetText(win, TheGameText->fetch("GUI:Unignore")); - } -} - -void refreshIgnoreList() -{ - - - SavedIgnoreMap tempMap; - tempMap = TheGameSpyInfo->returnSavedIgnoreList(); - SavedIgnoreMap::iterator it = tempMap.begin(); - GadgetListBoxReset(listboxIgnore); - while(it != tempMap.end()) - { - UnicodeString name; - name.translate(it->second); - Int pos = GadgetListBoxAddEntryText(listboxIgnore, name, GameMakeColor(255,100,100,255),-1); - GadgetListBoxSetItemData(listboxIgnore, (void *)it->first,pos ); - ++it; - } - IgnoreList tempList; - tempList = TheGameSpyInfo->returnIgnoreList(); - IgnoreList::iterator iListIt = tempList.begin(); - while( iListIt != tempList.end()) - { - AsciiString aName = *iListIt; - UnicodeString name; - name.translate(aName); - Int pos = GadgetListBoxAddEntryText(listboxIgnore, name, GameMakeColor(255,100,100,255),-1); - GadgetListBoxSetItemData(listboxIgnore, nullptr,pos ); - ++iListIt; - } - -// -// GPProfile profileID = 0; -// PlayerInfoMap::iterator it = TheGameSpyInfo->getPlayerInfoMap()->find(aName); -// if (it != TheGameSpyInfo->getPlayerInfoMap()->end()) -// profileID = it->second.m_profileID; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp deleted file mode 100644 index aef620ff9d1..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp +++ /dev/null @@ -1,232 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////// -// FILE: WOLCustomScoreScreen.cpp -// Author: Matt Campbell, December 2001 -// Description: Custom match score screen -/////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Lib/BaseType.h" -#include "Common/GameEngine.h" -#include "Common/NameKeyGenerator.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetTextEntry.h" -#include "Common/GlobalData.h" -//#include "GameNetwork/WOL.h" -//#include "GameNetwork/WOLmenus.h" - - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -// window ids ------------------------------------------------------------------------------ -static NameKeyType parentWOLCustomScoreID = NAMEKEY_INVALID; -static NameKeyType buttonDisconnectID = NAMEKEY_INVALID; -static NameKeyType buttonLobbyID = NAMEKEY_INVALID; - -// Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLCustomScore = nullptr; -static GameWindow *buttonDisconnect = nullptr; -static GameWindow *buttonLobby = nullptr; - -//------------------------------------------------------------------------------------------------- -/** Initialize the WOL Status Menu */ -//------------------------------------------------------------------------------------------------- -void WOLCustomScoreScreenInit( WindowLayout *layout, void *userData ) -{ - parentWOLCustomScoreID = TheNameKeyGenerator->nameToKey( "WOLCustomScoreScreen.wnd:WOLCustomScoreScreenParent" ); - buttonDisconnectID = TheNameKeyGenerator->nameToKey( "WOLCustomScoreScreen.wnd:ButtonDisconnect" ); - buttonLobbyID = TheNameKeyGenerator->nameToKey( "WOLCustomScoreScreen.wnd:ButtonLobby" ); - parentWOLCustomScore = TheWindowManager->winGetWindowFromId( nullptr, parentWOLCustomScoreID ); - buttonDisconnect = TheWindowManager->winGetWindowFromId( nullptr, buttonDisconnectID); - buttonLobby = TheWindowManager->winGetWindowFromId( nullptr, buttonLobbyID); - - /* - if (WOL::TheWOL->getState() == WOL::WOLAPI_FATAL_ERROR) - { - // We can get to the score screen even though we've been disconnected. Just hide - // any buttons that lead back into WOL. - buttonLobby->winHide( TRUE ); - } - */ - - // Show Menu - layout->hide( FALSE ); - - // Set Keyboard to Main Parent - TheWindowManager->winSetFocus( parentWOLCustomScore ); -} - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void WOLCustomScoreScreenShutdown( WindowLayout *layout, void *userData ) -{ - // hide menu - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout ); -} - - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu update method */ -//------------------------------------------------------------------------------------------------- -void WOLCustomScoreScreenUpdate( WindowLayout * layout, void *userData) -{ - /* - if (WOL::TheWOL) - WOL::TheWOL->update(); - */ -} - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLCustomScoreScreenInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonDisconnect, buttonDisconnectID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; -} - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLCustomScoreScreenSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - UnicodeString txtInput; - - switch( msg ) - { - - case GWM_CREATE: - { - - break; - } - - case GWM_DESTROY: - { - break; - } - - case GWM_INPUT_FOCUS: - { - // if we're given the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - } - - case GBM_SELECTED: - { - /* - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if ( controlID == buttonDisconnectID ) - { - if (WOL::TheWOL->setState( WOL::WOLAPI_FATAL_ERROR )) - { - WOL::TheWOL->addCommand( WOL::WOLCOMMAND_RESET ); // don't display an error, log out, or anything - } - - } - else if ( controlID == buttonLobbyID ) - { - if (WOL::TheWOL->getState() != WOL::WOLAPI_FATAL_ERROR) - { - WOL::TheWOL->setScreen(WOL::WOLAPI_MENU_CUSTOMLOBBY); - WOL::TheWOL->setGameMode(WOL::WOLTYPE_CUSTOM); - WOL::TheWOL->setState( WOL::WOLAPI_LOBBY ); - WOL::TheWOL->addCommand( WOL::WOLCOMMAND_REFRESH_CHANNELS ); - } - else - { - } - } - */ - break; - } - - case GEM_EDIT_DONE: - { - break; - } - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp deleted file mode 100644 index 2729a2eb158..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ReplayMenu.cpp ///////////////////////////////////////////////////////////////////// -// Author: Chris The masta Huybregts, December 2001 -// Description: Replay Menus -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameEngine.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/MessageBox.h" -#include "GameNetwork/WOLBrowser/WebBrowser.h" - -// window ids ------------------------------------------------------------------------------------- -static NameKeyType parentWindowID = NAMEKEY_INVALID; -static NameKeyType buttonBackID = NAMEKEY_INVALID; -static NameKeyType windowLadderID = NAMEKEY_INVALID; - - -// window pointers -------------------------------------------------------------------------------- -static GameWindow *parentWindow = nullptr; -static GameWindow *buttonBack = nullptr; -static GameWindow *windowLadder = nullptr; - - -//------------------------------------------------------------------------------------------------- -/** Initialize the single player menu */ -//------------------------------------------------------------------------------------------------- -void WOLLadderScreenInit( WindowLayout *layout, void *userData ) -{ - TheShell->showShellMap(TRUE); - - // get ids for our children controls - parentWindowID = TheNameKeyGenerator->nameToKey( "WOLLadderScreen.wnd:LadderParent" ); - buttonBackID = TheNameKeyGenerator->nameToKey( "WOLLadderScreen.wnd:ButtonBack" ); - windowLadderID = TheNameKeyGenerator->nameToKey( "WOLLadderScreen.wnd:WindowLadder" ); - - parentWindow = TheWindowManager->winGetWindowFromId( nullptr, parentWindowID ); - buttonBack = TheWindowManager->winGetWindowFromId( parentWindow, buttonBackID ); - windowLadder = TheWindowManager->winGetWindowFromId( parentWindow, windowLadderID ); - - //Load the listbox shiznit -// PopulateReplayFileListbox(listboxReplayFiles); - - //TheWebBrowser->createBrowserWindow("Westwood", windowLadder); - if (TheWebBrowser != nullptr) - { - TheWebBrowser->createBrowserWindow("MessageBoard", windowLadder); - } - - // show menu - layout->hide( FALSE ); - - // set keyboard focus to main parent - TheWindowManager->winSetFocus( parentWindow ); - -} - -//------------------------------------------------------------------------------------------------- -/** single player menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void WOLLadderScreenShutdown( WindowLayout *layout, void *userData ) -{ - - if (TheWebBrowser != nullptr) - { - TheWebBrowser->closeBrowserWindow(windowLadder); - } - - // hide menu - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout ); - -} - -//------------------------------------------------------------------------------------------------- -/** single player menu update method */ -//------------------------------------------------------------------------------------------------- -void WOLLadderScreenUpdate( WindowLayout *layout, void *userData ) -{ - -} - -//------------------------------------------------------------------------------------------------- -/** Replay menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLLadderScreenInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonBack, buttonBackID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** single player menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLLadderScreenSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - - } - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == buttonBackID ) - { - - // thou art directed to return to thy known solar system immediately! - TheShell->pop(); - - } - - break; - - } - - default: - return MSG_IGNORED; - } - - return MSG_HANDLED; -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp deleted file mode 100644 index 086149c9516..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////// -// FILE: WOLLocaleSelectPopup.cpp -// Author: Matt Campbell, December 2001 -// Description: WOL locale select popup -/////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/GameText.h" -#include "Common/CustomMatchPreferences.h" -#include "Common/GameEngine.h" -#include "Common/GameSpyMiscPreferences.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "Common/GlobalData.h" -#include "GameNetwork/GameSpyOverlay.h" -#include "GameNetwork/GameSpy/PeerDefs.h" -#include "GameNetwork/GameSpy/PeerThread.h" -#include "GameNetwork/GameSpy/PersistentStorageDefs.h" -#include "GameNetwork/GameSpy/PersistentStorageThread.h" - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -// window ids ------------------------------------------------------------------------------ -static NameKeyType parentLocaleSelectID = NAMEKEY_INVALID; -static NameKeyType buttonOkID = NAMEKEY_INVALID; -static NameKeyType listboxLocaleID = NAMEKEY_INVALID; - -// Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentLocaleSelect = nullptr; -static GameWindow *buttonOk = nullptr; -static GameWindow *listboxLocale = nullptr; - -//------------------------------------------------------------------------------------------------- -/** Initialize the WOL Status Menu */ -//------------------------------------------------------------------------------------------------- -void WOLLocaleSelectInit( WindowLayout *layout, void *userData ) -{ - parentLocaleSelectID = TheNameKeyGenerator->nameToKey( "PopupLocaleSelect.wnd:ParentLocaleSelect" ); - buttonOkID = TheNameKeyGenerator->nameToKey( "PopupLocaleSelect.wnd:ButtonOk" ); - listboxLocaleID = TheNameKeyGenerator->nameToKey( "PopupLocaleSelect.wnd:ListBoxLocaleSelect" ); - parentLocaleSelect = TheWindowManager->winGetWindowFromId( nullptr, parentLocaleSelectID ); - buttonOk = TheWindowManager->winGetWindowFromId( nullptr, buttonOkID); - listboxLocale = TheWindowManager->winGetWindowFromId( nullptr, listboxLocaleID); - - for (int i=LOC_MIN; i<=LOC_MAX; ++i) - { - AsciiString id; - id.format("WOL:Locale%2.2d", i); - GadgetListBoxAddEntryText(listboxLocale, TheGameText->fetch(id.str()), GameSpyColor[GSCOLOR_DEFAULT], -1, -1); - } - GadgetListBoxSetSelected(listboxLocale, 0); - - // Show Menu - layout->hide( FALSE ); - - // Set Keyboard to Main Parent - TheWindowManager->winSetFocus( parentLocaleSelect ); - TheWindowManager->winSetModal( parentLocaleSelect ); -} - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void WOLLocaleSelectShutdown( WindowLayout *layout, void *userData ) -{ - - // hide menu - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout ); - -} - - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu update method */ -//------------------------------------------------------------------------------------------------- -void WOLLocaleSelectUpdate( WindowLayout * layout, void *userData) -{ - -} - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLLocaleSelectInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { -// UnsignedByte key = mData1; -// UnsignedByte state = mData2; - - // ---------------------------------------------------------------------------------------- - // don't let key fall through anywhere else - return MSG_HANDLED; - } - } - return MSG_IGNORED; -} - -//Int getRegistryNicknameOffset(AsciiString nick); /// @todo: mdc remove this once we can save ini pref files -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLLocaleSelectSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - UnicodeString txtInput; - - switch( msg ) - { - - - case GWM_CREATE: - { - - break; - } - - case GWM_DESTROY: - { - break; - } - - case GWM_INPUT_FOCUS: - { - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - } - - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if ( controlID == buttonOkID ) - { - int selected; - GadgetListBoxGetSelected(listboxLocale, &selected); - if (selected < 0) - return MSG_HANDLED; // can't select nothing! - PSRequest psReq; - psReq.requestType = PSRequest::PSREQUEST_UPDATEPLAYERLOCALE; - psReq.player.locale = selected + LOC_MIN; - psReq.email = TheGameSpyInfo->getLocalEmail().str(); - psReq.nick = TheGameSpyInfo->getLocalBaseName().str(); - psReq.password = TheGameSpyInfo->getLocalPassword().str(); - psReq.player.id = TheGameSpyInfo->getLocalProfileID(); - - TheGameSpyPSMessageQueue->addRequest(psReq); - GameSpyCloseOverlay(GSOVERLAY_LOCALESELECT); - - GameSpyMiscPreferences cPref; - cPref.setLocale(psReq.player.locale); - cPref.write(); - - PSPlayerStats stats = TheGameSpyPSMessageQueue->findPlayerStatsByID(TheGameSpyInfo->getLocalProfileID()); - stats.locale = psReq.player.locale; - if (stats.id == TheGameSpyInfo->getLocalProfileID()) - TheGameSpyPSMessageQueue->trackPlayerStats(stats); - - if(stats.id == 0) - { - stats = TheGameSpyInfo->getCachedLocalPlayerStats(); - stats.locale = psReq.player.locale; - TheGameSpyInfo->setCachedLocalPlayerStats(stats); - } - else - { - // force an update of our shtuff - PSResponse newResp; - newResp.responseType = PSResponse::PSRESPONSE_PLAYERSTATS; - newResp.player = TheGameSpyPSMessageQueue->findPlayerStatsByID(TheGameSpyInfo->getLocalProfileID()); - TheGameSpyPSMessageQueue->addResponse(newResp); - } - CheckReOpenPlayerInfo(); - } - break; - } - - case GEM_EDIT_DONE: - { - break; - } - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp deleted file mode 100644 index 6edaba07101..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp +++ /dev/null @@ -1,1537 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////// -// FILE: WOLLoginMenu.cpp -// Author: Chris Huybregts, November 2001 -// Description: Lan Lobby Menu -/////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/STLTypedefs.h" - -#include "Common/file.h" -#include "Common/FileSystem.h" -#include "Common/GameEngine.h" -#include "Common/GameSpyMiscPreferences.h" -#include "Common/QuotedPrintable.h" -#include "Common/Registry.h" -#include "Common/OptionPreferences.h" -#include "GameClient/AnimateWindowManager.h" -#include "GameClient/ClientInstance.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameText.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetComboBox.h" -#include "GameClient/GadgetCheckBox.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/MessageBox.h" -#include "GameClient/ShellHooks.h" -#include "GameClient/GameWindowTransitions.h" - -#include "GameNetwork/GameSpy/GSConfig.h" -#include "GameNetwork/GameSpy/PeerDefs.h" -#include "GameNetwork/GameSpy/PeerThread.h" -#include "GameNetwork/GameSpy/PingThread.h" -#include "GameNetwork/GameSpy/BuddyThread.h" -#include "GameNetwork/GameSpy/ThreadUtils.h" -#include "GameNetwork/GameSpy/PersistentStorageThread.h" - -#include "GameNetwork/GameSpyOverlay.h" - -#include "GameNetwork/WOLBrowser/WebBrowser.h" - - -#ifdef ALLOW_NON_PROFILED_LOGIN -Bool GameSpyUseProfiles = false; -#endif // ALLOW_NON_PROFILED_LOGIN - -static Bool webBrowserActive = FALSE; -static Bool useWebBrowserForTOS = FALSE; - -static Bool isShuttingDown = false; -static Bool buttonPushed = false; -static const char *nextScreen = nullptr; - -static const UnsignedInt loginTimeoutInMS = 10000; -static UnsignedInt loginAttemptTime = 0; - -class GameSpyLoginPreferences : public UserPreferences -{ -public: - GameSpyLoginPreferences(); - virtual ~GameSpyLoginPreferences() override; - - Bool loadFromIniFile(); - - virtual Bool load(AsciiString fname) override; - virtual Bool write() override; - - AsciiString getPasswordForEmail( AsciiString email ); - AsciiString getDateForEmail( AsciiString email, AsciiString &month, AsciiString &date, AsciiString &year ); - AsciiStringList getNicksForEmail( AsciiString email ); - void addLogin( AsciiString email, AsciiString nick, AsciiString password, AsciiString date ); - void forgetLogin( AsciiString email ); - AsciiStringList getEmails(); - -private: - typedef std::map PassMap; - typedef std::map DateMap; - typedef std::map NickMap; - PassMap m_emailPasswordMap; - NickMap m_emailNickMap; - DateMap m_emailDateMap; -}; - -static AsciiString obfuscate( AsciiString in ) -{ - char *buf = NEW char[in.getLength() + 1]; - strcpy(buf, in.str()); - static const char *xorWord = "1337Munkee"; - char *c = buf; - const char *c2 = xorWord; - while (*c) - { - if (!*c2) - c2 = xorWord; - if (*c != *c2) - *c = *c++ ^ *c2++; - else - c++, c2++; - } - AsciiString out = buf; - delete[] buf; - return out; -} - -GameSpyLoginPreferences::GameSpyLoginPreferences() -{ - loadFromIniFile(); -} - -GameSpyLoginPreferences::~GameSpyLoginPreferences() -{ -} - -Bool GameSpyLoginPreferences::loadFromIniFile() -{ - if (rts::ClientInstance::getInstanceId() > 1u) - { - AsciiString fname; - fname.format("GameSpyLogin_Instance%.2u.ini", rts::ClientInstance::getInstanceId()); - return load(fname); - } - - return load("GameSpyLogin.ini"); -} - - -Bool GameSpyLoginPreferences::load( AsciiString fname ) -{ - if (!UserPreferences::load(fname)) - return false; - - UserPreferences::iterator upIt = begin(); - while (upIt != end()) - { - AsciiString key = upIt->first; - if (key.startsWith("pass_")) - { - AsciiString email, pass; - email = key.str() + 5; - pass = upIt->second; - - AsciiString quoPass = QuotedPrintableToAsciiString(pass); - pass = obfuscate(quoPass); - - m_emailPasswordMap[email] = pass; - } - if (key.startsWith("date_")) - { - AsciiString email, date; - email = key.str() + 5; - date = upIt->second; - - date = QuotedPrintableToAsciiString(date); - - m_emailDateMap[email] = date; - } - else if (key.startsWith("nick_")) - { - AsciiString email, nick, nicks; - email = key.str() + 5; - nicks = upIt->second; - while (nicks.nextToken(&nick, ",")) - { - m_emailNickMap[email].push_back(nick); - } - } - ++upIt; - } - - return true; -} - -Bool GameSpyLoginPreferences::write() -{ - if (m_filename.isEmpty()) - return false; - - FILE *fp = fopen(m_filename.str(), "w"); - if (fp) - { - fprintf(fp, "lastEmail = %s\n", ((*this)["lastEmail"].str())); - fprintf(fp, "lastName = %s\n", ((*this)["lastName"].str())); - fprintf(fp, "useProfiles = %s\n", ((*this)["useProfiles"].str())); - PassMap::iterator passIt = m_emailPasswordMap.begin(); - while (passIt != m_emailPasswordMap.end()) - { - AsciiString pass = obfuscate(passIt->second); - AsciiString quoPass = AsciiStringToQuotedPrintable(pass); - - fprintf(fp, "pass_%s = %s\n", passIt->first.str(), quoPass.str()); - ++passIt; - } - - PassMap::iterator dateIt = m_emailDateMap.begin(); - while (dateIt != m_emailDateMap.end()) - { - AsciiString date = AsciiStringToQuotedPrintable(dateIt->second); - - fprintf(fp, "date_%s = %s\n", dateIt->first.str(), date.str()); - ++dateIt; - } - - NickMap::iterator nickIt = m_emailNickMap.begin(); - while (nickIt != m_emailNickMap.end()) - { - AsciiString nicks; - AsciiStringListIterator listIt = nickIt->second.begin(); - while (listIt != nickIt->second.end()) - { - nicks.concat(*listIt); - nicks.concat(','); - ++listIt; - } - fprintf(fp, "nick_%s = %s\n", nickIt->first.str(), nicks.str()); - ++nickIt; - } - - fclose(fp); - return true; - } - return false; -} -AsciiString GameSpyLoginPreferences::getDateForEmail( AsciiString email, AsciiString &month, AsciiString &date, AsciiString &year ) -{ - if ( m_emailDateMap.find(email) == m_emailDateMap.end() ) - return AsciiString::TheEmptyString; - AsciiString fullDate = m_emailDateMap[email]; - if(fullDate.getLength() != 8) - return AsciiString::TheEmptyString; - month.format("%c%c", fullDate.getCharAt(0), fullDate.getCharAt(1)); - date.format("%c%c", fullDate.getCharAt(2), fullDate.getCharAt(3)); - year.format("%c%c%c%c", fullDate.getCharAt(4), fullDate.getCharAt(5), fullDate.getCharAt(6), fullDate.getCharAt(7)); - return m_emailDateMap[email]; -} - -AsciiString GameSpyLoginPreferences::getPasswordForEmail( AsciiString email ) -{ - if ( m_emailPasswordMap.find(email) == m_emailPasswordMap.end() ) - return AsciiString::TheEmptyString; - return m_emailPasswordMap[email]; -} - -AsciiStringList GameSpyLoginPreferences::getNicksForEmail( AsciiString email ) -{ - if ( m_emailNickMap.find(email) == m_emailNickMap.end() ) - { - AsciiStringList empty; - return empty; - } - return m_emailNickMap[email]; -} - -void GameSpyLoginPreferences::addLogin( AsciiString email, AsciiString nick, AsciiString password, AsciiString date ) -{ - if ( std::find(m_emailNickMap[email].begin(), m_emailNickMap[email].end(), nick) == m_emailNickMap[email].end() ) - m_emailNickMap[email].push_back(nick); - m_emailPasswordMap[email] = password; - m_emailDateMap[email] = date; -} - -void GameSpyLoginPreferences::forgetLogin( AsciiString email ) -{ - m_emailNickMap.erase(email); - m_emailPasswordMap.erase(email); - m_emailDateMap.erase(email); - -} - -AsciiStringList GameSpyLoginPreferences::getEmails() -{ - AsciiStringList theList; - NickMap::iterator it = m_emailNickMap.begin(); - while (it != m_emailNickMap.end()) - { - theList.push_back(it->first); - ++it; - } - return theList; -} - -static GameSpyLoginPreferences *loginPref = nullptr; - -static void startPings() -{ - std::list pingServers = TheGameSpyConfig->getPingServers(); - Int timeout = TheGameSpyConfig->getPingTimeoutInMs(); - Int reps = TheGameSpyConfig->getNumPingRepetitions(); - - for (std::list::const_iterator it = pingServers.begin(); it != pingServers.end(); ++it) - { - AsciiString pingServer = *it; - PingRequest req; - req.hostname = pingServer.str(); - req.repetitions = reps; - req.timeout = timeout; - ThePinger->addRequest(req); - } -} - -//------------------------------------------------------------------------------------------------- -/** This is called when a shutdown is complete for this menu */ -//------------------------------------------------------------------------------------------------- -static void shutdownComplete( WindowLayout *layout ) -{ - - isShuttingDown = false; - - // hide the layout - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout, (nextScreen != nullptr) ); - - if (nextScreen != nullptr) - { - if (loginPref) - { - loginPref->write(); - delete loginPref; - loginPref = nullptr; - } - TheShell->push(nextScreen); - } - else - { - DEBUG_ASSERTCRASH(loginPref != nullptr, ("loginPref == nullptr")); - if (loginPref) - { - loginPref->write(); - delete loginPref; - loginPref = nullptr; - } - } - - nextScreen = nullptr; - -} - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -// window ids ------------------------------------------------------------------------------ -static NameKeyType parentWOLLoginID = NAMEKEY_INVALID; -static NameKeyType buttonBackID = NAMEKEY_INVALID; // profile, quick -static NameKeyType buttonLoginID = NAMEKEY_INVALID; // profile, quick -static NameKeyType buttonCreateAccountID = NAMEKEY_INVALID; // profile, quick -static NameKeyType buttonUseAccountID = NAMEKEY_INVALID; // quick -static NameKeyType buttonDontUseAccountID = NAMEKEY_INVALID; // profile -static NameKeyType buttonTOSID = NAMEKEY_INVALID; // TOS -static NameKeyType parentTOSID = NAMEKEY_INVALID; // TOS Parent -static NameKeyType buttonTOSOKID = NAMEKEY_INVALID; // TOS -static NameKeyType listboxTOSID = NAMEKEY_INVALID; // TOS -static NameKeyType comboBoxEmailID = NAMEKEY_INVALID; // profile -static NameKeyType comboBoxLoginNameID = NAMEKEY_INVALID; // profile -static NameKeyType textEntryLoginNameID = NAMEKEY_INVALID; // quick -static NameKeyType textEntryPasswordID = NAMEKEY_INVALID; // profile -static NameKeyType checkBoxRememberPasswordID = NAMEKEY_INVALID; // checkbox to remember information or not -static NameKeyType textEntryMonthID = NAMEKEY_INVALID; // profile -static NameKeyType textEntryDayID = NAMEKEY_INVALID; // profile -static NameKeyType textEntryYearID = NAMEKEY_INVALID; // profile - -// Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLLogin = nullptr; -static GameWindow *buttonBack = nullptr; -static GameWindow *buttonLogin = nullptr; -static GameWindow *buttonCreateAccount = nullptr; -static GameWindow *buttonUseAccount = nullptr; -static GameWindow *buttonDontUseAccount = nullptr; -static GameWindow *buttonTOS = nullptr; -static GameWindow *parentTOS = nullptr; -static GameWindow *buttonTOSOK = nullptr; -static GameWindow *listboxTOS = nullptr; -static GameWindow *comboBoxEmail = nullptr; -static GameWindow *comboBoxLoginName = nullptr; -static GameWindow *textEntryLoginName = nullptr; -static GameWindow *textEntryPassword = nullptr; -static GameWindow *checkBoxRememberPassword = nullptr; -static GameWindow *textEntryMonth = nullptr; -static GameWindow *textEntryDay = nullptr; -static GameWindow *textEntryYear = nullptr; - -void EnableLoginControls( Bool state ) -{ - if (buttonLogin) - buttonLogin->winEnable(state); - if (buttonCreateAccount) - buttonCreateAccount->winEnable(state); - if (buttonUseAccount) - buttonUseAccount->winEnable(state); - if (buttonDontUseAccount) - buttonDontUseAccount->winEnable(state); - if (comboBoxEmail) - comboBoxEmail->winEnable(state); - if (comboBoxLoginName) - comboBoxLoginName->winEnable(state); - if (textEntryLoginName) - textEntryLoginName->winEnable(state); - if (textEntryPassword) - textEntryPassword->winEnable(state); - if (checkBoxRememberPassword) - checkBoxRememberPassword->winEnable(state); - if( buttonTOS ) - buttonTOS->winEnable(state); - - if (textEntryMonth) - textEntryMonth->winEnable(state); - if (textEntryDay) - textEntryDay->winEnable(state); - if( textEntryYear ) - textEntryYear->winEnable(state); -} - -//------------------------------------------------------------------------------------------------- -/** Initialize the WOL Login Menu */ -//------------------------------------------------------------------------------------------------- -void WOLLoginMenuInit( WindowLayout *layout, void *userData ) -{ - nextScreen = nullptr; - buttonPushed = false; - isShuttingDown = false; - loginAttemptTime = 0; - - if (!loginPref) - { - loginPref = NEW GameSpyLoginPreferences; - } - - // if the ESRB warning is blank (other country) hide the box - GameWindow *esrbTitle = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("GameSpyLoginProfile.wnd:StaticTextESRBTop") ); - GameWindow *esrbParent = TheWindowManager->winGetWindowFromId( nullptr, NAMEKEY("GameSpyLoginProfile.wnd:ParentESRB") ); - if (esrbTitle && esrbParent) - { - if ( GadgetStaticTextGetText( esrbTitle ).getLength() < 2 ) - { - esrbParent->winHide(TRUE); - } - } - - parentWOLLoginID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:WOLLoginMenuParent" ); - buttonBackID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:ButtonBack" ); - buttonLoginID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:ButtonLogin" ); - buttonCreateAccountID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:ButtonCreateAccount" ); - buttonUseAccountID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:ButtonUseAccount" ); - buttonDontUseAccountID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:ButtonDontUseAccount" ); - buttonTOSID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:ButtonTOS" ); - parentTOSID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:ParentTOS" ); - buttonTOSOKID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:ButtonTOSOK" ); - listboxTOSID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:ListboxTOS" ); - comboBoxEmailID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:ComboBoxEmail" ); - comboBoxLoginNameID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:ComboBoxLoginName" ); - textEntryLoginNameID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:TextEntryLoginName" ); - textEntryPasswordID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:TextEntryPassword" ); - checkBoxRememberPasswordID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:CheckBoxRememberInfo" ); - textEntryMonthID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:TextEntryMonth" ); - textEntryDayID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:TextEntryDay" ); - textEntryYearID = TheNameKeyGenerator->nameToKey( "GameSpyLoginProfile.wnd:TextEntryYear" ); - - parentWOLLogin = TheWindowManager->winGetWindowFromId( nullptr, parentWOLLoginID ); - buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); - buttonLogin = TheWindowManager->winGetWindowFromId( nullptr, buttonLoginID); - buttonCreateAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonCreateAccountID); - buttonUseAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonUseAccountID); - buttonDontUseAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonDontUseAccountID); - buttonTOS = TheWindowManager->winGetWindowFromId( nullptr, buttonTOSID); - parentTOS = TheWindowManager->winGetWindowFromId( nullptr, parentTOSID); - buttonTOSOK = TheWindowManager->winGetWindowFromId( nullptr, buttonTOSOKID); - listboxTOS = TheWindowManager->winGetWindowFromId( nullptr, listboxTOSID); - comboBoxEmail = TheWindowManager->winGetWindowFromId( nullptr, comboBoxEmailID); - comboBoxLoginName = TheWindowManager->winGetWindowFromId( nullptr, comboBoxLoginNameID); - textEntryLoginName = TheWindowManager->winGetWindowFromId( nullptr, textEntryLoginNameID); - textEntryPassword = TheWindowManager->winGetWindowFromId( nullptr, textEntryPasswordID); - checkBoxRememberPassword = TheWindowManager->winGetWindowFromId( nullptr, checkBoxRememberPasswordID); - textEntryMonth = TheWindowManager->winGetWindowFromId( nullptr, textEntryMonthID); - textEntryDay = TheWindowManager->winGetWindowFromId( nullptr, textEntryDayID); - textEntryYear = TheWindowManager->winGetWindowFromId( nullptr, textEntryYearID); - - GadgetTextEntrySetText(textEntryMonth, UnicodeString::TheEmptyString); - - GadgetTextEntrySetText(textEntryDay, UnicodeString::TheEmptyString); - - GadgetTextEntrySetText(textEntryYear, UnicodeString::TheEmptyString); - - - - GameWindowList tabList; - tabList.push_front(comboBoxEmail); - tabList.push_back(comboBoxLoginName); - tabList.push_back(textEntryPassword); - tabList.push_back(textEntryMonth); - tabList.push_back(textEntryDay); - tabList.push_back(textEntryYear); - tabList.push_back(checkBoxRememberPassword); - tabList.push_back(buttonLogin); - tabList.push_back(buttonCreateAccount); - tabList.push_back(buttonTOS); - tabList.push_back(buttonBack); - TheWindowManager->clearTabList(); - TheWindowManager->registerTabList(tabList); - TheWindowManager->winSetFocus( comboBoxEmail ); - // short form or long form? -#ifdef ALLOW_NON_PROFILED_LOGIN - if (parentWOLLogin) - { - GameSpyUseProfiles = true; -#endif // ALLOW_NON_PROFILED_LOGIN - - DEBUG_ASSERTCRASH(buttonBack, ("buttonBack missing!")); - DEBUG_ASSERTCRASH(buttonLogin, ("buttonLogin missing!")); - DEBUG_ASSERTCRASH(buttonCreateAccount, ("buttonCreateAccount missing!")); - //DEBUG_ASSERTCRASH(buttonDontUseAccount, ("buttonDontUseAccount missing!")); - DEBUG_ASSERTCRASH(comboBoxEmail, ("comboBoxEmail missing!")); - DEBUG_ASSERTCRASH(comboBoxLoginName, ("comboBoxLoginName missing!")); - DEBUG_ASSERTCRASH(textEntryPassword, ("textEntryPassword missing!")); - - //TheShell->registerWithAnimateManager(parentWOLLogin, WIN_ANIMATION_SLIDE_TOP, TRUE); - /**/ -// TheShell->registerWithAnimateManager(buttonTOS, WIN_ANIMATION_SLIDE_BOTTOM, TRUE); - //TheShell->registerWithAnimateManager(buttonCreateAccount, WIN_ANIMATION_SLIDE_LEFT, TRUE); - //TheShell->registerWithAnimateManager(buttonDontUseAccount, WIN_ANIMATION_SLIDE_LEFT, TRUE); -// TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_BOTTOM, TRUE); - /**/ -#ifdef ALLOW_NON_PROFILED_LOGIN - } - else - { - GameSpyUseProfiles = false; - - parentWOLLoginID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:WOLLoginMenuParent" ); - buttonBackID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:ButtonBack" ); - buttonLoginID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:ButtonLogin" ); - buttonCreateAccountID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:ButtonCreateAccount" ); - buttonUseAccountID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:ButtonUseAccount" ); - buttonDontUseAccountID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:ButtonDontUseAccount" ); - buttonTOSID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:ButtonTOS" ); - parentTOSID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:ParentTOS" ); - buttonTOSOKID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:ButtonTOSOK" ); - listboxTOSID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:ListboxTOS" ); - comboBoxEmailID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:ComboBoxEmail" ); - textEntryLoginNameID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:TextEntryLoginName" ); - textEntryPasswordID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:TextEntryPassword" ); - checkBoxRememberPasswordID = TheNameKeyGenerator->nameToKey( "GameSpyLoginQuick.wnd:CheckBoxRememberPassword" ); - - parentWOLLogin = TheWindowManager->winGetWindowFromId( nullptr, parentWOLLoginID ); - buttonBack = TheWindowManager->winGetWindowFromId( nullptr, buttonBackID); - buttonLogin = TheWindowManager->winGetWindowFromId( nullptr, buttonLoginID); - buttonCreateAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonCreateAccountID); - buttonUseAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonUseAccountID); - buttonDontUseAccount = TheWindowManager->winGetWindowFromId( nullptr, buttonDontUseAccountID); - comboBoxEmail = TheWindowManager->winGetWindowFromId( nullptr, comboBoxEmailID); - buttonTOS = TheWindowManager->winGetWindowFromId( nullptr, buttonTOSID); - parentTOS = TheWindowManager->winGetWindowFromId( nullptr, parentTOSID); - buttonTOSOK = TheWindowManager->winGetWindowFromId( nullptr, buttonTOSOKID); - listboxTOS = TheWindowManager->winGetWindowFromId( nullptr, listboxTOSID); - textEntryLoginName = TheWindowManager->winGetWindowFromId( nullptr, textEntryLoginNameID); - textEntryPassword = TheWindowManager->winGetWindowFromId( nullptr, textEntryPasswordID); - checkBoxRememberPassword = TheWindowManager->winGetWindowFromId( nullptr, checkBoxRememberPasswordID); - - DEBUG_ASSERTCRASH(buttonBack, ("buttonBack missing!")); - DEBUG_ASSERTCRASH(buttonLogin, ("buttonLogin missing!")); - DEBUG_ASSERTCRASH(buttonCreateAccount, ("buttonCreateAccount missing!")); - DEBUG_ASSERTCRASH(buttonUseAccount, ("buttonUseAccount missing!")); - DEBUG_ASSERTCRASH(textEntryLoginName, ("textEntryLoginName missing!")); - TheWindowManager->winSetFocus( textEntryLoginName ); - //TheShell->registerWithAnimateManager(parentWOLLogin, WIN_ANIMATION_SLIDE_TOP, TRUE); - -// TheShell->registerWithAnimateManager(buttonTOS, WIN_ANIMATION_SLIDE_LEFT, TRUE); -// TheShell->registerWithAnimateManager(buttonCreateAccount, WIN_ANIMATION_SLIDE_LEFT, TRUE); -// TheShell->registerWithAnimateManager(buttonUseAccount, WIN_ANIMATION_SLIDE_LEFT, TRUE); -// TheShell->registerWithAnimateManager(buttonBack, WIN_ANIMATION_SLIDE_RIGHT, TRUE); - - } -#endif // ALLOW_NON_PROFILED_LOGIN - - -#ifdef ALLOW_NON_PROFILED_LOGIN - if (GameSpyUseProfiles) - { -#endif // ALLOW_NON_PROFILED_LOGIN - // Read login names from registry... - GadgetComboBoxReset(comboBoxEmail); - GadgetTextEntrySetText(textEntryPassword, UnicodeString::TheEmptyString); - - // look for cached nicks to add - AsciiString lastName; - AsciiString lastEmail; - Bool markCheckBox = FALSE; - UserPreferences::const_iterator it = loginPref->find("lastName"); - if (it != loginPref->end()) - { - lastName = it->second; - } - it = loginPref->find("lastEmail"); - if (it != loginPref->end()) - { - lastEmail = it->second; - } - - // fill in list of Emails, and select the most recent - AsciiStringList cachedEmails = loginPref->getEmails(); - AsciiStringListIterator eIt = cachedEmails.begin(); - Int selectedPos = -1; - while (eIt != cachedEmails.end()) - { - UnicodeString uniEmail; - uniEmail.translate(*eIt); - Int pos = GadgetComboBoxAddEntry(comboBoxEmail, uniEmail, GameSpyColor[GSCOLOR_DEFAULT]); - if (*eIt == lastEmail) - selectedPos = pos; - - ++eIt; - } - if (selectedPos >= 0) - { - GadgetComboBoxSetSelectedPos(comboBoxEmail, selectedPos); - - // fill in the password for the selected email - UnicodeString pass; - pass.translate(loginPref->getPasswordForEmail(lastEmail)); - GadgetTextEntrySetText(textEntryPassword, pass); - - AsciiString month,day,year; - loginPref->getDateForEmail(lastEmail, month, day, year); - pass.translate(month); - GadgetTextEntrySetText(textEntryMonth, pass); - pass.translate(day); - GadgetTextEntrySetText(textEntryDay, pass); - pass.translate(year); - GadgetTextEntrySetText(textEntryYear, pass); - - markCheckBox = TRUE; - } - - // fill in list of nicks for selected email, selecting the most recent - GadgetComboBoxReset(comboBoxLoginName); - AsciiStringList cachedNicks = loginPref->getNicksForEmail(lastEmail); - AsciiStringListIterator nIt = cachedNicks.begin(); - selectedPos = -1; - while (nIt != cachedNicks.end()) - { - UnicodeString uniNick; - uniNick.translate(*nIt); - Int pos = GadgetComboBoxAddEntry(comboBoxLoginName, uniNick, GameSpyColor[GSCOLOR_DEFAULT]); - if (*nIt == lastName) - selectedPos = pos; - - ++nIt; - } - if (selectedPos >= 0) - { - GadgetComboBoxSetSelectedPos(comboBoxLoginName, selectedPos); - markCheckBox = TRUE; - } - // always start with not storing information - if( markCheckBox) - GadgetCheckBoxSetChecked(checkBoxRememberPassword, TRUE); - else - GadgetCheckBoxSetChecked(checkBoxRememberPassword, FALSE); -#ifdef ALLOW_NON_PROFILED_LOGIN - } - else - { - // Read login names from registry... - GadgetComboBoxReset(comboBoxLoginName); - UnicodeString nick; - - UserPreferences::const_iterator it = loginPref->find("lastName"); - if (it != loginPref->end()) - { - nick.translate(it->second); - } - else - { - char userBuf[32] = ""; - unsigned long bufSize = 32; - GetUserName(userBuf, &bufSize); - nick.translate(userBuf); - } - - GadgetTextEntrySetText(textEntryLoginName, nick); - } -#endif // ALLOW_NON_PROFILED_LOGIN - - EnableLoginControls(TRUE); - - // Show Menu - layout->hide( FALSE ); - - // Set Keyboard to Main Parent - - RaiseGSMessageBox(); - - OptionPreferences optionPref; - if (!optionPref.getBool("SawTOS", TRUE)) - { - TheWindowManager->winSendSystemMsg( parentWOLLogin, GBM_SELECTED, - (WindowMsgData)buttonTOS, buttonTOSID ); - } - TheTransitionHandler->setGroup("GameSpyLoginProfileFade"); - -} - -//------------------------------------------------------------------------------------------------- -/** WOL Login Menu shutdown method */ -//------------------------------------------------------------------------------------------------- -static Bool loggedInOK = false; -void WOLLoginMenuShutdown( WindowLayout *layout, void *userData ) -{ - isShuttingDown = true; - loggedInOK = false; - TheWindowManager->clearTabList(); - if (webBrowserActive) - { - if (TheWebBrowser != nullptr) - { - TheWebBrowser->closeBrowserWindow(listboxTOS); - } - webBrowserActive = FALSE; - } - - // if we are shutting down for an immediate pop, skip the animations - Bool popImmediate = *(Bool *)userData; - if( popImmediate ) - { - - shutdownComplete( layout ); - return; - - } - - TheShell->reverseAnimatewindow(); - TheTransitionHandler->reverse("GameSpyLoginProfileFade"); - -} - - -// this is used to check if we've got all the pings -static void checkLogin() -{ - if (loggedInOK && ThePinger && !ThePinger->arePingsInProgress()) - { - // save off our ping string, and end those threads - AsciiString pingStr = ThePinger->getPingString( 1000 ); - DEBUG_LOG(("Ping string is %s", pingStr.str())); - TheGameSpyInfo->setPingString(pingStr); - //delete ThePinger; - //ThePinger = nullptr; - - buttonPushed = true; - loggedInOK = false; // don't try this again - - loginAttemptTime = 0; - - // start looking for group rooms - TheGameSpyInfo->clearGroupRoomList(); - - SignalUIInteraction(SHELL_SCRIPT_HOOK_GENERALS_ONLINE_LOGIN); - nextScreen = "Menus/WOLWelcomeMenu.wnd"; - TheShell->pop(); - - // read in some cached data - GameSpyMiscPreferences mPref; - PSPlayerStats localPSStats = GameSpyPSMessageQueueInterface::parsePlayerKVPairs(mPref.getCachedStats().str()); - localPSStats.id = TheGameSpyInfo->getLocalProfileID(); - TheGameSpyInfo->setCachedLocalPlayerStats(localPSStats); -// TheGameSpyPSMessageQueue->trackPlayerStats(localPSStats); - - // and push the info around to other players -// PSResponse newResp; -// newResp.responseType = PSResponse::PSRESPONSE_PLAYERSTATS; -// newResp.player = localPSStats; -// TheGameSpyPSMessageQueue->addResponse(newResp); - } -} - -//------------------------------------------------------------------------------------------------- -/** WOL Login Menu update method */ -//------------------------------------------------------------------------------------------------- -void WOLLoginMenuUpdate( WindowLayout * layout, void *userData) -{ - - // We'll only be successful if we've requested to - if(isShuttingDown && TheShell->isAnimFinished() && TheTransitionHandler->isFinished()) - shutdownComplete(layout); - - if (TheShell->isAnimFinished() && !buttonPushed && TheGameSpyPeerMessageQueue) - { - PingResponse pingResp; - if (ThePinger && ThePinger->getResponse(pingResp)) - { - checkLogin(); - } - - PeerResponse resp; - if (!loggedInOK && TheGameSpyPeerMessageQueue->getResponse( resp )) - { - switch (resp.peerResponseType) - { - case PeerResponse::PEERRESPONSE_GROUPROOM: - { - GameSpyGroupRoom room; - room.m_groupID = resp.groupRoom.id; - room.m_maxWaiting = resp.groupRoom.maxWaiting; - room.m_name = resp.groupRoomName.c_str(); - room.m_translatedName = L"TEST"; - room.m_numGames = resp.groupRoom.numGames; - room.m_numPlaying = resp.groupRoom.numPlaying; - room.m_numWaiting = resp.groupRoom.numWaiting; - TheGameSpyInfo->addGroupRoom( room ); - } - break; - case PeerResponse::PEERRESPONSE_LOGIN: - { - loggedInOK = true; - - // fetch our player info - TheGameSpyInfo->setLocalName( resp.nick.c_str() ); - TheGameSpyInfo->setLocalProfileID( resp.player.profileID ); - TheGameSpyInfo->loadSavedIgnoreList(); - TheGameSpyInfo->setLocalIPs(resp.player.internalIP, resp.player.externalIP); - TheGameSpyInfo->readAdditionalDisconnects(); - //TheGameSpyInfo->setLocalEmail( resp.player.email ); - //TheGameSpyInfo->setLocalPassword( resp) - - GameSpyMiscPreferences miscPref; - TheGameSpyInfo->setMaxMessagesPerUpdate(miscPref.getMaxMessagesPerUpdate()); - } - break; - case PeerResponse::PEERRESPONSE_DISCONNECT: - { - loginAttemptTime = 0; - UnicodeString title, body; - AsciiString disconMunkee; - disconMunkee.format("GUI:GSDisconReason%d", resp.discon.reason); - title = TheGameText->fetch( "GUI:GSErrorTitle" ); - body = TheGameText->fetch( disconMunkee ); - GSMessageBoxOk( title, body ); - EnableLoginControls( TRUE ); - - // kill & restart the threads - AsciiString motd = TheGameSpyInfo->getMOTD(); - AsciiString config = TheGameSpyInfo->getConfig(); - DEBUG_LOG(("Tearing down GameSpy from WOLLoginMenuUpdate(PEERRESPONSE_DISCONNECT)")); - TearDownGameSpy(); - SetUpGameSpy( motd.str(), config.str() ); - } - break; - } - } - - checkLogin(); - } - - if (TheGameSpyInfo && !buttonPushed && loginAttemptTime && (loginAttemptTime + loginTimeoutInMS < timeGetTime())) - { - // timed out a login attempt, so say so - loginAttemptTime = 0; - UnicodeString title, body; - AsciiString disconMunkee; - disconMunkee.format("GUI:GSDisconReason4"); // ("could not connect to server") - title = TheGameText->fetch( "GUI:GSErrorTitle" ); - body = TheGameText->fetch( disconMunkee ); - GSMessageBoxOk( title, body ); - EnableLoginControls( TRUE ); - - // kill & restart the threads - AsciiString motd = TheGameSpyInfo->getMOTD(); - AsciiString config = TheGameSpyInfo->getConfig(); - DEBUG_LOG(("Tearing down GameSpy from WOLLoginMenuUpdate(login timeout)")); - TearDownGameSpy(); - SetUpGameSpy( motd.str(), config.str() ); - } - -} - -//------------------------------------------------------------------------------------------------- -/** WOL Login Menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLLoginMenuInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - if (buttonPushed) - break; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonBack, buttonBackID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; -} - -static Bool isNickOkay(UnicodeString nick) -{ - static const WideChar * legalIRCChars = L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]`_^{|}-"; - - Int len = nick.getLength(); - if (len == 0) - return TRUE; - - if (len == 1 && nick.getCharAt(0) == L'-') - return FALSE; - - WideChar newChar = nick.getCharAt(len-1); - if (wcschr(legalIRCChars, newChar) == nullptr) - return FALSE; - - return TRUE; -} - -static Bool isAgeOkay(AsciiString &month, AsciiString &day, AsciiString year) -{ - if(month.isEmpty() || day.isEmpty() || year.isEmpty() || year.getLength() != 4) - return FALSE; - - Int monthInt = atoi(month.str()); - Int dayInt = atoi(day.str()); - - if(monthInt > 12 || dayInt > 31) - return FALSE; - // setup date buffer for local region date format - month.format("%02.2d",monthInt); - day.format("%02.2d",dayInt); - - // test the year first - #define DATE_BUFFER_SIZE 256 - char dateBuffer[ DATE_BUFFER_SIZE ]; - GetDateFormat( LOCALE_SYSTEM_DEFAULT, - 0, nullptr, - "yyyy", - dateBuffer, DATE_BUFFER_SIZE ); - Int sysVal = atoi(dateBuffer); - Int userVal = atoi(year.str()); - if(sysVal - userVal >= 14) - return TRUE; - else if( sysVal - userVal <= 12) - return FALSE; - - GetDateFormat( LOCALE_SYSTEM_DEFAULT, - 0, nullptr, - "MM", - dateBuffer, DATE_BUFFER_SIZE ); - sysVal = atoi(dateBuffer); - userVal = atoi(month.str()); - if(sysVal - userVal >0 ) - return TRUE; - else if( sysVal -userVal < 0 ) - return FALSE; -// month.format("%02.2d",userVal); - GetDateFormat( LOCALE_SYSTEM_DEFAULT, - 0, nullptr, - "dd", - dateBuffer, DATE_BUFFER_SIZE ); - sysVal = atoi(dateBuffer); - userVal = atoi(day.str()); - if(sysVal - userVal< 0) - return FALSE; -// day.format("%02.2d",userVal); - return TRUE; -} - -//------------------------------------------------------------------------------------------------- -/** WOL Login Menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLLoginMenuSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - UnicodeString txtInput; - - switch( msg ) - { - - - case GWM_CREATE: - { - break; - } - - case GWM_DESTROY: - { - break; - } - - case GWM_INPUT_FOCUS: - { - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - } - - // someone typed in a combo box. Clear password (or fill it in if the typed name matches a known login name) - case GCM_UPDATE_TEXT: - { - UnicodeString uNick = GadgetComboBoxGetText(comboBoxLoginName); - UnicodeString uEmail = GadgetComboBoxGetText(comboBoxEmail); - AsciiString nick, email; - nick.translate(uNick); - email.translate(uEmail); - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - UnicodeString trimmedNick = uNick, trimmedEmail = uEmail; - trimmedNick.trim(); - trimmedEmail.trim(); - if (!trimmedNick.isEmpty()) - { - trimmedNick.trimEnd(L'\\'); - trimmedNick.trimEnd(L'/'); - } - if (!trimmedEmail.isEmpty()) - { - trimmedEmail.trimEnd(L'\\'); - trimmedEmail.trimEnd(L'/'); - } - if (trimmedEmail.getLength() != uEmail.getLength()) - { - // we just trimmed a space. set the text back and bail - GadgetComboBoxSetText(comboBoxEmail, trimmedEmail); - break; - } - if (trimmedNick.getLength() != nick.getLength()) - { - // we just trimmed a space. set the text back and bail - GadgetComboBoxSetText(comboBoxLoginName, trimmedNick); - break; - } - - if (controlID == comboBoxEmailID) - { - // email changed. look up password, and choose new login names - - // fill in the password for the selected email - UnicodeString pass; - pass.translate(loginPref->getPasswordForEmail(email)); - GadgetTextEntrySetText(textEntryPassword, pass); - - // fill in list of nicks for selected email, selecting the first - AsciiStringList cachedNicks = loginPref->getNicksForEmail(email); - AsciiStringListIterator nIt = cachedNicks.begin(); - Int selectedPos = -1; - GadgetComboBoxReset(comboBoxLoginName); - while (nIt != cachedNicks.end()) - { - UnicodeString uniNick; - uniNick.translate(*nIt); - GadgetComboBoxAddEntry(comboBoxLoginName, uniNick, GameSpyColor[GSCOLOR_DEFAULT]); - selectedPos = 0; - ++nIt; - } - if (selectedPos >= 0) - { - GadgetComboBoxSetSelectedPos(comboBoxLoginName, selectedPos); - GadgetCheckBoxSetChecked(checkBoxRememberPassword, true); - AsciiString month,day,year; - loginPref->getDateForEmail(email, month, day, year); - pass.translate(month); - GadgetTextEntrySetText(textEntryMonth, pass); - pass.translate(day); - GadgetTextEntrySetText(textEntryDay, pass); - pass.translate(year); - GadgetTextEntrySetText(textEntryYear, pass); - - } - else - { - GadgetCheckBoxSetChecked(checkBoxRememberPassword, false); - GadgetTextEntrySetText(textEntryMonth, UnicodeString::TheEmptyString); - GadgetTextEntrySetText(textEntryDay, UnicodeString::TheEmptyString); - GadgetTextEntrySetText(textEntryYear, UnicodeString::TheEmptyString); - - } - } - else if (controlID == comboBoxLoginNameID) - { - // they typed a new login name. Email & pass shouldn't change - } - - break; - } - - case GCM_SELECTED: - { - if (buttonPushed) - break; - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if (controlID == comboBoxEmailID) - { - // email changed. look up password, and choose new login names - UnicodeString uEmail = GadgetComboBoxGetText(comboBoxEmail); - AsciiString email; - email.translate(uEmail); - - // fill in the password for the selected email - UnicodeString pass; - pass.translate(loginPref->getPasswordForEmail(email)); - GadgetTextEntrySetText(textEntryPassword, pass); - - // fill in list of nicks for selected email, selecting the first - AsciiStringList cachedNicks = loginPref->getNicksForEmail(email); - AsciiStringListIterator nIt = cachedNicks.begin(); - Int selectedPos = -1; - GadgetComboBoxReset(comboBoxLoginName); - while (nIt != cachedNicks.end()) - { - UnicodeString uniNick; - uniNick.translate(*nIt); - GadgetComboBoxAddEntry(comboBoxLoginName, uniNick, GameSpyColor[GSCOLOR_DEFAULT]); - selectedPos = 0; - ++nIt; - } - if (selectedPos >= 0) - { - GadgetComboBoxSetSelectedPos(comboBoxLoginName, selectedPos); - GadgetCheckBoxSetChecked(checkBoxRememberPassword, true); - AsciiString month,day,year; - loginPref->getDateForEmail(email, month, day, year); - pass.translate(month); - GadgetTextEntrySetText(textEntryMonth, pass); - pass.translate(day); - GadgetTextEntrySetText(textEntryDay, pass); - pass.translate(year); - GadgetTextEntrySetText(textEntryYear, pass); - - } - else - { - GadgetCheckBoxSetChecked(checkBoxRememberPassword, false); - GadgetTextEntrySetText(textEntryMonth, UnicodeString::TheEmptyString); - GadgetTextEntrySetText(textEntryDay, UnicodeString::TheEmptyString); - GadgetTextEntrySetText(textEntryYear, UnicodeString::TheEmptyString); - } - - } - else if (controlID == comboBoxLoginNameID) - { - // they typed a new login name. Email & pass shouldn't change - } - break; - } - - case GBM_SELECTED: - { - if (buttonPushed) - break; - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - // If we back out, just bail - we haven't gotten far enough to need to log out - if ( controlID == buttonBackID ) - { - buttonPushed = true; - TearDownGameSpy(); - TheShell->pop(); - } -#ifdef ALLOW_NON_PROFILED_LOGIN - else if ( controlID == buttonUseAccountID ) - { - buttonPushed = true; - nextScreen = "Menus/GameSpyLoginProfile.wnd"; - TheShell->pop(); - //TheShell->push( "Menus/GameSpyLoginProfile.wnd" ); - } - else if ( controlID == buttonDontUseAccountID ) - { - buttonPushed = true; - nextScreen = "Menus/GameSpyLoginQuick.wnd"; - TheShell->pop(); - //TheShell->push( "Menus/GameSpyLoginQuick.wnd" ); - } -#endif // ALLOW_NON_PROFILED_LOGIN - else if ( controlID == buttonCreateAccountID ) - { -#ifdef ALLOW_NON_PROFILED_LOGIN - if (GameSpyUseProfiles) - { -#endif // ALLOW_NON_PROFILED_LOGIN - // actually attempt to create an account based on info entered - AsciiString month, day, year; - month.translate( GadgetTextEntryGetText(textEntryMonth) ); - day.translate( GadgetTextEntryGetText(textEntryDay) ); - year.translate( GadgetTextEntryGetText(textEntryYear) ); - - if(!isAgeOkay(month, day, year)) - { - GSMessageBoxOk(TheGameText->fetch("GUI:AgeFailedTitle"), TheGameText->fetch("GUI:AgeFailed")); - break; - } - - AsciiString login, password, email; - email.translate( GadgetComboBoxGetText(comboBoxEmail) ); - login.translate( GadgetComboBoxGetText(comboBoxLoginName) ); - password.translate( GadgetTextEntryGetText(textEntryPassword) ); - - if ( !email.isEmpty() && !login.isEmpty() && !password.isEmpty() ) - { - loginAttemptTime = timeGetTime(); - BuddyRequest req; - req.buddyRequestType = BuddyRequest::BUDDYREQUEST_LOGINNEW; - strlcpy(req.arg.login.nick, login.str(), ARRAY_SIZE(req.arg.login.nick)); - strlcpy(req.arg.login.email, email.str(), ARRAY_SIZE(req.arg.login.email)); - strlcpy(req.arg.login.password, password.str(), ARRAY_SIZE(req.arg.login.password)); - req.arg.login.hasFirewall = TRUE; - - TheGameSpyInfo->setLocalBaseName( login ); - //TheGameSpyInfo->setLocalProfileID( resp.player.profileID ); - TheGameSpyInfo->setLocalEmail( email ); - TheGameSpyInfo->setLocalPassword( password ); - DEBUG_LOG(("before create: TheGameSpyInfo->stuff(%s/%s/%s)", TheGameSpyInfo->getLocalBaseName().str(), TheGameSpyInfo->getLocalEmail().str(), TheGameSpyInfo->getLocalPassword().str())); - - TheGameSpyBuddyMessageQueue->addRequest( req ); - if(checkBoxRememberPassword && GadgetCheckBoxIsChecked(checkBoxRememberPassword)) - { - (*loginPref)["lastName"] = login; - (*loginPref)["lastEmail"] = email; - (*loginPref)["useProfiles"] = "yes"; - AsciiString date; - date = month; - date.concat(day); - date.concat(year); - - loginPref->addLogin(email, login, password, date); - } - - EnableLoginControls( FALSE ); - - // fire off some pings - startPings(); - } - else - { - // user didn't fill in all info. prompt him. - if(email.isEmpty() && login.isEmpty() && password.isEmpty()) - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:GSNoLoginInfoAll")); - else if( email.isEmpty() && login.isEmpty()) - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:GSNoLoginInfoEmailNickname")); - else if( email.isEmpty() && password.isEmpty()) - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:GSNoLoginInfoEmailPassword")); - else if( login.isEmpty() && password.isEmpty()) - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:GSNoLoginInfoNicknamePassword")); - else if( email.isEmpty()) - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:GSNoLoginInfoEmail")); - else if( password.isEmpty()) - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:GSNoLoginInfoPassword")); - else if( login.isEmpty() ) - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:GSNoLoginInfoNickname")); - else - GSMessageBoxOk(TheGameText->fetch("GUI:Error"), TheGameText->fetch("GUI:GSNoLoginInfoAll")); - } -#ifdef ALLOW_NON_PROFILED_LOGIN - } - else - { - // not the profile screen - switch to it - buttonPushed = TRUE; - nextScreen = "Menus/GameSpyLoginProfile.wnd"; - TheShell->pop(); - } -#endif // ALLOW_NON_PROFILED_LOGIN - } - else if ( controlID == buttonLoginID ) - { - AsciiString login, password, email; - -#ifdef ALLOW_NON_PROFILED_LOGIN - if (GameSpyUseProfiles) - { -#endif // ALLOW_NON_PROFILED_LOGIN - AsciiString month, day, year; - month.translate( GadgetTextEntryGetText(textEntryMonth) ); - day.translate( GadgetTextEntryGetText(textEntryDay) ); - year.translate( GadgetTextEntryGetText(textEntryYear) ); - - if(!isAgeOkay(month, day, year)) - { - GSMessageBoxOk(TheGameText->fetch("GUI:AgeFailedTitle"), TheGameText->fetch("GUI:AgeFailed")); - break; - } - - email.translate( GadgetComboBoxGetText(comboBoxEmail) ); - login.translate( GadgetComboBoxGetText(comboBoxLoginName) ); - password.translate( GadgetTextEntryGetText(textEntryPassword) ); - - if ( !email.isEmpty() && !login.isEmpty() && !password.isEmpty() ) - { - loginAttemptTime = timeGetTime(); - BuddyRequest req; - req.buddyRequestType = BuddyRequest::BUDDYREQUEST_LOGIN; - strlcpy(req.arg.login.nick, login.str(), ARRAY_SIZE(req.arg.login.nick)); - strlcpy(req.arg.login.email, email.str(), ARRAY_SIZE(req.arg.login.email)); - strlcpy(req.arg.login.password, password.str(), ARRAY_SIZE(req.arg.login.password)); - req.arg.login.hasFirewall = true; - - TheGameSpyInfo->setLocalBaseName( login ); - //TheGameSpyInfo->setLocalProfileID( resp.player.profileID ); - TheGameSpyInfo->setLocalEmail( email ); - TheGameSpyInfo->setLocalPassword( password ); - DEBUG_LOG(("before login: TheGameSpyInfo->stuff(%s/%s/%s)", TheGameSpyInfo->getLocalBaseName().str(), TheGameSpyInfo->getLocalEmail().str(), TheGameSpyInfo->getLocalPassword().str())); - - TheGameSpyBuddyMessageQueue->addRequest( req ); - if(checkBoxRememberPassword && GadgetCheckBoxIsChecked(checkBoxRememberPassword)) - { - (*loginPref)["lastName"] = login; - (*loginPref)["lastEmail"] = email; - (*loginPref)["useProfiles"] = "yes"; - AsciiString date; - date = month; - date.concat(day); - date.concat(year); - - loginPref->addLogin(email, login, password,date); - } - else - { - loginPref->forgetLogin(email); - } - EnableLoginControls( FALSE ); - - // fire off some pings - startPings(); - } - else - { - // user didn't fill in all info. prompt him. - if(email.isEmpty() && login.isEmpty() && password.isEmpty()) - GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:GSNoLoginInfoAll")); - else if( email.isEmpty() && login.isEmpty()) - GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:GSNoLoginInfoEmailNickname")); - else if( email.isEmpty() && password.isEmpty()) - GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:GSNoLoginInfoEmailPassword")); - else if( login.isEmpty() && password.isEmpty()) - GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:GSNoLoginInfoNicknamePassword")); - else if( email.isEmpty()) - GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:GSNoLoginInfoEmail")); - else if( password.isEmpty()) - GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:GSNoLoginInfoPassword")); - else if( login.isEmpty() ) - GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:GSNoLoginInfoNickname")); - else - GSMessageBoxOk(TheGameText->fetch("GUI:GSErrorTitle"), TheGameText->fetch("GUI:GSNoLoginInfoAll")); - } -#ifdef ALLOW_NON_PROFILED_LOGIN - } - else - { - login.translate( GadgetTextEntryGetText(textEntryLoginName) ); - - if ( !login.isEmpty() ) - { - loginAttemptTime = timeGetTime(); - PeerRequest req; - req.peerRequestType = PeerRequest::PEERREQUEST_LOGIN; - req.nick = login.str(); - req.login.profileID = 0; - TheGameSpyPeerMessageQueue->addRequest( req ); - - (*loginPref)["lastName"] = login; - loginPref->erase("lastEmail"); - (*loginPref)["useProfiles"] = "no"; - EnableLoginControls( FALSE ); - - // fire off some pings - startPings(); - } - } -#endif // ALLOW_NON_PROFILED_LOGIN - - } - else if ( controlID == buttonTOSID ) - { - parentTOS->winHide(FALSE); - useWebBrowserForTOS = FALSE;//loginPref->getBool("UseTOSBrowser", TRUE); - if (useWebBrowserForTOS && (TheWebBrowser != nullptr)) - { - TheWebBrowser->createBrowserWindow("TermsOfService", listboxTOS); - webBrowserActive = TRUE; - } - else - { - // Okay, no web browser. This means we're looking at a UTF-8 text file. - GadgetListBoxReset(listboxTOS); - AsciiString fileName; - fileName.format("Data\\%s\\TOS.txt", GetRegistryLanguage().str()); - File *theFile = TheFileSystem->openFile(fileName.str(), File::READ); - if (theFile) - { - Int size = theFile->size(); - - char *fileBuf = new char[size]; - Color tosColor = GameMakeColor(255, 255, 255, 255); - - Int bytesRead = theFile->read(fileBuf, size); - if (bytesRead == size && size > 2) - { - fileBuf[size-1] = 0; // just to be safe - AsciiString asciiBuf = fileBuf+2; - AsciiString asciiLine; - while (asciiBuf.nextToken(&asciiLine, "\r\n")) - { - UnicodeString uniLine; - uniLine = UnicodeString(MultiByteToWideCharSingleLine(asciiLine.str()).c_str()); - uniLine.trimEnd(); - DEBUG_LOG(("adding TOS line: [%ls]", uniLine.str())); - GadgetListBoxAddEntryText(listboxTOS, uniLine, tosColor, -1); - } - - } - - delete[] fileBuf; - fileBuf = nullptr; - - theFile->close(); - theFile = nullptr; - } - } - EnableLoginControls( FALSE ); - buttonBack->winEnable(FALSE); - - } - else if ( controlID == buttonTOSOKID ) - { - EnableLoginControls( TRUE ); - - parentTOS->winHide(TRUE); - if (useWebBrowserForTOS && (TheWebBrowser != nullptr)) - { - if (listboxTOS != nullptr) - { - TheWebBrowser->closeBrowserWindow(listboxTOS); - } - } - - OptionPreferences optionPref; - optionPref["SawTOS"] = "yes"; - optionPref.write(); - webBrowserActive = FALSE; - buttonBack->winEnable(TRUE); - } - break; - } - - case GEM_EDIT_DONE: - { - break; - } - /* - case GEM_UPDATE_TEXT: - { - if (buttonPushed) - break; - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if ( controlID == textEntryLoginNameID ) - { - UnicodeString munkee = GadgetTextEntryGetText( textEntryLoginName ); - if ( !isNickOkay( munkee ) ) - { - munkee.removeLastChar(); - GadgetTextEntrySetText( textEntryLoginName, munkee ); - } - } - break; - } - */ - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; -} - - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp deleted file mode 100644 index 98c4e4cb9d5..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp +++ /dev/null @@ -1,196 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////// -// FILE: WOLMessageWindow.cpp -// Author: Chris Huybregts, November 2001 -// Description: Lan Lobby Menu -/////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameEngine.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameNetwork/IPEnumeration.h" -//#include "GameNetwork/WOL.h" - - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -// window ids ------------------------------------------------------------------------------ -static NameKeyType parentWOLMessageWindowID = NAMEKEY_INVALID; -static NameKeyType buttonCancelID = NAMEKEY_INVALID; - -// Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLMessageWindow = nullptr; -static GameWindow *buttonCancel = nullptr; - - -//------------------------------------------------------------------------------------------------- -/** Initialize the WOLMessage Window */ -//------------------------------------------------------------------------------------------------- -void WOLMessageWindowInit( WindowLayout *layout, void *userData ) -{ - parentWOLMessageWindowID = TheNameKeyGenerator->nameToKey( "WOLMessageWindow.wnd:WOLMessageWindowParent" ); - buttonCancelID = TheNameKeyGenerator->nameToKey( "WOLMessageWindow.wnd:ButtonCancel" ); - parentWOLMessageWindow = TheWindowManager->winGetWindowFromId( nullptr, parentWOLMessageWindowID ); - buttonCancel = TheWindowManager->winGetWindowFromId( nullptr, buttonCancelID); - - - // Show Menu - layout->hide( FALSE ); - - // Set Keyboard to Main Parent - TheWindowManager->winSetFocus( parentWOLMessageWindow ); - -} - -//------------------------------------------------------------------------------------------------- -/** WOLMessage Window shutdown method */ -//------------------------------------------------------------------------------------------------- -void WOLMessageWindowShutdown( WindowLayout *layout, void *userData ) -{ - - // hide menu - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout ); -} - - -//------------------------------------------------------------------------------------------------- -/** WOLMessage Window update method */ -//------------------------------------------------------------------------------------------------- -void WOLMessageWindowUpdate( WindowLayout * layout, void *userData) -{ - /* - if (WOL::TheWOL) - WOL::TheWOL->update(); - */ - -} - -//------------------------------------------------------------------------------------------------- -/** WOLMessage Window input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLMessageWindowInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonCancel, buttonCancelID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; -} - -//------------------------------------------------------------------------------------------------- -/** WOLMessage Window window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLMessageWindowSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - UnicodeString txtInput; - - switch( msg ) - { - - - case GWM_CREATE: - { - - break; - } - - case GWM_DESTROY: - { - break; - } - - case GWM_INPUT_FOCUS: - { - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - } - - case GBM_SELECTED: - { - break; - } - - case GEM_EDIT_DONE: - { - break; - } - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp deleted file mode 100644 index 50e90a74af5..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp +++ /dev/null @@ -1,239 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////// -// FILE: WOLQMScoreScreen.cpp -// Author: Matt Campbell, November 2001 -// Description: QuickMatch score screen (different from normal screen in that it has 'QM' and 'Discon' buttons) -/////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameEngine.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetTextEntry.h" -//#include "GameNetwork/WOL.h" -//#include "GameNetwork/WOLmenus.h" - - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -// window ids ------------------------------------------------------------------------------ -static NameKeyType parentWOLQMScoreID = NAMEKEY_INVALID; -static NameKeyType buttonDisconnectID = NAMEKEY_INVALID; -static NameKeyType buttonQuickmatchID = NAMEKEY_INVALID; - -// Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLQMScore = nullptr; -static GameWindow *buttonDisconnect = nullptr; -static GameWindow *buttonQuickmatch = nullptr; - -//------------------------------------------------------------------------------------------------- -/** Initialize the WOL Status Menu */ -//------------------------------------------------------------------------------------------------- -void WOLQMScoreScreenInit( WindowLayout *layout, void *userData ) -{ - parentWOLQMScoreID = TheNameKeyGenerator->nameToKey( "WOLQMScoreScreen.wnd:WOLQMScoreScreenParent" ); - buttonDisconnectID = TheNameKeyGenerator->nameToKey( "WOLQMScoreScreen.wnd:ButtonDisconnect" ); - buttonQuickmatchID = TheNameKeyGenerator->nameToKey( "WOLQMScoreScreen.wnd:ButtonQuickMatch" ); - parentWOLQMScore = TheWindowManager->winGetWindowFromId( nullptr, parentWOLQMScoreID ); - buttonDisconnect = TheWindowManager->winGetWindowFromId( nullptr, buttonDisconnectID); - buttonQuickmatch = TheWindowManager->winGetWindowFromId( nullptr, buttonQuickmatchID); - - /* - if (WOL::TheWOL->getState() == WOL::WOLAPI_FATAL_ERROR) - { - // We can get to the score screen even though we've been disconnected. Just hide - // any buttons that lead back into WOL. - - buttonQuickmatch->winHide( TRUE ); - } - */ - - // Show Menu - layout->hide( FALSE ); - - // Set Keyboard to Main Parent - TheWindowManager->winSetFocus( parentWOLQMScore ); - - //progressLayout = TheShell->top(); - -} - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void WOLQMScoreScreenShutdown( WindowLayout *layout, void *userData ) -{ - - // hide menu - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout ); - - //progressLayout = nullptr; - -} - - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu update method */ -//------------------------------------------------------------------------------------------------- -void WOLQMScoreScreenUpdate( WindowLayout * layout, void *userData) -{ - /* - if (WOL::TheWOL) - WOL::TheWOL->update(); - */ -} - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLQMScoreScreenInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonDisconnect, buttonDisconnectID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; -} - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLQMScoreScreenSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - UnicodeString txtInput; - - switch( msg ) - { - - - case GWM_CREATE: - { - - break; - } - - case GWM_DESTROY: - { - break; - } - - case GWM_INPUT_FOCUS: - { - // if we're given the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - } - - case GBM_SELECTED: - { - /* - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if ( controlID == buttonDisconnectID ) - { - //TheShell->pop(); - if (WOL::TheWOL->setState( WOL::WOLAPI_FATAL_ERROR )) - { - WOL::TheWOL->addCommand( WOL::WOLCOMMAND_RESET ); // don't display an error, log out, or anything - } - - } - else if ( controlID == buttonQuickmatchID ) - { - //TheShell->pop(); - if (WOL::TheWOL->getState() != WOL::WOLAPI_FATAL_ERROR) - { - if (WOL::TheWOL->setState( WOL::WOLAPI_TOURNAMENT )) - { - WOL::TheWOL->setScreen( WOL::WOLAPI_MENU_QUICKMATCH ); - WOL::TheWOL->addCommand( WOL::WOLCOMMAND_FIND_MATCH_CHANNEL ); - } - } - - } - */ - break; - } - - case GEM_EDIT_DONE: - { - break; - } - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp deleted file mode 100644 index 9c45f169ea4..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp +++ /dev/null @@ -1,216 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////// -// FILE: WOLLoginMenu.cpp -// Author: Chris Huybregts, November 2001 -// Description: Lan Lobby Menu -/////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameEngine.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetTextEntry.h" -//#include "GameNetwork/WOL.h" -//#include "GameNetwork/WOLmenus.h" - - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -// window ids ------------------------------------------------------------------------------ -static NameKeyType parentWOLStatusID = NAMEKEY_INVALID; -static NameKeyType buttonDisconnectID = NAMEKEY_INVALID; - -// Window Pointers ------------------------------------------------------------------------ -static GameWindow *parentWOLStatus = nullptr; -static GameWindow *buttonDisconnect = nullptr; -GameWindow *progressTextWindow = nullptr; - -//------------------------------------------------------------------------------------------------- -/** Initialize the WOL Status Menu */ -//------------------------------------------------------------------------------------------------- -void WOLStatusMenuInit( WindowLayout *layout, void *userData ) -{ - parentWOLStatusID = TheNameKeyGenerator->nameToKey( "WOLStatusMenu.wnd:WOLStatusMenuParent" ); - buttonDisconnectID = TheNameKeyGenerator->nameToKey( "WOLStatusMenu.wnd:ButtonDisconnect" ); - parentWOLStatus = TheWindowManager->winGetWindowFromId( nullptr, parentWOLStatusID ); - buttonDisconnect = TheWindowManager->winGetWindowFromId( nullptr, buttonDisconnectID); - - progressTextWindow = TheWindowManager->winGetWindowFromId( nullptr, - TheNameKeyGenerator->nameToKey( "WOLStatusMenu.wnd:ListboxStatus" ) ); - - // Show Menu - layout->hide( FALSE ); - - // Set Keyboard to Main Parent - TheWindowManager->winSetFocus( parentWOLStatus ); - - //progressLayout = TheShell->top(); - - //WOL::raiseWOLMessageBox(); -} - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu shutdown method */ -//------------------------------------------------------------------------------------------------- -void WOLStatusMenuShutdown( WindowLayout *layout, void *userData ) -{ - - // hide menu - layout->hide( TRUE ); - - // our shutdown is complete - TheShell->shutdownComplete( layout ); - - //progressLayout = nullptr; - - //WOL::raiseWOLMessageBox(); -} - - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu update method */ -//------------------------------------------------------------------------------------------------- -void WOLStatusMenuUpdate( WindowLayout * layout, void *userData) -{ - //if (WOL::TheWOL) - //WOL::TheWOL->update(); -} - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLStatusMenuInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonDisconnect, buttonDisconnectID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; -} - -//------------------------------------------------------------------------------------------------- -/** WOL Status Menu window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType WOLStatusMenuSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - UnicodeString txtInput; - - switch( msg ) - { - - - case GWM_CREATE: - { - - break; - } - - case GWM_DESTROY: - { - break; - } - - case GWM_INPUT_FOCUS: - { - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - } - - case GBM_SELECTED: - { - /* - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if ( controlID == buttonDisconnectID ) - { - //TheShell->pop(); - if (WOL::TheWOL->setState( WOL::WOLAPI_FATAL_ERROR )) - { - WOL::TheWOL->addCommand( WOL::WOLCOMMAND_RESET ); // don't display an error, log out, or anything - } - - } - */ - break; - } - - case GEM_EDIT_DONE: - { - break; - } - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp deleted file mode 100644 index 82518dd1b99..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: MessageBox.cpp ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: MessageBox.cpp -// -// Created: Chris Huybregts, June 2001 -// -// Desc: the Message Box control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameEngine.h" -#include "Common/NameKeyGenerator.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/MessageBox.h" - - -GameWindow *MessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback) ///< convenience function for displaying a Message box with Yes and No buttons -{ - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, yesCallback, noCallback, nullptr, nullptr); -} -GameWindow *QuitMessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback) ///< convenience function for displaying a Message box with Yes and No buttons -{ - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, yesCallback, noCallback, nullptr, nullptr, TRUE); -} - - -GameWindow *MessageBoxYesNoCancel(UnicodeString titleString,UnicodeString bodyString, GameWinMsgBoxFunc yesCallback, GameWinMsgBoxFunc noCallback, GameWinMsgBoxFunc cancelCallback)///< convenience function for displaying a Message box with Yes,No and Cancel buttons -{ - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES | MSG_BOX_CANCEL , titleString, bodyString, yesCallback, noCallback, nullptr, cancelCallback); -} - - -GameWindow *MessageBoxOkCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback,GameWinMsgBoxFunc cancelCallback)///< convenience function for displaying a Message box with Ok and Cancel buttons -{ - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_OK | MSG_BOX_CANCEL , titleString, bodyString, nullptr, nullptr, okCallback, cancelCallback); -} - -GameWindow *MessageBoxOk(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback)///< convenience function for displaying a Message box with Ok button -{ - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_OK, titleString, bodyString, nullptr, nullptr, okCallback, nullptr); -} - - -GameWindow *MessageBoxCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc cancelCallback)///< convenience function for displaying a Message box with Cancel button -{ - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1, MSG_BOX_CANCEL, titleString, bodyString, nullptr, nullptr, nullptr, cancelCallback); -} - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// - - - -//------------------------------------------------------------------------------------------------- -/** Message Box window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType MessageBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - - switch( msg ) - { - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - delete (WindowMessageBoxData *)window->winGetUserData(); - window->winSetUserData( nullptr ); - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - static NameKeyType buttonOkID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonOk" ); - static NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonYes" ); - static NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonNo" ); - static NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonCancel" ); - WindowMessageBoxData *MsgBoxCallbacks = (WindowMessageBoxData *)window->winGetUserData(); - - if( controlID == buttonOkID ) - { - //simple enough,if we have a callback, call it, if not, then just destroy the window - if (MsgBoxCallbacks->okCallback) - MsgBoxCallbacks->okCallback(); - - TheWindowManager->winDestroy(window); - - } - else if( controlID == buttonYesID ) - { - if (MsgBoxCallbacks->yesCallback) - MsgBoxCallbacks->yesCallback(); - TheWindowManager->winDestroy(window); - } - else if( controlID == buttonNoID ) - { - if (MsgBoxCallbacks->noCallback) - MsgBoxCallbacks->noCallback(); - TheWindowManager->winDestroy(window); - } - else if( controlID == buttonCancelID ) - { - if (MsgBoxCallbacks->cancelCallback) - MsgBoxCallbacks->cancelCallback(); - TheWindowManager->winDestroy(window); - } - - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} -//------------------------------------------------------------------------------------------------- -/** Message Box window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType QuitMessageBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - - switch( msg ) - { - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - delete (WindowMessageBoxData *)window->winGetUserData(); - window->winSetUserData( nullptr ); - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - static NameKeyType buttonOkID = TheNameKeyGenerator->nameToKey( "QuitMessageBox.wnd:ButtonOk" ); - static NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( "QuitMessageBox.wnd:ButtonYes" ); - static NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey( "QuitMessageBox.wnd:ButtonNo" ); - static NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( "QuitMessageBox.wnd:ButtonCancel" ); - WindowMessageBoxData *MsgBoxCallbacks = (WindowMessageBoxData *)window->winGetUserData(); - - if( controlID == buttonOkID ) - { - //simple enough,if we have a callback, call it, if not, then just destroy the window - if (MsgBoxCallbacks->okCallback) - MsgBoxCallbacks->okCallback(); - - TheWindowManager->winDestroy(window); - - } - else if( controlID == buttonYesID ) - { - if (MsgBoxCallbacks->yesCallback) - MsgBoxCallbacks->yesCallback(); - TheWindowManager->winDestroy(window); - } - else if( controlID == buttonNoID ) - { - if (MsgBoxCallbacks->noCallback) - MsgBoxCallbacks->noCallback(); - TheWindowManager->winDestroy(window); - } - else if( controlID == buttonCancelID ) - { - if (MsgBoxCallbacks->cancelCallback) - MsgBoxCallbacks->cancelCallback(); - TheWindowManager->winDestroy(window); - } - - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp deleted file mode 100644 index cf2c0115bbe..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ReplayControls.cpp /////////////////////////////////////////////////////////////////////// -// Author: Bryan Cleveland - December 2001 -// Desc: GUI Control box for the playback controls -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameClient.h" - -//------------------------------------------------------------------------------------------------- -/** Input procedure for the control bar */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType ReplayControlInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** System callback for the control bar parent */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType ReplayControlSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp deleted file mode 100644 index 205cbda9638..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp +++ /dev/null @@ -1,376 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: CheckBox.cpp ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: CheckBox.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Checkbox GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Keyboard.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// GadgetCheckBoxInput ======================================================== -/** Handle input for check box */ -//============================================================================= -WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - mData1 ); - //TheWindowManager->winSetFocus( window ); - - } - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - mData1 ); - } - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - { - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), GGM_LEFT_DRAG, - (WindowMsgData)window, mData1 ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - { - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - { - - if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) == FALSE ) - { - // this up click was not meant for this button - return MSG_IGNORED; - } - - // Toggle the check state - instData->m_state ^= WIN_STATE_SELECTED; - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), GBM_SELECTED, - (WindowMsgData)window, mData1 ); - - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_RIGHT_DOWN: - { - - break; - } - - //------------------------------------------------------------------------- - case GWM_RIGHT_UP: - { - // Need to be specially marked to care about right mouse events - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - TheWindowManager->winSendSystemMsg( instData->getOwner(), GBM_SELECTED_RIGHT, - (WindowMsgData)window, mData1 ); - - BitClear( instData->m_state, WIN_STATE_SELECTED ); - } - else - { - // this up click was not meant for this button - return MSG_IGNORED; - } - break; - } - - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch( mData1 ) - { - - // -------------------------------------------------------------------- - case KEY_ENTER: - case KEY_SPACE: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - // Toggle the check state - instData->m_state ^= WIN_STATE_SELECTED; - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_SELECTED, - (WindowMsgData)window, - 0 ); - } - break; - - } - - // -------------------------------------------------------------------- - case KEY_DOWN: - case KEY_RIGHT: - case KEY_TAB: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - TheWindowManager->winNextTab(window); - break; - - } - - // -------------------------------------------------------------------- - case KEY_UP: - case KEY_LEFT: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - TheWindowManager->winPrevTab(window); - break; - - } - - // -------------------------------------------------------------------- - default: - { - - return MSG_IGNORED; - - } - - } - - break; - - } - - // ------------------------------------------------------------------------ - default: - { - - return MSG_IGNORED; - - } - - } - - return MSG_HANDLED; - -} - -// GadgetCheckBoxSystem ======================================================= -/** Handle system messages for check box */ -//============================================================================= -WindowMsgHandledType GadgetCheckBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GGM_SET_LABEL: - { - window->winSetText( *(UnicodeString*)mData1 ); - break; - } - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - break; - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - - if( mData1 == FALSE ) - BitClear( instData->m_state, WIN_STATE_HILITED ); - else - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - if( mData1 == FALSE ) - *(Bool*)mData2 = FALSE; - else - *(Bool*)mData2 = TRUE; - - break; - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetCheckBoxSetText ====================================================== -/** Set the text for the control */ -//============================================================================= -void GadgetCheckBoxSetText( GameWindow *g, UnicodeString text ) -{ - - // sanity - if( g == nullptr ) - return; - - TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); - -} - -// GadgetCheckBoxSetChecked ============================================ -//============================================================================= -/** Set the check state for the check box */ -//============================================================================= -void GadgetCheckBoxSetChecked( GameWindow *g, Bool isChecked) -{ - WinInstanceData *instData = g->winGetInstanceData(); - if (isChecked) - { - BitSet(instData->m_state, WIN_STATE_SELECTED); - } - else - { - BitClear(instData->m_state, WIN_STATE_SELECTED); - } - - TheWindowManager->winSendSystemMsg( g->winGetOwner(), GBM_SELECTED, - (WindowMsgData)g, 0 ); - -} - -// GadgetCheckBoxToggle ============================================ -//============================================================================= -/** Toggle the check state for the check box */ -//============================================================================= -void GadgetCheckBoxToggle( GameWindow *g) -{ - WinInstanceData *instData = g->winGetInstanceData(); - Bool isChecked = BitIsSet(instData->m_state, WIN_STATE_SELECTED); - if (isChecked) - { - BitClear(instData->m_state, WIN_STATE_SELECTED); - } - else - { - BitSet(instData->m_state, WIN_STATE_SELECTED); - } - - TheWindowManager->winSendSystemMsg( g->winGetOwner(), GBM_SELECTED, - (WindowMsgData)g, 0 ); - -} - -// GadgetCheckBoxIsChecked ====================================================== -/** Check the check state */ -//============================================================================= -Bool GadgetCheckBoxIsChecked( GameWindow *g ) -{ - WinInstanceData *instData = g->winGetInstanceData(); - return (BitIsSet(instData->m_state, WIN_STATE_SELECTED)); -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp deleted file mode 100644 index 96769530207..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp +++ /dev/null @@ -1,1107 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetComboBox.cpp /////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: ListBox.cpp -// -// Created: Dean Iverson, March 1998 -// Colin Day, June 2001 -// -// Desc: ListBox GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "Common/AudioEventRTS.h" -#include "Common/GameAudio.h" -#include "Common/Debug.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetComboBox.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/GadgetSlider.h" -#include "GameClient/GameWindowGlobal.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE DATA /////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void HideListBox(GameWindow * window); - -// GadgetComboBoxInput ========================================================= -/** Handle input for Combo box */ -//============================================================================= -WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ -// ComboBoxData *combo = (ComboBoxData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - GameWindow *editBox = GadgetComboBoxGetEditBox(window); - switch (msg) - { - - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch (mData1) - { - - // -------------------------------------------------------------------- - case KEY_DOWN: - case KEY_RIGHT: - case KEY_TAB: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - TheWindowManager->winNextTab(window); - break; - - // -------------------------------------------------------------------- - case KEY_UP: - case KEY_LEFT: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - TheWindowManager->winPrevTab(window); - break; - - // -------------------------------------------------------------------- - default: - return TheWindowManager->winSendInputMsg( editBox, GWM_CHAR, mData1, mData2 ); - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_WHEEL_DOWN: - { - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_WHEEL_UP: - { - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - { - ComboBoxData *comboData = (ComboBoxData *)window->winGetUserData(); - ICoord2D winSize; - //ICoord2D winPosition; - ICoord2D newSize; - Int listX =0; - Int multiplier; - comboData->dontHide = FALSE; - AudioEventRTS buttonClick("GUIClick"); - - if( TheAudio ) - { - TheAudio->addAudioEvent( &buttonClick ); - } - - GameWindow *listBox = GadgetComboBoxGetListBox(window); - if (listBox) - { - TheWindowManager->winSetLoneWindow(window); - // If the Listbox isn't showing, Show it. - if(listBox->winIsHidden()) - { - listBox->winHide(FALSE); - window->winGetSize(&winSize.x, &winSize.y); - WinInstanceData *listInstData = listBox->winGetInstanceData(); - ListboxData *listData = (ListboxData *)listBox->winGetUserData(); - // If we have less entries then our max display is set to, only show - // those entries and not additional blank lines. Also, just so it looks - // pretty, hide the list box's sliders if we don't need to scroll. - if(comboData->entryCount <= comboData->maxDisplay) - { - multiplier = comboData->entryCount; - listX = winSize.x;// + 16; - - if(listData->upButton) - listData->upButton->winHide(TRUE); - if(listData->downButton) - listData->downButton->winHide(TRUE); - if(listData->slider) - listData->slider->winHide(TRUE); - } - else - { - multiplier = comboData->maxDisplay; - listX = winSize.x; - if(listData->upButton) - listData->upButton->winHide(FALSE); - if(listData->downButton) - listData->downButton->winHide(FALSE); - if(listData->slider) - listData->slider->winHide(FALSE); - - } - - newSize.y = ((TheWindowManager->winFontHeight( listInstData->getFont() ) ) * multiplier) + multiplier * 2 + 4; - window->winSetSize(winSize.x , winSize.y + newSize.y ); - listBox->winSetPosition(0, winSize.y); - - listBox->winSetSize(listX , newSize.y); - } - // if the Listbox was showing, hide it. - else - { - HideListBox(window); - } - } break; - - } - - // ------------------------------------------------------------------------ - case GWM_RIGHT_UP: - { - break; - - } - -/* - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - 0 ); - TheWindowManager->winSetFocus( window ); - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK )) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - 0 ); - } - - break; - - } -*/ - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if (BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, - 0 ); - break; - - // ------------------------------------------------------------------------ -// case GWM_LEFT_DOWN: - - // we want to eat the down... so we may receive the up. -// return MSG_HANDLED; - - //------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// HideListBox ================================================================ -/** Called to close the listbox if it is opened */ -//============================================================================= -void HideListBox(GameWindow * window) -{ - ICoord2D winSize; - ICoord2D newSize; - GameWindow *listBox = GadgetComboBoxGetListBox(window); - if (!listBox) - return; - - if(!listBox->winIsHidden()) - { - listBox->winHide(TRUE); - GameWindow *editBox = GadgetComboBoxGetEditBox(window); - editBox->winGetSize(&winSize.x, &winSize.y); - window->winGetSize(&newSize.x, &newSize.y); - window->winSetSize(newSize.x, winSize.y ); - } -} - -// GadgetListBoxSystem ======================================================== -/** Handle system messages for list box */ -//============================================================================= -WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ -// ListboxData *list = (ListboxData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - ComboBoxData *comboData = (ComboBoxData *)window->winGetUserData(); - switch( msg ) - { - // ------------------------------------------------------------------------ - case GGM_SET_LABEL: - { - instData->setText(*(UnicodeString*)mData1); - break; - - } - - // ------------------------------------------------------------------------ - case GCM_GET_TEXT: - { - if(comboData->editBox) - *(UnicodeString*)mData2 = GadgetTextEntryGetText(comboData->editBox); - break; - } - - // ------------------------------------------------------------------------ - case GCM_SET_TEXT: - { - if (comboData->editBox) - GadgetTextEntrySetText(comboData->editBox,*(const UnicodeString*)mData1); - break; - - } - - case GEM_UPDATE_TEXT: - { - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GCM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - if (comboData->listBox) - { - GadgetListBoxSetSelected(comboData->listBox, -1); - HideListBox(window); - } - break; - } - - // ------------------------------------------------------------------------ - // if we get sent an edit done message from the text box, lets notify the parent - case GEM_EDIT_DONE: - { - if ((GameWindow *)mData1 == comboData->editBox) - { - HideListBox(window); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GCM_SELECTED, - (WindowMsgData)window, - 0 ); - } - break; - } - // ------------------------------------------------------------------------ - // Set the selection in the listbox, this will trigger the listbox selected message - // which will set the edit box. - case GCM_SET_SELECTION: - { - GameWindow *listBox = GadgetComboBoxGetListBox(window); - if(listBox) - { - if( !listBox->winIsHidden() && mData2 == TRUE ) - comboData->dontHide = TRUE; - - GadgetListBoxSetSelected(listBox, (Int)mData1); - } - break; - } - // ------------------------------------------------------------------------ - // Get what the listbox has selected. - case GCM_GET_SELECTION: - { - if(comboData->listBox) - GadgetListBoxGetSelected(comboData->listBox, (Int *)mData2); - else - { - DEBUG_CRASH(("We don't have a listbox as part of the combo box")); - *(Int *)mData2 = -1; - } - break; - } - // ------------------------------------------------------------------------ - // Set the User Data for the specified listbox element - case GCM_SET_ITEM_DATA: - { - if(comboData->listBox) - { - GadgetListBoxSetItemData(comboData->listBox, (void *)mData2, (Int)mData1 ); - } - - break; - } - // ------------------------------------------------------------------------ - // Get the user Data for the specified listbox element - case GCM_GET_ITEM_DATA: - { - if(comboData->listBox) - { - *(void **)mData2 = GadgetListBoxGetItemData(comboData->listBox, (Int) mData1, 0); - } - break; - } - // ------------------------------------------------------------------------ - // Pass onto the parent window the selection the listbox just made - case GLM_SELECTED: - { - if((GameWindow *) mData1 == comboData->listBox) - { - if( comboData->dontHide == TRUE ) - { - comboData->dontHide = FALSE; - } - else - HideListBox(window); - - // Nothing was actually selected, so we just want to - if( mData2 == -1) - { - break; - } - - //Grab the text that was selected - UnicodeString tempUString; - Color color; - tempUString = GadgetListBoxGetTextAndColor( comboData->listBox, &color, mData2, 0 ); - - GadgetTextEntrySetTextColor(comboData->editBox, color); - - GadgetTextEntrySetText(comboData->editBox, tempUString); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GCM_SELECTED, - (WindowMsgData)window, - 0 ); - } - break; - } - - // ------------------------------------------------------------------------ - case GGM_LEFT_DRAG: - { - - break; - - } - - // ------------------------------------------------------------------------ - case GCM_DEL_ALL: - { - if ( comboData->listBox ) - GadgetListBoxReset(comboData->listBox); - if ( comboData->editBox ) - GadgetTextEntrySetText(comboData->editBox, UnicodeString::TheEmptyString ); - comboData->entryCount = 0; - //HideListBox(window); - break; - - } - - // ------------------------------------------------------------------------ - case GCM_DEL_ENTRY: - { - - break; - - } - // ------------------------------------------------------------------------ - case GGM_CLOSE: - { - HideListBox(window); - break; - - } - - // ------------------------------------------------------------------------ - case GCM_ADD_ENTRY: - { - GameWindow *listBox = GadgetComboBoxGetListBox(window); - ListboxData *listData = (ListboxData *)listBox->winGetUserData(); - - Int addedIndex = -1; - if( listBox ) - { - //Increase our internal entry count - comboData->entryCount++; - //If we've exceeded the set listlength, resize it to twice the size - if(comboData->entryCount >= listData->listLength) - GadgetListBoxSetListLength(listBox,listData->listLength * 2); - //Add the entry to the Listbox - addedIndex = GadgetListBoxAddEntryText( listBox, *(UnicodeString*)mData1, mData2, -1, 0 ); - - // Now resize the list box - ICoord2D winSize; - ICoord2D newSize; - ICoord2D editBoxSize; - Int listX; - Int multiplier; - WinInstanceData *listInstData = listBox->winGetInstanceData(); - GameWindow *editBox = GadgetComboBoxGetEditBox(window); - window->winGetSize(&winSize.x, &winSize.y); - editBox->winGetSize(&editBoxSize.x, &editBoxSize.y); - // If the listbox has less entries then the MaxDisplay, size it smaller - if(comboData->entryCount <= comboData->maxDisplay) - { - multiplier = comboData->entryCount; - listX = winSize.x + 16; - if(listData->upButton) - listData->upButton->winHide(TRUE); - if(listData->downButton) - listData->downButton->winHide(TRUE); - if(listData->slider) - listData->slider->winHide(TRUE); - } - else - { - //Else size it to the MaxDisplay Size - multiplier = comboData->maxDisplay; - listX = winSize.x; - if(listData->upButton) - listData->upButton->winHide(FALSE); - if(listData->downButton) - listData->downButton->winHide(FALSE); - if(listData->slider) - listData->slider->winHide(FALSE); - } - newSize.y = ((TheWindowManager->winFontHeight( listInstData->getFont() ) ) * multiplier) + multiplier * 2 + 4; - listBox->winSetPosition(0, editBoxSize.y); - listBox->winSetSize(listX , newSize.y); - } - - return( (WindowMsgHandledType) addedIndex ); - } - - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GGM_RESIZED: - { - Int width = (Int)mData1; - Int height = (Int)mData2; - ICoord2D dropDownSize; - - // get needed window sizes - - comboData->dropDownButton->winGetSize( &dropDownSize.x, &dropDownSize.y ); - - GameWindow *listBox = GadgetComboBoxGetListBox(window); - if (listBox->winIsHidden()) - { - if (listBox) - listBox->winSetSize(width,height); - - if( comboData->dropDownButton ) - { - comboData->dropDownButton->winSetPosition( width - dropDownSize.x, 0 ); - } - - if( comboData->editBox ) - { - comboData->editBox->winSetPosition( 0, 0 ); - comboData->editBox->winSetSize( width - dropDownSize.x, height ); - } - } - break; - - } - - // ------------------------------------------------------------------------ - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - TheWindowManager->winSetLoneWindow(nullptr); // if we are transitioning screens, close all combo boxes - delete (ComboBoxData *)window->winGetUserData(); - window->winSetUserData(nullptr); - comboData = nullptr; - break; - } - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - { - - // If we're losing focus - if( mData1 == FALSE ) - { - BitClear( instData->m_state, WIN_STATE_HILITED ); - } - else - { - BitSet( instData->m_state, WIN_STATE_HILITED ); - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - - Bool wantsFocus = FALSE; - GameWindow *editBox = GadgetComboBoxGetEditBox(window); - // we need to tell the text entry box to take the focus. - TheWindowManager->winSendSystemMsg( editBox, GWM_INPUT_FOCUS, mData1, (WindowMsgData)&wantsFocus ); - - *(Bool*)mData2 = TRUE; - break; - - } - - - case GBM_SELECTED: - { - // See if the drop down button was selected - if( (GameWindow *)mData1 == comboData->dropDownButton ) - { - ICoord2D winSize; - //ICoord2D winPosition; - ICoord2D newSize; - Int listX =0; - Int multiplier; - comboData->dontHide = FALSE; - GameWindow *listBox = GadgetComboBoxGetListBox(window); - if (listBox) - { - TheWindowManager->winSetLoneWindow(window); - // If the Listbox isn't showing, Show it. - if(listBox->winIsHidden()) - { - listBox->winHide(FALSE); - window->winGetSize(&winSize.x, &winSize.y); - WinInstanceData *listInstData = listBox->winGetInstanceData(); - ListboxData *listData = (ListboxData *)listBox->winGetUserData(); - // If we have less entries then our max display is set to, only show - // those entries and not additional blank lines. Also, just so it looks - // pretty, hide the list box's sliders if we don't need to scroll. - if(comboData->entryCount <= comboData->maxDisplay) - { - multiplier = comboData->entryCount; - listX = winSize.x;// + 16; - - if(listData->upButton) - listData->upButton->winHide(TRUE); - if(listData->downButton) - listData->downButton->winHide(TRUE); - if(listData->slider) - listData->slider->winHide(TRUE); - } - else - { - multiplier = comboData->maxDisplay; - listX = winSize.x; - if(listData->upButton) - listData->upButton->winHide(FALSE); - if(listData->downButton) - listData->downButton->winHide(FALSE); - if(listData->slider) - listData->slider->winHide(FALSE); - - } - - newSize.y = ((TheWindowManager->winFontHeight( listInstData->getFont() ) ) * multiplier) + multiplier * 2 + 4; - window->winSetSize(winSize.x , winSize.y + newSize.y ); - listBox->winSetPosition(0, winSize.y); - - listBox->winSetSize(listX , newSize.y); - } - // if the Listbox was showing, hide it. - else - { - HideListBox(window); - } - } - } - break; - } - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetComboBoxSetColors ==================================================== -/** Set the colors for a Combo box, note that this will also automatically - * change the colors of any attached slider, slider thumb, and slider - * buttons */ -//============================================================================= -void GadgetComboBoxSetColors( GameWindow *comboBox, - Color enabledColor, - Color enabledBorderColor, - Color enabledSelectedItemColor, - Color enabledSelectedItemBorderColor, - Color disabledColor, - Color disabledBorderColor, - Color disabledSelectedItemColor, - Color disabledSelectedItemBorderColor, - Color hiliteColor, - Color hiliteBorderColor, - Color hiliteSelectedItemColor, - Color hiliteSelectedItemBorderColor ) -{ -// ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); - // enabled - -// enabled - GadgetComboBoxSetEnabledColor( comboBox, enabledColor); - GadgetComboBoxSetEnabledBorderColor( comboBox, enabledBorderColor ); - GadgetComboBoxSetEnabledSelectedItemColor( comboBox, enabledSelectedItemColor ); - GadgetComboBoxSetEnabledSelectedItemBorderColor( comboBox, enabledSelectedItemBorderColor ); - // disabled - GadgetComboBoxSetDisabledColor( comboBox, disabledColor ); - GadgetComboBoxSetDisabledBorderColor( comboBox, disabledBorderColor ); - GadgetComboBoxSetDisabledSelectedItemColor( comboBox, disabledSelectedItemColor ); - GadgetComboBoxSetDisabledSelectedItemBorderColor( comboBox, disabledSelectedItemBorderColor ); - // hilite - GadgetComboBoxSetHiliteColor( comboBox, hiliteColor ); - GadgetComboBoxSetHiliteBorderColor( comboBox,hiliteBorderColor ); - GadgetComboBoxSetHiliteSelectedItemColor( comboBox, hiliteSelectedItemColor ); - GadgetComboBoxSetHiliteSelectedItemBorderColor( comboBox, hiliteSelectedItemBorderColor ); - - GameWindow *editBox = GadgetComboBoxGetEditBox(comboBox); - if (editBox) - { - // enabled - GadgetButtonSetEnabledColor( editBox, enabledColor ); - GadgetButtonSetEnabledBorderColor( editBox, enabledBorderColor ); - GadgetButtonSetEnabledSelectedColor( editBox, enabledSelectedItemColor ); - GadgetButtonSetEnabledSelectedBorderColor( editBox, enabledSelectedItemBorderColor ); - // disabled - GadgetButtonSetDisabledColor( editBox, disabledColor ); - GadgetButtonSetDisabledBorderColor( editBox, disabledBorderColor ); - GadgetButtonSetDisabledSelectedColor( editBox, disabledSelectedItemColor ); - GadgetButtonSetDisabledSelectedBorderColor( editBox, disabledSelectedItemBorderColor ); - // hilite - GadgetButtonSetHiliteColor( editBox,hiliteColor ); - GadgetButtonSetHiliteBorderColor( editBox, hiliteBorderColor ); - GadgetButtonSetHiliteSelectedColor( editBox, hiliteSelectedItemColor ); - GadgetButtonSetHiliteSelectedBorderColor( editBox, hiliteSelectedItemBorderColor ); - } - - GameWindow *dropDownButton = GadgetComboBoxGetDropDownButton(comboBox); - if (dropDownButton) - { - // enabled - GadgetButtonSetEnabledColor( dropDownButton, enabledColor ); - GadgetButtonSetEnabledBorderColor( dropDownButton, enabledBorderColor ); - GadgetButtonSetEnabledSelectedColor( dropDownButton, enabledSelectedItemColor ); - GadgetButtonSetEnabledSelectedBorderColor( dropDownButton, enabledSelectedItemBorderColor ); - // disabled - GadgetButtonSetDisabledColor( dropDownButton, disabledColor ); - GadgetButtonSetDisabledBorderColor( dropDownButton, disabledBorderColor ); - GadgetButtonSetDisabledSelectedColor( dropDownButton, disabledSelectedItemColor ); - GadgetButtonSetDisabledSelectedBorderColor( dropDownButton, disabledSelectedItemBorderColor ); - // hilite - GadgetButtonSetHiliteColor( dropDownButton,hiliteColor ); - GadgetButtonSetHiliteBorderColor( dropDownButton, hiliteBorderColor ); - GadgetButtonSetHiliteSelectedColor( dropDownButton, hiliteSelectedItemColor ); - GadgetButtonSetHiliteSelectedBorderColor( dropDownButton, hiliteSelectedItemBorderColor ); - } - - GameWindow * listBox = GadgetComboBoxGetListBox( comboBox ); - if ( listBox ) - { - GadgetListBoxSetColors(listBox, - enabledColor, - enabledBorderColor, - enabledSelectedItemColor, - enabledSelectedItemBorderColor, - disabledColor, - disabledBorderColor, - disabledSelectedItemColor, - disabledSelectedItemBorderColor, - hiliteColor, - hiliteBorderColor, - hiliteSelectedItemColor, - hiliteSelectedItemBorderColor ); - } -} - -// GadgetComboBoxSetIsEditable ================================================ -/** Sets up the Text Entry gadget as editable or not */ -//============================================================================= -void GadgetComboBoxSetIsEditable(GameWindow *comboBox, Bool isEditable ) -{ - ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); - GameWindow *editBox = GadgetComboBoxGetEditBox(comboBox); - UnsignedInt status ; - if(!editBox) - return; - - comboData->isEditable = isEditable; - if (isEditable) - { - status = editBox->winGetStatus(); - - BitClear(status, WIN_STATUS_NO_INPUT); -// BitClear(status, WIN_STATUS_NO_FOCUS); - editBox->winSetStatus(status); - } - else - { - status = editBox->winGetStatus(); - - BitSet(status, WIN_STATUS_NO_INPUT); -// BitSet(status, WIN_STATUS_NO_FOCUS); - editBox->winSetStatus(status); - } -} - -// GadgetComboBoxSetIsAsciiOnly ================================================== -/** Get the text the Combo Box */ -//============================================================================= -void GadgetComboBoxSetLettersAndNumbersOnly(GameWindow *comboBox, Bool isLettersAndNumbersOnly) -{ - //sanity - if(comboBox == nullptr) - return; - ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); - - comboData->lettersAndNumbersOnly = isLettersAndNumbersOnly; - if(comboData->entryData) - comboData->entryData->alphaNumericalOnly = isLettersAndNumbersOnly; - -} - -// GadgetComboBoxSetAsciiOnly ================================================== -/** Get the text the Combo Box */ -//============================================================================= -void GadgetComboBoxSetAsciiOnly(GameWindow *comboBox, Bool isAsciiOnly ) -{ - //sanity - if(comboBox == nullptr) - return; - ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); - - comboData->asciiOnly = isAsciiOnly; - if(comboData->entryData) - comboData->entryData->aSCIIOnly = isAsciiOnly; - -} - -// GadgetComboBoxSetMaxChars ================================================== -/** Get the text the Combo Box */ -//============================================================================= -void GadgetComboBoxSetMaxChars( GameWindow *comboBox, Int maxChars ) -{ - //sanity - if(comboBox == nullptr) - return; - - ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); - comboData->maxChars = maxChars; - comboData->entryData->maxTextLen = maxChars; - -} - -// GadgetComboBoxSetMaxDisplay ================================================ -/** Sets the MaxDisplay variable to the new Max Display */ -//============================================================================= -void GadgetComboBoxSetMaxDisplay( GameWindow *comboBox, Int maxDisplay ) -{ - ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); - comboData->maxDisplay = maxDisplay; - -} - -// GadgetComboBoxGetText ======================================================= -/** Get the text the Combo Box */ -//============================================================================= -UnicodeString GadgetComboBoxGetText( GameWindow *comboBox ) -{ - - // sanity - if( comboBox == nullptr ) - return UnicodeString::TheEmptyString; - - // verify that this is a combo box - if( BitIsSet( comboBox->winGetStyle(), GWS_COMBO_BOX ) == FALSE ) - return UnicodeString::TheEmptyString; - - return GadgetTextEntryGetText( GadgetComboBoxGetEditBox(comboBox) ); -} - -// GadgetComboBoxSetText ======================================================= -/** Set the text the Combo Box */ -//============================================================================= -void GadgetComboBoxSetText( GameWindow *comboBox, UnicodeString text ) -{ - if( comboBox == nullptr ) - return; - - GadgetTextEntrySetText(GadgetComboBoxGetEditBox(comboBox), text); -} - -// GadgetComboBoxAddEntry ======================================================= -/** Convenience wrapper function for adding an entry */ -//============================================================================= -Int GadgetComboBoxAddEntry( GameWindow *comboBox, UnicodeString text, Color color ) -{ - // sanity - if( comboBox == nullptr ) - return -1; - return (Int)TheWindowManager->winSendSystemMsg( comboBox, GCM_ADD_ENTRY, (WindowMsgData)&text, color ); -} -// GadgetComboBoxReset ======================================================= -/** Convenience wrapper function for resetting the Combo Box entries */ -//============================================================================= -void GadgetComboBoxReset( GameWindow *comboBox ) -{ - // sanity - if( comboBox == nullptr ) - return; - // reset via system message - TheWindowManager->winSendSystemMsg( comboBox, GCM_DEL_ALL, 0, 0 ); -} -// GadgetComboBoxHideList ======================================================= -/** Convenience wrapper function hiding the list */ -//============================================================================= -void GadgetComboBoxHideList( GameWindow *comboBox ) -{ - // sanity - if( comboBox == nullptr ) - return; - // reset via system message - TheWindowManager->winSendSystemMsg( comboBox, GGM_CLOSE, 0, 0 ); -} -// GadgetComboBoxSetFont ======================================================= -/** Function used to set the Font of the combo box and all sub gadgets */ -//============================================================================= -void GadgetComboBoxSetFont( GameWindow *comboBox, GameFont *font ) -{ - // sanity - if( comboBox == nullptr ) - return; - - // set the ListBox gadget's font - GameWindow *listBox = GadgetComboBoxGetListBox(comboBox); - if(listBox) - listBox->winSetFont( font); - - // set the Text Entry gadget's font - GameWindow *editBox = GadgetComboBoxGetEditBox(comboBox); - if(editBox) - editBox->winSetFont(font); - - //Need to setup the default window font - DisplayString *dString; - - // set the font for the display strings all windows have - dString = comboBox->winGetInstanceData()->getTextDisplayString(); - if( dString ) - dString->setFont( font ); - dString = comboBox->winGetInstanceData()->getTooltipDisplayString(); - if( dString ) - dString->setFont( font ); -} - -// GadgetComboBoxSetEnabledTextColors ========================================= -/** Set the Enabled Text Colors for the Sub Gadgets*/ -//============================================================================= -void GadgetComboBoxSetEnabledTextColors(GameWindow *comboBox, Color color, Color borderColor ) -{ - // sanity - if( comboBox == nullptr ) - return; - - ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); - if(comboBoxData->listBox) - comboBoxData->listBox->winSetEnabledTextColors( color,borderColor); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetEnabledTextColors(color,borderColor); -} -// GadgetComboBoxSetDisabledTextColors ======================================== -/** Set the Disabled Text Colors for the Sub Gadgets */ -//============================================================================= -void GadgetComboBoxSetDisabledTextColors(GameWindow *comboBox, Color color, Color borderColor ) -{ - ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); - // sanity - if( comboBox == nullptr ) - return; - - if(comboBoxData->listBox) - comboBoxData->listBox->winSetDisabledTextColors( color,borderColor); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetDisabledTextColors(color,borderColor); -} -// GadgetComboBoxSetHiliteTextColors ========================================== -/** Set the Hilite Text Colors for the Sub Gadgets */ -//============================================================================= -void GadgetComboBoxSetHiliteTextColors( GameWindow *comboBox,Color color, Color borderColor ) -{ - // sanity - if( comboBox == nullptr ) - return; - - ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); - - if(comboBoxData->listBox) - comboBoxData->listBox->winSetHiliteTextColors( color,borderColor); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetHiliteTextColors(color,borderColor); -} -// GadgetComboBoxSetIMECompositeTextColors ==================================== -/** Set the IME Composite Text Colors Text Colors for the Sub Gadgets */ -//============================================================================= -void GadgetComboBoxSetIMECompositeTextColors(GameWindow *comboBox, Color color, Color borderColor ) -{ - // sanity - if( comboBox == nullptr ) - return; - - ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); - - if(comboBoxData->listBox) - comboBoxData->listBox->winSetIMECompositeTextColors( color,borderColor); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetIMECompositeTextColors(color,borderColor); -} - -// GadgetComboBoxGetSelectedPos =============================================== -/** Convenience wrapper function for getting the selected Position */ -//============================================================================= -void GadgetComboBoxGetSelectedPos( GameWindow *comboBox, Int *selectedIndex ) -{ - // sanity - if( comboBox == nullptr ) - return; - - // get selected indices via system message - TheWindowManager->winSendSystemMsg( comboBox, GCM_GET_SELECTION, 0, (WindowMsgData)selectedIndex ); -} - -// GadgetComboBoxSetSelectedPos =============================================== -/** Convenience wrapper function for setting the selected Position, if don't hide - is set to true, the listbox won't be forced to hide when the Selected call is - passed back */ -//============================================================================= -void GadgetComboBoxSetSelectedPos( GameWindow *comboBox, Int selectedIndex, Bool dontHide ) -{ - // sanity - if( comboBox == nullptr ) - return; - - // get selected indices via system message - TheWindowManager->winSendSystemMsg( comboBox, GCM_SET_SELECTION, selectedIndex, dontHide ); -} -// GadgetComboBoxSetItemData ================================================== -/** Convenience wrapper function for setting the Item data for the listbox under the combo box */ -//============================================================================= -void GadgetComboBoxSetItemData( GameWindow *comboBox, Int index, void *data ) -{ - if (comboBox) - TheWindowManager->winSendSystemMsg( comboBox, GCM_SET_ITEM_DATA, index, (WindowMsgData)data); -} -// GadgetComboBoxGetItemData ================================================== -/** Convenience wrapper function for getting the Item data from the listbox under the combo Box */ -//============================================================================= -void *GadgetComboBoxGetItemData( GameWindow *comboBox, Int index ) -{ - void *data = nullptr; - - if (comboBox) - { - TheWindowManager->winSendSystemMsg( comboBox, GCM_GET_ITEM_DATA, index, (WindowMsgData)&data); - } - return (data); -} - -// GadgetComboBoxGetLength ================================================= -/** Get the list length data contained in the listboxData - * parameter. */ -//============================================================================= -Int GadgetComboBoxGetLength( GameWindow *combobox ) -{ - ComboBoxData *comboboxData = (ComboBoxData *)combobox->winGetUserData(); - if (comboboxData) - return comboboxData->entryCount; - - return 0; -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp deleted file mode 100644 index 8d8d4062286..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp +++ /dev/null @@ -1,480 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: HorizontalSlider.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: HorizontalSlider.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Horizontal GUI slider -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Gadget.h" -#include "GameClient/GadgetSlider.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// GadgetHorizontalSliderInput ================================================ -/** Handle input for horizontal slider */ -//============================================================================= -WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - SliderData *s = (SliderData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - ICoord2D size, childSize, childCenter; - window->winGetSize( &size.x, &size.y ); - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - 0 ); - //TheWindowManager->winSetFocus( window ); - - } - - if(window->winGetChild() && BitIsSet(window->winGetChild()->winGetStyle(),GWS_PUSH_BUTTON) ) - { - WinInstanceData *instDataChild = window->winGetChild()->winGetInstanceData(); - BitSet(instDataChild->m_state, WIN_STATE_HILITED); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK )) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - 0 ); - } - if(window->winGetChild() && BitIsSet(window->winGetChild()->winGetStyle(),GWS_PUSH_BUTTON) ) - { - WinInstanceData *instDataChild = window->winGetChild()->winGetInstanceData(); - BitClear(instDataChild->m_state, WIN_STATE_HILITED); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, - mData1 ); - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - { - Int x, y; - Int mousex = mData1 & 0xFFFF; -// Int mousey = mData1 >> 16; - - GameWindow *child = window->winGetChild(); - Int pageClickSize, clickPos; - - window->winGetScreenPosition( &x, &y ); - - child->winGetSize( &childSize.x, &childSize.y ); - child->winGetPosition( &childCenter.x, &childCenter.y ); - childCenter.x += childSize.x / 2; - childCenter.y += childSize.y / 2; - - // - // when you click on the slider, but not the button, we will jump - // the slider position up/down by this much - // - pageClickSize = size.x / 5; - - clickPos = mousex - x; - if( clickPos >= childCenter.x ) - { - - clickPos = childCenter.x + pageClickSize; - if( clickPos > mousex - x ) - clickPos = mousex - x; - - } - else - { - - clickPos = childCenter.x - pageClickSize; - if( clickPos < mousex - x ) - clickPos = mousex - x; - - } - - // keep it all valid to the window - if( clickPos > x + size.x - childSize.x / 2 ) - clickPos = x + size.y - childSize.x / 2; - if( clickPos < childSize.x / 2 ) - clickPos = childSize.x / 2; - - child->winSetPosition( clickPos - childSize.x / 2, HORIZONTAL_SLIDER_THUMB_POSITION); - TheWindowManager->winSendSystemMsg( window, GGM_LEFT_DRAG, 0, mData1 ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch( mData1 ) - { - - // -------------------------------------------------------------------- - case KEY_RIGHT: - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( s->position > s->minVal + 1 ) - { - GameWindow *child = window->winGetChild(); - - s->position -= 2; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - - // Translate to window coords - child->winSetPosition( (Int)((s->position - s->minVal) * s->numTicks), HORIZONTAL_SLIDER_THUMB_POSITION ); - - } - - } - - break; - - // -------------------------------------------------------------------- - case KEY_LEFT: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( s->position < s->maxVal - 1 ) - { - GameWindow *child = window->winGetChild(); - - s->position += 2; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - - // Translate to window coords - child->winSetPosition( (Int)((s->position - s->minVal) * s->numTicks),HORIZONTAL_SLIDER_THUMB_POSITION ); - - } - - } - - break; - - // -------------------------------------------------------------------- - case KEY_DOWN: - case KEY_TAB: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winNextTab(); - break; - - // -------------------------------------------------------------------- - case KEY_UP: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winPrevTab(); - break; - - // -------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - break; - - } - - // ------------------------------------------------------------------------ - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetHorizontalSliderSystem =============================================== -/** Handle system messages for horizontal slider */ -//============================================================================= -WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - SliderData *s = (SliderData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - ICoord2D size, childSize, childCenter,childRelativePos; - window->winGetSize( &size.x, &size.y ); - switch( msg ) - { - // ------------------------------------------------------------------------ - case GGM_LEFT_DRAG: - { - Int mousex = mData2 & 0xFFFF; -// Int mousey = mData2 >> 16; - Int x, y, delta; - GameWindow *child = window->winGetChild(); - - - window->winGetScreenPosition( &x, &y ); - - child->winGetSize( &childSize.x, &childSize.y ); - child->winGetScreenPosition( &childCenter.x, &childCenter.y ); - child->winGetPosition(&childRelativePos.x, &childRelativePos.y); - childCenter.x += childSize.x / 2; - childCenter.y += childSize.y / 2; - - // - // ignore drag attempts when the mouse is right or left of slider totally - // and put the dragging thumb back at the slider pos - // - if( mousex > x + size.x -HORIZONTAL_SLIDER_THUMB_WIDTH/2 ) - { - - TheWindowManager->winSendSystemMsg( window, GSM_SET_SLIDER, - s->maxVal, 0 ); - // tell owner i moved - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - break; - - } - else if( mousex < x + HORIZONTAL_SLIDER_THUMB_WIDTH/2) - { - - TheWindowManager->winSendSystemMsg( window, GSM_SET_SLIDER, - s->minVal, 0 ); - // tell owner i moved - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - break; - - } - - if( childCenter.x < x + childSize.x / 2 ) - { - child->winSetPosition( 0,HORIZONTAL_SLIDER_THUMB_POSITION ); - s->position = s->minVal; - - } - else if( childCenter.x >= x + size.x - childSize.x / 2 ) - { - child->winSetPosition( (Int)((s->maxVal - s->minVal) * s->numTicks) -HORIZONTAL_SLIDER_THUMB_WIDTH/2 , HORIZONTAL_SLIDER_THUMB_POSITION ); - s->position = s->maxVal; - - } - else - { - delta = childCenter.x - x -HORIZONTAL_SLIDER_THUMB_WIDTH/2; - - // Calc slider position - s->position = (Int)((delta) / s->numTicks)+ s->minVal ; - - /* - s->position += s->minVal; - */ - - if( s->position > s->maxVal ) - s->position = s->maxVal; - if( s->position < s->minVal) - s->position = s->minVal; - - child->winSetPosition( childRelativePos.x, HORIZONTAL_SLIDER_THUMB_POSITION ); - } - - // tell owner i moved - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - - break; - - } - - // ------------------------------------------------------------------------ - case GSM_SET_SLIDER: - { - Int newPos = (Int)mData1; - GameWindow *child = window->winGetChild(); - - if( newPos < s->minVal || newPos > s->maxVal ) - break; - - s->position = newPos; - - // Translate to window coords - newPos = (Int)((newPos - s->minVal) * s->numTicks); - - child->winSetPosition( newPos , HORIZONTAL_SLIDER_THUMB_POSITION ); - break; - - } - - // ------------------------------------------------------------------------ - case GSM_SET_MIN_MAX: - { - ICoord2D size; - GameWindow *child = window->winGetChild(); - - window->winGetSize( &size.x, &size.y ); - - s->minVal = (Int)mData1; - s->maxVal = (Int)mData2; - s->numTicks = (Real)(size.x - HORIZONTAL_SLIDER_THUMB_WIDTH)/(Real)(s->maxVal - s->minVal); - s->position = s->minVal; - - child->winSetPosition( 0, HORIZONTAL_SLIDER_THUMB_POSITION ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - delete ( (SliderData *)window->winGetUserData() ); - window->winSetUserData(nullptr); - s = nullptr; - break; - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - { - - // If we're losing focus - if( mData1 == FALSE ) - BitClear( instData->m_state, WIN_STATE_HILITED ); - else - BitSet( instData->m_state, WIN_STATE_HILITED ); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - - *(Bool*)mData2 = TRUE; - break; - - } - - // ------------------------------------------------------------------------ - case GGM_RESIZED: - { -// Int width = (Int)mData1; - Int height = (Int)mData2; - GameWindow *thumb = window->winGetChild(); - - if( thumb ) - thumb->winSetSize( GADGET_SIZE, height ); - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp deleted file mode 100644 index cd943ef7a47..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ /dev/null @@ -1,2825 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetListBox.cpp //////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: ListBox.cpp -// -// Created: Dean Iverson, March 1998 -// Colin Day, June 2001 -// -// Desc: ListBox GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/AudioEventRTS.h" -#include "Common/Language.h" -#include "Common/Debug.h" -#include "Common/GameAudio.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/GadgetSlider.h" -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/Keyboard.h" - - -// DEFINES //////////////////////////////////////////////////////////////////// -// Sets up the user's OS set doubleclick time so if they don't like it... they can -// change it in their OS. -static UnsignedInt doubleClickTime = GetDoubleClickTime(); - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// -typedef struct _AddMessageStruct -{ - Int row; // The row to add the data to - Int column; // The column to add the data to - const void *data; // void pointer, can be either an DisplayString or an Image - Int type; // Can either be set to LISTBOX_TEXT or LISTBOX_IMAGE - Bool overwrite; // Do we overwrite existing data? - Int width; // set to -1 if we want the defaults - Int height; // set to -1 if we want the defaults -} AddMessageStruct; - - -typedef struct _TextAndColor -{ - UnicodeString string; // Holds a unicode String - Color color; // holds a text's color -} TextAndColor; - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE DATA /////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -static void doAudioFeedback(GameWindow *window) -{ - if (!window) - return; - - ListboxData *lData = (ListboxData *)window->winGetUserData(); - if (!lData) - return; - - if (lData->audioFeedback) - { - AudioEventRTS buttonClick("GUIComboBoxClick"); - - if( TheAudio ) - { - TheAudio->addAudioEvent( &buttonClick ); - } - } -} - -static Int getListboxEntryBasedOnCoord(GameWindow *window, Int x, Int y, Int &row, Int &column) -{ - Int pos; - Int winx, winy, i; - WinInstanceData *instData = window->winGetInstanceData(); - ListboxData *list = (ListboxData *)window->winGetUserData(); - - window->winGetScreenPosition( &winx, &winy ); - - // Adjust for title if present - if( instData->getTextLength() ) - winy += TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - pos = -2; - - for( i=0; ; i++ ) - { - if( i > 0 ) - if( list->listData[ i - 1 ].listHeight > - (list->displayPos + list->displayHeight ) ) - { - pos = -1; - break; - } - - if( i == list->endPos ) - { - pos = -1; - break; - } - - if( list->listData[i].listHeight > (y - winy + list->displayPos) ) - break; - } - - column = -1; - if( pos == -2 ) - { - pos = i; - Int total = 0; - for( i = 0; i < list->columns ;i++) - { - total += list->columnWidth[i]; - if(x - winx < total) - { - column = i; - break; - } - } - } - row = pos; - return pos; -} - -Int GadgetListBoxGetEntryBasedOnXY( GameWindow *listbox, Int x, Int y, Int &row, Int &column) -{ - return getListboxEntryBasedOnCoord( listbox, x, y, row, column ); - -} - -// getListboxTopEntry ========================================================= -//============================================================================= -static Int getListboxTopEntry( ListboxData *list ) -{ - Int entry; - - // determine which entry is at the top of the display area - for( entry=0; ; entry++ ) - { - if( list->listData[entry].listHeight > list->displayPos ) - return entry; - - if( entry >= list->endPos ) - return 0; - } - - return 0; -} - -// getListboxTopEntry ========================================================= -//============================================================================= -static Int getListboxBottomEntry( ListboxData *list ) -{ - Int entry; - - // determine which entry is at the top of the display area - for( entry=list->endPos - 1; ; entry-- ) - { - if( entry < 0 ) - return 0; - if( list->listData[entry].listHeight == list->displayPos + list->displayHeight ) - return entry; - if( list->listData[entry].listHeight < list->displayPos + list->displayHeight && entry != list->endPos - 1) - return entry + 1; - if( list->listData[entry].listHeight < list->displayPos + list->displayHeight) - return entry; - } - - return 0; -} - - -// removeSelection ============================================================ -/** Remove Selection from a multiple selection list */ -//============================================================================= -static void removeSelection( ListboxData *list, Int i ) -{ - memcpy( &list->selections[i], &list->selections[(i+1)], - ((list->listLength - i) * sizeof(Int)) ); - - // put -1 at end of list just for safety - list->selections[(list->listLength - 1)] = -1; -} - -// adjustDisplay ============================================================== -/** Update Display List information including scrollbar */ -//============================================================================= -static void adjustDisplay( GameWindow *window, Int adjustment, - Bool updateSlider ) -{ - Int entry; - SliderData *sData; - ListboxData *list = (ListboxData *)window->winGetUserData(); - - // determine which entry is at the top of the display area - entry = getListboxTopEntry( list ) + adjustment; - - if( entry < 0 ) - entry = 0; - else if( entry >= list->endPos ) - entry = list->endPos - 1; - - if( updateSlider ) - { - if( entry > 0 ) - list->displayPos = list->listData[(entry - 1)].listHeight + 1; - else - list->displayPos = 0; - } - - if( list->slider != nullptr ) - { - ICoord2D sliderSize, sliderChildSize; - GameWindow *child; - - sData = (SliderData *)list->slider->winGetUserData(); - list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - // Take into account that there is a line-drawn outline surrounding listbox - sData->maxVal = list->totalHeight - ( list->displayHeight - TOTAL_OUTLINE_HEIGHT ) + 1; - - if( sData->maxVal < 0 ) - { - sData->maxVal = 0; - } - - child = list->slider->winGetChild(); - child->winGetSize( &sliderChildSize.x, &sliderChildSize.y ); - sData->numTicks = (float)((sliderSize.y - sliderChildSize.y) / (float)sData->maxVal); - - if( updateSlider ) - TheWindowManager->winSendSystemMsg( list->slider, - GSM_SET_SLIDER, - (sData->maxVal - list->displayPos), - 0 ); - } - -} - -// computeTotalHeight ========================================================= -/** Compute Total Height and fill in listHeight values */ -//============================================================================= -static void computeTotalHeight( GameWindow *window ) -{ - Int i, height = 0; - Int tempHeight; - ListboxData *list = (ListboxData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - for( i=0; iendPos; i++ ) - { - - if(!list->listData[i].cell) - continue; - tempHeight = 0; - - for (Int j = 0; j < list->columns; j++) - { - Int cellHeight = 0; - if(list->listData[i].cell[j].cellType == LISTBOX_TEXT) - { - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ONE_LINE ) == TRUE ) - { - cellHeight = TheWindowManager->winFontHeight( instData->getFont() ); - } - else - { - DisplayString *displayString = (DisplayString *)list->listData[i].cell[j].data; - if(displayString) - displayString->getSize( nullptr, &cellHeight ); - } - } - else if(list->listData[i].cell[j].cellType == LISTBOX_IMAGE) - { - if(list->listData[i].cell[j].height > 0) - cellHeight = list->listData[i].cell[j].height + 1; - else - cellHeight = TheWindowManager->winFontHeight( instData->getFont() ); - } - if(cellHeight > tempHeight) - tempHeight = cellHeight; - } - list->listData[i].height = tempHeight; - height += (list->listData[i].height + 1); - list->listData[i].listHeight = height; - } - - list->totalHeight = height; - - adjustDisplay( window, 0, TRUE ); -} - -// addImageEntry ============================================================== -/** Add Images to position and column. Row and Column are both based from starting - Position 0 */ -//============================================================================= -static Int addImageEntry( const Image *image, Color color, Int row, Int column, GameWindow *window, Bool overwrite, Int width, Int height ) -{ -// WinInstanceData *instData = window->winGetInstanceData(); - ListboxData *list = (ListboxData *)window->winGetUserData(); - - if( column >= list->columns || row >= list->listLength ) - { - DEBUG_CRASH(("Tried to add Image to Listbox at invalid position")); - return -1; - } - - // If we want to just add an entry to the bottom, set the defaults - if (row == -1) - { - row = list->insertPos; - list->insertPos++; - list->endPos++; - } - if( column == -1 ) - column = 0; - - ListEntryRow *listRow = &list->listData[row]; - - // Check and see if we have allocated cells for that row yet, if not, allocate them - if(!listRow->cell) - { - listRow->cell = NEW ListEntryCell[list->columns]; - memset(listRow->cell,0,list->columns * sizeof(ListEntryCell)); - } - // if we're copying over strings, then lets first deallocate them. - if(listRow->cell[column].cellType == LISTBOX_TEXT) - { - TheDisplayStringManager->freeDisplayString((DisplayString *)listRow->cell[column].data); - - } - //add Image to selected row/cell - listRow->cell[column].cellType = LISTBOX_IMAGE; - listRow->cell[column].data = (void *)image; - listRow->cell[column].color = color; - listRow->cell[column].height = height; - listRow->cell[column].width = width; - - computeTotalHeight( window ); - - return (row); - -} - -// startingRow will get moved to startingRow+1, etc. This assumes there is space!!!!! -static Int moveRowsDown(ListboxData *list, Int startingRow) -{ - // - // copy the cells down - // - Int copyLen = (list->endPos - startingRow) * sizeof(ListEntryRow); - char *buf = NEW char[copyLen]; - memcpy(buf, list->listData + startingRow, copyLen); - memcpy(list->listData + startingRow + 1, buf, copyLen ); - delete[] buf; - - list->endPos ++; - list->insertPos = list->endPos; - - // - // remove the display or links to images after the shift - // - list->listData[startingRow].cell = nullptr; - list->listData[startingRow].height = 0; - list->listData[startingRow].listHeight = 0; - - if( list->multiSelect ) - { - Int i = 0; - - while( list->selections[i] >= 0 ) - { - if( startingRow <= list->selections[i] ) - list->selections[i]++; - i++; - } - } - else - { - if( list->selectPos >= startingRow ) - list->selectPos++; - } - - /* - if( list->displayPos > 0 ) - adjustDisplay( window, (-1 * mData1), TRUE ); - - computeTotalHeight( window ); - */ - - return 1; -} - -// addEntry =================================================================== -/** Add and process one string at insertPos */ -//============================================================================= -static Int addEntry( UnicodeString *string, Int color, Int row, Int column, GameWindow *window, Bool overwrite ) -{ -// WinInstanceData *instData = window->winGetInstanceData(); - ListboxData *list = (ListboxData *)window->winGetUserData(); - Int width; - DisplayString *displayString; - - // make sure our params are good - if( column >= list->columns || row >= list->listLength ) - { - DEBUG_CRASH(("Tried to add text to Listbox at invalid position")); - return -1; - } - - // If we want to just add an entry to the bottom, set the defaults - if (row == -1) - { - row = list->insertPos; - list->insertPos++; - list->endPos++; - } - if( column == -1 ) - column = 0; - - width = list->columnWidth[column] - TEXT_WIDTH_OFFSET; - - Int rowsAdded = 0; - - ListEntryRow *listRow = &list->listData[row]; - // Here I've decided to just overwrite what's in the row, if that's not what we want, change it here - // Check and see if we have allocated cells for that row yet, if not, allocate them - if(!listRow->cell) - { - listRow->cell = NEW ListEntryCell[list->columns]; - memset(listRow->cell,0,list->columns * sizeof(ListEntryCell)); - rowsAdded = 1; - } - else if (!overwrite) - { - // Shove things down - moveRowsDown(list, row); - listRow->cell = NEW ListEntryCell[list->columns]; - memset(listRow->cell,0,list->columns * sizeof(ListEntryCell)); - rowsAdded = 1; - } - - //add Image to selected row/cell - listRow->cell[column].cellType = LISTBOX_TEXT; - - // assign the color to the list data element - listRow->cell[column].color = color; - - // copy text - if( !listRow->cell[column].data ) - listRow->cell[column].data = (void *) TheDisplayStringManager->newDisplayString(); - displayString = (DisplayString *) listRow->cell[column].data; - if ( BitIsSet( window->winGetStatus(), WIN_STATUS_ONE_LINE ) == FALSE ) - displayString->setWordWrap( width ); - displayString->setText( *string ); - - /** @todo we need for formalize this, but for now just set the font - of this listbox entry to the font of the window */ - displayString->setFont( window->winGetFont() ); - - if (overwrite) - { - Int oldRowHeight = listRow->height; - Int oldTotalHeight = listRow->listHeight; - Int rowHeight; - Int totalHeight; - - if (!oldTotalHeight && row) - { - oldTotalHeight = list->listData[row-1].listHeight; - } - - displayString->getSize( nullptr, &rowHeight ); - if (rowHeight > oldRowHeight) - { - totalHeight = oldTotalHeight + (rowHeight - oldRowHeight); - listRow->height = rowHeight; - listRow->listHeight = totalHeight + rowsAdded; - list->totalHeight += (rowHeight - oldRowHeight) + rowsAdded; - adjustDisplay( window, 0, TRUE ); - } - } - else - { - computeTotalHeight( window ); - } - - return (row); -} - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// GadgetListBoxInput ========================================================= -/** Handle input for list box */ -//============================================================================= -WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - ListboxData *list = (ListboxData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - switch (msg) - { - - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch (mData1) - { - - // -------------------------------------------------------------------- - case KEY_ENTER: - case KEY_SPACE: - { - - if( BitIsSet( mData2, KEY_STATE_UP ) ) - { - doAudioFeedback(window); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_DOUBLE_CLICKED, - (WindowMsgData)window, - list->selectPos ); - } - - break; - - } - - // -------------------------------------------------------------------- - case KEY_DOWN: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( list->selectPos == -1 ) - { - list->selectPos = 0; - adjustDisplay( window, 0, TRUE ); - } - else if( list->selectPos < list->endPos - 1 ) - { - - list->selectPos++; - - while (1) - { - Int cellBottom = list->listData[list->selectPos].listHeight; - Int cellTop = cellBottom - list->listData[list->selectPos].height; - Int displayTop = list->displayPos; - Int displayBottom = list->displayPos + list->displayHeight - 1; // account for the border - - if ( cellTop < displayTop ) - { - adjustDisplay(window, -1, TRUE ); - } - else if ( cellBottom < displayBottom ) - { - adjustDisplay(window, 0, TRUE ); - break; - } - else - { - adjustDisplay(window, 1, TRUE ); - } - } - - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - list->selectPos ); - } - - break; - - } - - // -------------------------------------------------------------------- - case KEY_UP: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( list->selectPos == -1 ) - { - list->selectPos = 0; - adjustDisplay( window, 0, TRUE ); - } - else if( list->selectPos > 0 ) - { - - list->selectPos--; - - while (1) - { - if( list->listData[list->selectPos].listHeight - list->listData[list->selectPos].height < list->displayPos ) - { - list->displayPos = list->listData[list->selectPos].listHeight +1; - adjustDisplay( window, -1, TRUE ); - } - else if( list->listData[list->selectPos].listHeight > list->displayPos + list->displayHeight) - { - list->displayPos = list->listData[list->selectPos].listHeight - list->displayHeight; - adjustDisplay(window, 1, TRUE); - } - else - { - adjustDisplay(window, 0, TRUE); - break; - } - } - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - list->selectPos ); - } - - break; - - } - - // -------------------------------------------------------------------- - case KEY_RIGHT: - case KEY_TAB: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - TheWindowManager->winNextTab(window); - break; - - // -------------------------------------------------------------------- - case KEY_LEFT: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - TheWindowManager->winPrevTab(window); - break; - - // -------------------------------------------------------------------- - default: - { - Bool foundIt = false; - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - // set the position to start looking for the line of text with this character - Int position = list->selectPos; - // only search the max number of times so that we're not looping over and over - for(Int i = 0; i < list->endPos; ++i) - { - // start at the next position - ++position; - // if we've reached the end of the list, start at the beginning - if( position >= list->endPos) - position = 0; - - ListEntryCell *cell = nullptr; - // go through the columns until we find a column with text - Int j = 0; - for(; j < list->columns; ++j) - { - cell = &list->listData[position].cell[j]; - if(cell && cell->cellType == LISTBOX_TEXT && cell->data) - { - break; - } - } - if(!cell || cell->cellType != LISTBOX_TEXT) - continue; - DisplayString *dString = (DisplayString *)cell->data; - if(!dString) - continue; - for(j = 0; j < TheKeyboard->MAX_KEY_STATES; ++j) - { - if(dString->getText().getCharAt(0) == TheKeyboard->getPrintableKey((KeyDefType)mData1, j)) - { - list->selectPos = position; - Int prevPos = getListboxTopEntry(list); - //list->displayPos = list->listData[position].listHeight - list->displayHeight; - adjustDisplay(window, position - prevPos, TRUE); - foundIt = TRUE; - break; - } - } - if(foundIt) - { - doAudioFeedback(window); - break; - } - - } - - - } - - if (!foundIt) - return MSG_IGNORED; - } - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_WHEEL_DOWN: - { - if( list->endPos <= 0) - break; - - if (list->listData[list->endPos - 1].listHeight > list->displayHeight + list->displayPos) - adjustDisplay( window, 1, TRUE ); - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_WHEEL_UP: - { - if( list->endPos <= 0) - break; - - adjustDisplay( window, -1, TRUE ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - { - TheWindowManager->winSetFocus( window ); -// Int mousex = mData1 & 0xFFFF; - Int mousey = mData1 >> 16; - Int x, y, i; - Int oldPos = list->selectPos; - - window->winGetScreenPosition( &x, &y ); - - // Adjust for title if present - if( instData->getTextLength() ) - y += TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - list->selectPos = -2; - - for( i=0; ; i++ ) - { - - if( i > 0 ) - if( list->listData[ i - 1 ].listHeight > - (list->displayPos + list->displayHeight) ) - { - list->selectPos = -1; - break; - } - - if( i == list->endPos ) - { - list->selectPos = -1; - break; - } - - if( list->listData[i].listHeight > (mousey - y + list->displayPos) ) - break; - } - - //Bool dblClicked = FALSE; - if( list->doubleClickTime + doubleClickTime > timeGetTime() && - (i == oldPos || (oldPos == -1 && ( i>=0 && iendPos ) )) ) - { - int temp; - list->doubleClickTime = 0; - if( oldPos == -1 ) - temp = i; - else - temp = oldPos; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_DOUBLE_CLICKED, - (WindowMsgData)window, - temp ); - //break; - } - if( (i == oldPos) && (list->forceSelect == FALSE) ) - { - list->selectPos = -1; - } - - if( (list->selectPos == -2) && (i < list->endPos) ) - { - list->selectPos = i; - } - - if( (list->selectPos < 0) && (list->forceSelect) ) - { - list->selectPos = oldPos; - } - list->doubleClickTime = timeGetTime(); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - list->selectPos ); - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_RIGHT_DOWN: - doAudioFeedback(window); - break; // if we're in game, we want to eat this message because we're right clicking on a listbox - case GWM_RIGHT_UP: - { - TheWindowManager->winSetFocus( window ); - Int pos; - Int mousex = mData1 & 0xFFFF; - Int mousey = mData1 >> 16; - Int x, y, i; - RightClickStruct rc; - - window->winGetScreenPosition( &x, &y ); - - // Adjust for title if present - if( instData->getTextLength() ) - y += TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - pos = -2; - - for( i=0; ; i++ ) - { - if( i > 0 ) - if( list->listData[ i - 1 ].listHeight > - (list->displayPos + list->displayHeight ) ) - { - pos = -1; - break; - } - - if( i == list->endPos ) - { - pos = -1; - break; - } - - if( list->listData[i].listHeight > (mousey - y + list->displayPos) ) - break; - } - - if( pos == -2 ) - pos = i; - - rc.pos = pos; - rc.mouseX = mousex; - rc.mouseY = mousey; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_RIGHT_CLICKED, - (WindowMsgData)window, - (WindowMsgData)&rc ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - 0 ); - //TheWindowManager->winSetFocus( window ); - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK )) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - 0 ); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if (BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, - 0 ); - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - doAudioFeedback(window); - // we want to eat the down... so we may receive the up. - return MSG_HANDLED; - - //------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetListBoxMultiInput ==================================================== -/** Handle input for multiple selection list box */ -//============================================================================= -WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - ListboxData *list = (ListboxData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch( mData1 ) - { - - // -------------------------------------------------------------------- - case KEY_TAB: - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winNextTab(); - break; - - // -------------------------------------------------------------------- - default: - return MSG_IGNORED; - } - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - //case GWM_LEFT_CLICK: - { - TheWindowManager->winSetFocus( window ); -// Int *selections = list->selections; - Int selectPos = -2; -// Int mousex = mData1 & 0xFFFF; - Int mousey = mData1 >> 16; - Int x, y, i; - Bool removed = FALSE; - - window->winGetScreenPosition( &x, &y ); - - // Adjust for title if present - if( instData->getTextLength() ) - y += TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - for( i = 0; ; i++ ) - { - - if( i > 0 ) - if( list->listData[ i - 1 ].listHeight > - (list->displayPos + list->displayHeight ) ) - { - selectPos = -1; - break; - } - - if( i == list->endPos ) - { - selectPos = -1; - break; - } - - if( list->listData[i].listHeight > (mousey - y + list->displayPos) ) - break; - } - - if( selectPos == -2 ) - selectPos = i; - - i = 0; - while( list->selections[i] >= 0 ) - { - if( list->selections[i] == selectPos ) - { - removeSelection( list, i ); - removed = TRUE; - break; - } - - i++; - } - - if( removed == FALSE ) - { - list->selections[ i] = selectPos; - list->selections[ i + 1 ] = -1; - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - selectPos ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_RIGHT_UP: - { -/* - Int selectPos = -2; -// Int mousex = mData1 & 0xFFFF; - Int mousey = mData1 >> 16; - Int x, y, i; - - window->winGetScreenPosition( &x, &y ); - - // Adjust for title if present - if( instData->getTextLength() ) - y += TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - for( i = 0; ; i++ ) - { - if( i > 0 ) - if( list->listData[ i - 1 ].listHeight > - (list->displayPos + list->displayHeight ) ) - { - selectPos = -1; - break; - } - - if( i == list->endPos ) - { - selectPos = -1; - break; - } - - if( list->listData[i].listHeight > (mousey - y + list->displayPos) ) - break; - } - - if( selectPos == -2 ) - selectPos = i; - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_RIGHT_CLICKED, - (WindowMsgData)window, - selectPos );*/ - TheWindowManager->winSetFocus( window ); - Int pos; - Int mousex = mData1 & 0xFFFF; - Int mousey = mData1 >> 16; - Int x, y, i; - RightClickStruct rc; - - window->winGetScreenPosition( &x, &y ); - - // Adjust for title if present - if( instData->getTextLength() ) - y += TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - pos = -2; - - for( i=0; ; i++ ) - { - if( i > 0 ) - if( list->listData[ i - 1 ].listHeight > - (list->displayPos + list->displayHeight ) ) - { - pos = -1; - break; - } - - if( i == list->endPos ) - { - pos = -1; - break; - } - - if( list->listData[i].listHeight > (mousey - y + list->displayPos) ) - break; - } - - if( pos == -2 ) - pos = i; - - rc.pos = pos; - rc.mouseX = mousex; - rc.mouseY = mousey; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_RIGHT_CLICKED, - (WindowMsgData)window, - (WindowMsgData)&rc ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_WHEEL_DOWN: - - // Simulate the down button if it exists - if( list->downButton ) - { - if( list->displayPos + list->displayHeight <= list->totalHeight ) - adjustDisplay( window, 1, TRUE ); - } - break; - - // ------------------------------------------------------------------------ - case GWM_WHEEL_UP: - - // Simulate the up button if it exists - if( list->upButton ) - { - if( list->displayPos > 0 ) - adjustDisplay( window, -1, TRUE ); - } - break; - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - 0 ); - //TheWindowManager->winSetFocus( window ); - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK )) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - 0 ); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if (BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, - 0 ); - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - doAudioFeedback(window); - // we want to eat the down... so we may receive the up. - return MSG_HANDLED; - - // ------------------------------------------------------------------------ - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetListBoxSystem ======================================================== -/** Handle system messages for list box */ -//============================================================================= -WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - ListboxData *list = (ListboxData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - ICoord2D *pos; - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GGM_SET_LABEL: - { - instData->setText(*(UnicodeString*)mData1); - break; - - } - - // ------------------------------------------------------------------------ - case GLM_GET_TEXT: - { - pos = (ICoord2D *)mData1; - TextAndColor *tAndC = (TextAndColor *)mData2; - - if(pos->x >= list->columns || pos->y >= list->listLength || - list->listData[pos->y].cell[pos->x].cellType != LISTBOX_TEXT) - { - tAndC->string = UnicodeString::TheEmptyString; - tAndC->color = 0; - } - else - { - tAndC->string = ((DisplayString *)list->listData[ pos->y ].cell[pos->x].data)->getText(); - tAndC->color = list->listData[ pos->y ].cell[pos->x].color; - } - break; - } - - // ------------------------------------------------------------------------ - case GBM_SELECTED: - { - - // See if the up button was selected - if( (GameWindow *)mData1 == list->upButton ) - { - if( list->displayPos > 0 ) - adjustDisplay( window, -1, TRUE ); - } - else if( (GameWindow *)mData1 == list->downButton ) - { - if( list->displayPos + list->displayHeight <= list->totalHeight ) - adjustDisplay( window, 1, TRUE ); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GGM_LEFT_DRAG: - { - - if( (GameWindow *)mData1 == list->upButton ) - { - if( list->displayPos > 0 ) - adjustDisplay( window, -1, TRUE ); - } - else if( (GameWindow *)mData1 == list->downButton ) - { - if( list->displayPos + list->displayHeight <= list->totalHeight ) - adjustDisplay( window, 1, TRUE ); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GLM_DEL_ALL: - { - - // - // Reset the listbox by freeing all the display string stuff and setting - // everything else to zero - // - // Loop through and destroy any display strings we've allocated that aren't used - for( Int i = 0; i < list->listLength; i++ ) - { - // Loop though - ListEntryCell *cells = list->listData[i].cell; - for (int j = list->columns - 1; j >=0; j-- ) - { - if(!cells) - break; - if( cells[j].cellType == LISTBOX_TEXT ) - { - if ( cells[j].data ) - { - TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); - } - } - - cells[j].userData = nullptr; - cells[j].data = nullptr; - } - delete[](list->listData[i].cell); - list->listData[i].cell = nullptr; - } - //zero out the header structure - memset(list->listData,0,list->listLength * sizeof(ListEntryRow)); - - if( mData1 != GP_DONT_UPDATE ) - { - list->displayPos = 0; - } - - if( list->multiSelect ) - memset( list->selections, -1, list->listLength * sizeof( Int ) ); - else - list->selectPos = -1; - - list->insertPos = 0; - list->endPos = 0; - - list->totalHeight = 0; - - adjustDisplay( window, 0, TRUE ); - break; - - } - - // ------------------------------------------------------------------------ - case GLM_DEL_ENTRY: - { - Int i; - - if( list->endPos <= (Int)mData1 ) - break; - - ListEntryCell *cells = list->listData[mData1].cell; - if(cells) - for( i = 0; i <= list->columns; i ++ ) - { - if( cells[i].cellType == LISTBOX_TEXT && cells[i].data ) - TheDisplayStringManager->freeDisplayString((DisplayString *) cells[i].data ); - cells[i].data = nullptr; - cells[i].userData = nullptr; - } - - delete[](list->listData[mData1].cell); - list->listData[mData1].cell = nullptr; - - memcpy( &list->listData[mData1], &list->listData[(mData1+1)], - (list->endPos - mData1 - 1) * sizeof(ListEntryRow) ); - - list->endPos--; - list->insertPos = list->endPos; - - if( list->multiSelect ) - { - i = 0; - - while( list->selections[i] >= 0 ) - { - if( (Int)mData1 < list->selections[i] ) - list->selections[i]--; - else if ( (Int)mData1 == list->selections[i] ) - { - removeSelection( list, i ); - i--; // compensate for lost entry - } - - i++; - } - } - else - { - if( (Int)mData1 < list->selectPos ) - list->selectPos--; - else if ( (Int)mData1 == list->selectPos ) - list->selectPos = -1; - } - - computeTotalHeight( window ); - break; - - } - - // ------------------------------------------------------------------------ - case GLM_ADD_ENTRY: - { - Bool success = TRUE; - Int addedIndex = -1; - AddMessageStruct *addInfo = (AddMessageStruct*)mData1; - if (addInfo->row >= list->insertPos) - addInfo->row = -1; - - Int row = addInfo->row; - // Special case, we're just appending and we've reached the end. - if( addInfo->row == -1 && list->insertPos == list->listLength ) - { - row = list->insertPos; - // Check to see if we've filled our buffer and need to scroll the window - if( list->insertPos == list->listLength ) - { - if( list->autoPurge ) - TheWindowManager->winSendSystemMsg( window, GLM_SCROLL_BUFFER, 1, 0 ); - else - success = FALSE; - } - } - else if (addInfo->row != -1 && !addInfo->overwrite && list->insertPos == list->listLength) - { - // We're inserting into the middle with no space - see if we can scroll the window - if( list->autoPurge ) - TheWindowManager->winSendSystemMsg( window, GLM_SCROLL_BUFFER, 1, 0 ); - else - success = FALSE; - } - - if(success) - { - if( addInfo->type == LISTBOX_TEXT ) - { - addedIndex = addEntry( (UnicodeString *)addInfo->data, mData2, addInfo->row, addInfo->column, window, addInfo->overwrite ); - } - else if ( addInfo->type == LISTBOX_IMAGE ) - { - addedIndex = addImageEntry( (const Image *)addInfo->data, mData2, addInfo->row, addInfo->column, window, addInfo->overwrite,addInfo->width, addInfo->height ); - } - else - success = FALSE; - } - - if( success ) - { - - if( list->autoScroll ) - { - - while( TRUE ) - { - // If off bottom of screen, scroll and try again. - // we use -1 because insertPos was increased in addEntry - if( row == -1 ) - { - if( list->listData[(list->insertPos - 1)].listHeight >= - (list->displayPos + list->displayHeight) ) - adjustDisplay( window, 1, TRUE ); - else - break; - } - else - { - if( list->listData[( row )].listHeight >= - (list->displayPos + list->displayHeight) ) - adjustDisplay( window, 1, TRUE ); - else - break; - } - } - - } - - if( list->multiSelect ) - { - Int i = 0; - - while( list->selections[i] >= 0 ) - { - - if( (row = list->selections[i]) != 0 ) - list->selections[i] = -1; - - i++; - - } - - } - else - { - if( row == list->selectPos ) - list->selectPos = -1; - } - - } - - return((WindowMsgHandledType) addedIndex ); - - } - - // ------------------------------------------------------------------------ - case GLM_TOGGLE_MULTI_SELECTION: - { - - if( (Int)mData1 < 0 ) - { - // a negative number will purge the entire list. - if( list->multiSelect ) - memset( list->selections, -1, list->listLength * sizeof(Int) ); - else - { - // this message has no effect in a non-multi listbox - } - - break; - } - - // if there is no cells we shouldn't be selecting this entry - if( !list->listData[ mData1 ].cell ) - break; - - if( list->multiSelect ) - { - Int i = 0; - Bool removed = FALSE; - - while( list->selections[i] >= 0 ) - { - if( list->selections[i] == (Int)mData1 ) - { - removeSelection( list, i ); - removed = TRUE; - break; - } - - i++; - } - - if( removed == FALSE ) - { - list->selections[i] = (Int)mData1; - list->selections[i+1] = -1; - } - } - else - { - // this message has no effect in a non-multi listbox - } - - break; - - } - - // ------------------------------------------------------------------------ - case GLM_SET_SELECTION: - { - const Int *selectList = (const Int *)mData1; - Int selectCount = (Int)mData2; - DEBUG_ASSERTCRASH( list->multiSelect || selectCount == 1, ("Bad selection size")); - - if( selectList[0] < 0 || list->listLength <= selectList[0] ) - { - - if( list->multiSelect ) - memset( list->selections, -1, list->listLength * sizeof(Int) ); - else - list->selectPos = -1; - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - list->selectPos ); - - break; - - } - - if( list->multiSelect ) - { - // forced selections override the entire selection list. - Int i=0; - for (; iendPos; ++i) - { - // don't select off the end - if (list->listLength <= selectList[i]) - { - break; - } - - // if there is no cells we shouldn't be selecting this entry - if( !list->listData[ selectList[i] ].cell ) - { - break; - } - - list->selections[i] = selectList[i]; - } - list->selections[i] = -1; - } - else - { - // if there is no cells we shouldn't be selecting this entry - if( !list->listData[ selectList[0] ].cell ) - { - break; - } - - list->selectPos = selectList[0]; - GameWindow *parent = window->winGetParent(); - if( parent && BitIsSet( parent->winGetStyle(), GWS_COMBO_BOX ) ) - { - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - list->selectPos ); - break; - } - if( list->listData[list->selectPos].listHeight < list->displayPos ) - { - - TheWindowManager->winSendSystemMsg( window, GLM_UPDATE_DISPLAY, - list->selectPos, 0 ); - } - else if( list->listData[list->selectPos].listHeight > - (list->displayPos + list->displayHeight) ) - { - - if( list->selectPos > 0 ) - list->displayPos = - list->listData[list->selectPos].listHeight - list->displayHeight; - else - list->displayPos = 0; - - adjustDisplay( window, 0, TRUE ); - - } - - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - list->selectPos ); - break; - - } - - // ------------------------------------------------------------------------ - case GLM_SCROLL_BUFFER: - { - - if( list->endPos < (Int)mData1 ) - break; - - // - // scroll buffer literally scrolls the entire list data buffer - // up one entry, effectively removing the top entry. - // - - // - // Loop through and remove all the entries from the top up until we reach - // the position mData1 contains - // - ListEntryCell *cells = nullptr; - Int i = 0; - for (; i < (Int)mData1; i++) - { - cells = list->listData[i].cell; - - if(cells) - for( Int j = 0; j < list->columns; j++ ) - { - if( cells[j].cellType == LISTBOX_TEXT && cells[j].data ) - TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); - -// free(cells[i].userData); - cells[j].data = nullptr; - cells[j].userData = nullptr; - cells[j].color = 0; - cells[j].cellType = 0; - } - - delete[](list->listData[i].cell); - list->listData[i].cell = nullptr; - } - - - // - // copy the cells up - // - memcpy(list->listData, &list->listData[mData1], - (list->endPos - mData1) * sizeof(ListEntryRow) ); - - list->endPos -= mData1; - list->insertPos = list->endPos; - - // - // remove the display or links to images after the shift - // - for(i = 0; i < (Int)mData1; i ++) - { - list->listData[list->endPos + i].cell = nullptr; - } - - - if( list->multiSelect ) - { - Int i = 0; - - while( list->selections[i] >= 0 ) - { - if( (Int)mData1 >= list->selections[i] ) - list->selections[i] -= (Int)mData1; - else - { - removeSelection( list, i ); - i--; // compensate for lost entry - } - - i++; - } - } - else - { - if( list->selectPos > 0 ) - list->selectPos -= mData1; - } - - if( list->displayPos > 0 ) - adjustDisplay( window, (-1 * mData1), TRUE ); - - computeTotalHeight( window ); - - break; - - } - - // ------------------------------------------------------------------------ - case GLM_GET_SELECTION: - { - - if( list->multiSelect ) - *(Int*)mData2 = (Int)list->selections; - else - *(Int*)mData2 = list->selectPos; - - break; - - } - - // ------------------------------------------------------------------------ - case GLM_SET_UP_BUTTON: - list->upButton = (GameWindow *)mData1; - break; - - // ------------------------------------------------------------------------ - case GLM_SET_DOWN_BUTTON: - list->downButton = (GameWindow *)mData1; - break; - - // ------------------------------------------------------------------------ - case GLM_SET_SLIDER: - list->slider = (GameWindow *)mData1; - break; - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GGM_RESIZED: - { - Int width = (Int)mData1; - Int height = (Int)mData2; - ICoord2D downSize = {0, 0}; - ICoord2D upSize = {0, 0}; - ICoord2D sliderSize = {0, 0}; - GameWindow *child = nullptr; - ICoord2D sliderChildSize = {0, 0}; - - // get needed window sizes - if (list->downButton) - list->downButton->winGetSize( &downSize.x, &downSize.y ); - if (list->upButton) - list->upButton->winGetSize( &upSize.x, &upSize.y ); - if (list->slider) - { - list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - child = list->slider->winGetChild(); - if (child) - child->winGetSize( &sliderChildSize.x, &sliderChildSize.y ); - } - - if( list->upButton ) - { - - list->upButton->winSetPosition( width - upSize.x - 2, 2 ); - - } - - if( list->downButton ) - { - - list->downButton->winSetPosition( width - downSize.x - 2, - height - downSize.y - 2 ); - - } - - if( list->slider ) - { - list->slider->winSetSize( sliderSize.x, - height - (2 * upSize.y) -6 ); - list->slider->winSetPosition( width - sliderSize.x -2, upSize.y + 3 ); - - } - - list->displayHeight = height; - // store display height - if( instData->getTextLength() ) - { - list->displayHeight -= TheWindowManager->winFontHeight( instData->getFont() ); - } - - // - // Setup listbox Columns - // - if( list->columns == 1 ) - { - list->columnWidth[0] = width; - if( list->slider ) - { - ICoord2D sliderSize; - - list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - list->columnWidth[0] -= sliderSize.x; - - } - } - else - { - if( !list->columnWidthPercentage ) - break; - if(!list->columnWidth) - break; - - Int totalWidth = width; - if( list->slider ) - { - ICoord2D sliderSize; - - list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - totalWidth -= sliderSize.x; - - } - for(Int i = 0; i < list->columns; i++ ) - { - list->columnWidth[i] = list->columnWidthPercentage[i] * totalWidth / 100; - } - } - //reset the total height - computeTotalHeight(window); - break; - - } - - // ------------------------------------------------------------------------ - case GLM_UPDATE_DISPLAY: - { - - if( mData1 > 0 ) - // set the display to the top of a specific entry - // which is the previous listHeight + 1 - list->displayPos = list->listData[(mData1 - 1)].listHeight + 1; - else - list->displayPos = 0; - - if( list->displayPos + list->displayHeight >= list->totalHeight ) - { - list->displayPos = list->totalHeight - list->displayHeight; - } - adjustDisplay( window, 0, TRUE ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - Int i; - - // Loop through and destroy any display strings we've allocated - for( i = 0; i < list->listLength; i++ ) - { - //We're now onto a row of cells we are not using anymore Pull off the cells and loop through them - ListEntryCell *cells = list->listData[i].cell; - for (int j = list->columns - 1; j >=0; j-- ) - { - if(!cells) - break; - if( cells[j].cellType == LISTBOX_TEXT ) - { - // If we can delete the stuff that won't be showing up in the new listData structure - if ( cells[j].data ) - { - TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); - } - } -// free(cells[j].userData); - - // Null out the data pointers so they're not destroyed when we free up this listdata - cells[j].userData = nullptr; - cells[j].data = nullptr; - } - delete[](list->listData[i].cell); - list->listData[i].cell = nullptr; - } - - delete[]( list->listData ); - delete[]( list->columnWidth ); - delete[]( list->columnWidthPercentage ); - if( list->multiSelect ) - delete[]( list->selections ); - - delete (ListboxData *)window->winGetUserData(); - window->winSetUserData( nullptr ); - list = nullptr; - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - { - - // If we're losing focus - if( mData1 == FALSE ) - { - BitClear( instData->m_state, WIN_STATE_HILITED ); - } - else - { - BitSet( instData->m_state, WIN_STATE_HILITED ); - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - - *(Bool*)mData2 = TRUE; - break; - - } - // ------------------------------------------------------------------------ - case GSM_SLIDER_TRACK: - { - SliderData *sData = (SliderData *)list->slider->winGetUserData(); - list->displayPos = sData->maxVal - mData2; - - if( list->displayPos > (list->totalHeight - list->displayHeight + 1) ) - list->displayPos = (list->totalHeight - list->displayHeight + 1); - - if( list->displayPos < 0) - list->displayPos = 0; - - adjustDisplay( window, 0, FALSE ); - break; - - } - // ------------------------------------------------------------------------ - case GLM_SET_ITEM_DATA: - { - void *data = (void *)mData2; - pos = (ICoord2D *)mData1; - - if (pos->y >= 0 && pos->y < list->endPos && list->listData[pos->y].cell) - list->listData[pos->y].cell[pos->x].userData = data; - - break; - } - // ------------------------------------------------------------------------ - case GLM_GET_ITEM_DATA: - { - pos = (ICoord2D *)mData1; - void **data = (void **)mData2; - - *data = nullptr; // initialize to nullptr - if (pos->y >= 0 && pos->y < list->endPos && list->listData[pos->y].cell) - *data = list->listData[pos->y].cell[pos->x].userData; - - break; - } - - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetListBoxSetColors ===================================================== -/** Set the colors for a list box, note that this will also automatically - * change the colors of any attached slider, slider thumb, and slider - * buttons */ -//============================================================================= -void GadgetListBoxSetColors( GameWindow *listbox, - Color enabledColor, - Color enabledBorderColor, - Color enabledSelectedItemColor, - Color enabledSelectedItemBorderColor, - Color disabledColor, - Color disabledBorderColor, - Color disabledSelectedItemColor, - Color disabledSelectedItemBorderColor, - Color hiliteColor, - Color hiliteBorderColor, - Color hiliteSelectedItemColor, - Color hiliteSelectedItemBorderColor ) -{ - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - - // enabled - GadgetListBoxSetEnabledColor( listbox, enabledColor ); - GadgetListBoxSetEnabledBorderColor( listbox, enabledBorderColor ); - GadgetListBoxSetEnabledSelectedItemColor( listbox, enabledSelectedItemColor ); - GadgetListBoxSetEnabledSelectedItemBorderColor( listbox, enabledSelectedItemBorderColor ); - - // disabled - GadgetListBoxSetDisabledColor( listbox, disabledColor ); - GadgetListBoxSetDisabledBorderColor( listbox, disabledBorderColor ); - GadgetListBoxSetDisabledSelectedItemColor( listbox, disabledSelectedItemColor ); - GadgetListBoxSetDisabledSelectedItemBorderColor( listbox, disabledSelectedItemBorderColor ); - - // hilited - GadgetListBoxSetHiliteColor( listbox, hiliteColor ); - GadgetListBoxSetHiliteBorderColor( listbox, hiliteBorderColor ); - GadgetListBoxSetHiliteSelectedItemColor( listbox, hiliteSelectedItemColor ); - GadgetListBoxSetHiliteSelectedItemBorderColor( listbox, hiliteSelectedItemBorderColor ); - - // assign default slider colors and images as part of the list box - GameWindow *slider = listboxData->slider; - if( slider ) - { - GameWindow *upButton = listboxData->upButton; - GameWindow *downButton = listboxData->downButton; - - // slider and slider thumb ---------------------------------------------- - - // enabled - GadgetSliderSetEnabledColor( slider, GadgetListBoxGetEnabledColor( listbox ) ); - GadgetSliderSetEnabledBorderColor( slider, GadgetListBoxGetEnabledBorderColor( listbox ) ); - - // Disabled - GadgetSliderSetDisabledColor( slider, GadgetListBoxGetDisabledColor( listbox ) ); - GadgetSliderSetDisabledBorderColor( slider, GadgetListBoxGetDisabledBorderColor( listbox ) ); - - // Hilite - GadgetSliderSetHiliteColor( slider, GadgetListBoxGetHiliteColor( listbox ) ); - GadgetSliderSetHiliteBorderColor( slider, GadgetListBoxGetHiliteBorderColor( listbox ) ); - - // up button ------------------------------------------------------------ - - // enabled - GadgetButtonSetEnabledColor( upButton, GadgetSliderGetEnabledColor( slider ) ); - GadgetButtonSetEnabledBorderColor( upButton, GadgetSliderGetEnabledBorderColor( slider ) ); - GadgetButtonSetEnabledSelectedColor( upButton, GadgetSliderGetEnabledSelectedThumbColor( slider ) ); - GadgetButtonSetEnabledSelectedBorderColor( upButton, GadgetSliderGetEnabledSelectedThumbBorderColor( slider ) ); - - // disabled - GadgetButtonSetDisabledColor( upButton, GadgetSliderGetDisabledColor( slider ) ); - GadgetButtonSetDisabledBorderColor( upButton, GadgetSliderGetDisabledBorderColor( slider ) ); - GadgetButtonSetDisabledSelectedColor( upButton, GadgetSliderGetDisabledSelectedThumbColor( slider ) ); - GadgetButtonSetDisabledSelectedBorderColor( upButton, GadgetSliderGetDisabledSelectedThumbBorderColor( slider ) ); - - // hilite - GadgetButtonSetHiliteColor( upButton, GadgetSliderGetHiliteColor( slider ) ); - GadgetButtonSetHiliteBorderColor( upButton, GadgetSliderGetHiliteBorderColor( slider ) ); - GadgetButtonSetHiliteSelectedColor( upButton, GadgetSliderGetHiliteSelectedThumbColor( slider ) ); - GadgetButtonSetHiliteSelectedBorderColor( upButton, GadgetSliderGetHiliteSelectedThumbBorderColor( slider ) ); - - // down button ---------------------------------------------------------- - - // enabled - GadgetButtonSetEnabledColor( downButton, GadgetSliderGetEnabledColor( slider ) ); - GadgetButtonSetEnabledBorderColor( downButton, GadgetSliderGetEnabledBorderColor( slider ) ); - GadgetButtonSetEnabledSelectedColor( downButton, GadgetSliderGetEnabledSelectedThumbColor( slider ) ); - GadgetButtonSetEnabledSelectedBorderColor( downButton, GadgetSliderGetEnabledSelectedThumbBorderColor( slider ) ); - - // disabled - GadgetButtonSetDisabledColor( downButton, GadgetSliderGetDisabledColor( slider ) ); - GadgetButtonSetDisabledBorderColor( downButton, GadgetSliderGetDisabledBorderColor( slider ) ); - GadgetButtonSetDisabledSelectedColor( downButton, GadgetSliderGetDisabledSelectedThumbColor( slider ) ); - GadgetButtonSetDisabledSelectedBorderColor( downButton, GadgetSliderGetDisabledSelectedThumbBorderColor( slider ) ); - - // hilite - GadgetButtonSetHiliteColor( downButton, GadgetSliderGetHiliteColor( slider ) ); - GadgetButtonSetHiliteBorderColor( downButton, GadgetSliderGetHiliteBorderColor( slider ) ); - GadgetButtonSetHiliteSelectedColor( downButton, GadgetSliderGetHiliteSelectedThumbColor( slider ) ); - GadgetButtonSetHiliteSelectedBorderColor( downButton, GadgetSliderGetHiliteSelectedThumbBorderColor( slider ) ); - - } - -} - -// GadgetListBoxGetText ======================================================= -/** Get the text for a list box entry */ -//============================================================================= -UnicodeString GadgetListBoxGetText( GameWindow *listbox, Int row, Int column) -{ - Color color; - return GadgetListBoxGetTextAndColor( listbox,&color,row,column ); -} - -// GadgetListBoxGetText ======================================================= -/** Get the text for a list box entry */ -//============================================================================= -UnicodeString GadgetListBoxGetTextAndColor( GameWindow *listbox, Color *color, Int row, Int column) -{ - *color = 0; - // sanity - if( listbox == nullptr || row == -1 || column == -1) - return UnicodeString::TheEmptyString; - - // verify that this is a list box - if( BitIsSet( listbox->winGetStyle(), GWS_SCROLL_LISTBOX ) == FALSE ) - return UnicodeString::TheEmptyString; - TextAndColor tAndC; - //UnicodeString result; - ICoord2D pos; - pos.x = column; - pos.y = row; - TheWindowManager->winSendSystemMsg( listbox, GLM_GET_TEXT, (WindowMsgData)&pos, (WindowMsgData)&tAndC ); - - - *color = tAndC.color; - return tAndC.string; - - //return UnicodeString::TheEmptyString; - -} - -// GadgetListBoxAddEntryText ================================================== -/** Add a new string entry into the listbox at the insert position */ -//============================================================================= -Int GadgetListBoxAddEntryText( GameWindow *listbox, - UnicodeString text, - Color color, Int row, Int column, Bool overwrite ) -{ - if (!listbox) - return -1; - if (text.isEmpty()) - text = L" "; - Int index; - AddMessageStruct addInfo; - addInfo.row = row; - addInfo.column = column; - addInfo.type = LISTBOX_TEXT; - addInfo.data = &text; - addInfo.overwrite = overwrite; - addInfo.height = -1; - addInfo.width = -1; - - ListboxData *listData = (ListboxData *)listbox->winGetUserData(); - if (listData == nullptr) - return -1; - Bool wasFull = (listData->listLength <= listData->endPos); - Int newEntryOffset = (wasFull)?0:1; - Int oldBottomIndex = GadgetListBoxGetBottomVisibleEntry(listbox); - - /// @TODO: Don't do this type cast! - index = (Int) TheWindowManager->winSendSystemMsg( listbox, GLM_ADD_ENTRY, (WindowMsgData)&addInfo, color ); - - //DEBUG_ASSERTLOG(!listData->scrollIfAtEnd, ("Adding line %d (orig end was %d, newEntryOffset is %d, (%d-%d)?=%d, isFull=%d/%d ll=%d, end=%d", - //index, oldBottomIndex, newEntryOffset, index, oldBottomIndex, newEntryOffset, wasFull, GadgetListBoxIsFull(listbox), listData->listLength, listData->endPos)); - if(listData->scrollIfAtEnd && index - oldBottomIndex == newEntryOffset && GadgetListBoxIsFull(listbox)) - { - GadgetListBoxSetBottomVisibleEntry( listbox, index ); - } - - return (index); -} - -// GadgetListBoxAddEntryImage ================================================= -/** Add a new string entry into the listbox at the insert position */ -//============================================================================= -Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image, - Int row, Int column, - Int hight, Int width, - Bool overwrite, Color color ) -{ - Int index; - AddMessageStruct addInfo; - addInfo.row = row; - addInfo.column = column; - addInfo.type = LISTBOX_IMAGE; - addInfo.data = image; - addInfo.overwrite = overwrite; - addInfo.height = hight; - addInfo.width = width; - /// @TODO: Don't do this type cast! - index = (Int) TheWindowManager->winSendSystemMsg( listbox, GLM_ADD_ENTRY, (WindowMsgData)&addInfo, color ); - return (index); -} - -Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image, - Int row, Int column, - Bool overwrite, Color color ) -{ - return GadgetListBoxAddEntryImage(listbox, image, row, column, -1, -1, overwrite, color); -} - -// GadgetListBoxSetFont ======================================================= -/** Set the font for a listbox control, we need to set the window - * text font, the tooltip font, and the edit text display strings for - * the text data itself and the secret text */ -//============================================================================= -void GadgetListBoxSetFont( GameWindow *g, GameFont *font ) -{ - ListboxData *listData = (ListboxData *)g->winGetUserData(); - DisplayString *dString; - - // set the font for the display strings all windows have - dString = g->winGetInstanceData()->getTextDisplayString(); - if( dString ) - dString->setFont( font ); - dString = g->winGetInstanceData()->getTooltipDisplayString(); - if( dString ) - dString->setFont( font ); - - // listbox specific - if( listData ) - for( Int i = 0; i < listData->listLength; i++ ) - { - if(listData->listData[i].cell) - for( Int j = 0; j < listData->columns; j++ ) - { - if( listData->listData[i].cell[j].cellType == LISTBOX_TEXT && listData->listData[i].cell[j].data ) - { - dString = (DisplayString *)listData->listData[i].cell[j].data; - dString->setFont( font ); - } - } - } - -} - -// GadgetListboxCreateScrollbar =============================================== -/** Create the scroll bar using a slider and two buttons for a listbox */ -//============================================================================= -void GadgetListboxCreateScrollbar( GameWindow *listbox ) -{ - ListboxData *listData = (ListboxData *)listbox->winGetUserData(); - WinInstanceData winInstData; - SliderData sData = { 0 }; - Int buttonWidth, buttonHeight; - Int sliderButtonWidth, sliderButtonHeight; - Int fontHeight; - Int top; - Int bottom; - UnsignedInt status = listbox->winGetStatus(); - Bool title = FALSE; - Int width, height; - - // get width and height of listbox - listbox->winGetSize( &width, &height ); - - // do we have a title - if( listbox->winGetTextLength() ) - title = TRUE; - - // remove unwanted status bits. - status &= ~(WIN_STATUS_BORDER | WIN_STATUS_HIDDEN | WIN_STATUS_NO_INPUT); - - fontHeight = TheWindowManager->winFontHeight( listbox->winGetFont() ); - top = title ? (fontHeight + 1):0; - bottom = title ? (height - (fontHeight + 1)):height; - - // initialize instData - winInstData.init(); - - // size of button - buttonWidth = 21;//GADGET_SIZE; - buttonHeight = 22;//GADGET_SIZE; - - // ---------------------------------------------------------------------- - // Create Top Button - // ---------------------------------------------------------------------- - status |= WIN_STATUS_IMAGE; - - winInstData.m_owner = listbox; - winInstData.m_style = GWS_PUSH_BUTTON; - - // if listbox tracks, so will this sub control - if( BitIsSet( listbox->winGetStyle(), GWS_MOUSE_TRACK ) ) - BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - - listData->upButton = - TheWindowManager->gogoGadgetPushButton( listbox, - status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, - width - buttonWidth -2, top+2, - buttonWidth, buttonHeight, - &winInstData, nullptr, TRUE ); - - // ---------------------------------------------------------------------- - // Create Bottom Button - // ---------------------------------------------------------------------- - - winInstData.init(); - winInstData.m_style = GWS_PUSH_BUTTON; - winInstData.m_owner = listbox; - - // if listbox tracks, so will this sub control - if( BitIsSet( listbox->winGetStyle(), GWS_MOUSE_TRACK ) ) - BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - - listData->downButton = - TheWindowManager->gogoGadgetPushButton( listbox, - status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, - width - buttonWidth -2, - (top + bottom - buttonHeight -2), - buttonWidth, buttonHeight, - &winInstData, nullptr, TRUE ); - - // ---------------------------------------------------------------------- - // create the slider - // ---------------------------------------------------------------------- - - // size of button - sliderButtonWidth = buttonWidth;//GADGET_SIZE; - sliderButtonHeight = GADGET_SIZE; - - // initialize instData - winInstData.init(); - winInstData.m_style = GWS_VERT_SLIDER; - winInstData.m_owner = listbox; - - // if listbox tracks, so will this sub control - if( BitIsSet( listbox->winGetStyle(), GWS_MOUSE_TRACK ) ) - BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - - // initialize sData - memset( &sData, 0, sizeof(SliderData) ); - - // Create Slider - listData->slider = - TheWindowManager->gogoGadgetSlider( listbox, - status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, - width - sliderButtonWidth - 2, - (top + buttonHeight + 3), - sliderButtonWidth, bottom - (2 * buttonHeight) - 6, - &winInstData, &sData, nullptr, TRUE ); - - // we now have all the scrollbar parts, this better be set :) - listData->scrollBar = TRUE; - -} - -// GadgetListBoxAddMultiSelect ================================================ -/** Enable multi selections for a listbox - * - * ASSUMPTION: The listLength must already be set at this time so - * that we can make enough space to hold all the selection data, if you - * change the list length you must also change the selection array - * for multi select listboxes - */ -//============================================================================= -void GadgetListBoxAddMultiSelect( GameWindow *listbox ) -{ - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - - DEBUG_ASSERTCRASH(listboxData && listboxData->selections == nullptr, ("selections is not null")); - listboxData->selections = NEW Int [listboxData->listLength]; - DEBUG_LOG(( "Enable list box multi select: listLength (select) = %d * %d = %d bytes;", - listboxData->listLength, sizeof(Int), - listboxData->listLength *sizeof(Int) )); - - if( listboxData->selections == nullptr ) - { - - delete[]( listboxData->listData ); - listboxData->listData = nullptr; - return; - - } - - memset( listboxData->selections, -1, - listboxData->listLength * sizeof(Int) ); - - // set mutliselect flag - listboxData->multiSelect = TRUE; - - // adjust the input procedure for the listbox - listbox->winSetInputFunc( GadgetListBoxMultiInput ); - -} - -// GadgetListBoxRemoveMultiSelect ============================================= -/** Remove multi select capability from a listbox */ -//============================================================================= -void GadgetListBoxRemoveMultiSelect( GameWindow *listbox ) -{ - ListboxData *listData = (ListboxData *)listbox->winGetUserData(); - - delete[]( listData->selections ); - listData->selections = nullptr; - - listData->multiSelect = FALSE; - - // adjust the input procedure for the listbox - listbox->winSetInputFunc( GadgetListBoxInput ); - -} - -// GadgetListBoxSetListLength ================================================= -/** Set OR reset the list length data contained in the listboxData - * parameter. When adjusting the size of lists we also have to - * adjust multiselection lists if present and any display - * strings present */ -//============================================================================= -void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) -{ - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - - -// ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); -// ListEntry *newData = (ListEntry *)malloc(newLength * sizeof(ListEntry)); - DEBUG_ASSERTCRASH(listboxData, ("We don't have our needed listboxData!")); - if( !listboxData ) - return; - DEBUG_ASSERTCRASH(listboxData->columns > 0,("We need at least one Column in the listbox")); - if( listboxData->columns < 1 ) - return; - - Int columns = listboxData->columns; - ListEntryRow *newData = NEW ListEntryRow[ newLength ]; - DEBUG_ASSERTCRASH(newData, ("Unable to allocate new data structures for the Listbox")); - if( !newData ) - return; - Int i; - // zero out the new Data structure - memset( newData, 0, newLength * sizeof( ListEntryRow ) ); - - // we want to copy over different amounts of data depending on if we're adding - // to the list box or removing from the listbox - if(newLength >= listboxData->listLength) - { - memcpy(newData,listboxData->listData,listboxData->listLength * sizeof( ListEntryRow ) ); - } - else - { - // If we're removing entries from the listbox, we need to reset the length, - // position, and selection to their new places - if( listboxData->displayPos >newLength) - listboxData->displayPos = newLength; - //if we're multiselect, just select no position - if(listboxData->selectPos > newLength || listboxData->multiSelect) - listboxData->selectPos = -1; - if(listboxData->insertPos > newLength) - listboxData->insertPos = newLength; - - listboxData->endPos = newLength; - //copy only the data that we'll be needing. - memcpy(newData,listboxData->listData,newLength * sizeof( ListEntryRow ) ); - } - - // Loop through and destroy any display strings we've allocated that aren't used - for( i = 0; i < listboxData->listLength; i++ ) - { - //We're now onto a row of cells we are not using anymore Pull off the cells and loop through them - ListEntryCell *cells = listboxData->listData[i].cell; - for (int j = columns - 1; j >=0; j-- ) - { - if(!cells) - break; - if ( i >= newLength ) - { - if( cells[j].cellType == LISTBOX_TEXT && i >= newLength) - { - // If we can delete the stuff that won't be showing up in the new listData structure - if ( cells[j].data ) - { - TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); - } - } -// free(cells[j].userData); - } - } - if (i >= newLength) { - delete[](listboxData->listData[i].cell); - listboxData->listData[i].cell = nullptr; - } - } - - listboxData->listLength = newLength; - - delete[]( listboxData->listData ); - listboxData->listData = newData; - - //reset the total height - computeTotalHeight(listbox); - - // Sanity check that everything was created properly - if( listboxData->listData == nullptr ) - { - - DEBUG_LOG(( "Unable to allocate listbox data pointer" )); - assert( 0 ); - return; - - } - - // adjust the selection array for multi select listboxes - if( listboxData->multiSelect ) - { - - GadgetListBoxRemoveMultiSelect( listbox ); - GadgetListBoxAddMultiSelect( listbox ); - - } - -} - -//============================================================================= -Int GadgetListBoxGetListLength( GameWindow *listbox ) -{ - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - if (listboxData) - return listboxData->listLength; - - return 0; -} - -//============================================================================= -Int GadgetListBoxGetMaxSelectedLength( GameWindow *listbox ) -{ - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - if (listboxData) - return listboxData->multiSelect ? listboxData->listLength : 1; - - return 0; -} - -// GadgetListBoxGetNumEntries ================================================= -/** Get the list length data contained in the listboxData - * parameter. */ -//============================================================================= -Int GadgetListBoxGetNumEntries( GameWindow *listbox ) -{ - if (!listbox) - return 0; - - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - if (listboxData) - return listboxData->endPos; - - return 0; -} - -//------------------------------------------------------------------------------------------------- -/** Get the selected item(s) of a listbox. For a single select listbox the parameter - * should be a single integer pointer. For a multi select listbox the parameter - * should be an (Int *), this array returned will be an array of indices of the selected items - * of the list box. An entry of -1 in this array is the "end" of the selected list, - * and this list will never be larger than the max items in the list box */ -//------------------------------------------------------------------------------------------------- -void GadgetListBoxGetSelected( GameWindow *listbox, Int *selectList ) -{ - - // sanity - if( listbox == nullptr ) - return; - - // get selected indices via system message - TheWindowManager->winSendSystemMsg( listbox, GLM_GET_SELECTION, 0, (WindowMsgData)selectList ); - -} - -//------------------------------------------------------------------------------------------------- -/** Set the selected item of a listbox. The parameter is a single integer. If - * the selected index is less than 0, nothing is selected. */ -//------------------------------------------------------------------------------------------------- -void GadgetListBoxSetSelected( GameWindow *listbox, Int selectIndex ) -{ - - // sanity - if( listbox == nullptr ) - return; - - // set selected index via system message - TheWindowManager->winSendSystemMsg( listbox, GLM_SET_SELECTION, (WindowMsgData)(&selectIndex), 1 ); - -} - -//------------------------------------------------------------------------------------------------- -/** Set the selected item of a listbox. */ -//------------------------------------------------------------------------------------------------- -void GadgetListBoxSetSelected( GameWindow *listbox, const Int *selectList, Int selectCount ) -{ - // sanity - if( listbox == nullptr ) - return; - // set selected index via system message - TheWindowManager->winSendSystemMsg( listbox, GLM_SET_SELECTION, (WindowMsgData)selectList, selectCount ); -} - -//------------------------------------------------------------------------------------------------- -/** Reset the content of the listbox */ -//------------------------------------------------------------------------------------------------- -void GadgetListBoxReset( GameWindow *listbox ) -{ - - // sanity - if( listbox == nullptr ) - return; - - // reset via system message - TheWindowManager->winSendSystemMsg( listbox, GLM_DEL_ALL, 0, 0 ); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void GadgetListBoxSetItemData( GameWindow *listbox, void *data, Int row, Int column ) -{ - ICoord2D pos; - pos.x = column; - pos.y = row; - - if (listbox) - TheWindowManager->winSendSystemMsg( listbox, GLM_SET_ITEM_DATA, (WindowMsgData)&pos, (WindowMsgData)data); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void *GadgetListBoxGetItemData( GameWindow *listbox, Int row, Int column) -{ - void *data = nullptr; - ICoord2D pos; - pos.x = column; - pos.y = row; - - if (listbox) - { - TheWindowManager->winSendSystemMsg( listbox, GLM_GET_ITEM_DATA, (WindowMsgData)&pos, (WindowMsgData)&data); - } - return (data); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -Int GadgetListBoxGetBottomVisibleEntry( GameWindow *window ) -{ - if (!window) - return 0; - - ListboxData *listData = (ListboxData *)window->winGetUserData(); - if (!listData) - return 0; - - return getListboxBottomEntry(listData); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -bool GadgetListBoxIsFull(GameWindow *window) -{ - if (!window) - return FALSE; - ListboxData *listData = (ListboxData *)window->winGetUserData(); - if (!listData) - return FALSE; - - Int entry = getListboxBottomEntry(listData); - if(listData->listData[entry].listHeight >= listData->displayPos + listData->displayHeight - 5) - return TRUE; - else - return FALSE; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void GadgetListBoxSetBottomVisibleEntry( GameWindow *window, Int newPos ) -{ - if (!window) - return; - - ListboxData *listData = (ListboxData *)window->winGetUserData(); - if (!listData) - return; - - int prevPos = GadgetListBoxGetBottomVisibleEntry( window ); - - adjustDisplay(window, newPos - prevPos + 1, true); -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -Int GadgetListBoxGetTopVisibleEntry( GameWindow *window ) -{ - if (!window) - return 0; - - ListboxData *listData = (ListboxData *)window->winGetUserData(); - if (!listData) - return 0; - - return getListboxTopEntry(listData); -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void GadgetListBoxSetTopVisibleEntry( GameWindow *window, Int newPos ) -{ - if (!window) - return; - - ListboxData *listData = (ListboxData *)window->winGetUserData(); - if (!listData) - return; - - int prevPos = GadgetListBoxGetTopVisibleEntry( window ); - - adjustDisplay(window, newPos - prevPos, true); -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void GadgetListBoxSetAudioFeedback( GameWindow *listbox, Bool enable ) -{ - if (!listbox) - return; - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - if (!listboxData) - return; - - listboxData->audioFeedback = enable; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -Int GadgetListBoxGetNumColumns( GameWindow *listbox ) -{ - if (!listbox) - return 0; - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - if (!listboxData) - return 0; - - return listboxData->columns; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -Int GadgetListBoxGetColumnWidth( GameWindow *listbox, Int column ) -{ - if (!listbox) - return 0; - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - if (!listboxData) - return 0; - if (listboxData->columns <= column || column < 0) - return 0; - - return listboxData->columnWidth[column]; -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp deleted file mode 100644 index d798d23f0d6..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ProgressBar.cpp ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: ProgressBar.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Progress bar GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowManager.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// - -// GadgetProgressBarSystem ==================================================== -/** Handle system messages for Progress Bar */ -//============================================================================= -WindowMsgHandledType GadgetProgressBarSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - window->winSetUserData( nullptr ); - break; - } - - // ------------------------------------------------------------------------ - case GPM_SET_PROGRESS: - { - Int newPos = (Int)mData1; - - if (newPos < 0 || newPos > 100) - break; - - window->winSetUserData( (void *)newPos ); - - break; - - } - - // ------------------------------------------------------------------------ - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetProgressBarSetProgress =============================================== -/** send progress system message to Progress Bar */ -//============================================================================= -void GadgetProgressBarSetProgress( GameWindow *g, Int progress ) -{ - if(!g) - return; - - TheWindowManager->winSendSystemMsg( g, GPM_SET_PROGRESS, progress, 0); -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp deleted file mode 100644 index de74e32a20e..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp +++ /dev/null @@ -1,448 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: RadioButton.cpp ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: RadioButton.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Radio button GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Gadget.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// doRadioUnselect ============================================================ -/** Do the unselect of matching group not including exception window */ -//============================================================================= -static void doRadioUnselect( GameWindow *window, Int group, Int screen, - GameWindow *except ) -{ - - // - // if this is a radio button we have something to consider, but we - // will ignore the except window - // - if( window != except && BitIsSet( window->winGetStyle(), GWS_RADIO_BUTTON ) ) - { - RadioButtonData *radioData = (RadioButtonData *)window->winGetUserData(); - - if( radioData->group == group && radioData->screen == screen ) - { - WinInstanceData *instData = window->winGetInstanceData(); - - BitClear( instData->m_state, WIN_STATE_SELECTED ); - - } - - } - - // recursively call on all my children - GameWindow *child; - - for( child = window->winGetChild(); child; child = child->winGetNext() ) - doRadioUnselect( child, group, screen, except ); - -} - -// unselectOtherRadioOfGroup ================================================== -/** Go through the entire window system, including child windows and - * unselect any radio buttons of the specified group, but not the - * window specified */ -//============================================================================= -static void unselectOtherRadioOfGroup( Int group, Int screen, - GameWindow *except ) -{ - GameWindow *window = TheWindowManager->winGetWindowList(); - - for( window = TheWindowManager->winGetWindowList(); - window; - window = window->winGetNext() ) - doRadioUnselect( window, group, screen, except ); - -} - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// - -// GadgetRadioButtonInput ===================================================== -/** Handle input for radio button */ -//============================================================================= -WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( instData->getOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - mData1 ); - //TheWindowManager->winSetFocus( window ); - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( instData->getOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - mData1 ); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - { - - TheWindowManager->winSendSystemMsg( instData->getOwner(), GGM_LEFT_DRAG, - (WindowMsgData)window, mData1 ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - { - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - { - - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) == FALSE ) - { - RadioButtonData *radioData = (RadioButtonData *)window->winGetUserData(); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_SELECTED, - (WindowMsgData)window, - mData1 ); - - // - // unselect any windows in the system (including children) that - // are radio buttons with this same group and screen ID - // - if( radioData->group != 0 ) - unselectOtherRadioOfGroup(radioData->group, radioData->screen, window ); - - // this button is now selected - BitSet( instData->m_state, WIN_STATE_SELECTED ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) == FALSE ) - { - - // this up click was not meant for this button - return MSG_IGNORED; - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch( mData1 ) - { - - // -------------------------------------------------------------------- - case KEY_ENTER: - case KEY_SPACE: - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) == FALSE ) - { - RadioButtonData *radioData = (RadioButtonData *)window->winGetUserData(); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_SELECTED, - (WindowMsgData)window, - mData1 ); - - // - // unselect any windows in the system (including children) that - // are radio buttons with this same group and screen ID - // - if( radioData->group != 0 ) - unselectOtherRadioOfGroup(radioData->group, radioData->screen, window ); - - // this button is now selected - BitSet( instData->m_state, WIN_STATE_SELECTED ); - - } - - } - - break; - - // -------------------------------------------------------------------- - case KEY_DOWN: - case KEY_RIGHT: - case KEY_TAB: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winNextTab(); - break; - - } - - // -------------------------------------------------------------------- - case KEY_UP: - case KEY_LEFT: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winPrevTab(); - break; - - } - - // -------------------------------------------------------------------- - default: - { - - return MSG_IGNORED; - - } - - } - - break; - - } - - // ------------------------------------------------------------------------ - default: - { - - return MSG_IGNORED; - - } - - } - - return MSG_HANDLED; - -} - -// GadgetRadioButtonSystem ==================================================== -/** Handle system messages for radio button */ -//============================================================================= -WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GBM_SET_SELECTION: - { - - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) == FALSE ) - { - - // do we want to send a selected message? - if( (Bool)mData1 == TRUE ) - { - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_SELECTED, - (WindowMsgData)window, - 0 ); - } - - // - // unselect any windows in the system (including children) that - // are radio buttons with this same group and screen ID - // - RadioButtonData *radioData = (RadioButtonData *)window->winGetUserData(); - if( radioData->group != 0 ) - unselectOtherRadioOfGroup(radioData->group, radioData->screen, window ); - - // this button is now selected - BitSet( instData->m_state, WIN_STATE_SELECTED ); - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GGM_SET_LABEL: - { - - window->winSetText( *(UnicodeString*)mData1 ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - // free radio button user data - delete (RadioButtonData *)window->winGetUserData(); - window->winSetUserData( nullptr ); - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - { - - if( mData1 == FALSE ) - BitClear( instData->m_state, WIN_STATE_HILITED ); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - - *(Bool*)mData2 = TRUE; - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetRadioSetText ========================================================= -/** Set the text for the control */ -//============================================================================= -void GadgetRadioSetText( GameWindow *g, UnicodeString text ) -{ - - // sanity - if( g == nullptr ) - return; - - TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); - -} - -// GadgetRadioSetGroup ======================================================== -/** Set the group number for a radio button, only one radio button of - * a group can be selected at any given time */ -//============================================================================= -void GadgetRadioSetGroup( GameWindow *g, Int group, Int screen ) -{ - RadioButtonData *radioData = (RadioButtonData *)g->winGetUserData(); - - radioData->group = group; - radioData->screen = screen; - -} - - -// GadgetRadioSetText ========================================================= -/** Set the text for the control */ -//============================================================================= -void GadgetRadioSetSelection( GameWindow *g, Bool sendMsg ) -{ - - // sanity - if( g == nullptr ) - return; - - TheWindowManager->winSendSystemMsg( g, GBM_SET_SELECTION, (WindowMsgData)&sendMsg, 0 ); - -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp deleted file mode 100644 index 68a010e6bac..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: StaticText.cpp /////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: StaticText.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Static text control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowManager.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// GadgetStaticTextInput ====================================================== -/** Handle input for text field */ -//============================================================================= -WindowMsgHandledType GadgetStaticTextInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_CHAR: - switch (mData1) - { - - case KEY_DOWN: - case KEY_RIGHT: - case KEY_TAB: - // Just in case some fool sets static text as a tab stop - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winNextTab(); - break; - - case KEY_UP: - case KEY_LEFT: - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winPrevTab(); - break; - - default: - return MSG_IGNORED; - } - - break; - - default: - return MSG_IGNORED; - - } - return MSG_HANDLED; - - -} - -// GadgetStaticTextSystem ===================================================== -/** Handle system messages for text field */ -//============================================================================= -WindowMsgHandledType GadgetStaticTextSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ -// WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GGM_GET_LABEL: - { - TextData *tData = (TextData *)window->winGetUserData(); - if (tData && tData->text) - *(UnicodeString*)mData2 = tData->text->getText(); - break; - - } - - // ------------------------------------------------------------------------ - case GGM_SET_LABEL: - { - if( mData1 ) - { - TextData *tData = (TextData *)window->winGetUserData(); - if (tData && tData->text) - tData->text->setText( *(UnicodeString*)mData1 ); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - TextData *data = (TextData *)window->winGetUserData(); - - // free the display string - TheDisplayStringManager->freeDisplayString( data->text ); - - // free text data - delete (TextData *)window->winGetUserData(); - window->winSetUserData( nullptr ); - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; -} - -// GadgetStaticTextSetText ==================================================== -/** Set the text for a static text control */ -//============================================================================= -void GadgetStaticTextSetText( GameWindow *window, UnicodeString text ) -{ - if(!window) - return; - TheWindowManager->winSendSystemMsg( window, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); - -} - -UnicodeString GadgetStaticTextGetText( GameWindow *window ) -{ - if(!window) - return UnicodeString::TheEmptyString; - TextData *tData = (TextData *)window->winGetUserData(); - if(!tData) - return UnicodeString::TheEmptyString; - return tData->text->getText(); -} - -// GadgetStaticTextSetFont ==================================================== -/** Set the font for a text control, we need to set the window - * text font, the tooltip font, and the static text display strings for - * the text data itself */ -//============================================================================= -void GadgetStaticTextSetFont( GameWindow *g, GameFont *font ) -{ - TextData *textData = (TextData *)g->winGetUserData(); - DisplayString *dString; - - // set the font for the display strings all windows have - dString = g->winGetInstanceData()->getTextDisplayString(); - if( dString ) - dString->setFont( font ); - dString = g->winGetInstanceData()->getTooltipDisplayString(); - if( dString ) - dString->setFont( font ); - - // static text specific - if( textData ) - { - - dString = textData->text; - if( dString ) - dString->setFont( font ); - - } - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp deleted file mode 100644 index 8262f771162..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp +++ /dev/null @@ -1,366 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: RadioButton.cpp ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: \projects\RTS\code\gameengine\Source\GameClient\GUI\Gadget\GadgetTabControl.cpp -// -// Created: Graham Smallwood, November 2001 -// -// Desc: Tab Set GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Gadget.h" -#include "GameClient/GadgetTabControl.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// - -// GadgetTabControlInput ===================================================== -/** Handle input for TabControl */ -//============================================================================= -WindowMsgHandledType GadgetTabControlInput( GameWindow *tabControl, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ -// WinInstanceData *instData = tabControl->winGetInstanceData(); - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - - Int tabX, tabY; - tabControl->winGetScreenPosition( &tabX, &tabY ); - Int mouseX = LOLONGTOSHORT(mData1) - tabX;//mData1 is packedMouseCoords in screen space - Int mouseY = HILONGTOSHORT(mData1) - tabY; - Int tabsLeft = tabData->tabsLeftLimit; - Int tabsRight = tabData->tabsRightLimit; - Int tabsBottom = tabData->tabsBottomLimit; - Int tabsTop = tabData->tabsTopLimit; - - switch( msg ) - { - case GWM_LEFT_DOWN: - { - if( (mouseX < tabsLeft) - || (mouseX > tabsRight) - || (mouseY < tabsTop) - || (mouseY > tabsBottom) - ) - {//I eat input on myself that isn't a tab (a button click would mean I don't see the input ever.) - return MSG_HANDLED; - } - - Int distanceIn; - Int tabSize; - if( (tabData->tabEdge == TP_RIGHT_SIDE) || (tabData->tabEdge == TP_LEFT_SIDE) ) - {//scan down to find which button - distanceIn = mouseY - tabsTop; - tabSize = tabData->tabHeight; - } - else - {//scan right to find which button - distanceIn = mouseX - tabsLeft; - tabSize = tabData->tabWidth; - } - Int tabPressed = distanceIn / tabSize; - if( ! tabData->subPaneDisabled[tabPressed] && (tabPressed != tabData->activeTab) ) - GadgetTabControlShowSubPane( tabControl, tabPressed ); - } - - default: - { - return MSG_IGNORED; - } - } - - return MSG_HANDLED; - -} - -// GadgetTabControlSystem ==================================================== -/** Handle system messages for TabControl */ -//============================================================================= -WindowMsgHandledType GadgetTabControlSystem( GameWindow *tabControl, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - // free tab control user data - delete (TabControlData *)tabControl->winGetUserData(); - tabControl->winSetUserData( nullptr ); - - break; - - } - - case GGM_RESIZED: - {//On resize, we need to upkeep the pane sizes and tabs since they are bound to us - GadgetTabControlResizeSubPanes( tabControl ); - GadgetTabControlComputeTabRegion( tabControl ); - - break; - } - - case GBM_SELECTED: - {//Pass buttons messages up - GameWindow *parent = tabControl->winGetParent(); - - if( parent ) - return TheWindowManager->winSendSystemMsg( parent, msg, mData1, mData2 ); - - break; - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -void GadgetTabControlComputeTabRegion( GameWindow *tabControl )///< Recalc the tab positions based on userData -{ - Int winWidth, winHeight; - tabControl->winGetSize( &winWidth, &winHeight ); - - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - - Int horzOffset = 0, vertOffset = 0; - if( (tabData->tabEdge == TP_TOP_SIDE) || (tabData->tabEdge == TP_BOTTOM_SIDE) ) - { - if( tabData->tabOrientation == TP_CENTER ) - { - horzOffset = winWidth - ( 2 * tabData->paneBorder ) - ( tabData->tabCount * tabData->tabWidth ); - horzOffset /= 2; - } - else if( tabData->tabOrientation == TP_BOTTOMRIGHT ) - { - horzOffset = winWidth - ( 2 * tabData->paneBorder ) - ( tabData->tabCount * tabData->tabWidth ); - } - else if( tabData->tabOrientation == TP_TOPLEFT ) - { - horzOffset = 0; - } - } - else - { - if( tabData->tabOrientation == TP_CENTER ) - { - vertOffset = winHeight - ( 2 * tabData->paneBorder ) - ( tabData->tabCount * tabData->tabHeight ); - vertOffset /= 2; - } - else if( tabData->tabOrientation == TP_BOTTOMRIGHT ) - { - vertOffset = winHeight - ( 2 * tabData->paneBorder ) - ( tabData->tabCount * tabData->tabHeight ); - } - else if( tabData->tabOrientation == TP_TOPLEFT ) - { - vertOffset = 0; - } - } - - if( tabData->tabEdge == TP_TOP_SIDE ) - { - tabData->tabsTopLimit = tabData->paneBorder; - tabData->tabsBottomLimit = tabData->paneBorder + tabData->tabHeight; - tabData->tabsLeftLimit = tabData->paneBorder + horzOffset; - tabData->tabsRightLimit = tabData->paneBorder + horzOffset + ( tabData->tabWidth * tabData->tabCount ); - } - else if( tabData->tabEdge == TP_BOTTOM_SIDE ) - { - tabData->tabsTopLimit = winHeight - tabData->paneBorder - tabData->tabHeight; - tabData->tabsBottomLimit = winHeight - tabData->paneBorder; - tabData->tabsLeftLimit = tabData->paneBorder + horzOffset; - tabData->tabsRightLimit = tabData->paneBorder + horzOffset + ( tabData->tabWidth * tabData->tabCount ); - } - else if( tabData->tabEdge == TP_RIGHT_SIDE ) - { - tabData->tabsLeftLimit = winWidth - tabData->paneBorder - tabData->tabWidth; - tabData->tabsRightLimit = winWidth - tabData->paneBorder; - tabData->tabsTopLimit = tabData->paneBorder + vertOffset; - tabData->tabsBottomLimit = tabData->paneBorder + vertOffset + ( tabData->tabHeight * tabData->tabCount ); - } - else if( tabData->tabEdge == TP_LEFT_SIDE ) - { - tabData->tabsLeftLimit = tabData->paneBorder; - tabData->tabsRightLimit = tabData->paneBorder + tabData->tabWidth; - tabData->tabsTopLimit = tabData->paneBorder + vertOffset; - tabData->tabsBottomLimit = tabData->paneBorder + vertOffset + ( tabData->tabHeight * tabData->tabCount ); - } - -} - -void GadgetTabControlComputeSubPaneSize( GameWindow *tabControl, Int *width, Int *height, Int *x, Int *y ) -{ - Int winWidth, winHeight; - tabControl->winGetSize( &winWidth, &winHeight ); - - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - - if( (tabData->tabEdge == TP_TOP_SIDE) || (tabData->tabEdge == TP_BOTTOM_SIDE) ) - *height = winHeight - (2 * tabData->paneBorder) - tabData->tabHeight; - else - *height = winHeight - (2 * tabData->paneBorder); - - if( (tabData->tabEdge == TP_LEFT_SIDE) || (tabData->tabEdge == TP_RIGHT_SIDE) ) - *width = winWidth - (2 * tabData->paneBorder) - tabData->tabWidth; - else - *width = winWidth - (2 * tabData->paneBorder); - - if( tabData->tabEdge == TP_LEFT_SIDE ) - *x = tabData->paneBorder + tabData->tabWidth; - else - *x = tabData->paneBorder; - - if( tabData->tabEdge == TP_TOP_SIDE ) - *y = tabData->paneBorder + tabData->tabHeight; - else - *y = tabData->paneBorder; -} - -void GadgetTabControlShowSubPane( GameWindow *tabControl, Int whichPane) -{ - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - - for( Int paneIndex = 0; paneIndex < NUM_TAB_PANES; paneIndex++ ) - { - if( tabData->subPanes[paneIndex] != nullptr ) - tabData->subPanes[paneIndex]->winHide( true ); - } - if( tabData->subPanes[whichPane] ) - tabData->activeTab = whichPane; - else - tabData->activeTab = 0; - - tabData->activeTab = min( tabData->activeTab, tabData->tabCount - 1 ); - - tabData->subPanes[tabData->activeTab]->winHide( false ); -} - -void GadgetTabControlCreateSubPanes( GameWindow *tabControl )///< Create User Windows attached to userData as Panes -{//These two funcs are called after all the Editor set data is updated - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - Int width, height, x, y; - GadgetTabControlComputeSubPaneSize(tabControl, &width, &height, &x, &y); - - for( Int paneIndex = 0; paneIndex < NUM_TAB_PANES; paneIndex++ ) - { - if( tabData->subPanes[paneIndex] == nullptr )//This one is blank - { - tabData->subPanes[paneIndex] = TheWindowManager->winCreate( tabControl, - WIN_STATUS_NONE, x, y, - width, height, - PassSelectedButtonsToParentSystem, - nullptr); - WinInstanceData *instData = tabData->subPanes[paneIndex]->winGetInstanceData(); - BitSet( instData->m_style, GWS_TAB_PANE ); - char buffer[20]; - sprintf( buffer, "Pane %d", paneIndex ); - instData->m_decoratedNameString = buffer; - //set enabled status to that of Parent - tabData->subPanes[paneIndex]->winEnable( BitIsSet(tabControl->winGetStatus(), WIN_STATUS_ENABLED) ); - } - else//this one exists, tabCount will control keeping extra panes perma-hidden - { - tabData->subPanes[paneIndex]->winSetSize( width, height ); - tabData->subPanes[paneIndex]->winSetPosition( x, y ); - } - } - - GadgetTabControlShowSubPane( tabControl, tabData->activeTab ); -} - -void GadgetTabControlResizeSubPanes( GameWindow *tabControl ) -{ - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - Int width, height, x, y; - GadgetTabControlComputeSubPaneSize(tabControl, &width, &height, &x, &y); - for( Int paneIndex = 0; paneIndex < NUM_TAB_PANES; paneIndex++ ) - { - if( tabData->subPanes[paneIndex] ) - { - tabData->subPanes[paneIndex]->winSetSize( width, height ); - tabData->subPanes[paneIndex]->winSetPosition( x, y ); - } - } -} - -///winGetUserData(); - GameWindow *child = tabControl->winGetChild(); - if( child ) - {//need to write down children, and they are reversed from our array - while( child->winGetNext() != nullptr ) - { - child = child->winGetNext(); - } - - while( child ) - { - tabData->subPanes[childIndex] = child; - childIndex++; - child = child->winGetPrev(); - } - } -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp deleted file mode 100644 index 68e53631086..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp +++ /dev/null @@ -1,598 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: TextEntry.cpp //////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: TextEntry.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Text entry GUI gadget -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/IMEManager.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE DATA /////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static Byte drawCnt = 0; -// static TbIME *ourIME = nullptr; ///< @todo need this for IME kanji support -static GameWindow *curWindow = nullptr; /**< so we can keep track of the input - window when using IME */ - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// GadgetTextEntryInput ======================================================= -/** Handle input for text entry field */ -//============================================================================= -WindowMsgHandledType GadgetTextEntryInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - EntryData *e = (EntryData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - if ( TheIMEManager && TheIMEManager->isAttachedTo( window) && TheIMEManager->isComposing()) - { - // ignore input while IME has focus - return MSG_HANDLED; - } - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_IME_CHAR: - { - WideChar ch = (WideChar) mData1; - - // -------------------------------------------------------------------- - if ( ch == VK_RETURN ) - { - // Done with this edit - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_EDIT_DONE, - (WindowMsgData)window, - 0 ); - return MSG_HANDLED; - }; - - if( ch ) - { - // Constrain keys based on rules for entry box. - if( e->numericalOnly ) - { - if( TheWindowManager->winIsDigit( ch ) == 0 ) - return MSG_HANDLED; - } - if( e->alphaNumericalOnly ) - { - if( TheWindowManager->winIsAlNum( ch ) == 0 ) - return MSG_HANDLED; - } - if ( e->aSCIIOnly ) - { - if ( TheWindowManager->winIsAscii( ch ) == 0 ) - { - return MSG_HANDLED; - } - } - - if( e->charPos < e->maxTextLen-1 ) - { - e->text->appendChar( ch ); - e->sText->appendChar( L'*' ); - e->charPos++; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - } - } - break; - } - // ------------------------------------------------------------------------ - case GWM_CHAR: - if ( BitIsSet( mData2, KEY_STATE_DOWN ) && BitIsSet( mData2, KEY_STATE_ALT | KEY_STATE_CONTROL ) ) - { - return MSG_IGNORED; // text extries shouldn't care about CTRL+* or ALT+* - } - - switch( mData1 ) - { - /* - // -------------------------------------------------------------------- - case KEY_KPENTER: - case KEY_ENTER: - // Done with this edit - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - if( e->receivedUnichar == FALSE ) - { - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_EDIT_DONE, - (WindowMsgData)window, - 0 ); - } - } - - break; - */ - // -------------------------------------------------------------------- - // Don't process these keys - case KEY_ESC: - case KEY_PGUP: - case KEY_PGDN: - case KEY_HOME: - case KEY_END: - case KEY_F1: - case KEY_F2: - case KEY_F3: - case KEY_F4: - case KEY_F5: - case KEY_F6: - case KEY_F7: - case KEY_F8: - case KEY_F9: - case KEY_F10: - case KEY_F11: - case KEY_F12: - case KEY_CAPS: - case KEY_DEL: - return MSG_IGNORED; - - // -------------------------------------------------------------------- - case KEY_DOWN: - case KEY_RIGHT: - case KEY_TAB: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - GameWindow *parent; - parent = window->winGetParent(); - if(parent && !BitIsSet(parent->winGetStyle(), GWS_COMBO_BOX)) - parent = nullptr; - if(parent) - TheWindowManager->winNextTab(parent); - else - TheWindowManager->winNextTab(window); - } - - break; - - // -------------------------------------------------------------------- - case KEY_UP: - case KEY_LEFT: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - GameWindow *parent; - parent = window->winGetParent(); - if(parent && !BitIsSet(parent->winGetStyle(), GWS_COMBO_BOX)) - parent = nullptr; - if(parent) - TheWindowManager->winPrevTab(parent); - else - TheWindowManager->winPrevTab(window); - } - break; - - // -------------------------------------------------------------------- - case KEY_BACKSPACE: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - // if conCharPos != 0 this will fall through to next case. - // it should be noted that conCharPos can only != 0 in Jap & Kor - if( e->conCharPos == 0 ) - { - if( e->charPos > 0 ) - { - - e->text->removeLastChar(); - e->sText->removeLastChar(); - e->charPos--; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - } - } - } - break; - - } - - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSetFocus( window ); - break; - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - - if (BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, 0 ); - //TheWindowManager->winSetFocus( window ); - } - - break; - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, 0 ); - } - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, 0 ); - break; - - // ------------------------------------------------------------------------ - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetTextEntrySystem ====================================================== -/** Handle system messages for entry field */ -//============================================================================= -WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - EntryData *e = (EntryData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GEM_GET_TEXT: - *(UnicodeString*)mData2 = e->text->getText(); - break; - - // ------------------------------------------------------------------------ - case GEM_SET_TEXT: - { - - const UnicodeString* ustr = (const UnicodeString*)mData1; - e->text->setText( *ustr ); - e->charPos = ustr->getLength(); - e->constructText->setText( UnicodeString::TheEmptyString ); - e->conCharPos = 0; - - // set our secret text string to be filled with '*' the same length - e->sText->setText( UnicodeString::TheEmptyString ); - Int len = ustr->getLength(); - for( Int i = 0; i < len; i++ ) - e->sText->appendChar( L'*' ); - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CREATE: - - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - - // delete the edit display string - TheDisplayStringManager->freeDisplayString( e->text ); - TheDisplayStringManager->freeDisplayString( e->sText ); - TheDisplayStringManager->freeDisplayString( e->constructText ); - - // delete construct list - if( e->constructList ) - TheWindowManager->winDestroy( e->constructList ); - - // free all edit data - delete( (EntryData *)window->winGetUserData() ); - window->winSetUserData(nullptr); - e = nullptr; - break; - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - if( mData1 == FALSE ) - { - // If we're losing focus - /// @todo need to enable this for IME support - // ourIME->UnActivate(); - curWindow = nullptr; - BitClear( instData->m_state, WIN_STATE_SELECTED ); - BitClear( instData->m_state, WIN_STATE_HILITED ); - - if( e->constructList ) - e->constructList->winHide( TRUE ); - e->constructText->setText( UnicodeString::TheEmptyString ); - e->conCharPos = 0; - if(TheIMEManager && TheIMEManager->isAttachedTo(window)) - TheIMEManager->attach(nullptr); - //TheIMEManager->detach(); - } - else - { - curWindow = window; - /// @todo need to enable this for IME support - if (TheIMEManager) - TheIMEManager->attach( window ); - // ourIME->Activate( (void *)ApplicationHWnd ); - BitSet( instData->m_state, WIN_STATE_SELECTED ); - BitSet( instData->m_state, WIN_STATE_HILITED ); - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - - *(Bool*)mData2 = TRUE; - break; - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -/** @todo we might want to do something like this if we use IME for language - * support in this product */ -/* -// used to create interface to IME -BoolCode InitializeEntryGadget() -{ - ourIME = NEW TbIME; - - ourIME->Composition_SetMaxLength( 11 ); - - return TRUE; -} - -// used to destroy interface to IME -BoolCode ShutdownEntryGadget() -{ - delete ourIME; - ourIME = nullptr; - - return TRUE; -} - -void InformEntry( WideChar c ) -{ - Int i, listCount = 0; - EntryData *e; - - if( ourIME == nullptr || curWindow == nullptr ) - return; - - e = (EntryData *)curWindow->winGetUserData(); - - if( ( (OurLanguage == LANGUAGE_ID_JAPANESE) || - (OurLanguage == LANGUAGE_ID_KOREAN) ) && - ( (e->aSCIIOnly == FALSE ) && - (e->alphaNumericalOnly == FALSE ) && - (e->numericalOnly == FALSE ) ) ) - { - e->receivedUnichar = TRUE; - - // we must eat the following keys - switch( c ) - { - case L'\a': - case L'\b': - case L'\f': - case L'\t': - case L'\v': - return; - - // we must completely ignore the return key - case L'\r': - case L'\n': - e->receivedUnichar = FALSE; - return; - } - - if( e->charPos < e->maxTextLen-1 ) - { - e->text[ e->charPos++ ] = c; - e->text[ e->charPos ] = 0; - } - - // always update the construction buffer after a key has come through here. - TheWindowManager->winStrcpy( e->constructText, (WideChar *)ourIME->Composition_Get() ); - e->conCharPos = NoxStrlen( e->constructText ); - - // we might need to update our listbox - listCount = ourIME->CandidateList_GetSize(); - - if( TRUE ) //listCount == 0) - { - // if no entries just hide it and leave - if( e->constructList ) - e->constructList->winHide( TRUE ); - } - else - { - Int maxWidth = 0; - ListboxData list = nullptr; - ICoord2D constructSize, sliderSize; - - WinHide( e->constructList, FALSE ); - list = (ListBoxData)e->constructList->winGetUserData(); - - e->constructList->winGetSize( &constructSize.x, &constructSize.y ); - list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - - TheWindowManager->winSendSystemMsg( e->constructList, GLM_DEL_ALL, 0, 0 ); - - for( i=0; iCandidateList_GetItem( i ); - - TheWindowManager->winGetTextSize( e->constructList->instData.font, - text, nullptr, &tempWidth, 0 ); - - if( tempWidth > maxWidth ) - maxWidth = tempWidth; - - UnicodeString tmp(text); - TheWindowManager->winSendSystemMsg( e->constructList, GLM_ADD_ENTRY, - (WindowMsgData)&tmp, -1 ); - } - - e->constructList->winSetSize( maxWidth + sliderSize.y, - constructSize.y ); - } - } -} -*/ - -// GadgetTextEntrySetFont ===================================================== -/** Set the font for a text entry control, we need to set the window - * text font, the tooltip font, and the edit text display strings for - * the text data itself and the secret text */ -//============================================================================= -void GadgetTextEntrySetFont( GameWindow *g, GameFont *font ) -{ - EntryData *entryData = (EntryData *)g->winGetUserData(); - DisplayString *dString; - - // set the font for the display strings all windows have - dString = g->winGetInstanceData()->getTextDisplayString(); - if( dString ) - dString->setFont( font ); - dString = g->winGetInstanceData()->getTooltipDisplayString(); - if( dString ) - dString->setFont( font ); - - // text entry specific - if( entryData ) - { - - dString = entryData->text; - if( dString ) - dString->setFont( font ); - dString = entryData->sText; - if( dString ) - dString->setFont( font ); - - } - -} - -// GadgetTextEntryGetText ======================================================= -/** Get the text for a Text entry */ -//============================================================================= -UnicodeString GadgetTextEntryGetText( GameWindow *textentry ) -{ - - // sanity - if( textentry == nullptr ) - return UnicodeString::TheEmptyString; - - // verify that this is a list box - if( BitIsSet( textentry->winGetStyle(), GWS_ENTRY_FIELD ) == FALSE ) - return UnicodeString::TheEmptyString; - - UnicodeString result; - TheWindowManager->winSendSystemMsg( textentry, GEM_GET_TEXT, 0, (WindowMsgData)&result ); - return result; - -} - -//============================================================================= -void GadgetTextEntrySetMaxLen( GameWindow *g, Short length ) -{ - if( g == nullptr ) - return; - - EntryData *data = static_cast( g->winGetUserData() ); - - if( length > ENTRY_TEXT_LEN ) - length = ENTRY_TEXT_LEN; - - data->maxTextLen = length; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp deleted file mode 100644 index f60c27e6cfd..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +++ /dev/null @@ -1,469 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: VerticalSlider.cpp /////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: VerticalSlider.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Vertical slider gui control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Gadget.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// GadgetVerticalSliderInput ================================================== -/** Handle input for vertical slider */ -//============================================================================= -WindowMsgHandledType GadgetVerticalSliderInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - SliderData *s = (SliderData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - 0 ); - //TheWindowManager->winSetFocus( window ); - - } - break; - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - 0 ); - } - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, - mData1 ); - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - { - Int x, y; -// Int mousex = mData1 & 0xFFFF; - Int mousey = mData1 >> 16; - ICoord2D size, childSize, childCenter; - GameWindow *child = window->winGetChild(); - Int pageClickSize, clickPos; - - window->winGetScreenPosition( &x, &y ); - window->winGetSize( &size.x, &size.y ); - child->winGetSize( &childSize.x, &childSize.y ); - child->winGetPosition( &childCenter.x, &childCenter.y ); - childCenter.x += childSize.x / 2; - childCenter.y += childSize.y / 2; - - // - // when you click on the slider, but not the button, we will jump - // the slider position up/down by this much - // - pageClickSize = size.y / 5; - - clickPos = mousey - y; - if( clickPos >= childCenter.y ) - { - - clickPos = childCenter.y + pageClickSize; - if( clickPos > mousey - y ) - clickPos = mousey - y; - - } - else - { - - clickPos = childCenter.y - pageClickSize; - if( clickPos < mousey - y ) - clickPos = mousey - y; - - } - - // keep pos valid on window - if( clickPos > y + size.y - childSize.y / 2 ) - clickPos = y + size.y - childSize.y / 2; - if( clickPos < childSize.y / 2 ) - clickPos = childSize.y / 2; - - child->winSetPosition( 0, clickPos - childSize.y / 2 ); - TheWindowManager->winSendSystemMsg( window, GGM_LEFT_DRAG, 0, mData1 ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch (mData1) - { - - // -------------------------------------------------------------------- - case KEY_UP: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( s->position < s->maxVal - 1) - { - GameWindow *child = window->winGetChild(); - - s->position += 2; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - // Translate to window coords - child->winSetPosition( 0, (Int)((s->maxVal - s->position) * s->numTicks) ); - - } - - } - - break; - - // -------------------------------------------------------------------- - case KEY_DOWN: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( s->position > s->minVal + 1 ) - { - GameWindow *child = window->winGetChild(); - - s->position -= 2; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - // Translate to window coords - child->winSetPosition( 0, (Int)((s->maxVal - s->position) * s->numTicks) ); - } - } - break; - - // -------------------------------------------------------------------- - case KEY_RIGHT: - case KEY_TAB: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winNextTab(); - break; - - // -------------------------------------------------------------------- - case KEY_LEFT: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winPrevTab(); - break; - - default: - return MSG_IGNORED; - - } - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetVerticalSliderSystem ================================================= -/** Handle system messages for vertical slider */ -//============================================================================= -WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - SliderData *s = (SliderData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GBM_SELECTED: - { - // tell owner I've finished moving - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_DONE, - (WindowMsgData)window, - s->position ); - break; - - } - - // ------------------------------------------------------------------------ - case GGM_LEFT_DRAG: - { -// Int mousex = mData2 & 0xFFFF; - Int mousey = mData2 >> 16; - Int x, y, delta; - ICoord2D size, childSize, childCenter; - GameWindow *child = window->winGetChild(); - - window->winGetScreenPosition( &x, &y ); - window->winGetSize( &size.x, &size.y ); - child->winGetSize( &childSize.x, &childSize.y ); - child->winGetScreenPosition( &childCenter.x, &childCenter.y ); - childCenter.x += childSize.x / 2; - childCenter.y += childSize.y / 2; - - // - // ignore drag attempts when the mouse is below or above the slider totally - // and put the dragging thumb back at the slider pos - // - if( mousey > y + size.y ) - { - - //s->position = s->minVal; - TheWindowManager->winSendSystemMsg( window, GSM_SET_SLIDER, - s->minVal, 0 ); - // tell owner i moved - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - break; - - } - else if( mousey < y ) - { - - //s->position = s->maxVal; - TheWindowManager->winSendSystemMsg( window, GSM_SET_SLIDER, - s->maxVal, 0 ); - // tell owner i moved - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - break; - - } - - if( childCenter.y <= y + childSize.y / 2 ) - { - child->winSetPosition( 0, 0 ); - s->position = s->maxVal; - } - else if( childCenter.y >= y + size.y - childSize.y / 2 ) - { - child->winSetPosition( 0, size.y - childSize.y ); - s->position = s->minVal; - } - else - { - delta = childCenter.y - y - childSize.y/2; - - // Calc slider position - s->position = (Int)(delta / s->numTicks) ; - - /* - s->position += s->minVal; - */ - - if( s->position > s->maxVal ) - s->position = s->maxVal; - - // Invert slider position so that maxval is at the top - s->position = s->maxVal - s->position; - - } - - // tell owner i moved - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - break; - - } - - // ------------------------------------------------------------------------ - case GSM_SET_SLIDER: - { - Int newPos = (Int)mData1; - GameWindow *child = window->winGetChild(); - - if (newPos < s->minVal || newPos > s->maxVal) - break; - - s->position = newPos; - - // Translate to window coords - newPos = (Int)((s->maxVal - newPos) * s->numTicks); - - child->winSetPosition( 0, newPos ); - - break; - - } - - // ------------------------------------------------------------------------ - case GSM_SET_MIN_MAX: - { - Int newPos; - ICoord2D size; - GameWindow *child = window->winGetChild(); - - window->winGetSize( &size.x, &size.y ); - - s->minVal = (Int)mData1; - s->maxVal = (Int)mData2; - s->numTicks = (Real)( size.y-GADGET_SIZE)/(Real)(s->maxVal - s->minVal); - s->position = s->minVal; - - // Translate to window coords - newPos = (Int)((s->maxVal - s->minVal) * s->numTicks); - - child->winSetPosition( 0, newPos ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - delete( (SliderData *)window->winGetUserData() ); - window->winSetUserData(nullptr); - s = nullptr; - break; - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - - // If we're losing focus - if( mData1 == FALSE ) - { - BitClear( instData->m_state, WIN_STATE_HILITED ); - } else { - BitSet( instData->m_state, WIN_STATE_HILITED ); - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - - *(Bool*)mData2 = TRUE; - break; - - // ------------------------------------------------------------------------ - case GGM_RESIZED: - { - Int width = (Int)mData1; -// Int height = (Int)mData2; - GameWindow *thumb = window->winGetChild(); - - if( thumb ) - thumb->winSetSize( width, GADGET_SIZE ); - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp deleted file mode 100644 index d3d2afadcdc..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ /dev/null @@ -1,4064 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GameWindowManager.cpp //////////////////////////////////////////////////////////////////// -// Created: Colin Day, June 2001 -// Dean Iverson, March 1998 (Original window code) -// Desc: The game window manager is the singleton class that we interface -// with to interact with the game windowing system. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/Debug.h" -#include "Common/Language.h" -#include "GameClient/Display.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Mouse.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetComboBox.h" -#include "GameClient/GadgetTabControl.h" -#include "GameClient/GadgetProgressBar.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/GadgetSlider.h" -#include "GameClient/GadgetRadioButton.h" -#include "GameClient/GadgetCheckBox.h" -#include "GameClient/GlobalLanguage.h" -#include "GameClient/GameWindowTransitions.h" -#include "Common/NameKeyGenerator.h" - -// PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -GameWindowManager *TheWindowManager = nullptr; -UnsignedInt WindowLayoutCurrentVersion = 2; - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// -// with this status set to true, the window system will propagate mouse position -// messages to windows. You may want to disable this if you feel the mouse position -// messages are "spamming" your window and making a particular debugging situation -// difficult. Make sure you do enable this before you check in again tho because -// it is necessary for any code that needs to look at objects or anything under -// the radar cursor -// -static Bool sendMousePosMessages = TRUE; - -//------------------------------------------------------------------------------------------------- -/** Process windows waiting to be destroyed */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::processDestroyList() -{ - GameWindow *next; - GameWindow *doDestroy; - - // - // we need to pass the ownership of the destroy list so - // if, while destroying a window, we need to add other windows - // to the destroy list it won't cause problems. - // - doDestroy = m_destroyList; - - // set the list to empty - m_destroyList = nullptr; - - // do the destroys - for( ; doDestroy; doDestroy = next ) - { - - next = doDestroy->m_next; - - // Check to see if this window is "special" - if( m_mouseCaptor == doDestroy ) - winRelease( doDestroy ); - - if( m_keyboardFocus == doDestroy ) - winSetFocus( nullptr ); - - if( (m_modalHead != nullptr) && (doDestroy == m_modalHead->window) ) - winUnsetModal( m_modalHead->window ); - - if( m_currMouseRgn == doDestroy ) - m_currMouseRgn = nullptr; - - if( m_grabWindow == doDestroy ) - m_grabWindow = nullptr; - - // send the destroy message to the window we're about to kill - winSendSystemMsg( doDestroy, GWM_DESTROY, 0, 0 ); - - DEBUG_ASSERTCRASH(doDestroy->winGetUserData() == nullptr, ("Win user data is expected to be deleted now")); - - // free the memory - deleteInstance(doDestroy); - - } - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -/** Generic function to simply propagate only button press messages to parent and let it deal with it */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PassSelectedButtonsToParentSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - // sanity - if( window == nullptr ) - return MSG_IGNORED; - - if( (msg == GBM_SELECTED) || (msg == GBM_SELECTED_RIGHT) || (msg == GBM_MOUSE_ENTERING) || (msg == GBM_MOUSE_LEAVING) || (msg == GEM_EDIT_DONE)) - { - GameWindow *parent = window->winGetParent(); - - if( parent ) - return TheWindowManager->winSendSystemMsg( parent, msg, mData1, mData2 ); - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** Generic function to simply propagate only button press messages to parent and let it deal with it */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PassMessagesToParentSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - // sanity - if( window == nullptr ) - return MSG_IGNORED; - - - GameWindow *parent = window->winGetParent(); - - if( parent ) - return TheWindowManager->winSendSystemMsg( parent, msg, mData1, mData2 ); - - return MSG_IGNORED; - -} - - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -GameWindowManager::GameWindowManager() -{ - - m_windowList = nullptr; // list of all top level windows - m_windowTail = nullptr; // last in windowList - - m_destroyList = nullptr; // list of windows to destroy - - m_currMouseRgn = nullptr; // window that mouse is over - m_mouseCaptor = nullptr; // window that captured mouse - m_keyboardFocus = nullptr; // window that has input focus - m_modalHead = nullptr; // top of windows in the modal stack - m_grabWindow = nullptr; // window that grabbed the last down event - m_loneWindow = nullptr; // Set if we just opened a combo box - - m_cursorBitmap = nullptr; - m_captureFlags = 0; - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -GameWindowManager::~GameWindowManager() -{ - - // destroy all windows - winDestroyAll(); - freeStaticStrings(); - - delete TheTransitionHandler; - TheTransitionHandler = nullptr; -} - -//------------------------------------------------------------------------------------------------- -/** Initialize the game window manager system */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::init() -{ - if(!TheTransitionHandler) - TheTransitionHandler = NEW GameWindowTransitionsHandler; - TheTransitionHandler->load(); - TheTransitionHandler->init(); -} - -//------------------------------------------------------------------------------------------------- -/** Reset window system */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::reset() -{ - - // destroy all windows left - winDestroyAll(); - if(TheTransitionHandler) - TheTransitionHandler->reset(); - -} - -//------------------------------------------------------------------------------------------------- -/** Update cycle for game window manager */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::update() -{ - - // Process windows waiting to be destroyed - processDestroyList(); - if(TheTransitionHandler) - TheTransitionHandler->update(); -} - -//------------------------------------------------------------------------------------------------- -/** Puts a window at the head of the window list */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::linkWindow( GameWindow *window ) -{ - GameWindow *lastModalWindow = nullptr; - GameWindow *tmp = m_windowList; - while (tmp) - { - const ModalWindow *modal = m_modalHead; - while (modal) - { - if (modal->window == tmp && modal->window != window) - { - lastModalWindow = tmp; - } - modal = modal->next; - } - tmp = tmp->m_next; - } - - if (!lastModalWindow) - { - - // Add to head of the top level window list - window->m_prev = nullptr; - window->m_next = m_windowList; - - if( m_windowList ) - m_windowList->m_prev = window; - else - { - // first on list is also the tail - m_windowTail = window; - } - - m_windowList = window; - } - else - { - // lastModalWindow points to a modal window - add behind it - window->m_prev = lastModalWindow; - window->m_next = lastModalWindow->m_next; - lastModalWindow->m_next = window; - if (window->m_next) - { - window->m_next->m_prev = window; - } - } - -} - -//------------------------------------------------------------------------------------------------- -/** Insert the window ahead of the the 'aheadOf' window. 'aheadOf' can - * be a window in the master list or a child of any window in that master - * list */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::insertWindowAheadOf( GameWindow *window, - GameWindow *aheadOf ) -{ - - // sanity - if( window == nullptr ) - return; - - // we'll say that an aheadOf window means at the head of the list - if( aheadOf == nullptr ) - { - - linkWindow( window ); - return; - - } - - // get parent of aheadOf - GameWindow *aheadOfParent = aheadOf->winGetParent(); - - // - // if ahead of has no parent insert it in the master list just before - // ahead of - // - if( aheadOfParent == nullptr ) - { - - window->m_prev = aheadOf->m_prev; - - if( aheadOf->m_prev ) - aheadOf->m_prev->m_next = window; - else - m_windowList = window; - - aheadOf->m_prev = window; - window->m_next = aheadOf; - - } - else - { - - window->m_prev = aheadOf->m_prev; - - if( aheadOf->m_prev ) - aheadOf->m_prev->m_next = window; - else - aheadOfParent->m_child = window; - - aheadOf->m_prev = window; - window->m_next = aheadOf; - - window->m_parent = aheadOfParent; - - } - -} - -//------------------------------------------------------------------------------------------------- -/** Takes a window off the window list */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::unlinkWindow( GameWindow *window ) -{ - - if( window->m_next ) - window->m_next->m_prev = window->m_prev; - else - { - // no next means this is the tail - m_windowTail = window->m_prev; - } - - if( window->m_prev ) - window->m_prev->m_next = window->m_next; - else - m_windowList = window->m_next; - -} - -//------------------------------------------------------------------------------------------------- -/** Takes a child window off its parent's window list */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::unlinkChildWindow( GameWindow *window ) -{ - - if( window->m_prev ) - { - - window->m_prev->m_next = window->m_next; - - if( window->m_next ) - window->m_next->m_prev = window->m_prev; - - } - else - { - - if( window->m_next ) - { - - window->m_parent->m_child = window->m_next; - - window->m_next->m_prev = window->m_prev; - - window->m_next = nullptr; - - } - else - { - - window->m_parent->m_child = nullptr; - - } - - } - - // remove the parent reference from this window - window->m_parent = nullptr; - -} - -//------------------------------------------------------------------------------------------------- -/** Check window and parents to see if this window is enabled */ -//------------------------------------------------------------------------------------------------- -Bool GameWindowManager::isEnabled( GameWindow *win ) -{ - - // sanity - if( win == nullptr ) - return FALSE; - - if( BitIsSet( win->m_status, WIN_STATUS_ENABLED ) == FALSE ) - { - return FALSE; - } - - while( win->m_parent ) - { - win = win->m_parent; - if( BitIsSet( win->m_status, WIN_STATUS_ENABLED ) == FALSE ) - { - return FALSE; - } - } - - return TRUE; - -} - -//------------------------------------------------------------------------------------------------- -/** Check window and parents to see if this window is hidden */ -//------------------------------------------------------------------------------------------------- -Bool GameWindowManager::isHidden( GameWindow *win ) -{ - - // we'll allow for the idea that if a window doesn't exist it is hidden - if( win == nullptr ) - return TRUE; - - if( BitIsSet( win->m_status, WIN_STATUS_HIDDEN )) - { - return TRUE; - } - - while( win->m_parent ) - { - win = win->m_parent; - if( BitIsSet( win->m_status, WIN_STATUS_HIDDEN )) - { - return TRUE; - } - } - - return FALSE; - -} - -//------------------------------------------------------------------------------------------------- -// Adds a child window to its parent. -//------------------------------------------------------------------------------------------------- -void GameWindowManager::addWindowToParent( GameWindow *window, - GameWindow *parent ) -{ - if( parent ) - { - - // add to parent's list of children - window->m_prev = nullptr; - window->m_next = parent->m_child; - - if( parent->m_child ) - parent->m_child->m_prev = window; - - parent->m_child = window; - - window->m_parent = parent; - - } - -} - -//------------------------------------------------------------------------------------------------- -/** Add a child window to the parent, put place it at the end of the - * parent window child list */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::addWindowToParentAtEnd( GameWindow *window, - GameWindow *parent ) -{ - - if( parent ) - { - - window->m_prev = nullptr; - window->m_next = nullptr; - if( parent->m_child ) - { - GameWindow *last; - - // wind down to last child in list - last = parent->m_child; - while( last->m_next != nullptr ) - last = last->m_next; - - // tie to list - last->m_next = window; - window->m_prev = last; - - } - else - parent->m_child = window; - - // assign the parent to the window - window->m_parent = parent; - - } - -} - -//------------------------------------------------------------------------------------------------- -/** this gets called from winHide() when a window hides itself */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::windowHiding( GameWindow *window ) -{ - - // if this window has keyboard focus remove it - if( m_keyboardFocus == window ) - m_keyboardFocus = nullptr; - - // if this is the modal head, unset it - if( m_modalHead && m_modalHead->window == window ) - winUnsetModal( window ); - - // if this is the captor, it shall no longer be - if( m_mouseCaptor == window ) - winCapture( nullptr ); - - // - // since hiding a parent will also hide the children, when a parent - // hides we must call this same method for all the children so they - // each have a chance to go through this logic - // - GameWindow *child; - for( child = window->winGetChild(); child; child = child->winGetNext() ) - windowHiding( child ); - -} - -//------------------------------------------------------------------------------------------------- -/** Hide all windows in a certain range of id's (inclusive) */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::hideWindowsInRange( GameWindow *baseWindow, - Int first, Int last, - Bool hideFlag ) -{ - Int i; - GameWindow *window; - - for( i = first; i <= last; i++ ) - { - - window = winGetWindowFromId( baseWindow, i ); - if( window ) - window->winHide( hideFlag ); - - } - -} - -//------------------------------------------------------------------------------------------------- -// Enable all windows in a certain range of id's (inclusive) -//------------------------------------------------------------------------------------------------- -void GameWindowManager::enableWindowsInRange( GameWindow *baseWindow, - Int first, Int last, - Bool enableFlag ) -{ - Int i; - GameWindow *window; - - for( i =first; i <= last; i++ ) - { - - window = winGetWindowFromId( baseWindow, i ); - if( window ) - window->winEnable( enableFlag ); - - } - -} - -//------------------------------------------------------------------------------------------------- -/** Captures the mouse capture. */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winCapture( GameWindow *window ) -{ - - if( m_mouseCaptor != nullptr) - return WIN_ERR_MOUSE_CAPTURED; - - m_mouseCaptor = window; - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Releases the mouse capture. */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winRelease( GameWindow *window ) -{ - - if( window == m_mouseCaptor ) - m_mouseCaptor = nullptr; - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Returns the current mouse captor. */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::winGetCapture() -{ - - return m_mouseCaptor; - -} - -//------------------------------------------------------------------------------------------------- -/** Gets the window pointer from its id */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::winGetWindowFromId( GameWindow *window, Int id ) -{ - - if( window == nullptr ) - window = m_windowList; - - for( ; window; window = window->m_next ) - { - - if( window->winGetWindowId() == id) - return window; - else if( window->m_child ) - { - GameWindow *child = winGetWindowFromId( window->m_child, id ); - - if( child ) - return child; - - } - - } - - return nullptr; - -} - -//------------------------------------------------------------------------------------------------- -/** Gets the Window List Pointer */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::winGetWindowList() -{ - - return m_windowList; - -} - -//------------------------------------------------------------------------------------------------- -/** Send a system message to the specified window */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType GameWindowManager::winSendSystemMsg( GameWindow *window, - UnsignedInt msg, - WindowMsgData mData1, - WindowMsgData mData2 ) -{ - - if( window == nullptr) - return MSG_IGNORED; - - if( msg != GWM_DESTROY && BitIsSet( window->m_status, WIN_STATUS_DESTROYED ) ) - return MSG_IGNORED; - - return window->m_system( window, msg, mData1, mData2 ); - -} - -//------------------------------------------------------------------------------------------------- -/** Send a system message to the specified window */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType GameWindowManager::winSendInputMsg( GameWindow *window, - UnsignedInt msg, - WindowMsgData mData1, - WindowMsgData mData2 ) -{ - - if( window == nullptr ) - return MSG_IGNORED; - - if( msg != GWM_DESTROY && BitIsSet( window->m_status, WIN_STATUS_DESTROYED ) ) - return MSG_IGNORED; - - return window->m_input( window, msg, mData1, mData2 ); - -} - -//------------------------------------------------------------------------------------------------- -/** Get the current input focus */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::winGetFocus() -{ - - return m_keyboardFocus; - -} - -//------------------------------------------------------------------------------------------------- -/** Set the current input focus */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winSetFocus( GameWindow *window ) -{ - Bool wantsFocus = FALSE; - - // if a window doesn't want keyboard focus don't give it - if( window ) - if( BitIsSet( window->winGetStatus(), WIN_STATUS_NO_FOCUS) ) - return 0; - - // - // Tell current focus window that it's losing focus - // unless we are trying to give focus to the current focus window - // - if( (m_keyboardFocus) && (m_keyboardFocus != window) ) - { - Bool wf; // dummy var, ignored, but must be passed - winSendSystemMsg( m_keyboardFocus, GWM_INPUT_FOCUS, FALSE, (WindowMsgData)&wf ); - } - - // Set focus to new window - m_keyboardFocus = window; - - // Tell new focus window that it has focus - if( m_keyboardFocus ) - { - - for (;;) - { - winSendSystemMsg( window, GWM_INPUT_FOCUS, TRUE, (WindowMsgData)&wantsFocus ); - if (wantsFocus) - break; - - window = window->winGetParent(); - if( window == nullptr ) - break; - } - - } - - // If new window doesn't want focus, set focus to nullptr - if( wantsFocus == FALSE ) - m_keyboardFocus = nullptr; - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Process key press through the GUI. */ -//------------------------------------------------------------------------------------------------- -WinInputReturnCode GameWindowManager::winProcessKey( UnsignedByte key, - UnsignedByte state ) -{ - WinInputReturnCode returnCode = WIN_INPUT_NOT_USED; - - // Check for keyboard focus and a legal key for sanity - if( m_keyboardFocus && (key != KEY_NONE) ) - { - GameWindow *win = m_keyboardFocus; - - returnCode = WIN_INPUT_USED; // assume input will be used - - // - // Pass the keystroke up the window hierarchy until it is - // processed or we reach the top level window - // - while( winSendInputMsg( win, GWM_CHAR, key, state ) == MSG_IGNORED ) - { - - win = win->winGetParent(); - if( win == nullptr ) - { - - returnCode = WIN_INPUT_NOT_USED; // oops, it wasn't used after all - break; - - } - - } - - } - - return returnCode; - -} - -//------------------------------------------------------------------------------------------------- -/** Process a single mouse event through the window system */ -//------------------------------------------------------------------------------------------------- -WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage msg, - ICoord2D *mousePos, - void *data ) -{ - WinInputReturnCode returnCode = WIN_INPUT_NOT_USED; - Bool objectTooltip = FALSE; - UnsignedInt packedMouseCoords; - GameWindow *window = nullptr; - GameWindow *toolTipWindow = nullptr; - Int dx, dy; - Bool clearGrabWindow = FALSE; - - // pack mouse coords into one entity for message passing - packedMouseCoords = SHORTTOLONG( mousePos->x, mousePos->y ); - - // clear tooltip ... it will be reset if necessary - TheMouse->setCursorTooltip( UnicodeString::TheEmptyString ); - - // Check for mouse capture - if( m_mouseCaptor ) - { - - // no window grabbed as of yet - m_grabWindow = nullptr; - - // what what window within the captured window are we in - window = m_mouseCaptor->winPointInChild( mousePos->x, mousePos->y ); - - // - // send buttons, drags, wheels to the windows, we don't continually - // send mouse positions - // - if( sendMousePosMessages == TRUE || msg != GWM_MOUSE_POS ) - { - GameWindow *win = window; - - if( win ) - { - while( win != nullptr ) - { - - if( winSendInputMsg( win, msg, packedMouseCoords, 0 ) == MSG_HANDLED ) - { - - // if used clear the event - returnCode = WIN_INPUT_USED; - break; - - } - - // if we just tested mouseCaptor don't go any higher in the chain - if( win == m_mouseCaptor ) - break; - - win = win->winGetParent(); - - } - - } - else - { - - // if used clear the event - if( winSendInputMsg( m_mouseCaptor, msg, packedMouseCoords, 0 ) == MSG_HANDLED ) - returnCode = WIN_INPUT_USED; - - } - - } - - } - else - { - - if( m_grabWindow ) - { - GameWindow *parent; - - switch( msg ) - { - - // -------------------------------------------------------------------- - case GWM_LEFT_UP: - { - //Play a beep sound if the window is disabled. - m_grabWindow->winPointInChild( mousePos->x, mousePos->y, FALSE, TRUE ); - - BitClear( m_grabWindow->m_status, WIN_STATUS_ACTIVE ); - if( m_grabWindow->winPointInWindow( mousePos->x, mousePos->y ) ) - winSendInputMsg( m_grabWindow, GWM_LEFT_UP, packedMouseCoords, 0 ); - else if( BitIsSet( m_grabWindow->m_status, WIN_STATUS_DRAGGABLE )) - { - winSendInputMsg( m_grabWindow, GWM_LEFT_UP, packedMouseCoords, 0 ); - } - - clearGrabWindow = TRUE; - break; - - } - - // -------------------------------------------------------------------- - case MOUSE_EVENT_NONE: - case GWM_LEFT_DRAG: - { - - if( BitIsSet( m_grabWindow->m_status, WIN_STATUS_DRAGGABLE ) ) - { - ICoord2D *mouseDelta = (ICoord2D *)data; - dx = mouseDelta->x; - dy = mouseDelta->y; - - // Clip window to parent - if( m_grabWindow->winGetParent() ) - { - - parent = m_grabWindow->winGetParent(); - - if( m_grabWindow->m_region.lo.x + dx < 0 ) - dx = 0 - m_grabWindow->m_region.lo.x; - else if( m_grabWindow->m_region.hi.x + dx > parent->m_size.x ) - dx = parent->m_size.x - m_grabWindow->m_region.hi.x; - - if( m_grabWindow->m_region.lo.y + dy < 0 ) - dy = 0 - m_grabWindow->m_region.lo.y; - else if( m_grabWindow->m_region.hi.y + dy > parent->m_size.y ) - dy = parent->m_size.y - m_grabWindow->m_region.hi.y; - } - - // Move the window, but keep it completely visible within screen boundaries - IRegion2D newRegion; - ICoord2D grabSize; - - m_grabWindow->winGetPosition( &newRegion.lo.x, &newRegion.lo.y ); - m_grabWindow->winGetSize( &grabSize.x, &grabSize.y ); - - newRegion.lo.x += dx; - newRegion.lo.y += dy; - if( newRegion.lo.x < 0 ) - newRegion.lo.x = 0; - if( newRegion.lo.y < 0 ) - newRegion.lo.y = 0; - - newRegion.hi.x = newRegion.lo.x + grabSize.x; - newRegion.hi.y = newRegion.lo.y + grabSize.y; - if( newRegion.hi.x > (Int)TheDisplay->getWidth() ) - newRegion.hi.x = (Int)TheDisplay->getWidth(); - if( newRegion.hi.y > (Int)TheDisplay->getHeight() ) - newRegion.hi.y = (Int)TheDisplay->getHeight(); - - newRegion.lo.x = newRegion.hi.x - grabSize.x; - newRegion.lo.y = newRegion.hi.y - grabSize.y; - - m_grabWindow->winSetPosition( newRegion.lo.x, newRegion.lo.y ); - - } - - // Send mouse drag message - winSendInputMsg( m_grabWindow, msg, packedMouseCoords, 0 ); - break; - - } - - } - - // mark event handled - returnCode = WIN_INPUT_USED; - - } - else - { - - if( m_modalHead && m_modalHead->window ) - { - window = m_modalHead->window->winPointInChild( mousePos->x, mousePos->y ); - } - else - { - // search for top-level window which contains pointer - window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_ABOVE, WIN_STATUS_HIDDEN); - - // check !above, below and hidden - if( window == nullptr ) - window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_NONE, WIN_STATUS_ABOVE | WIN_STATUS_BELOW | WIN_STATUS_HIDDEN); - - // check below and !hidden - if( window == nullptr ) - window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_BELOW, WIN_STATUS_HIDDEN); - } - - if( window ) - if( BitIsSet( window->m_status, WIN_STATUS_NO_INPUT ) ) - { - if(window->winGetParent() && BitIsSet( window->winGetParent()->winGetInstanceData()->getStyle(), GWS_COMBO_BOX )) - window = window->winGetParent(); - else - window = nullptr; - } - - if( window ) - { - GameWindow *tempWin; - - // - // only send messages for button states, wheel states, we do not - // continually send messages for mouse positions - // - if( sendMousePosMessages == TRUE || msg != GWM_MOUSE_POS ) - { - - tempWin = window; - - // Give everyone a chance to do something with the clicks - GameWindow *oldLoneWindow = m_loneWindow; - while( winSendInputMsg( tempWin, msg, packedMouseCoords, 0 ) == MSG_IGNORED ) - { - - tempWin = tempWin->m_parent; - if( tempWin == nullptr ) - break; - - } - - - // First check to see if m_loneWindow is set if so, close the window - if( m_loneWindow && m_loneWindow == oldLoneWindow - &&( msg == GWM_LEFT_UP || msg == GWM_MIDDLE_UP || msg == GWM_RIGHT_UP || tempWin)) - { - if(!m_loneWindow->winIsChild(tempWin)) - winSetLoneWindow( nullptr ); - /* - ComboBoxData *cData = (ComboBoxData *)m_comboBoxOpen->winGetUserData(); - // verify that the window that ate the message wasn't one of our own - if(cData->dropDownButton != tempWin && - cData->editBox != tempWin && - cData->listBox != tempWin && - cData->listboxData->upButton != tempWin && - cData->listboxData->downButton != tempWin && - cData->listboxData->slider != tempWin && - cData->listboxData->slider != tempWin->winGetParent()) - winSetOpenComboBoxWindow( nullptr );*/ - - } - if( tempWin ) - { - - // - // Someone cares, if this is a left button down event - // it should get "grabbed" - /// @todo should allow for left handed mouse configs here? - // - if( msg == GWM_LEFT_DOWN ) - { - -// if( tempWin != windowList ) -// WinActivate( tempWin ); - m_grabWindow = tempWin; - - } - - // event is used - returnCode = WIN_INPUT_USED; - - } - - } - - } - - if( toolTipWindow == nullptr ) - { - - if( isHidden( window ) == FALSE ) - toolTipWindow = window; - - } - - // if tooltips are on set them into the window - Bool tooltipsOn = TRUE; - if( tooltipsOn ) - { -// if( toolTipWindow && toolTipWindow->winGetParent() && BitIsSet( toolTipWindow->winGetParent()->winGetInstanceData()->getStyle(), GWS_COMBO_BOX )) -// toolTipWindow = toolTipWindow->winGetParent(); - if( toolTipWindow ) - { - // do we have a callback to call for the tooltip - if( toolTipWindow->m_tooltip ) - toolTipWindow->m_tooltip( toolTipWindow, - &toolTipWindow->m_instData, - packedMouseCoords ); - - // else, do we have a normal tooltip to set - else if( toolTipWindow->m_instData.getTooltipTextLength() ) - TheMouse->setCursorTooltip( toolTipWindow->m_instData.getTooltipText(), toolTipWindow->m_instData.m_tooltipDelay ); - - } - else - { - - // - // not pointing at a window... perhaps we are pointing at a valid - // tooltip-able object in the game world ... let's set a flag so - // during the object testing we can set the tooltip, we can do - // whatever we like now that we know no other tooltip was set from - // a window - // - objectTooltip = TRUE; - - } - - } - - } - - } - - // - // check if new current window is different from the last - // but only if both windows fall within the mouseCaptor if one exists - // - if( (m_grabWindow == nullptr) && (window != m_currMouseRgn) ) - { - if( m_mouseCaptor ) - { - if( m_mouseCaptor->winIsChild( m_currMouseRgn ) ) - winSendInputMsg( m_currMouseRgn, GWM_MOUSE_LEAVING, packedMouseCoords, 0 ); - } - else if( m_currMouseRgn ) - winSendInputMsg( m_currMouseRgn, GWM_MOUSE_LEAVING, packedMouseCoords, 0 ); - - if( window ) - winSendInputMsg( window, GWM_MOUSE_ENTERING, packedMouseCoords, 0 ); - - m_currMouseRgn = window; - - } - - // clear grabWindow if necessary - if( clearGrabWindow == TRUE ) - { - - m_grabWindow = nullptr; - clearGrabWindow = FALSE; - - } - - return returnCode; - -} - -bool GameWindowManager::isMouseWithinWindow(GameWindow* window, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask) -{ - return ((BitIsSet(window->m_status, requiredStatusMask) || requiredStatusMask == 0) && - !BitIsSet(window->m_status, forbiddenStatusMask) && - mousePos->x >= window->m_region.lo.x && - mousePos->x <= window->m_region.hi.x && - mousePos->y >= window->m_region.lo.y && - mousePos->y <= window->m_region.hi.y); -} - -GameWindow* GameWindowManager::findWindowUnderMouse(GameWindow*& toolTipWindow, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask) -{ - for (GameWindow* window = m_windowList; window; window = window->m_next) - { - if (!isMouseWithinWindow(window, mousePos, requiredStatusMask, forbiddenStatusMask)) - continue; - - if (toolTipWindow == nullptr) - { - GameWindow* childWindow = window->winPointInAnyChild(mousePos->x, mousePos->y, TRUE, TRUE); - - if (childWindow->m_tooltip || childWindow->m_instData.getTooltipTextLength()) - toolTipWindow = childWindow; - } - - if (BitIsSet(window->m_status, WIN_STATUS_ENABLED)) - { - // determine which child window the mouse is in - return window->winPointInChild(mousePos->x, mousePos->y); - } - } - - return nullptr; -} - -//------------------------------------------------------------------------------------------------- -/** Draw a window and its children, in parent-first order. - * Children's coordinates are relative to their parents. - * Note that hidden windows automatically will not draw any - * of their children ... but see-thru windows only will not - * draw themselves, but will give their children an - * opportunity to draw */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::drawWindow( GameWindow *window ) -{ - GameWindow *child; - - if( window == nullptr ) - return WIN_ERR_INVALID_WINDOW; - - if( BitIsSet( window->m_status, WIN_STATUS_HIDDEN ) == FALSE ) - { - - if( !BitIsSet( window->m_status, WIN_STATUS_SEE_THRU ) && window->m_draw ) - window->m_draw( window, &window->m_instData ); - - /// @todo visit list boxes and borders, this is stupid! - // for list boxes only draw the borders BEFORE the children - if( BitIsSet( window->winGetStyle(), GWS_SCROLL_LISTBOX ) ) - if( BitIsSet( window->m_status, WIN_STATUS_BORDER ) == TRUE && - !BitIsSet( window->m_status, WIN_STATUS_SEE_THRU ) ) - window->winDrawBorder(); - - // draw children in reverse order just like the window list - child = window->m_child; - while( child && child->m_next ) - child = child->m_next; - - for( ; child; child = child->m_prev ) - drawWindow( child ); - - // - // draw the border for the window AFTER the window contents AND the - // children contents have drawn - // - if( !BitIsSet( window->winGetStyle(), GWS_SCROLL_LISTBOX ) ) - if( BitIsSet( window->m_status, WIN_STATUS_BORDER ) == TRUE && - !BitIsSet( window->m_status, WIN_STATUS_SEE_THRU ) ) - window->winDrawBorder(); - - } - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Draw the GUI in reverse order to correlate with clicking priority */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::winRepaint() -{ - GameWindow *window, *next; - - // draw below windows - for( window = m_windowTail; window; window = next ) - { - next = window->m_prev; - - if( BitIsSet( window->m_status, WIN_STATUS_BELOW ) ) - drawWindow( window ); - } - - // draw non-above and non-below windows - for( window = m_windowTail; window; window = next ) - { - next = window->m_prev; - - if (BitIsSet( window->m_status, WIN_STATUS_ABOVE | - WIN_STATUS_BELOW ) == FALSE) - drawWindow( window ); - } - - // draw above windows - for( window = m_windowTail; window; window = next ) - { - next = window->m_prev; - - if( BitIsSet( window->m_status, WIN_STATUS_ABOVE ) ) - drawWindow( window ); - } - - if(TheTransitionHandler) - TheTransitionHandler->draw(); -} - -//------------------------------------------------------------------------------------------------- -/** Dump information about all the windows for resource problems */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::dumpWindow( GameWindow *window ) -{ -#ifndef FINAL - GameWindow *child; - - if( window == nullptr ) - return; - - DEBUG_LOG(( "ID: %d\tRedraw: 0x%08X\tUser Data: %d", - window->winGetWindowId(), window->m_draw, window->m_userData )); - - for( child = window->m_child; child; child = child->m_next ) - dumpWindow( child ); - - return; -#endif -} - -//------------------------------------------------------------------------------------------------- -/** Create a new window by setting up its parameters and callbacks. */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::winCreate( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - GameWinSystemFunc system, - WinInstanceData *instData ) -{ - GameWindow *window; - - // allocate new window - window = allocateNewWindow(); - if( window == nullptr ) - { - - DEBUG_LOG(( "WinCreate error: Could not allocate new window" )); -#ifndef FINAL - { - GameWindow *win; - - for( win = m_windowList; win; win = win->m_next ) - dumpWindow( win ); - } -#endif - - return nullptr; - - } - - // If this is a child window add it to the parent's window list - if( parent ) - addWindowToParent( window, parent ); - else - linkWindow( window ); - - window->m_status = status; - window->m_size.x = width; - window->m_size.y = height; - - window->m_region.lo.x = x; - window->m_region.lo.y = y; - window->m_region.hi.x = x + width; - window->m_region.hi.y = y + height; - - window->normalizeWindowRegion(); - - // set the system function and send a create message to window - window->winSetSystemFunc( system ); - winSendSystemMsg( window, GWM_CREATE, 0, 0 ); - - // copy over instance data if present - if( instData ) - window->winSetInstanceData( instData ); - - // set default font - if (TheGlobalLanguageData && TheGlobalLanguageData->m_defaultWindowFont.name.isNotEmpty()) - { window->winSetFont( winFindFont( - TheGlobalLanguageData->m_defaultWindowFont.name, - TheGlobalLanguageData->m_defaultWindowFont.size, - TheGlobalLanguageData->m_defaultWindowFont.bold) ); - } - else - window->winSetFont( winFindFont( "Times New Roman", 14, FALSE ) ); - - return window; - -} - -//------------------------------------------------------------------------------------------------- -/** Take a window and its children off the top level list and free - * their allocation class data. */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winDestroy( GameWindow *window ) -{ - GameWindow *child, *next; - - if( window == nullptr ) - return WIN_ERR_INVALID_WINDOW; - - // - // we should never have edit data allocated in the window code, it's - // completely handled by the editor ONLY - // - DEBUG_ASSERTCRASH( window->winGetEditData() == nullptr, - ("winDestroy(): edit data should NOT be present!") ); - - if( BitIsSet( window->m_status, WIN_STATUS_DESTROYED ) ) - return WIN_ERR_OK; - - BitSet( window->m_status, WIN_STATUS_DESTROYED ); - window->freeImages(); - - if( m_mouseCaptor == window ) - winRelease( window ); - - if( m_keyboardFocus == window ) - winSetFocus( nullptr ); - - if( (m_modalHead != nullptr) && (window == m_modalHead->window) ) - winUnsetModal( m_modalHead->window ); - - if( m_currMouseRgn == window ) - m_currMouseRgn = nullptr; - - if( m_grabWindow == window ) - m_grabWindow = nullptr; - - for( child = window->m_child; child; child = next ) - { - next = child->m_next; - winDestroy( child ); - } - - // Remove the top level window from list - if( window->m_parent == nullptr ) - unlinkWindow( window ); - else - unlinkChildWindow( window ); - - // Add to head of the destroy list - window->m_prev = nullptr; - window->m_next = m_destroyList; - - m_destroyList = window; - - // - // if this window is part of a layout screen, notify the screen that - // this window is going away - // - if( window->m_layout ) - window->m_layout->removeWindow( window ); - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Destroy all windows on the window list IMMEDIATELY */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winDestroyAll() -{ - GameWindow *win, *next; - - // - // NOTE that it is CRITICAL that the windows be destroyed this way, - // the editor has windows that are not on this main list that must - // exist throughout a reset of the system (copy/paste for instance) - // so DO NOT ever change this to a clever pool of memory for the - // windows and reset the _pool_ ... I will have to kill you! CBD - // - - for( next = win = m_windowList; next; win = next) - { - next = win->m_next; - - winDestroy( win ); - - } - - // Destroy All Windows just added to destroy list - processDestroyList(); - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Sets selected window into a modal state. This window will get - * put at the top of a modal stack */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winSetModal( GameWindow *window ) -{ - ModalWindow *modal; - - if( window == nullptr ) - return WIN_ERR_INVALID_WINDOW; - - // verify requesting window is a root window - if( window->m_parent != nullptr ) - { - DEBUG_LOG(( "WinSetModal: Non Root window attempted to go modal." )); - return WIN_ERR_INVALID_PARAMETER; // return error if not - } - // Allocate new Modal Window Entry - modal = newInstance(ModalWindow); - if( modal == nullptr ) - { - DEBUG_LOG(( "WinSetModal: Unable to allocate space for Modal Entry." )); - return WIN_ERR_GENERAL_FAILURE; - } - - // Put new entry at top of list - modal->window = window; - modal->next = m_modalHead; - m_modalHead = modal; - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** pops window off of the modal stack. If this window is not the top - * of the modal stack an error will occur. */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winUnsetModal( GameWindow *window ) -{ - ModalWindow *next; - - if( window == nullptr ) - return WIN_ERR_INVALID_WINDOW; - - // verify entry is at top of list - if( (m_modalHead == nullptr) || (m_modalHead->window != window) ) - { - - // return error if not - DEBUG_LOG(( "WinUnsetModal: Invalid window attempting to unset modal (%d)", - window->winGetWindowId() )); - return WIN_ERR_GENERAL_FAILURE; - - } - - // remove from top of list - next = m_modalHead->next; - deleteInstance(m_modalHead); - m_modalHead = next; - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Get the grabbed window */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::winGetGrabWindow() -{ - - return m_grabWindow; - -} - -//------------------------------------------------------------------------------------------------- -/** Explicitly set the grab window */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::winSetGrabWindow( GameWindow *window ) -{ - - m_grabWindow = window; - -} - -//------------------------------------------------------------------------------------------------- -/** Explicitly set the grab window */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::winSetLoneWindow( GameWindow *window ) -{ - // ignore if we're trying to set the same window - if( m_loneWindow == window ) - return; - if( m_loneWindow ) - winSendSystemMsg( m_loneWindow, GGM_CLOSE, 0, 0 ); - m_loneWindow = window; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a Modal Message Box */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int height, UnsignedShort buttonFlags, - UnicodeString titleString, UnicodeString bodyString, - GameWinMsgBoxFunc yesCallback, - GameWinMsgBoxFunc noCallback, - GameWinMsgBoxFunc okCallback, - GameWinMsgBoxFunc cancelCallback ) -{ - return gogoMessageBox(x,y, width,height,buttonFlags,titleString,bodyString,yesCallback,noCallback,okCallback,cancelCallback, FALSE); -} - -GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int height, UnsignedShort buttonFlags, - UnicodeString titleString, UnicodeString bodyString, - GameWinMsgBoxFunc yesCallback, - GameWinMsgBoxFunc noCallback, - GameWinMsgBoxFunc okCallback, - GameWinMsgBoxFunc cancelCallback, Bool useLogo ) - -{ - // first check to make sure we have some buttons to display - if(buttonFlags == 0 ) - { - return nullptr; - } - GameWindow *trueParent = nullptr; - //Changed by Chris - if(useLogo) - trueParent = winCreateFromScript( "Menus/QuitMessageBox.wnd" ); - else - trueParent = winCreateFromScript( "Menus/MessageBox.wnd" ); - //Added By Chris - AsciiString menuName; - if(useLogo) - menuName.set("QuitMessageBox.wnd:"); - else - menuName.set("MessageBox.wnd:"); - - AsciiString tempName; - GameWindow *parent = nullptr; - - tempName = menuName; - tempName.concat("MessageBoxParent"); - parent = winGetWindowFromId(trueParent, TheNameKeyGenerator->nameToKey( tempName )); - winSetModal( trueParent ); - winSetFocus( nullptr ); // make sure we lose focus from other windows even if we refuse focus ourselves - winSetFocus( parent ); - - // If the user wants the size to be different then the default - float ratioX, ratioY = 1; - - if( width > 0 && height > 0 ) - { - ICoord2D temp; - //First grab the percent increase/decrease compared to the default size - parent->winGetSize( &temp.x, &temp.y); - ratioX = (float)width / (float)temp.x; - ratioY = (float)height / (float)temp.y; - //Set the window's new size - parent->winSetSize( width, height); - - //Resize/reposition all the children windows based off the ratio - GameWindow *child; - for( child = parent->winGetChild(); child; child = child->winGetNext() ) - { - child->winGetSize(&temp.x, &temp.y); - temp.x =Int(temp.x * ratioX); - temp.y =Int(temp.y * ratioY); - child->winSetSize(temp.x, temp.y); - - child->winGetPosition(&temp.x, &temp.y); - temp.x =Int(temp.x * ratioX); - temp.y =Int(temp.y * ratioY); - child->winSetPosition(temp.x, temp.y); - } - } - - // If the user wants to position the message box somewhere other then default - if( x >= 0 && y >= 0) - parent->winSetPosition(x, y); - - // Reposition the buttons - Int buttonX[3], buttonY[3]; - - //In the layout, buttonOk will be in the first button position - NameKeyType buttonOkID = NAMEKEY_INVALID; - - tempName = menuName; - tempName.concat("ButtonOk"); - buttonOkID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *buttonOk = winGetWindowFromId(parent, buttonOkID); - buttonOk->winGetPosition(&buttonX[0], &buttonY[0]); - - tempName = menuName; - tempName.concat("ButtonYes"); - NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *buttonYes = winGetWindowFromId(parent, buttonYesID); - //buttonNo in the second position - tempName = menuName; - tempName.concat("ButtonNo"); - NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey(tempName); - GameWindow *buttonNo = winGetWindowFromId(parent, buttonNoID); - buttonNo->winGetPosition(&buttonX[1], &buttonY[1]); - - //and buttonCancel in the third - tempName = menuName; - tempName.concat("ButtonCancel"); - NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *buttonCancel = winGetWindowFromId(parent, buttonCancelID); - buttonCancel->winGetPosition(&buttonX[2], &buttonY[2]); - - //we shouldn't have button OK and Yes on the same dialog - if((buttonFlags & (MSG_BOX_OK | MSG_BOX_YES)) == (MSG_BOX_OK | MSG_BOX_YES) ) - { - DEBUG_CRASH(("Passed in MSG_BOX_OK and MSG_BOX_YES. Big No No.")); - } - - //Position the OK button if we have one - if( (buttonFlags & MSG_BOX_OK) == MSG_BOX_OK) - { - buttonOk->winSetPosition(buttonX[0], buttonY[0]); - buttonOk->winHide(FALSE); - } - else if( (buttonFlags & MSG_BOX_YES) == MSG_BOX_YES) - { - //Position the Yes if we have one - buttonYes->winSetPosition(buttonX[0], buttonY[0]); - buttonYes->winHide(FALSE); - } - - if((buttonFlags & (MSG_BOX_NO | MSG_BOX_CANCEL)) == (MSG_BOX_NO | MSG_BOX_CANCEL) ) - { - //If we have both the No and Cancel button, then the no should go in the middle position - buttonNo->winSetPosition(buttonX[1], buttonY[1]); - buttonCancel->winSetPosition(buttonX[2], buttonY[2]); - buttonNo->winHide(FALSE); - buttonCancel->winHide(FALSE); - } - else if( (buttonFlags & MSG_BOX_NO) == MSG_BOX_NO) - { - //if we just have the no button, then position it in the right most spot - buttonNo->winSetPosition(buttonX[2], buttonY[2]); - buttonNo->winHide(FALSE); - } - else if( (buttonFlags & MSG_BOX_CANCEL) == MSG_BOX_CANCEL) - { - //else if we just have the Cancel button, well, it should always go in the right spot - buttonCancel->winSetPosition(buttonX[2], buttonY[2]); - buttonCancel->winHide(FALSE); - } - - // Fill the text into the text boxes - tempName = menuName; - tempName.concat("StaticTextTitle"); - NameKeyType staticTextTitleID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *staticTextTitle = winGetWindowFromId(parent, staticTextTitleID); - GadgetStaticTextSetText(staticTextTitle,titleString); - tempName = menuName; - tempName.concat("StaticTextMessage"); - NameKeyType staticTextMessageID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *staticTextMessage = winGetWindowFromId(parent, staticTextMessageID); - GadgetStaticTextSetText(staticTextMessage,bodyString); - - // create a structure that will pass the functions to - WindowMessageBoxData *MsgBoxCallbacks = NEW WindowMessageBoxData; - MsgBoxCallbacks->cancelCallback = cancelCallback; - MsgBoxCallbacks->noCallback = noCallback; - MsgBoxCallbacks->okCallback = okCallback; - MsgBoxCallbacks->yesCallback = yesCallback; - //pass the structure to the dialog - trueParent->winSetUserData( MsgBoxCallbacks ); - - //make sure the dialog is showing and bring it to the top - parent->winHide(FALSE); - parent->winBringToTop(); - - //Changed By Chris - return trueParent; -} - -//------------------------------------------------------------------------------------------------- -/** Create a button GUI control */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - GameFont *defaultFont, - Bool defaultVisual ) -{ - GameWindow *button; - - // we MUST have a push button style window to do this - if( BitIsSet( instData->getStyle(), GWS_PUSH_BUTTON ) == FALSE ) - { - - DEBUG_LOG(( "Can't create button gadget, instance data not button type" )); - assert( 0 ); - return nullptr; - - } - - // create the button window - button = winCreate( parent, status, - x, y, width, height, - GadgetPushButtonSystem, - instData ); - if( button == nullptr ) - { - - DEBUG_LOG(( "Unable to create button for push button gadget" )); - assert( 0 ); - return nullptr; - - } - - // assign input function - button->winSetInputFunc( GadgetPushButtonInput ); - - // - // assign draw function, the draw functions must actually be implemented - // on the device level of the engine - // - if( BitIsSet( button->winGetStatus(), WIN_STATUS_IMAGE ) ) - button->winSetDrawFunc( getPushButtonImageDrawFunc() ); - else - button->winSetDrawFunc( getPushButtonDrawFunc() ); - - // set the owner to the parent, or if no parent it will be itself - button->winSetOwner( parent ); - - // Init the userdata to null - button->winSetUserData(nullptr); - - // assign the default images/colors - assignDefaultGadgetLook( button, defaultFont, defaultVisual ); - - // assign text from label - UnicodeString text = winTextLabelToText( instData->m_textLabelString ); - if( text.getLength() ) - GadgetButtonSetText( button, text ); - - return button; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a checkbox UI element */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *checkbox; - - // we MUST have a push button style window to do this - if( BitIsSet( instData->getStyle(), GWS_CHECK_BOX ) == FALSE ) - { - - DEBUG_LOG(( "Can't create checkbox gadget, instance data not checkbox type" )); - assert( 0 ); - return nullptr; - - } - - // create the button window - checkbox = winCreate( parent, status, - x, y, width, height, - GadgetCheckBoxSystem, - instData ); - if( checkbox == nullptr ) - { - - DEBUG_LOG(( "Unable to create checkbox window" )); - assert( 0 ); - return nullptr; - - } - - // assign input function - checkbox->winSetInputFunc( GadgetCheckBoxInput ); - - // - // assign draw function, the draw functions must actually be implemented - // on the device level of the engine - // - if( BitIsSet( checkbox->winGetStatus(), WIN_STATUS_IMAGE ) ) - checkbox->winSetDrawFunc( getCheckBoxImageDrawFunc() ); - else - checkbox->winSetDrawFunc( getCheckBoxDrawFunc() ); - - // set the owner to the parent, or if no parent it will be itself - checkbox->winSetOwner( parent ); - - // assign the default images/colors - assignDefaultGadgetLook( checkbox, defaultFont, defaultVisual ); - - // assign text from label - UnicodeString text = winTextLabelToText( instData->m_textLabelString ); - if( text.getLength() ) - GadgetCheckBoxSetText( checkbox, text ); - - return checkbox; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a radio button GUI element */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - RadioButtonData *rData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *radioButton; - RadioButtonData *radioData; - - // we MUST have a push button style window to do this - if( BitIsSet( instData->getStyle(), GWS_RADIO_BUTTON ) == FALSE ) - { - - DEBUG_LOG(( "Can't create radioButton gadget, instance data not radioButton type" )); - assert( 0 ); - return nullptr; - - } - - // create the button window - radioButton = winCreate( parent, status, - x, y, width, height, - GadgetRadioButtonSystem, - instData ); - if( radioButton == nullptr ) - { - - DEBUG_LOG(( "Unable to create radio button window" )); - assert( 0 ); - return nullptr; - - } - - // allocate and store the radio button user data - radioData = NEW RadioButtonData; - memcpy( radioData, rData, sizeof( RadioButtonData ) ); - radioButton->winSetUserData( radioData ); - - // assign input function - radioButton->winSetInputFunc( GadgetRadioButtonInput ); - - // - // assign draw function, the draw functions must actually be implemented - // on the device level of the engine - // - if( BitIsSet( radioButton->winGetStatus(), WIN_STATUS_IMAGE ) ) - radioButton->winSetDrawFunc( getRadioButtonImageDrawFunc() ); - else - radioButton->winSetDrawFunc( getRadioButtonDrawFunc() ); - - // set the owner to the parent, or if no parent it will be itself - radioButton->winSetOwner( parent ); - - // assign the default images/colors - assignDefaultGadgetLook( radioButton, defaultFont, defaultVisual ); - - // assign text from label - UnicodeString text = winTextLabelToText( instData->m_textLabelString ); - if( text.getLength() ) - GadgetRadioSetText( radioButton, text ); - - return radioButton; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a tab control GUI element */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - TabControlData *tData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *tabControl; - TabControlData *tabData; - - // we MUST have a tab control style window to do this - if( BitIsSet( instData->getStyle(), GWS_TAB_CONTROL ) == FALSE ) - { - - DEBUG_LOG(( "Can't create tabControl gadget, instance data not tabControl type" )); - assert( 0 ); - return nullptr; - - } - - // create the tab control window - tabControl = winCreate( parent, status, - x, y, width, height, - GadgetTabControlSystem, - instData ); - if( tabControl == nullptr ) - { - - DEBUG_LOG(( "Unable to create tab control window" )); - assert( 0 ); - return nullptr; - - } - - // allocate and store the tab control user data - tabData = NEW TabControlData; - memcpy( tabData, tData, sizeof( TabControlData ) ); - tabControl->winSetUserData( tabData ); - - GadgetTabControlComputeTabRegion( tabControl ); - GadgetTabControlCreateSubPanes( tabControl ); - GadgetTabControlShowSubPane( tabControl, 0 ); - - // assign input function - tabControl->winSetInputFunc( GadgetTabControlInput ); - - // - // assign draw function, the draw functions must actually be implemented - // on the device level of the engine - // - if( BitIsSet( tabControl->winGetStatus(), WIN_STATUS_IMAGE ) ) - tabControl->winSetDrawFunc( getTabControlImageDrawFunc() ); - else - tabControl->winSetDrawFunc( getTabControlDrawFunc() ); - - // set the owner to the parent, or if no parent it will be itself - tabControl->winSetOwner( parent ); - - // assign the default images/colors - assignDefaultGadgetLook( tabControl, defaultFont, defaultVisual ); - - return tabControl; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a list box GUI control */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - ListboxData *listboxDataTemplate, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *listbox; - ListboxData *listboxData; - Bool title = FALSE; - - // we MUST have a push button style window to do this - if( BitIsSet( instData->getStyle(), GWS_SCROLL_LISTBOX ) == FALSE ) - { - - DEBUG_LOG(( "Can't create listbox gadget, instance data not listbox type" )); - assert( 0 ); - return nullptr; - - } - - // create the listbox - listbox = winCreate( parent, status, x, y, width, height, - GadgetListBoxSystem, instData ); - - if( listbox == nullptr ) - { - - DEBUG_LOG(( "Unable to create listbox window" )); - assert( 0 ); - return nullptr; - - } - - // allocate the listbox data, copy template data over and set it into box - listboxData = NEW ListboxData; - DEBUG_ASSERTCRASH(listboxDataTemplate, ("listboxDataTemplate not initialized")); - memcpy( listboxData, listboxDataTemplate, sizeof( ListboxData ) ); - - // Add the list box data struct to the window's class data - listbox->winSetUserData( listboxData ); - - // set the owner to the parent, or if no parent it will be itself - listbox->winSetOwner( parent ); - - // Adjust for list title if present - if( instData->getTextLength() ) - title = TRUE; - - // Set up list box redraw callbacks - if( BitIsSet( listbox->winGetStatus(), WIN_STATUS_IMAGE )) - listbox->winSetDrawFunc( getListBoxImageDrawFunc() ); - else - listbox->winSetDrawFunc( getListBoxDrawFunc() ); - - // Set up list box input callbacks - if( listboxData->multiSelect ) - listbox->winSetInputFunc( GadgetListBoxMultiInput ); - else - listbox->winSetInputFunc( GadgetListBoxInput ); - - - - // - // allocate and set the list length, note that setting the list length will - // automatically allocate the selection entries that are needed for multi - // select list boxes etc. - // - Int length = listboxData->listLength; - listboxData->listLength = 0; // hacky! - GadgetListBoxSetListLength( listbox, length ); - - // store display height - listboxData->displayHeight = height; - - if( title ) - listboxData->displayHeight -= winFontHeight( instData->getFont() ); - - // Set display position to the top of the list - listboxData->displayPos = 0; - listboxData->selectPos = -1; - listboxData->doubleClickTime = 0; - listboxData->insertPos = 0; - listboxData->endPos = 0; - listboxData->totalHeight = 0; - - // if this listbox has multiple selections prep it - //if( listboxData->multiSelect ) - // GadgetListBoxAddMultiSelect( listbox ); - - // If ScrollBar was requested ... create it. - if( listboxData->scrollBar ) - GadgetListboxCreateScrollbar( listbox ); - // - // Setup listbox Columns - // - if( listboxData->columns == 1 ) - { - listboxData->columnWidth = NEW Int[listboxData->columns]; - listboxData->columnWidth[0] = width; - if( listboxData->slider ) - { - ICoord2D sliderSize; - - listboxData->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - listboxData->columnWidth[0] -= (sliderSize.x + 2); - - } - } - else - { - if( !listboxData->columnWidthPercentage ) - return nullptr; - listboxData->columnWidth = NEW Int[listboxData->columns]; - if(!listboxData->columnWidth) - return nullptr; - - Int totalWidth = width; - if( listboxData->slider ) - { - ICoord2D sliderSize; - - listboxData->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - totalWidth -= (sliderSize.x + 2); - - } - for(Int i = 0; i < listboxData->columns; i++ ) - { - listboxData->columnWidth[i] = listboxData->columnWidthPercentage[i] * totalWidth / 100; - } - } - // assign the default images/colors - assignDefaultGadgetLook( listbox, defaultFont, defaultVisual ); - - return listbox; - -} - -//------------------------------------------------------------------------------------------------- -/** Does all generic window creation, calls appropriate slider create - * function to set up slider-specific data */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - SliderData *sliderData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *slider; - GameWindow *button; - SliderData *data; - - // - // All sliders need to have the tab stop status in order for - // the focus chain to work correctly. - // - BitSet( status, WIN_STATUS_TAB_STOP ); - - if( BitIsSet( instData->getStyle(), GWS_HORZ_SLIDER ) ) - { - - slider = winCreate( parent, status, x, y, width, height, - GadgetHorizontalSliderSystem, instData ); - - // Set up horizontal slider callbacks - slider->winSetInputFunc( GadgetHorizontalSliderInput ); - if( BitIsSet( slider->winGetStatus(), WIN_STATUS_IMAGE ) ) - slider->winSetDrawFunc( getHorizontalSliderImageDrawFunc() ); - else - slider->winSetDrawFunc( getHorizontalSliderDrawFunc() ); - - } - else if ( BitIsSet( instData->getStyle(), GWS_VERT_SLIDER ) ) - { - - slider = winCreate( parent, status, x, y, width, height, - GadgetVerticalSliderSystem, instData ); - - // Set up vertical slider callbacks - slider->winSetInputFunc( GadgetVerticalSliderInput ); - - if( BitIsSet( slider->winGetStatus(), WIN_STATUS_IMAGE ) && !(parent && BitIsSet(parent->winGetStyle(), GWS_SCROLL_LISTBOX))) - slider->winSetDrawFunc( getVerticalSliderImageDrawFunc() ); - else - slider->winSetDrawFunc( getVerticalSliderDrawFunc() ); - - } - else - { - - DEBUG_LOG(( "gogoGadgetSlider warning: unrecognized slider style." )); - assert( 0 ); - return nullptr; - - } - - // sanity - if( slider == nullptr ) - { - - DEBUG_LOG(( "Unable to create slider control window" )); - assert( 0 ); - return nullptr; - - } - - // set the owner to the parent, or if no parent it will be itself - slider->winSetOwner( parent ); - - // create the slider thumb button - WinInstanceData buttonInstData; - UnsignedInt statusFlags = status | WIN_STATUS_ENABLED | WIN_STATUS_DRAGGABLE; - - buttonInstData.init(); - - // if parent is hidden we don't need to be. - BitClear( statusFlags, WIN_STATUS_HIDDEN ); - - buttonInstData.m_owner = slider; - buttonInstData.m_style = GWS_PUSH_BUTTON; - - // if slider tracks, so will this sub control - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - BitSet( buttonInstData.m_style, GWS_MOUSE_TRACK ); - - if( BitIsSet( instData->getStyle(), GWS_HORZ_SLIDER ) ) - button = gogoGadgetPushButton( slider, statusFlags, 0, HORIZONTAL_SLIDER_THUMB_POSITION, - HORIZONTAL_SLIDER_THUMB_WIDTH, HORIZONTAL_SLIDER_THUMB_HEIGHT, &buttonInstData, nullptr, TRUE ); - else - button = gogoGadgetPushButton( slider, statusFlags, 0, 0, - width, width+1, &buttonInstData, nullptr, TRUE ); - - // Protect against divide by zero - if( sliderData->maxVal == sliderData->minVal ) - sliderData->maxVal = sliderData->minVal + 1; - - if( BitIsSet( instData->getStyle(), GWS_HORZ_SLIDER ) ) - { - sliderData->numTicks = (float)(width - HORIZONTAL_SLIDER_THUMB_WIDTH) / - (float)(sliderData->maxVal - sliderData->minVal); - } else - { - sliderData->numTicks = (float)(height - GADGET_SIZE) / - (float)(sliderData->maxVal - sliderData->minVal); - } - - data = NEW SliderData; - memcpy( data, sliderData, sizeof(SliderData) ); - - // Add the slider data struct to the window's class data - slider->winSetUserData( data ); - - // assign the default images/colors - assignDefaultGadgetLook( slider, defaultFont, defaultVisual ); - - return slider; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a Combo Box GUI element */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - ComboBoxData *comboBoxDataTemplate, - GameFont *defaultFont, - Bool defaultVisual ) -{ - GameWindow *comboBox; - ComboBoxData *comboBoxData; - Bool title = FALSE; - - // we MUST have a push button style window to do this - if( BitIsSet( instData->getStyle(), GWS_COMBO_BOX) == FALSE ) - { - - DEBUG_LOG(( "Can't create ComboBox gadget, instance data not ComboBox type" )); - assert( 0 ); - return nullptr; - - } - - // create the listbox - comboBox = winCreate( parent, status, x, y, width, height, - GadgetComboBoxSystem, instData ); - - if( comboBox == nullptr ) - { - - DEBUG_LOG(( "Unable to create ComboBox window" )); - assert( 0 ); - return nullptr; - - } - - -// begin here - // allocate the listbox data, copy template data over and set it into box - comboBoxData = NEW ComboBoxData; - memcpy( comboBoxData, comboBoxDataTemplate, sizeof( ComboBoxData ) ); - - // Add the list box data struct to the window's class data - comboBox->winSetUserData( comboBoxData ); - - // set the owner to the parent, or if no parent it will be itself - comboBox->winSetOwner( parent ); - - // Adjust for list title if present - if( instData->getTextLength() ) - title = TRUE; - - // Set up list box redraw callbacks - if( BitIsSet( comboBox->winGetStatus(), WIN_STATUS_IMAGE )) - comboBox->winSetDrawFunc( getComboBoxImageDrawFunc() ); - else - comboBox->winSetDrawFunc( getComboBoxDrawFunc() ); - - // Set up list box input callbacks - comboBox->winSetInputFunc( GadgetComboBoxInput ); - - //Create the windows that make up - - - WinInstanceData winInstData; - Int buttonWidth, buttonHeight; - Int fontHeight; - Int top; - Int bottom; - - - // do we have a title - if( comboBox->winGetTextLength() ) - title = TRUE; - - // remove unwanted status bits. - status &= ~(WIN_STATUS_BORDER | WIN_STATUS_HIDDEN); - - fontHeight = winFontHeight( comboBox->winGetFont() ); - top = title ? (fontHeight + 1):0; - bottom = title ? (height - (fontHeight + 1)):height; - - // initialize instData - winInstData.init(); - - // size of button - buttonWidth = 21; - buttonHeight = 22; - - // ---------------------------------------------------------------------- - // Create Drop Down Button - // ---------------------------------------------------------------------- - - winInstData.m_owner = comboBox; - winInstData.m_style = GWS_PUSH_BUTTON; - - // if listbox tracks, so will this sub control - if( BitIsSet( comboBox->winGetStyle(), GWS_MOUSE_TRACK ) ) - BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - - comboBoxData->dropDownButton = - gogoGadgetPushButton( comboBox, - status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, - width - buttonWidth, 0, - buttonWidth, height, - &winInstData, nullptr, TRUE ); - comboBoxData->dropDownButton->winSetTooltipFunc(comboBox->winGetTooltipFunc()); - comboBoxData->dropDownButton->winSetTooltip(instData->getTooltipText()); - comboBoxData->dropDownButton->setTooltipDelay(comboBox->getTooltipDelay()); - // ---------------------------------------------------------------------- - // Create text entry - // ---------------------------------------------------------------------- - UnsignedInt statusTextEntry; - winInstData.init(); - - winInstData.m_owner = comboBox; - winInstData.m_style |= GWS_ENTRY_FIELD; - winInstData.m_textLabelString = "Entry"; - if( BitIsSet( comboBox->winGetStyle(), GWS_MOUSE_TRACK ) ) - BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - if( comboBoxData->isEditable) - { - statusTextEntry = status; - } - else - { - statusTextEntry = status | WIN_STATUS_NO_INPUT ;//| WIN_STATUS_NO_FOCUS; - comboBoxData->entryData->drawTextFromStart = TRUE; - } - comboBoxData->editBox = gogoGadgetTextEntry( comboBox, statusTextEntry , - 0,0 , - width - buttonWidth , height , - &winInstData, comboBoxData->entryData, - winInstData.m_font, FALSE ); - comboBoxData->editBox->winSetTooltipFunc(comboBox->winGetTooltipFunc()); - comboBoxData->editBox->winSetTooltip(instData->getTooltipText()); - comboBoxData->editBox->setTooltipDelay(comboBox->getTooltipDelay()); - - delete (comboBoxData->entryData); - comboBoxData->entryData = (EntryData *)comboBoxData->editBox->winGetUserData(); - // ---------------------------------------------------------------------- - // Create list box - // ---------------------------------------------------------------------- - winInstData.init(); - - winInstData.m_owner = comboBox; - if( BitIsSet( comboBox->winGetStyle(), GWS_MOUSE_TRACK ) ) - BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - BitSet( winInstData.m_style, WIN_STATUS_HIDDEN ); - winInstData.m_style |= GWS_SCROLL_LISTBOX; - status &= ~(WIN_STATUS_IMAGE); - comboBoxData->listBox = gogoGadgetListBox( comboBox, status | WIN_STATUS_ABOVE | WIN_STATUS_ONE_LINE, 0, height, - width, height, - &winInstData, comboBoxData->listboxData, - winInstData.m_font, FALSE ); - comboBoxData->listBox->winHide(TRUE); - delete(comboBoxData->listboxData); - comboBoxData->listboxData = (ListboxData *)comboBoxData->listBox->winGetUserData(); - - comboBoxData->listBox->winSetTooltipFunc(comboBox->winGetTooltipFunc()); - comboBoxData->listBox->winSetTooltip(instData->getTooltipText()); - comboBoxData->listBox->setTooltipDelay(comboBox->getTooltipDelay()); - GadgetListBoxSetAudioFeedback(comboBoxData->listBox, TRUE); - - // Initialize the ComboBox's variables and the controls with them - GadgetComboBoxSetIsEditable(comboBox, comboBoxData->isEditable); - GadgetComboBoxSetMaxChars( comboBox, comboBoxData->maxChars ); - GadgetComboBoxSetMaxDisplay( comboBox, comboBoxData->maxDisplay ); - - //Initialize the control's text colors - Color color, border; - - color = comboBox->winGetEnabledTextColor(); - border = comboBox->winGetEnabledTextBorderColor(); - if(comboBoxData->listBox) - comboBoxData->listBox->winSetEnabledTextColors( color,border); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetEnabledTextColors(color,border); - - color = comboBox->winGetDisabledTextColor(); - border = comboBox->winGetDisabledTextBorderColor(); - if(comboBoxData->listBox) - comboBoxData->listBox->winSetDisabledTextColors( color,border); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetDisabledTextColors(color,border); - - - color = comboBox->winGetHiliteTextColor(); - border = comboBox->winGetHiliteTextBorderColor(); - if(comboBoxData->listBox) - comboBoxData->listBox->winSetHiliteTextColors( color,border); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetHiliteTextColors(color,border); - - comboBoxData->dontHide = FALSE; - - // assign the default images/colors - assignDefaultGadgetLook( comboBox, defaultFont, defaultVisual ); - - return comboBox; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a progress bar GUI element */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *progressBar; - - // we MUST have a push button style window to do this - if( BitIsSet( instData->getStyle(), GWS_PROGRESS_BAR ) == FALSE ) - { - - DEBUG_LOG(( "Can't create progressBar gadget, instance data not progressBar type" )); - assert( 0 ); - return nullptr; - - } - - // create the button window - progressBar = winCreate( parent, status, - x, y, width, height, - GadgetProgressBarSystem, - instData ); - if( progressBar == nullptr ) - { - - DEBUG_LOG(( "Unable to create progress bar control" )); - assert( 0 ); - return nullptr; - - } - - // - // assign draw function, the draw functions must actually be implemented - // on the device level of the engine - // - if( BitIsSet( progressBar->winGetStatus(), WIN_STATUS_IMAGE ) ) - progressBar->winSetDrawFunc( getProgressBarImageDrawFunc() ); - else - progressBar->winSetDrawFunc( getProgressBarDrawFunc() ); - - // set the owner to the parent, or if no parent it will be itself - progressBar->winSetOwner( parent ); - - // assign the default images/colors - assignDefaultGadgetLook( progressBar, defaultFont, defaultVisual ); - - return progressBar; - -} - -//------------------------------------------------------------------------------------------------- -/** Does all generic window creation, calls appropriate text field create - * function to set up specific data */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetStaticText( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - TextData *textData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *textWin; - TextData *data; - - // Static Text can not be a Tab Stop - BitClear( instData->m_style, GWS_TAB_STOP ); - - if( BitIsSet( instData->getStyle(), GWS_STATIC_TEXT ) ) - { - textWin = winCreate( parent, status, x, y, width, height, - GadgetStaticTextSystem, instData ); - } - else - { - DEBUG_LOG(( "gogoGadgetText warning: unrecognized text style." )); - return nullptr; - } - - if( textWin != nullptr ) - { - - // set the owner to the parent, or if no parent it will be itself - textWin->winSetOwner( parent ); - - // assign callbacks - textWin->winSetInputFunc( GadgetStaticTextInput ); - if( BitIsSet( textWin->winGetStatus(), WIN_STATUS_IMAGE ) ) - textWin->winSetDrawFunc( getStaticTextImageDrawFunc() ); - else - textWin->winSetDrawFunc( getStaticTextDrawFunc() ); - - data = NEW TextData; - assert( textData != nullptr ); - memcpy( data, textData, sizeof(TextData) ); - - // allocate a display string for the tet - data->text = TheDisplayStringManager->newDisplayString(); - // set whether or not we center the wrapped text - data->text->setWordWrapCentered( BitIsSet( instData->getStatus(), WIN_STATUS_WRAP_CENTERED )); - // Add the entry field data struct to the window's class data - textWin->winSetUserData( data ); - - // assign the default images/colors - assignDefaultGadgetLook( textWin, defaultFont, defaultVisual ); - - // assign text from label - UnicodeString text = winTextLabelToText( instData->m_textLabelString ); - if( text.getLength() ) - GadgetStaticTextSetText( textWin, text ); - - } - - return textWin; - -} - -//------------------------------------------------------------------------------------------------- -/** Does all generic window creation, calls appropriate entry field create - * function to set up specific data */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - EntryData *entryData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *entry; - EntryData *data; - - if( BitIsSet( instData->getStyle(), GWS_ENTRY_FIELD ) == FALSE ) - { - - DEBUG_LOG(( "Unable to create text entry, style not entry type" )); - assert( 0 ); - return nullptr; - - } - - // create the window - entry = winCreate( parent, status, x, y, width, height, - GadgetTextEntrySystem, instData ); - if( entry == nullptr ) - { - - DEBUG_LOG(( "Unable to create text entry window" )); - assert( 0 ); - return nullptr; - - } - - // set owner of this control - entry->winSetOwner( parent ); - - // assign callbacks - entry->winSetInputFunc( GadgetTextEntryInput ); - if( BitIsSet( entry->winGetStatus(), WIN_STATUS_IMAGE ) ) - entry->winSetDrawFunc( getTextEntryImageDrawFunc() ); - else - entry->winSetDrawFunc( getTextEntryDrawFunc() ); - - // zero entry data -// memset( entryData->text, 0, ENTRY_TEXT_LEN ); -// memset( entryData->constructText, 0, ENTRY_TEXT_LEN ); - - // initialize character positions, lengths etc - if( entryData->text ) - entryData->charPos = entryData->text->getTextLength(); - else - entryData->charPos = 0; - entryData->conCharPos = 0; - entryData->receivedUnichar = FALSE; - if( entryData->maxTextLen > ENTRY_TEXT_LEN ) - entryData->maxTextLen = ENTRY_TEXT_LEN; - - // allocate entry data - data = NEW EntryData; - - // copy over data control - memcpy( data, entryData, sizeof(EntryData) ); - - // allocate new text display string - data->text = TheDisplayStringManager->newDisplayString(); - data->sText = TheDisplayStringManager->newDisplayString(); - data->constructText = TheDisplayStringManager->newDisplayString(); - - // set the max for the text lengths -// data->text->allocateFixed( ENTRY_TEXT_LEN ); -// data->sText->allocateFixed( ENTRY_TEXT_LEN ); - - // do any real display string copies - if( entryData->text ) - data->text->setText( entryData->text->getText() ); - if( entryData->sText ) - data->sText->setText( entryData->sText->getText() ); - - // set data into window - entry->winSetUserData( data ); - - // asian languages get to have list box kanji character completion - data->constructList = nullptr; - if( OurLanguage == LANGUAGE_ID_KOREAN || - OurLanguage == LANGUAGE_ID_JAPANESE ) - { - // we need to create the construct listbox - WinInstanceData boxInstData; - ListboxData lData; - - // initialize instData - boxInstData.init(); - - // define display region - memset( &lData, 0, sizeof(ListboxData) ); - lData.listLength = 128; - lData.autoScroll = FALSE; - lData.scrollIfAtEnd = FALSE; - lData.autoPurge = TRUE; - lData.scrollBar = TRUE; - lData.multiSelect = FALSE; - lData.columns = 1; - lData.columnWidth = nullptr; - - boxInstData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - - data->constructList = gogoGadgetListBox( nullptr, - WIN_STATUS_ABOVE | - WIN_STATUS_HIDDEN | - WIN_STATUS_NO_FOCUS | - WIN_STATUS_ONE_LINE, - 0, height, - 110, 119, - &boxInstData, - &lData, - nullptr, - TRUE ); - - if( data->constructList == nullptr ) - { - - DEBUG_LOG(( "gogoGadgetEntry warning: Failed to create listbox." )); - assert( 0 ); - winDestroy( entry ); - return nullptr; - - } - - } - - // assign the default images/colors - assignDefaultGadgetLook( entry, defaultFont, defaultVisual ); - - // assign text from label - UnicodeString text = winTextLabelToText( instData->m_textLabelString ); - if( text.getLength() ) - GadgetTextEntrySetText( entry, text ); - - return entry; - -} - -//------------------------------------------------------------------------------------------------- -/** Use this method to assign the default images/colors to gadgets as - * they area created */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, - GameFont *defaultFont, - Bool assignVisual ) -{ - UnsignedByte alpha = 255; - static Color red = winMakeColor( 255, 0, 0, alpha ); - static Color darkRed = winMakeColor( 128, 0, 0, alpha ); - static Color lightRed = winMakeColor( 255, 128, 128, alpha ); - static Color green = winMakeColor( 0, 255, 0, alpha ); - static Color darkGreen = winMakeColor( 0, 128, 0, alpha ); - static Color lightGreen = winMakeColor( 128, 255, 128, alpha ); - static Color blue = winMakeColor( 0, 0, 255, alpha ); - static Color darkBlue = winMakeColor( 0, 0, 128, alpha ); - static Color lightBlue = winMakeColor( 128, 128, 255, alpha ); - static Color purple = winMakeColor( 255, 0, 255, alpha ); - static Color darkPurple = winMakeColor( 128, 0, 128, alpha ); - static Color lightPurple= winMakeColor( 255, 128, 255, alpha ); - static Color yellow = winMakeColor( 255, 255, 0, alpha ); - static Color darkYellow = winMakeColor( 128, 128, 0, alpha ); - static Color lightYellow= winMakeColor( 255, 255, 128, alpha ); - static Color cyan = winMakeColor( 0, 255, 255, alpha ); - static Color darkCyan = winMakeColor( 64, 128, 128, alpha ); - static Color lightCyan = winMakeColor( 128, 255, 255, alpha ); - static Color gray = winMakeColor( 128, 128, 128, alpha ); - static Color darkGray = winMakeColor( 64, 64, 64, alpha ); - static Color lightGray = winMakeColor( 192, 192, 192, alpha ); - static Color black = winMakeColor( 0, 0, 0, alpha ); - static Color white = winMakeColor( 254, 254, 254, alpha ); - static Color enabledText = white; - static Color enabledTextBorder = darkGray; - static Color disabledText = darkGray; - static Color disabledTextBorder = black; - static Color hiliteText = lightBlue; - static Color hiliteTextBorder = blue; - static Color imeCompositeText = green; - static Color imeCompositeTextBorder = blue; - WinInstanceData *instData; - - // sanity - if( gadget == nullptr ) - return; - - // get instance data - instData = gadget->winGetInstanceData(); - - // set default font - if( defaultFont ) - gadget->winSetFont( defaultFont ); - else - { - if (TheGlobalLanguageData && TheGlobalLanguageData->m_defaultWindowFont.name.isNotEmpty()) - { gadget->winSetFont( winFindFont( - TheGlobalLanguageData->m_defaultWindowFont.name, - TheGlobalLanguageData->m_defaultWindowFont.size, - TheGlobalLanguageData->m_defaultWindowFont.bold) ); - } - else - gadget->winSetFont( winFindFont( "Times New Roman", 14, FALSE ) ); - } - - // if we don't want to assign default colors/images get out of here - if( assignVisual == FALSE ) - return; - - // create images for the correct gadget type - if( BitIsSet( instData->getStyle(), GWS_PUSH_BUTTON ) ) - { - - // enabled background - GadgetButtonSetEnabledImage( gadget, winFindImage( "PushButtonEnabled" ) ); - GadgetButtonSetEnabledColor( gadget, red ); - GadgetButtonSetEnabledBorderColor( gadget, lightRed ); - // enabled selected button - GadgetButtonSetEnabledSelectedImage( gadget, winFindImage( "PushButtonEnabledSelected" ) ); - GadgetButtonSetEnabledSelectedColor( gadget, yellow ); - GadgetButtonSetEnabledSelectedBorderColor( gadget, white ); - - // Disabled background - GadgetButtonSetDisabledImage( gadget, winFindImage( "PushButtonDisabled" ) ); - GadgetButtonSetDisabledColor( gadget, gray ); - GadgetButtonSetDisabledBorderColor( gadget, lightGray ); - // Disabled selected button - GadgetButtonSetDisabledSelectedImage( gadget, winFindImage( "PushButtonDisabledSelected" ) ); - GadgetButtonSetDisabledSelectedColor( gadget, lightGray ); - GadgetButtonSetDisabledSelectedBorderColor( gadget, gray ); - - // Hilite background - GadgetButtonSetHiliteImage( gadget, winFindImage( "PushButtonHilite" ) ); - GadgetButtonSetHiliteColor( gadget, green ); - GadgetButtonSetHiliteBorderColor( gadget, darkGreen ); - // Hilite selected button - GadgetButtonSetHiliteSelectedImage( gadget, winFindImage( "PushButtonHiliteSelected" ) ); - GadgetButtonSetHiliteSelectedColor( gadget, yellow ); - GadgetButtonSetHiliteSelectedBorderColor( gadget, white ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - } - else if( BitIsSet( instData->getStyle(), GWS_CHECK_BOX ) ) - { - - // enabled background - GadgetCheckBoxSetEnabledImage( gadget, winFindImage( "CheckBoxEnabled" ) ); - GadgetCheckBoxSetEnabledColor( gadget, red ); - GadgetCheckBoxSetEnabledBorderColor( gadget, lightRed ); - // enabled CheckBox unselected - GadgetCheckBoxSetEnabledUncheckedBoxImage( gadget, winFindImage( "CheckBoxEnabledBoxUnselected" ) ); - GadgetCheckBoxSetEnabledUncheckedBoxColor( gadget, WIN_COLOR_UNDEFINED ); - GadgetCheckBoxSetEnabledUncheckedBoxBorderColor( gadget, lightBlue ); - // enabled CheckBox selected - GadgetCheckBoxSetEnabledCheckedBoxImage( gadget, winFindImage( "CheckBoxEnabledBoxSelected" ) ); - GadgetCheckBoxSetEnabledCheckedBoxColor( gadget, blue ); - GadgetCheckBoxSetEnabledCheckedBoxBorderColor( gadget, lightBlue ); - - // disabled background - GadgetCheckBoxSetDisabledImage( gadget, winFindImage( "CheckBoxDisabled" ) ); - GadgetCheckBoxSetDisabledColor( gadget, gray ); - GadgetCheckBoxSetDisabledBorderColor( gadget, lightGray ); - // Disabled CheckBox unselected - GadgetCheckBoxSetDisabledUncheckedBoxImage( gadget, winFindImage( "CheckBoxDisabledBoxUnselected" ) ); - GadgetCheckBoxSetDisabledUncheckedBoxColor( gadget, WIN_COLOR_UNDEFINED ); - GadgetCheckBoxSetDisabledUncheckedBoxBorderColor( gadget, lightGray ); - // Disabled CheckBox selected - GadgetCheckBoxSetDisabledCheckedBoxImage( gadget, winFindImage( "CheckBoxDisabledBoxSelected" ) ); - GadgetCheckBoxSetDisabledCheckedBoxColor( gadget, darkGray ); - GadgetCheckBoxSetDisabledCheckedBoxBorderColor( gadget, white ); - - // Hilite background - GadgetCheckBoxSetHiliteImage( gadget, winFindImage( "CheckBoxHilite" ) ); - GadgetCheckBoxSetHiliteColor( gadget, green ); - GadgetCheckBoxSetHiliteBorderColor( gadget, lightGreen ); - // Hilite CheckBox unselected - GadgetCheckBoxSetHiliteUncheckedBoxImage( gadget, winFindImage( "CheckBoxHiliteBoxUnselected" ) ); - GadgetCheckBoxSetHiliteUncheckedBoxColor( gadget, WIN_COLOR_UNDEFINED ); - GadgetCheckBoxSetHiliteUncheckedBoxBorderColor( gadget, lightBlue ); - // Hilite CheckBox selected - GadgetCheckBoxSetHiliteCheckedBoxImage( gadget, winFindImage( "CheckBoxHiliteBoxSelected" ) ); - GadgetCheckBoxSetHiliteCheckedBoxColor( gadget, yellow ); - GadgetCheckBoxSetHiliteCheckedBoxBorderColor( gadget, white ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - } - else if( BitIsSet( instData->getStyle(), GWS_RADIO_BUTTON ) ) - { - - // enabled background - GadgetRadioSetEnabledImage( gadget, winFindImage( "RadioButtonEnabled" ) ); - GadgetRadioSetEnabledColor( gadget, red ); - GadgetRadioSetEnabledBorderColor( gadget, lightRed ); - // enabled radio unselected - GadgetRadioSetEnabledUncheckedBoxImage( gadget, winFindImage( "RadioButtonEnabledBoxUnselected" ) ); - GadgetRadioSetEnabledUncheckedBoxColor( gadget, darkRed ); - GadgetRadioSetEnabledUncheckedBoxBorderColor( gadget, black ); - // enabled radio selected - GadgetRadioSetEnabledCheckedBoxImage( gadget, winFindImage( "RadioButtonEnabledBoxSelected" ) ); - GadgetRadioSetEnabledCheckedBoxColor( gadget, blue ); - GadgetRadioSetEnabledCheckedBoxBorderColor( gadget, lightBlue ); - - // disabled background - GadgetRadioSetDisabledImage( gadget, winFindImage( "RadioButtonDisabled" ) ); - GadgetRadioSetDisabledColor( gadget, gray ); - GadgetRadioSetDisabledBorderColor( gadget, lightGray ); - // Disabled radio unselected - GadgetRadioSetDisabledUncheckedBoxImage( gadget, winFindImage( "RadioButtonDisabledBoxUnselected" ) ); - GadgetRadioSetDisabledUncheckedBoxColor( gadget, gray ); - GadgetRadioSetDisabledUncheckedBoxBorderColor( gadget, lightGray ); - // Disabled radio selected - GadgetRadioSetDisabledCheckedBoxImage( gadget, winFindImage( "RadioButtonDisabledBoxSelected" ) ); - GadgetRadioSetDisabledCheckedBoxColor( gadget, darkGray ); - GadgetRadioSetDisabledCheckedBoxBorderColor( gadget, white ); - - // Hilite background - GadgetRadioSetHiliteImage( gadget, winFindImage( "RadioButtonHilite" ) ); - GadgetRadioSetHiliteColor( gadget, green ); - GadgetRadioSetHiliteBorderColor( gadget, lightGreen ); - // Hilite radio unselected - GadgetRadioSetHiliteUncheckedBoxImage( gadget, winFindImage( "RadioButtonHiliteBoxUnselected" ) ); - GadgetRadioSetHiliteUncheckedBoxColor( gadget, darkGreen ); - GadgetRadioSetHiliteUncheckedBoxBorderColor( gadget, lightGreen ); - // Hilite radio selected - GadgetRadioSetHiliteCheckedBoxImage( gadget, winFindImage( "RadioButtonHiliteBoxSelected" ) ); - GadgetRadioSetHiliteCheckedBoxColor( gadget, yellow ); - GadgetRadioSetHiliteCheckedBoxBorderColor( gadget, white ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - } - else if( BitIsSet( instData->getStyle(), GWS_HORZ_SLIDER ) ) - { - - // enabled - GadgetSliderSetEnabledImageLeft( gadget, winFindImage( "HSliderEnabledLeftEnd" ) ); - GadgetSliderSetEnabledImageRight( gadget, winFindImage( "HSliderEnabledRightEnd" ) ); - GadgetSliderSetEnabledImageCenter( gadget, winFindImage( "HSliderEnabledRepeatingCenter" ) ); - GadgetSliderSetEnabledImageSmallCenter( gadget, winFindImage( "HSliderEnabledSmallRepeatingCenter" ) ); - GadgetSliderSetEnabledColor( gadget, red ); - GadgetSliderSetEnabledBorderColor( gadget, lightRed ); - - // disabled - GadgetSliderSetDisabledImageLeft( gadget, winFindImage( "HSliderDisabledLeftEnd" ) ); - GadgetSliderSetDisabledImageRight( gadget, winFindImage( "HSliderDisabledRightEnd" ) ); - GadgetSliderSetDisabledImageCenter( gadget, winFindImage( "HSliderDisabledRepeatingCenter" ) ); - GadgetSliderSetDisabledImageSmallCenter( gadget, winFindImage( "HSliderDisabledSmallRepeatingCenter" ) ); - GadgetSliderSetDisabledColor( gadget, red ); - GadgetSliderSetDisabledBorderColor( gadget, lightRed ); - - // hilite - GadgetSliderSetHiliteImageLeft( gadget, winFindImage( "HSliderHiliteLeftEnd" ) ); - GadgetSliderSetHiliteImageRight( gadget, winFindImage( "HSliderHiliteRightEnd" ) ); - GadgetSliderSetHiliteImageCenter( gadget, winFindImage( "HSliderHiliteRepeatingCenter" ) ); - GadgetSliderSetHiliteImageSmallCenter( gadget, winFindImage( "HSliderHiliteSmallRepeatingCenter" ) ); - GadgetSliderSetHiliteColor( gadget, red ); - GadgetSliderSetHiliteBorderColor( gadget, lightRed ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - // - // set the default colors and images for the slider thumb - // - // enabled - GadgetSliderSetEnabledThumbImage( gadget, winFindImage( "HSliderThumbEnabled" ) ); - GadgetSliderSetEnabledThumbColor( gadget, GadgetSliderGetEnabledColor( gadget ) ); - GadgetSliderSetEnabledThumbBorderColor( gadget, GadgetSliderGetEnabledBorderColor( gadget ) ); - GadgetSliderSetEnabledSelectedThumbImage( gadget, winFindImage( "HSliderThumbEnabled" ) ); - GadgetSliderSetEnabledSelectedThumbColor( gadget, GadgetSliderGetEnabledBorderColor( gadget ) ); - GadgetSliderSetEnabledSelectedThumbBorderColor( gadget, GadgetSliderGetEnabledColor( gadget ) ); - - // disabled - GadgetSliderSetDisabledThumbImage( gadget, winFindImage( "HSliderThumbDisabled" ) ); - GadgetSliderSetDisabledThumbColor( gadget, GadgetSliderGetDisabledColor( gadget ) ); - GadgetSliderSetDisabledThumbBorderColor( gadget, GadgetSliderGetDisabledBorderColor( gadget ) ); - GadgetSliderSetDisabledSelectedThumbImage( gadget, winFindImage( "HSliderThumbDisabled" ) ); - GadgetSliderSetDisabledSelectedThumbColor( gadget, GadgetSliderGetDisabledBorderColor( gadget ) ); - GadgetSliderSetDisabledSelectedThumbBorderColor( gadget, GadgetSliderGetDisabledColor( gadget ) ); - - // hilite - GadgetSliderSetHiliteThumbImage( gadget, winFindImage( "HSliderThumbHilite" ) ); - GadgetSliderSetHiliteThumbColor( gadget, GadgetSliderGetHiliteColor( gadget ) ); - GadgetSliderSetHiliteThumbBorderColor( gadget, GadgetSliderGetHiliteBorderColor( gadget ) ); - GadgetSliderSetHiliteSelectedThumbImage( gadget, winFindImage( "HSliderThumbHiliteSelected" ) ); - GadgetSliderSetHiliteSelectedThumbColor( gadget, GadgetSliderGetHiliteBorderColor( gadget ) ); - GadgetSliderSetHiliteSelectedThumbBorderColor( gadget, GadgetSliderGetHiliteColor( gadget ) ); - - - } - else if( BitIsSet( instData->getStyle(), GWS_VERT_SLIDER ) ) - { - // enabled - GadgetSliderSetEnabledImageTop( gadget, winFindImage( "VSliderEnabledTopEnd" ) ); - GadgetSliderSetEnabledImageBottom( gadget, winFindImage( "VSliderEnabledBottomEnd" ) ); - GadgetSliderSetEnabledImageCenter( gadget, winFindImage( "VSliderEnabledRepeatingCenter" ) ); - GadgetSliderSetEnabledImageSmallCenter( gadget, winFindImage( "VSliderEnabledSmallRepeatingCenter" ) ); - GadgetSliderSetEnabledColor( gadget, red ); - GadgetSliderSetEnabledBorderColor( gadget, lightRed ); - - // disabled - GadgetSliderSetDisabledImageTop( gadget, winFindImage( "VSliderDisabledTopEnd" ) ); - GadgetSliderSetDisabledImageBottom( gadget, winFindImage( "VSliderDisabledBottomEnd" ) ); - GadgetSliderSetDisabledImageCenter( gadget, winFindImage( "VSliderDisabledRepeatingCenter" ) ); - GadgetSliderSetDisabledImageSmallCenter( gadget, winFindImage( "VSliderDisabledSmallRepeatingCenter" ) ); - GadgetSliderSetDisabledColor( gadget, red ); - GadgetSliderSetDisabledBorderColor( gadget, lightRed ); - - // hilite - GadgetSliderSetHiliteImageTop( gadget, winFindImage( "VSliderHiliteTopEnd" ) ); - GadgetSliderSetHiliteImageBottom( gadget, winFindImage( "VSliderHiliteBottomEnd" ) ); - GadgetSliderSetHiliteImageCenter( gadget, winFindImage( "VSliderHiliteRepeatingCenter" ) ); - GadgetSliderSetHiliteImageSmallCenter( gadget, winFindImage( "VSliderHiliteSmallRepeatingCenter" ) ); - GadgetSliderSetHiliteColor( gadget, red ); - GadgetSliderSetHiliteBorderColor( gadget, lightRed ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - // - // set the default colors and images for the slider thumb - // - // enabled - GadgetSliderSetEnabledThumbImage( gadget, winFindImage( "VSliderThumbEnabled" ) ); - GadgetSliderSetEnabledThumbColor( gadget, GadgetSliderGetEnabledColor( gadget ) ); - GadgetSliderSetEnabledThumbBorderColor( gadget, GadgetSliderGetEnabledBorderColor( gadget ) ); - GadgetSliderSetEnabledSelectedThumbImage( gadget, winFindImage( "VSliderThumbEnabled" ) ); - GadgetSliderSetEnabledSelectedThumbColor( gadget, GadgetSliderGetEnabledBorderColor( gadget ) ); - GadgetSliderSetEnabledSelectedThumbBorderColor( gadget, GadgetSliderGetEnabledColor( gadget ) ); - - // disabled - GadgetSliderSetDisabledThumbImage( gadget, winFindImage( "VSliderThumbDisabled" ) ); - GadgetSliderSetDisabledThumbColor( gadget, GadgetSliderGetDisabledColor( gadget ) ); - GadgetSliderSetDisabledThumbBorderColor( gadget, GadgetSliderGetDisabledBorderColor( gadget ) ); - GadgetSliderSetDisabledSelectedThumbImage( gadget, winFindImage( "VSliderThumbDisabled" ) ); - GadgetSliderSetDisabledSelectedThumbColor( gadget, GadgetSliderGetDisabledBorderColor( gadget ) ); - GadgetSliderSetDisabledSelectedThumbBorderColor( gadget, GadgetSliderGetDisabledColor( gadget ) ); - - // hilite - GadgetSliderSetHiliteThumbImage( gadget, winFindImage( "VSliderThumbHilite" ) ); - GadgetSliderSetHiliteThumbColor( gadget, GadgetSliderGetHiliteColor( gadget ) ); - GadgetSliderSetHiliteThumbBorderColor( gadget, GadgetSliderGetHiliteBorderColor( gadget ) ); - GadgetSliderSetHiliteSelectedThumbImage( gadget, winFindImage( "VSliderThumbHiliteSelected" ) ); - GadgetSliderSetHiliteSelectedThumbColor( gadget, GadgetSliderGetHiliteBorderColor( gadget ) ); - GadgetSliderSetHiliteSelectedThumbBorderColor( gadget, GadgetSliderGetHiliteColor( gadget ) ); - - } - else if( BitIsSet( instData->getStyle(), GWS_SCROLL_LISTBOX ) ) - { - ListboxData *listboxData = (ListboxData *)gadget->winGetUserData(); - - // set the colors - GadgetListBoxSetColors( gadget, - red, // enabled - lightRed, // enabled border - yellow, // enabled selected item - white, // enabled selected item border - gray, // disabled - lightGray, // disabled border - lightGray, // disabled selected item - white, // disabled selected item border - green, // hilite - darkGreen, // hilite border - white, // hilite selected item - darkGreen ); // hilite selected item border - - // now set the images - - // enabled - GadgetListBoxSetEnabledImage( gadget, winFindImage( "ListBoxEnabled" ) ); - GadgetListBoxSetEnabledSelectedItemImageLeft( gadget, winFindImage( "ListBoxEnabledSelectedItemLeftEnd" ) ); - GadgetListBoxSetEnabledSelectedItemImageRight( gadget, winFindImage( "ListBoxEnabledSelectedItemRightEnd" ) ); - GadgetListBoxSetEnabledSelectedItemImageCenter( gadget, winFindImage( "ListBoxEnabledSelectedItemRepeatingCenter" ) ); - GadgetListBoxSetEnabledSelectedItemImageSmallCenter( gadget, winFindImage( "ListBoxEnabledSelectedItemSmallRepeatingCenter" ) ); - - // disabled - GadgetListBoxSetDisabledImage( gadget, winFindImage( "ListBoxDisabled" ) ); - GadgetListBoxSetDisabledSelectedItemImageLeft( gadget, winFindImage( "ListBoxDisabledSelectedItemLeftEnd" ) ); - GadgetListBoxSetDisabledSelectedItemImageRight( gadget, winFindImage( "ListBoxDisabledSelectedItemRightEnd" ) ); - GadgetListBoxSetDisabledSelectedItemImageCenter( gadget, winFindImage( "ListBoxDisabledSelectedItemRepeatingCenter" ) ); - GadgetListBoxSetDisabledSelectedItemImageSmallCenter( gadget, winFindImage( "ListBoxDisabledSelectedItemSmallRepeatingCenter" ) ); - - - // hilited - GadgetListBoxSetHiliteImage( gadget, winFindImage( "ListBoxHilite" ) ); - GadgetListBoxSetHiliteSelectedItemImageLeft( gadget, winFindImage( "ListBoxHiliteSelectedItemLeftEnd" ) ); - GadgetListBoxSetHiliteSelectedItemImageRight( gadget, winFindImage( "ListBoxHiliteSelectedItemRightEnd" ) ); - GadgetListBoxSetHiliteSelectedItemImageCenter( gadget, winFindImage( "ListBoxHiliteSelectedItemRepeatingCenter" ) ); - GadgetListBoxSetHiliteSelectedItemImageSmallCenter( gadget, winFindImage( "ListBoxHiliteSelectedItemSmallRepeatingCenter" ) ); - - // assign default slider colors and images as part of the list box - GameWindow *slider = listboxData->slider; - if( slider ) - { - GameWindow *upButton = listboxData->upButton; - GameWindow *downButton = listboxData->downButton; - - // slider and slider thumb ---------------------------------------------- - - // enabled - GadgetSliderSetEnabledImageTop( slider, winFindImage( "VSliderLargeEnabledTopEnd" ) ); - GadgetSliderSetEnabledImageBottom( slider, winFindImage( "VSliderLargeEnabledBottomEnd" ) ); - GadgetSliderSetEnabledImageCenter( slider, winFindImage( "VSliderLargeEnabledRepeatingCenter" ) ); - GadgetSliderSetEnabledImageSmallCenter( slider, winFindImage( "VSliderLargeEnabledSmallRepeatingCenter" ) ); - GadgetSliderSetEnabledThumbImage( slider, winFindImage( "VSliderLargeThumbEnabled" ) ); - GadgetSliderSetEnabledSelectedThumbImage( slider, winFindImage( "VSliderLargeThumbEnabled" ) ); - - // disabled - GadgetSliderSetDisabledImageTop( slider, winFindImage( "VSliderLargeDisabledTopEnd" ) ); - GadgetSliderSetDisabledImageBottom( slider, winFindImage( "VSliderLargeDisabledBottomEnd" ) ); - GadgetSliderSetDisabledImageCenter( slider, winFindImage( "VSliderLargeDisabledRepeatingCenter" ) ); - GadgetSliderSetDisabledImageSmallCenter( slider, winFindImage( "VSliderLargeDisabledSmallRepeatingCenter" ) ); - GadgetSliderSetDisabledThumbImage( slider, winFindImage( "VSliderLargeThumbDisabled" ) ); - GadgetSliderSetDisabledSelectedThumbImage( slider, winFindImage( "VSliderLargeThumbDisabled" ) ); - - // hilite - GadgetSliderSetHiliteImageTop( slider, winFindImage( "VSliderLargeHiliteTopEnd" ) ); - GadgetSliderSetHiliteImageBottom( slider, winFindImage( "VSliderLargeHiliteBottomEnd" ) ); - GadgetSliderSetHiliteImageCenter( slider, winFindImage( "VSliderLargeHiliteRepeatingCenter" ) ); - GadgetSliderSetHiliteImageSmallCenter( slider, winFindImage( "VSliderLargeHiliteSmallRepeatingCenter" ) ); - GadgetSliderSetHiliteThumbImage( slider, winFindImage( "VSliderLargeThumbHilite" ) ); - GadgetSliderSetHiliteSelectedThumbImage( slider, winFindImage( "VSliderLargeThumbHilite" ) ); - - // up button ------------------------------------------------------------ - - // enabled - GadgetButtonSetEnabledImage( upButton, winFindImage( "VSliderLargeUpButtonEnabled" ) ); - GadgetButtonSetEnabledSelectedImage( upButton, winFindImage( "VSliderLargeUpButtonEnabled" ) ); - - // disabled - GadgetButtonSetDisabledImage( upButton, winFindImage( "VSliderLargeUpButtonDisabled" ) ); - GadgetButtonSetDisabledSelectedImage( upButton, winFindImage( "VSliderLargeUpButtonDisabled" ) ); - - // hilite - GadgetButtonSetHiliteImage( upButton, winFindImage( "VSliderLargeUpButtonHilite" ) ); - GadgetButtonSetHiliteSelectedImage( upButton, winFindImage( "VSliderLargeUpButtonHiliteSelected" ) ); - - // down button ---------------------------------------------------------- - - // enabled - GadgetButtonSetEnabledImage( downButton, winFindImage( "VSliderLargeDownButtonEnabled" ) ); - GadgetButtonSetEnabledSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonEnabled" ) ); - - // disabled - GadgetButtonSetDisabledImage( downButton, winFindImage( "VSliderLargeDownButtonDisabled" ) ); - GadgetButtonSetDisabledSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonDisabled" ) ); - - // hilite - GadgetButtonSetHiliteImage( downButton, winFindImage( "VSliderLargeDownButtonHilite" ) ); - GadgetButtonSetHiliteSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonHiliteSelected" ) ); - - } - - } - else if( BitIsSet( instData->getStyle(), GWS_COMBO_BOX ) ) - { -// ComboBoxData *comboBoxData = (ComboBoxData *)gadget->winGetUserData(); - - GadgetComboBoxSetColors( gadget, - red, // enabled - lightRed, // enabled border - yellow, // enabled selected item - white, // enabled selected item border - gray, // disabled - lightGray, // disabled border - lightGray, // disabled selected item - white, // disabled selected item border - green, // hilite - darkGreen, // hilite border - white, // hilite selected item - darkGreen ); // hilite selected item border - - // enabled - GadgetComboBoxSetEnabledImage( gadget, winFindImage( "ListBoxEnabled" ) ); - GadgetComboBoxSetEnabledSelectedItemImageLeft( gadget, winFindImage( "ListBoxEnabledSelectedItemLeftEnd" ) ); - GadgetComboBoxSetEnabledSelectedItemImageRight( gadget, winFindImage( "ListBoxEnabledSelectedItemRightEnd" ) ); - GadgetComboBoxSetEnabledSelectedItemImageCenter( gadget, winFindImage( "ListBoxEnabledSelectedItemRepeatingCenter" ) ); - GadgetComboBoxSetEnabledSelectedItemImageSmallCenter( gadget, winFindImage( "ListBoxEnabledSelectedItemSmallRepeatingCenter" ) ); - - // disabled - GadgetComboBoxSetDisabledImage( gadget, winFindImage( "ListBoxDisabled" ) ); - GadgetComboBoxSetDisabledSelectedItemImageLeft( gadget, winFindImage( "ListBoxDisabledSelectedItemLeftEnd" ) ); - GadgetComboBoxSetDisabledSelectedItemImageRight( gadget, winFindImage( "ListBoxDisabledSelectedItemRightEnd" ) ); - GadgetComboBoxSetDisabledSelectedItemImageCenter( gadget, winFindImage( "ListBoxDisabledSelectedItemRepeatingCenter" ) ); - GadgetComboBoxSetDisabledSelectedItemImageSmallCenter( gadget, winFindImage( "ListBoxDisabledSelectedItemSmallRepeatingCenter" ) ); - - - // hilited - GadgetComboBoxSetHiliteImage( gadget, winFindImage( "ListBoxHilite" ) ); - GadgetComboBoxSetHiliteSelectedItemImageLeft( gadget, winFindImage( "ListBoxHiliteSelectedItemLeftEnd" ) ); - GadgetComboBoxSetHiliteSelectedItemImageRight( gadget, winFindImage( "ListBoxHiliteSelectedItemRightEnd" ) ); - GadgetComboBoxSetHiliteSelectedItemImageCenter( gadget, winFindImage( "ListBoxHiliteSelectedItemRepeatingCenter" ) ); - GadgetComboBoxSetHiliteSelectedItemImageSmallCenter( gadget, winFindImage( "ListBoxHiliteSelectedItemSmallRepeatingCenter" ) ); - - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - GameWindow *dropDownButton = GadgetComboBoxGetDropDownButton( gadget ); - if ( dropDownButton ) - { - // enabled background - GadgetButtonSetEnabledImage( dropDownButton, winFindImage( "PushButtonEnabled" ) ); - // enabled selected button - GadgetButtonSetEnabledSelectedImage( dropDownButton, winFindImage( "PushButtonEnabledSelected" ) ); - - // Disabled background - GadgetButtonSetDisabledImage( dropDownButton, winFindImage( "PushButtonDisabled" ) ); - // Disabled selected button - GadgetButtonSetDisabledSelectedImage( dropDownButton, winFindImage( "PushButtonDisabledSelected" ) ); - - // Hilite background - GadgetButtonSetHiliteImage( dropDownButton, winFindImage( "PushButtonHilite" ) ); - // Hilite selected button - GadgetButtonSetHiliteSelectedImage( dropDownButton, winFindImage( "PushButtonHiliteSelected" ) ); - - } - - GameWindow *editBox = GadgetComboBoxGetEditBox( gadget ); - if ( editBox ) - { - // enabled - GadgetTextEntrySetEnabledImageLeft( editBox, winFindImage( "TextEntryEnabledLeftEnd" ) ); - GadgetTextEntrySetEnabledImageRight( editBox, winFindImage( "TextEntryEnabledRightEnd" ) ); - GadgetTextEntrySetEnabledImageCenter( editBox, winFindImage( "TextEntryEnabledRepeatingCenter" ) ); - GadgetTextEntrySetEnabledImageSmallCenter( editBox, winFindImage( "TextEntryEnabledSmallRepeatingCenter" ) ); - - // disabled - GadgetTextEntrySetDisabledImageLeft( editBox, winFindImage( "TextEntryDisabledLeftEnd" ) ); - GadgetTextEntrySetDisabledImageRight( editBox, winFindImage( "TextEntryDisabledRightEnd" ) ); - GadgetTextEntrySetDisabledImageCenter( editBox, winFindImage( "TextEntryDisabledRepeatingCenter" ) ); - GadgetTextEntrySetDisabledImageSmallCenter( editBox, winFindImage( "TextEntryDisabledSmallRepeatingCenter" ) ); - - // hilited - GadgetTextEntrySetHiliteImageLeft( editBox, winFindImage( "TextEntryHiliteLeftEnd" ) ); - GadgetTextEntrySetHiliteImageRight( editBox, winFindImage( "TextEntryHiliteRightEnd" ) ); - GadgetTextEntrySetHiliteImageCenter( editBox, winFindImage( "TextEntryHiliteRepeatingCenter" ) ); - GadgetTextEntrySetHiliteImageSmallCenter( editBox, winFindImage( "TextEntryHiliteSmallRepeatingCenter" ) ); - - } - - GameWindow * listBox = GadgetComboBoxGetListBox( gadget ); - if ( listBox ) - { - - // now set the images - - // enabled - GadgetListBoxSetEnabledImage( listBox, winFindImage( "ListBoxEnabled" ) ); - GadgetListBoxSetEnabledSelectedItemImageLeft( listBox, winFindImage( "ListBoxEnabledSelectedItemLeftEnd" ) ); - GadgetListBoxSetEnabledSelectedItemImageRight( listBox, winFindImage( "ListBoxEnabledSelectedItemRightEnd" ) ); - GadgetListBoxSetEnabledSelectedItemImageCenter( listBox, winFindImage( "ListBoxEnabledSelectedItemRepeatingCenter" ) ); - GadgetListBoxSetEnabledSelectedItemImageSmallCenter( listBox, winFindImage( "ListBoxEnabledSelectedItemSmallRepeatingCenter" ) ); - - // disabled - GadgetListBoxSetDisabledImage( listBox, winFindImage( "ListBoxDisabled" ) ); - GadgetListBoxSetDisabledSelectedItemImageLeft( listBox, winFindImage( "ListBoxDisabledSelectedItemLeftEnd" ) ); - GadgetListBoxSetDisabledSelectedItemImageRight( listBox, winFindImage( "ListBoxDisabledSelectedItemRightEnd" ) ); - GadgetListBoxSetDisabledSelectedItemImageCenter( listBox, winFindImage( "ListBoxDisabledSelectedItemRepeatingCenter" ) ); - GadgetListBoxSetDisabledSelectedItemImageSmallCenter( listBox, winFindImage( "ListBoxDisabledSelectedItemSmallRepeatingCenter" ) ); - - - // hilited - GadgetListBoxSetHiliteImage( listBox, winFindImage( "ListBoxHilite" ) ); - GadgetListBoxSetHiliteSelectedItemImageLeft( listBox, winFindImage( "ListBoxHiliteSelectedItemLeftEnd" ) ); - GadgetListBoxSetHiliteSelectedItemImageRight( listBox, winFindImage( "ListBoxHiliteSelectedItemRightEnd" ) ); - GadgetListBoxSetHiliteSelectedItemImageCenter( listBox, winFindImage( "ListBoxHiliteSelectedItemRepeatingCenter" ) ); - GadgetListBoxSetHiliteSelectedItemImageSmallCenter( listBox, winFindImage( "ListBoxHiliteSelectedItemSmallRepeatingCenter" ) ); - - // assign default slider colors and images as part of the list box - GameWindow *slider = GadgetListBoxGetSlider( listBox ); - if( slider ) - { - GameWindow *upButton = GadgetListBoxGetUpButton( listBox ); - GameWindow *downButton = GadgetListBoxGetDownButton( listBox ); - - // slider and slider thumb ---------------------------------------------- - - // enabled - GadgetSliderSetEnabledImageTop( slider, winFindImage( "VSliderLargeEnabledTopEnd" ) ); - GadgetSliderSetEnabledImageBottom( slider, winFindImage( "VSliderLargeEnabledBottomEnd" ) ); - GadgetSliderSetEnabledImageCenter( slider, winFindImage( "VSliderLargeEnabledRepeatingCenter" ) ); - GadgetSliderSetEnabledImageSmallCenter( slider, winFindImage( "VSliderLargeEnabledSmallRepeatingCenter" ) ); - GadgetSliderSetEnabledThumbImage( slider, winFindImage( "VSliderLargeThumbEnabled" ) ); - GadgetSliderSetEnabledSelectedThumbImage( slider, winFindImage( "VSliderLargeThumbEnabled" ) ); - - // disabled - GadgetSliderSetDisabledImageTop( slider, winFindImage( "VSliderLargeDisabledTopEnd" ) ); - GadgetSliderSetDisabledImageBottom( slider, winFindImage( "VSliderLargeDisabledBottomEnd" ) ); - GadgetSliderSetDisabledImageCenter( slider, winFindImage( "VSliderLargeDisabledRepeatingCenter" ) ); - GadgetSliderSetDisabledImageSmallCenter( slider, winFindImage( "VSliderLargeDisabledSmallRepeatingCenter" ) ); - GadgetSliderSetDisabledThumbImage( slider, winFindImage( "VSliderLargeThumbDisabled" ) ); - GadgetSliderSetDisabledSelectedThumbImage( slider, winFindImage( "VSliderLargeThumbDisabled" ) ); - - // hilite - GadgetSliderSetHiliteImageTop( slider, winFindImage( "VSliderLargeHiliteTopEnd" ) ); - GadgetSliderSetHiliteImageBottom( slider, winFindImage( "VSliderLargeHiliteBottomEnd" ) ); - GadgetSliderSetHiliteImageCenter( slider, winFindImage( "VSliderLargeHiliteRepeatingCenter" ) ); - GadgetSliderSetHiliteImageSmallCenter( slider, winFindImage( "VSliderLargeHiliteSmallRepeatingCenter" ) ); - GadgetSliderSetHiliteThumbImage( slider, winFindImage( "VSliderLargeThumbHilite" ) ); - GadgetSliderSetHiliteSelectedThumbImage( slider, winFindImage( "VSliderLargeThumbHilite" ) ); - - // up button ------------------------------------------------------------ - - // enabled - GadgetButtonSetEnabledImage( upButton, winFindImage( "VSliderLargeUpButtonEnabled" ) ); - GadgetButtonSetEnabledSelectedImage( upButton, winFindImage( "VSliderLargeUpButtonEnabled" ) ); - - // disabled - GadgetButtonSetDisabledImage( upButton, winFindImage( "VSliderLargeUpButtonDisabled" ) ); - GadgetButtonSetDisabledSelectedImage( upButton, winFindImage( "VSliderLargeUpButtonDisabled" ) ); - - // hilite - GadgetButtonSetHiliteImage( upButton, winFindImage( "VSliderLargeUpButtonHilite" ) ); - GadgetButtonSetHiliteSelectedImage( upButton, winFindImage( "VSliderLargeUpButtonHiliteSelected" ) ); - - // down button ---------------------------------------------------------- - - // enabled - GadgetButtonSetEnabledImage( downButton, winFindImage( "VSliderLargeDownButtonEnabled" ) ); - GadgetButtonSetEnabledSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonEnabled" ) ); - - // disabled - GadgetButtonSetDisabledImage( downButton, winFindImage( "VSliderLargeDownButtonDisabled" ) ); - GadgetButtonSetDisabledSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonDisabled" ) ); - - // hilite - GadgetButtonSetHiliteImage( downButton, winFindImage( "VSliderLargeDownButtonHilite" ) ); - GadgetButtonSetHiliteSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonHiliteSelected" ) ); - - } - } - } - else if( BitIsSet( instData->getStyle(), GWS_PROGRESS_BAR ) ) - { - - // enabled - GadgetProgressBarSetEnabledColor( gadget, red ); - GadgetProgressBarSetEnabledBorderColor( gadget, lightRed ); - GadgetProgressBarSetEnabledImageLeft( gadget, winFindImage( "ProgressBarEnabledLeftEnd" ) ); - GadgetProgressBarSetEnabledImageRight( gadget, winFindImage( "ProgressBarEnabledRightEnd" ) ); - GadgetProgressBarSetEnabledImageCenter( gadget, winFindImage( "ProgressBarEnabledRepeatingCenter" ) ); - GadgetProgressBarSetEnabledImageSmallCenter( gadget, winFindImage( "ProgressBarEnabledSmallRepeatingCenter" ) ); - GadgetProgressBarSetEnabledBarColor( gadget, yellow ); - GadgetProgressBarSetEnabledBarBorderColor( gadget, white ); - GadgetProgressBarSetEnabledBarImageLeft( gadget, winFindImage( "ProgressBarEnabledBarLeftEnd" ) ); - GadgetProgressBarSetEnabledBarImageRight( gadget, winFindImage( "ProgressBarEnabledBarRightEnd" ) ); - GadgetProgressBarSetEnabledBarImageCenter( gadget, winFindImage( "ProgressBarEnabledBarRepeatingCenter" ) ); - GadgetProgressBarSetEnabledBarImageSmallCenter( gadget, winFindImage( "ProgressBarEnabledBarSmallRepeatingCenter" ) ); - - // disabled - GadgetProgressBarSetDisabledColor( gadget, darkGray ); - GadgetProgressBarSetDisabledBorderColor( gadget, lightGray ); - GadgetProgressBarSetDisabledImageLeft( gadget, winFindImage( "ProgressBarDisabledLeftEnd" ) ); - GadgetProgressBarSetDisabledImageRight( gadget, winFindImage( "ProgressBarDisabledRightEnd" ) ); - GadgetProgressBarSetDisabledImageCenter( gadget, winFindImage( "ProgressBarDisabledRepeatingCenter" ) ); - GadgetProgressBarSetDisabledImageSmallCenter( gadget, winFindImage( "ProgressBarDisabledSmallRepeatingCenter" ) ); - GadgetProgressBarSetDisabledBarColor( gadget, lightGray ); - GadgetProgressBarSetDisabledBarBorderColor( gadget, white ); - GadgetProgressBarSetDisabledBarImageLeft( gadget, winFindImage( "ProgressBarDisabledBarLeftEnd" ) ); - GadgetProgressBarSetDisabledBarImageRight( gadget, winFindImage( "ProgressBarDisabledBarRightEnd" ) ); - GadgetProgressBarSetDisabledBarImageCenter( gadget, winFindImage( "ProgressBarDisabledBarRepeatingCenter" ) ); - GadgetProgressBarSetDisabledBarImageSmallCenter( gadget, winFindImage( "ProgressBarDisabledBarSmallRepeatingCenter" ) ); - - // Hilite - GadgetProgressBarSetHiliteColor( gadget, green ); - GadgetProgressBarSetHiliteBorderColor( gadget, darkGreen ); - GadgetProgressBarSetHiliteImageLeft( gadget, winFindImage( "ProgressBarHiliteLeftEnd" ) ); - GadgetProgressBarSetHiliteImageRight( gadget, winFindImage( "ProgressBarHiliteRightEnd" ) ); - GadgetProgressBarSetHiliteImageCenter( gadget, winFindImage( "ProgressBarHiliteRepeatingCenter" ) ); - GadgetProgressBarSetHiliteImageSmallCenter( gadget, winFindImage( "ProgressBarHiliteSmallRepeatingCenter" ) ); - GadgetProgressBarSetHiliteBarColor( gadget, yellow ); - GadgetProgressBarSetHiliteBarBorderColor( gadget, white ); - GadgetProgressBarSetHiliteBarImageLeft( gadget, winFindImage( "ProgressBarHiliteBarLeftEnd" ) ); - GadgetProgressBarSetHiliteBarImageRight( gadget, winFindImage( "ProgressBarHiliteBarRightEnd" ) ); - GadgetProgressBarSetHiliteBarImageCenter( gadget, winFindImage( "ProgressBarHiliteBarRepeatingCenter" ) ); - GadgetProgressBarSetHiliteBarImageSmallCenter( gadget, winFindImage( "ProgressBarHiliteBarSmallRepeatingCenter" ) ); - - } - else if( BitIsSet( instData->getStyle(), GWS_STATIC_TEXT ) ) - { - - // enabled - GadgetStaticTextSetEnabledImage( gadget, winFindImage( "StaticTextEnabled" ) ); - GadgetStaticTextSetEnabledColor( gadget, red ); - GadgetStaticTextSetEnabledBorderColor( gadget, lightRed ); - - // disabled - GadgetStaticTextSetDisabledImage( gadget, winFindImage( "StaticTextDisabled" ) ); - GadgetStaticTextSetDisabledColor( gadget, darkGray ); - GadgetStaticTextSetDisabledBorderColor( gadget, lightGray ); - - // hilite - GadgetStaticTextSetHiliteImage( gadget, winFindImage( "StaticTextHilite" ) ); - GadgetStaticTextSetHiliteColor( gadget, darkGreen ); - GadgetStaticTextSetHiliteBorderColor( gadget, lightGreen ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - } - else if( BitIsSet( instData->getStyle(), GWS_ENTRY_FIELD ) ) - { - - // enabled - GadgetTextEntrySetEnabledImageLeft( gadget, winFindImage( "TextEntryEnabledLeftEnd" ) ); - GadgetTextEntrySetEnabledImageRight( gadget, winFindImage( "TextEntryEnabledRightEnd" ) ); - GadgetTextEntrySetEnabledImageCenter( gadget, winFindImage( "TextEntryEnabledRepeatingCenter" ) ); - GadgetTextEntrySetEnabledImageSmallCenter( gadget, winFindImage( "TextEntryEnabledSmallRepeatingCenter" ) ); - GadgetTextEntrySetEnabledColor( gadget, red ); - GadgetTextEntrySetEnabledBorderColor( gadget, lightRed ); - - // disabled - GadgetTextEntrySetDisabledImageLeft( gadget, winFindImage( "TextEntryDisabledLeftEnd" ) ); - GadgetTextEntrySetDisabledImageRight( gadget, winFindImage( "TextEntryDisabledRightEnd" ) ); - GadgetTextEntrySetDisabledImageCenter( gadget, winFindImage( "TextEntryDisabledRepeatingCenter" ) ); - GadgetTextEntrySetDisabledImageSmallCenter( gadget, winFindImage( "TextEntryDisabledSmallRepeatingCenter" ) ); - GadgetTextEntrySetDisabledColor( gadget, gray ); - GadgetTextEntrySetDisabledBorderColor( gadget, black ); - - // hilited - GadgetTextEntrySetHiliteImageLeft( gadget, winFindImage( "TextEntryHiliteLeftEnd" ) ); - GadgetTextEntrySetHiliteImageRight( gadget, winFindImage( "TextEntryHiliteRightEnd" ) ); - GadgetTextEntrySetHiliteImageCenter( gadget, winFindImage( "TextEntryHiliteRepeatingCenter" ) ); - GadgetTextEntrySetHiliteImageSmallCenter( gadget, winFindImage( "TextEntryHiliteSmallRepeatingCenter" ) ); - GadgetTextEntrySetHiliteColor( gadget, green ); - GadgetTextEntrySetHiliteBorderColor( gadget, darkGreen ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - } - -} - -//------------------------------------------------------------------------------------------------- -/** Given a text label, retreive the real localized text associated - * with that label */ -//------------------------------------------------------------------------------------------------- -UnicodeString GameWindowManager::winTextLabelToText( AsciiString label ) -{ - - // sanity - if( label.isEmpty() ) - return UnicodeString::TheEmptyString; - - /// @todo we need to write the string manager here, this is TEMPORARY!!! - UnicodeString tmp; - tmp.translate(label); - return tmp; - -} - -//------------------------------------------------------------------------------------------------- -/** find the top window at the given coordinates */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEnabled ) -{ - if( m_mouseCaptor ) - { - // in what what window within the captured window are we? - return m_mouseCaptor->winPointInChild( x, y, ignoreEnabled ); - } - - if( m_grabWindow ) - { - // in what what window within the grabbed window are we? - return m_grabWindow->winPointInChild( x, y, ignoreEnabled ); - } - - GameWindow *window = nullptr; - if( m_modalHead && m_modalHead->window ) - { - return m_modalHead->window->winPointInChild( x, y, ignoreEnabled ); - } - else - { - // search for top-level window which contains pointer - for( window = m_windowList; window; window = window->m_next ) - { - - if( BitIsSet( window->m_status, WIN_STATUS_ABOVE ) && - !BitIsSet( window->m_status, WIN_STATUS_HIDDEN ) && - x >= window->m_region.lo.x && - x <= window->m_region.hi.x && - y >= window->m_region.lo.y && - y <= window->m_region.hi.y) - { - if( BitIsSet( window->m_status, WIN_STATUS_ENABLED ) || ignoreEnabled ) - { - // determine which child window the mouse is in - window = window->winPointInChild( x, y, ignoreEnabled ); - break; // exit for - } - } - } - - // check !above, below and hidden - if( window == nullptr ) - { - for( window = m_windowList; window; window = window->m_next ) - { - if( !BitIsSet( window->m_status, WIN_STATUS_ABOVE | - WIN_STATUS_BELOW | - WIN_STATUS_HIDDEN ) && - x >= window->m_region.lo.x && - x <= window->m_region.hi.x && - y >= window->m_region.lo.y && - y <= window->m_region.hi.y) - { - if( BitIsSet( window->m_status, WIN_STATUS_ENABLED )|| ignoreEnabled) - { - // determine which child window the mouse is in - window = window->winPointInChild( x, y, ignoreEnabled ); - break; // exit for - } - } - } - } - - // check below and !hidden - if( window == nullptr ) - { - for( window = m_windowList; window; window = window->m_next ) - { - if( BitIsSet( window->m_status, WIN_STATUS_BELOW ) && - !BitIsSet( window->m_status, WIN_STATUS_HIDDEN ) && - x >= window->m_region.lo.x && - x <= window->m_region.hi.x && - y >= window->m_region.lo.y && - y <= window->m_region.hi.y) - { - if( BitIsSet( window->m_status, WIN_STATUS_ENABLED )|| ignoreEnabled) - { - // determine which child window the mouse is in - window = window->winPointInChild( x, y, ignoreEnabled ); - break; // exit for - } - } - } - } - } - - if( window ) - { - if( BitIsSet( window->m_status, WIN_STATUS_NO_INPUT )) - { - // this window does not accept input, discard - window = nullptr; - } - else if( ignoreEnabled && !( BitIsSet( window->m_status, WIN_STATUS_ENABLED ) )) - { - window = nullptr; - } - } - - return window; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -static WindowMsgHandledType testGrab( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - case GWM_LEFT_DOWN: return MSG_HANDLED; // use it - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** Just for testing */ -//------------------------------------------------------------------------------------------------- -Bool GameWindowManager::initTestGUI() -{ - -// winCreateFromScript( "_ATest.wnd" ); - return TRUE; - -// UnsignedByte alpha = 200; - GameWindow *window; - UnsignedInt statusFlags = WIN_STATUS_ENABLED | WIN_STATUS_DRAGGABLE | WIN_STATUS_IMAGE; - WinInstanceData instData; - - // make some windows inside each other in the upper left - window = winCreate( nullptr, statusFlags, 0, 0, 100, 100, nullptr, nullptr ); - window->winSetInputFunc( testGrab ); - window->winSetEnabledColor( 0, winMakeColor( 255, 254, 255, 255 ) ); - window->winSetEnabledBorderColor( 0 , winMakeColor( 0, 0, 0, 255 ) ); - window = winCreate( window, statusFlags, 10, 10, 50, 50, nullptr, nullptr ); - window->winSetInputFunc( testGrab ); - window->winSetEnabledColor( 0, winMakeColor( 128, 128, 128, 255 ) ); - window->winSetEnabledBorderColor( 0 , winMakeColor( 0, 0, 0, 255 ) ); - - // make a push button - instData.init(); - BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); - instData.m_textLabelString = "What Up?"; - window = gogoGadgetPushButton( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 200, 100, - 100, 30, - &instData, nullptr, TRUE ); - - // make a push button - instData.init(); - BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); - instData.m_textLabelString = "Enabled"; - window = gogoGadgetPushButton( nullptr, - WIN_STATUS_ENABLED, - 330, 100, - 100, 30, - &instData, nullptr, TRUE ); - - // make a push button - instData.init(); - BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); - instData.m_textLabelString = "Disabled"; - window = gogoGadgetPushButton( nullptr, - 0, - 450, 100, - 100, 30, - &instData, nullptr, TRUE ); - - // make a check box - instData.init(); - instData.m_style = GWS_CHECK_BOX | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Check"; - window = gogoGadgetCheckbox( nullptr, - WIN_STATUS_ENABLED | - WIN_STATUS_IMAGE, - 200, 150, - 100, 30, - &instData, nullptr, TRUE ); - - // make a check box - instData.init(); - instData.m_style = GWS_CHECK_BOX | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Check"; - window = gogoGadgetCheckbox( nullptr, - WIN_STATUS_ENABLED, - 330, 150, - 100, 30, - &instData, nullptr, TRUE ); - - // make window to hold radio buttons - window = winCreate( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_DRAGGABLE, - 200, 200, 250, 45, nullptr ); - window->winSetInputFunc( testGrab ); - window->winSetEnabledColor( 0, winMakeColor( 50, 50, 50, 200 ) ); - window->winSetEnabledBorderColor( 0, winMakeColor( 254, 254, 254, 255 ) ); - - // make a radio button - GameWindow *radio; - RadioButtonData rData; - instData.init(); - instData.m_style = GWS_RADIO_BUTTON | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Mama Said!"; - rData.group = 1; - radio = gogoGadgetRadioButton( window, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 10, 10, - 100, 30, - &instData, - &rData, nullptr, TRUE ); - - // make a radio button - instData.init(); - instData.m_style = GWS_RADIO_BUTTON | GWS_MOUSE_TRACK; - instData.m_textLabelString = "On the Run"; - radio = gogoGadgetRadioButton( window, - WIN_STATUS_ENABLED, - 130, 10, - 100, 30, - &instData, - &rData, nullptr, TRUE ); - GadgetRadioSetEnabledColor( radio, GameMakeColor( 0, 0, 255, 255 ) ); - GadgetRadioSetEnabledBorderColor( radio, GameMakeColor( 0, 0, 255, 255 ) ); - - // make a listbox - ListboxData listData; - memset( &listData, 0, sizeof( ListboxData ) ); - listData.listLength = 8; - listData.autoScroll = 1; - listData.scrollIfAtEnd = FALSE; - listData.autoPurge = 1; - listData.scrollBar = 1; - listData.multiSelect = 1; - listData.forceSelect = 0; - listData.columns = 1; - listData.columnWidth = nullptr; - instData.init(); - instData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - window = gogoGadgetListBox( nullptr, - WIN_STATUS_ENABLED, - 200, 250, - 100, 100, - &instData, - &listData, nullptr, TRUE ); - GadgetListBoxAddEntryText( window, L"Listbox text", - winMakeColor( 255, 255, 255, 255 ), -1, 0 ); - GadgetListBoxAddEntryText( window, L"More text", - winMakeColor( 105, 105, 255, 255 ), -1, 0 ); - GadgetListBoxAddEntryText( window, L"Nothing", - winMakeColor( 105, 105, 255, 255 ), -1, 0 ); - GadgetListBoxAddEntryText( window, L"Seasons", - winMakeColor( 105, 205, 255, 255 ), -1, 0 ); - GadgetListBoxAddEntryText( window, L"Misery", - winMakeColor( 235, 105, 255, 255 ), -1, 0 ); - GadgetListBoxAddEntryText( window, L"Natural", - winMakeColor( 105, 205, 45, 255 ), -1, 0 ); - window->winSetFont( TheFontLibrary->getFont( "Times New Roman", 12, FALSE ) ); - - // make a listbox - memset( &listData, 0, sizeof( ListboxData ) ); - listData.listLength = 8; - listData.autoScroll = 1; - listData.scrollIfAtEnd = FALSE; - listData.autoPurge = 1; - listData.scrollBar = 1; - listData.multiSelect = 0; - listData.forceSelect = 0; - listData.columns = 1; - listData.columnWidth = nullptr; - instData.init(); - instData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - window = gogoGadgetListBox( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 75, 250, - 100, 100, - &instData, - &listData, nullptr, TRUE ); - GadgetListBoxAddEntryText( window, L"Listbox text", - winMakeColor( 255, 255, 255, 255 ), -1, -1 ); - GadgetListBoxAddEntryText( window, L"More text", - winMakeColor( 105, 105, 255, 255 ), -1, -1 ); - GadgetListBoxAddEntryText( window, L"Nothing", - winMakeColor( 105, 105, 255, 255 ), -1, -1 ); - GadgetListBoxAddEntryText( window, L"Seasons", - winMakeColor( 105, 205, 255, 255 ), -1, -1 ); - GadgetListBoxAddEntryText( window, L"Misery", - winMakeColor( 235, 105, 255, 255 ), -1, -1 ); - GadgetListBoxAddEntryText( window, L"Natural", - winMakeColor( 105, 205, 45, 255 ), -1, -1 ); - - // make a vert slider - SliderData sliderData; - memset( &sliderData, 0, sizeof( sliderData ) ); - sliderData.maxVal = 100; - sliderData.minVal = 0; - sliderData.numTicks = 100; - sliderData.position = 0; - instData.init(); - instData.m_style = GWS_VERT_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( nullptr, - WIN_STATUS_ENABLED, - 360, 250, - 11, 100, - &instData, - &sliderData, nullptr, TRUE ); - - // make a vert slider - memset( &sliderData, 0, sizeof( sliderData ) ); - sliderData.maxVal = 100; - sliderData.minVal = 0; - sliderData.numTicks = 100; - sliderData.position = 0; - instData.init(); - instData.m_style = GWS_VERT_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 400, 250, - 11, 100, - &instData, - &sliderData, nullptr, TRUE ); - - // make a horizontal slider - memset( &sliderData, 0, sizeof( sliderData ) ); - sliderData.maxVal = 100; - sliderData.minVal = 0; - sliderData.numTicks = 100; - sliderData.position = 0; - instData.init(); - instData.m_style = GWS_HORZ_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( nullptr, - WIN_STATUS_ENABLED, - 200, 400, - 200, 11, - &instData, - &sliderData, nullptr, TRUE ); - - // make a horizontal slider - memset( &sliderData, 0, sizeof( sliderData ) ); - sliderData.maxVal = 100; - sliderData.minVal = 0; - sliderData.numTicks = 100; - sliderData.position = 0; - instData.init(); - instData.m_style = GWS_HORZ_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 200, 420, - 200, 11, - &instData, - &sliderData, nullptr, TRUE ); - - // make a progress bar - instData.init(); - instData.m_style = GWS_PROGRESS_BAR | GWS_MOUSE_TRACK; - window = gogoGadgetProgressBar( nullptr, - WIN_STATUS_ENABLED, - 200, 450, - 250, 15, - &instData, nullptr, TRUE ); - - // make a progress bar - instData.init(); - instData.m_style = GWS_PROGRESS_BAR | GWS_MOUSE_TRACK; - window = gogoGadgetProgressBar( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 200, 470, - 250, 15, - &instData, nullptr, TRUE ); - - // make some static text - TextData textData; - textData.centered = 1; - instData.init(); - instData.m_style = GWS_STATIC_TEXT | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Centered Static Text"; - window = gogoGadgetStaticText( nullptr, - WIN_STATUS_ENABLED, - 200, 490, - 300, 25, - &instData, - &textData, nullptr, TRUE ); - - // make some static text - textData.centered = 0; - instData.init(); - instData.m_style = GWS_STATIC_TEXT | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Not Centered Static Text"; - window = gogoGadgetStaticText( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 200, 520, - 300, 25, - &instData, - &textData, nullptr, TRUE ); - window->winSetEnabledTextColors( winMakeColor( 128, 128, 255, 255 ), - winMakeColor( 255, 255, 255, 255 ) ); - - // make some entry text - EntryData entryData; - memset( &entryData, 0, sizeof( entryData ) ); - entryData.maxTextLen = 30; - instData.init(); - instData.m_style = GWS_ENTRY_FIELD | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Entry"; - window = gogoGadgetTextEntry( nullptr, - WIN_STATUS_ENABLED, - 450, 270, - 400, 30, - &instData, - &entryData, nullptr, TRUE ); - - // make some entry text - memset( &entryData, 0, sizeof( entryData ) ); - entryData.maxTextLen = 30; - instData.init(); - instData.m_style = GWS_ENTRY_FIELD | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Entry"; - window = gogoGadgetTextEntry( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 450, 310, - 400, 30, - &instData, - &entryData, nullptr, TRUE ); - - return TRUE; - -} - - -void GameWindowManager::winNextTab( GameWindow *window ) -{ - if(m_tabList.empty()|| m_modalHead) - return; - - GameWindowList::iterator it = m_tabList.begin(); - while( it != m_tabList.end()) - { - if(*it == window) - { - it++; - break; - } - it++; - } - if(it != m_tabList.end()) - winSetFocus(*it); - else - { - winSetFocus(*m_tabList.begin()); - } - winSetLoneWindow(nullptr); -} - -void GameWindowManager::winPrevTab( GameWindow *window ) -{ - if(m_tabList.empty() || m_modalHead) - return; - - GameWindowList::reverse_iterator it = m_tabList.rbegin(); - while( it != m_tabList.rend()) - { - if(*it == window) - { - it++; - break; - } - it++; - } - if(it != m_tabList.rend()) - winSetFocus(*it); - else - { - winSetFocus(*m_tabList.rbegin()); - } - winSetLoneWindow(nullptr); -} - -void GameWindowManager::registerTabList( GameWindowList tabList ) -{ - m_tabList.clear(); - m_tabList = tabList; -} - -void GameWindowManager::clearTabList() -{ - m_tabList.clear(); -} - - -GameWindow *GameWindowManagerDummy::winGetWindowFromId(GameWindow *window, Int id) -{ - window = GameWindowManager::winGetWindowFromId(window, id); - if (window != nullptr) - return window; - - // Just return any window, callers expect this to be non-null - return m_windowList; -} - -WindowMsgHandledType DummyWindowSystem(GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2) -{ - return MSG_IGNORED; -} - -GameWindow *GameWindowManagerDummy::winCreateFromScript(AsciiString filenameString, WindowLayoutInfo *info) -{ - WindowLayoutInfo scriptInfo; - GameWindow* dummyWindow = winCreate(nullptr, 0, 0, 0, 100, 100, DummyWindowSystem, nullptr); - scriptInfo.windows.push_back(dummyWindow); - if (info) - *info = scriptInfo; - return dummyWindow; -} - -GameWindowDummy::~GameWindowDummy() -{ -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp deleted file mode 100644 index 45dd45f9913..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +++ /dev/null @@ -1,323 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ShellMenuScheme.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Jul 2002 -// -// Filename: ShellMenuScheme.cpp -// -// author: Chris Huybregts -// -// purpose: -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/INI.h" -#include "GameClient/ShellMenuScheme.h" -#include "GameClient/Shell.h" -#include "GameClient/Display.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -const FieldParse ShellMenuSchemeManager::m_shellMenuSchemeFieldParseTable[] = -{ - - { "ImagePart", ShellMenuSchemeManager::parseImagePart, nullptr, 0 }, - { "LinePart", ShellMenuSchemeManager::parseLinePart, nullptr, 0 }, - { nullptr, nullptr, nullptr, 0 } - -}; - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -void INI::parseShellMenuSchemeDefinition( INI *ini ) -{ - AsciiString name; - ShellMenuSchemeManager *SMSchemeManager; - ShellMenuScheme *SMScheme; - - // read the name - const char* c = ini->getNextToken(); - name.set( c ); - - // find existing item if present - SMSchemeManager = TheShell->getShellMenuSchemeManager(); - DEBUG_ASSERTCRASH( SMSchemeManager, ("parseShellMenuSchemeDefinition: Unable to Get SMSchemeManager") ); - if( !SMSchemeManager ) - return; - - // If we have a previously allocated control bar, this will return a cleared out pointer to it so we - // can overwrite it - SMScheme = SMSchemeManager->newShellMenuScheme( name ); - - // sanity - DEBUG_ASSERTCRASH( SMScheme, ("parseControlBarSchemeDefinition: Unable to allocate Scheme '%s'", name.str()) ); - - // parse the ini definition - ini->initFromINI( SMScheme, SMSchemeManager->getFieldParse() ); - -} - -ShellMenuSchemeLine::ShellMenuSchemeLine() -{ - m_startPos.x = m_startPos.y = 0; - m_endPos.x = m_endPos.y = 0; - m_color = GAME_COLOR_UNDEFINED; - m_width = 1; -} -ShellMenuSchemeLine::~ShellMenuSchemeLine() -{ -} - -ShellMenuSchemeImage::ShellMenuSchemeImage() -{ - m_name.clear(); - m_position.x = m_position.y = 0; - m_size.x = m_size.x = 0; - m_image = nullptr; -} - -ShellMenuSchemeImage::~ShellMenuSchemeImage() -{ - m_image = nullptr; -} - -ShellMenuScheme::ShellMenuScheme() -{ - -} - -ShellMenuScheme::~ShellMenuScheme() -{ - ShellMenuSchemeImageListIt it = m_imageList.begin(); - while(it != m_imageList.end()) - { - ShellMenuSchemeImage *image = *it; - it = m_imageList.erase( it ); - delete image; - } - - ShellMenuSchemeLineListIt lineIt = m_lineList.begin(); - while(lineIt != m_lineList.end()) - { - ShellMenuSchemeLine *line = *lineIt; - lineIt = m_lineList.erase( lineIt ); - delete line; - } - - -} - -void ShellMenuScheme::addLine( ShellMenuSchemeLine* schemeLine ) -{ - if(!schemeLine) - return; - - m_lineList.push_back( schemeLine ); -} - - -void ShellMenuScheme::addImage( ShellMenuSchemeImage* schemeImage ) -{ - if(!schemeImage) - return; - - m_imageList.push_back( schemeImage ); -} - -void ShellMenuScheme::draw() -{ - - ShellMenuSchemeImageListIt imageIt = m_imageList.begin(); - while(imageIt != m_imageList.end()) - { - ShellMenuSchemeImage *image = *imageIt; - if(image && image->m_image) - { - TheDisplay->drawImage(image->m_image, image->m_position.x, image->m_position.y, - image->m_position.x + image->m_size.x , image->m_position.y + image->m_size.y); - } - ++imageIt; - } - - ShellMenuSchemeLineListIt it = m_lineList.begin(); - while(it != m_lineList.end()) - { - ShellMenuSchemeLine *line = *it; - - if(line) - { - TheDisplay->drawLine(line->m_startPos.x, line->m_startPos.y, line->m_endPos.x, - line->m_endPos.y,line->m_width, line->m_color); - } - ++it; - } - - -} - -ShellMenuSchemeManager::ShellMenuSchemeManager() -{ - m_currentScheme = nullptr; -} - -ShellMenuSchemeManager::~ShellMenuSchemeManager() -{ - m_currentScheme = nullptr; - - - ShellMenuSchemeListIt it = m_schemeList.begin(); - while(it != m_schemeList.end()) - { - ShellMenuScheme *scheme = *it; - it = m_schemeList.erase( it ); - delete scheme; - } - -} - -void ShellMenuSchemeManager::parseImagePart(INI *ini, void *instance, void* /*store*/, const void* /*userData*/) -{ - static const FieldParse myFieldParse[] = - { - { "Position", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeImage, m_position ) }, - { "Size", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeImage, m_size ) }, - { "ImageName", INI::parseMappedImage, nullptr, offsetof( ShellMenuSchemeImage, m_image ) }, - { nullptr, nullptr, nullptr, 0 } - }; - - ShellMenuSchemeImage *schemeImage = NEW ShellMenuSchemeImage; - ini->initFromINI(schemeImage, myFieldParse); - ((ShellMenuScheme*)instance)->addImage(schemeImage); - -} - -void ShellMenuSchemeManager::parseLinePart(INI *ini, void *instance, void* /*store*/, const void* /*userData*/) -{ - static const FieldParse myFieldParse[] = - { - { "StartPosition", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeLine, m_startPos ) }, - { "EndPosition", INI::parseICoord2D, nullptr, offsetof( ShellMenuSchemeLine, m_endPos ) }, - { "Color", INI::parseColorInt, nullptr, offsetof( ShellMenuSchemeLine, m_color ) }, - { "Width", INI::parseInt, nullptr, offsetof( ShellMenuSchemeLine, m_width ) }, - - { nullptr, nullptr, nullptr, 0 } - }; - - ShellMenuSchemeLine *schemeLine = NEW ShellMenuSchemeLine; - ini->initFromINI(schemeLine, myFieldParse); - ((ShellMenuScheme*)instance)->addLine(schemeLine); - -} - -ShellMenuScheme *ShellMenuSchemeManager::newShellMenuScheme(AsciiString name) -{ - ShellMenuSchemeListIt it; - it = m_schemeList.begin(); - name.toLower(); - while(it != m_schemeList.end()) - { - ShellMenuScheme *scheme = *it; - if(scheme->m_name.compare(name) == 0) - { - m_schemeList.erase( it ); - delete scheme; - break; - } - else - ++it; - } - ShellMenuScheme *newScheme = NEW ShellMenuScheme; - newScheme->m_name.set(name); - m_schemeList.push_back(newScheme); - return newScheme; -} - -void ShellMenuSchemeManager::init() -{ - INI ini; - // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\Default\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); - ini.loadFileDirectory( "Data\\INI\\ShellMenuScheme", INI_LOAD_OVERWRITE, nullptr ); - -} - -void ShellMenuSchemeManager::setShellMenuScheme( AsciiString name ) -{ - if(name.isEmpty()) - { - m_currentScheme = nullptr; - return; - } - - ShellMenuSchemeListIt it; - it = m_schemeList.begin(); - name.toLower(); - while(it != m_schemeList.end()) - { - ShellMenuScheme *scheme = *it; - if(scheme->m_name.compare(name) == 0) - { - m_currentScheme = scheme; - break; - } - ++it; - } -} - -void ShellMenuSchemeManager::draw() -{ - if(m_currentScheme) - m_currentScheme->draw(); -} - -void ShellMenuSchemeManager::update() -{ - -} -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp deleted file mode 100644 index fb657816171..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: .cpp ///////////////////////////////////////////////////////////////////////////////////// -// Author: Colin Day -// Description: Game Client message dispatcher -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/MessageStream.h" -#include "GameClient/GameClient.h" - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -/** The Client message dispatcher, this is the last "translator" on the message - * stream before the messages go to the network for processing. It gives - * the client itself the opportunity to respond to any messages on the stream - * or create new ones to pass along to the network and logic */ -GameMessageDisposition GameClientMessageDispatcher::translateGameMessage(const GameMessage *msg) -{ - if (msg->getType() >= GameMessage::MSG_BEGIN_NETWORK_MESSAGES && msg->getType() <= GameMessage::MSG_END_NETWORK_MESSAGES) - return KEEP_MESSAGE; - if (msg->getType() == GameMessage::MSG_NEW_GAME || msg->getType() == GameMessage::MSG_CLEAR_GAME_DATA) - return KEEP_MESSAGE; - - if (msg->getType() == GameMessage::MSG_FRAME_TICK) - return KEEP_MESSAGE; - - //DEBUG_LOG(("GameClientMessageDispatcher::translateGameMessage() - eating a %s on frame %d", - //((GameMessage *)msg)->getCommandAsString(), TheGameClient->getFrame())); - - return DESTROY_MESSAGE; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp deleted file mode 100644 index 63af29ea6fd..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: HotKey.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Sep 2002 -// -// Filename: HotKey.cpp -// -// author: Chris Huybregts -// -// purpose: -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "GameClient/HotKey.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/MetaEvent.h" -#include "GameClient/GameWindow.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Keyboard.h" -#include "GameClient/GameText.h" -#include "Common/AudioEventRTS.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -GameMessageDisposition HotKeyTranslator::translateGameMessage(const GameMessage *msg) -{ - GameMessageDisposition disp = KEEP_MESSAGE; - GameMessage::Type t = msg->getType(); - - if ( t == GameMessage::MSG_RAW_KEY_UP) - { - - //char key = msg->getArgument(0)->integer; - Int keyState = msg->getArgument(1)->integer; - - // for our purposes here, we don't care to distinguish between right and left keys, - // so just fudge a little to simplify things. - Int newModState = 0; - - if( keyState & KEY_STATE_CONTROL ) - { - newModState |= CTRL; - } - - if( keyState & KEY_STATE_SHIFT ) - { - newModState |= SHIFT; - } - - if( keyState & KEY_STATE_ALT ) - { - newModState |= ALT; - } - if(newModState != 0) - return disp; - WideChar key = TheKeyboard->getPrintableKey((KeyDefType)msg->getArgument(0)->integer, 0); - UnicodeString uKey; - uKey.concat(key); - AsciiString aKey; - aKey.translate(uKey); - if(TheHotKeyManager && TheHotKeyManager->executeHotKey(aKey)) - disp = DESTROY_MESSAGE; - } - return disp; -} - -//----------------------------------------------------------------------------- -HotKey::HotKey() -{ - m_win = nullptr; - m_key.clear(); -} - -//----------------------------------------------------------------------------- -HotKeyManager::HotKeyManager() -{ - -} - -//----------------------------------------------------------------------------- -HotKeyManager::~HotKeyManager() -{ - m_hotKeyMap.clear(); -} - -//----------------------------------------------------------------------------- -void HotKeyManager::init() -{ - m_hotKeyMap.clear(); -} - -//----------------------------------------------------------------------------- -void HotKeyManager::reset() -{ - m_hotKeyMap.clear(); -} - -//----------------------------------------------------------------------------- -void HotKeyManager::addHotKey( GameWindow *win, const AsciiString& keyIn) -{ - AsciiString key = keyIn; - key.toLower(); - HotKeyMap::iterator it = m_hotKeyMap.find(key); - if( it != m_hotKeyMap.end() ) - { - DEBUG_CRASH(("Hotkey %s is already mapped to window %s, current window is %s", key.str(), it->second.m_win->winGetInstanceData()->m_decoratedNameString.str(), win->winGetInstanceData()->m_decoratedNameString.str())); - return; - } - HotKey newHK; - newHK.m_key.set(key); - newHK.m_win = win; - m_hotKeyMap[key] = newHK; -} - -//----------------------------------------------------------------------------- -Bool HotKeyManager::executeHotKey( const AsciiString& keyIn ) -{ - AsciiString key = keyIn; - key.toLower(); - HotKeyMap::iterator it = m_hotKeyMap.find(key); - if( it == m_hotKeyMap.end() ) - return FALSE; - GameWindow *win = it->second.m_win; - if( !win ) - return FALSE; - if( !BitIsSet( win->winGetStatus(), WIN_STATUS_HIDDEN ) ) - { - if( BitIsSet( win->winGetStatus(), WIN_STATUS_ENABLED ) ) - { - TheWindowManager->winSendSystemMsg( win->winGetParent(), GBM_SELECTED, (WindowMsgData)win, win->winGetWindowId() ); - - // here we make the same click sound that the GUI uses when you click a button - AudioEventRTS buttonClick("GUIClick"); - - if( TheAudio ) - { - TheAudio->addAudioEvent( &buttonClick ); - } - return TRUE; - } - - AudioEventRTS disabledClick( "GUIClickDisabled" ); - if( TheAudio ) - { - TheAudio->addAudioEvent( &disabledClick ); - } - } - return FALSE; -} - -//----------------------------------------------------------------------------- -AsciiString HotKeyManager::searchHotKey( const AsciiString& label) -{ - return searchHotKey(TheGameText->fetch(label)); -} - -//----------------------------------------------------------------------------- -AsciiString HotKeyManager::searchHotKey( const UnicodeString& uStr ) -{ - if(uStr.isEmpty()) - return AsciiString::TheEmptyString; - - const WideChar *marker = (const WideChar *)uStr.str(); - while (marker && *marker) - { - if (*marker == L'&') - { - // found a '&' - now look for the next char - UnicodeString tmp = UnicodeString::TheEmptyString; - tmp.concat(*(marker+1)); - AsciiString retStr; - retStr.translate(tmp); - return retStr; - } - marker++; - } - return AsciiString::TheEmptyString; -} - -//----------------------------------------------------------------------------- -HotKeyManager *TheHotKeyManager = nullptr; - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - diff --git a/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp b/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp deleted file mode 100644 index 26a2f18ae53..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/System/Anim2D.cpp +++ /dev/null @@ -1,865 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Anim2D.cpp /////////////////////////////////////////////////////////////////////////////// -// Author: Colin Day, July 2002 -// Desc: A collection of 2D images to make animation -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -#define DEFINE_ANIM_2D_MODE_NAMES -#include "Common/RandomValue.h" -#include "Common/Xfer.h" -#include "GameClient/Anim2D.h" -#include "GameClient/Display.h" -#include "GameClient/Image.h" -#include "GameLogic/GameLogic.h" - - -// GLOBAL ///////////////////////////////////////////////////////////////////////////////////////// -Anim2DCollection *TheAnim2DCollection = nullptr; - -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -Anim2DTemplate::Anim2DTemplate( AsciiString name ) -{ - - m_name = name; - m_images = nullptr; - m_numFrames = NUM_FRAMES_INVALID; - m_framesBetweenUpdates = 0; - m_animMode = ANIM_2D_LOOP; - m_randomizeStartFrame = FALSE; - m_nextTemplate = nullptr; - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -Anim2DTemplate::~Anim2DTemplate() -{ - - delete [] m_images; - -} - -// ------------------------------------------------------------------------------------------------ -/** Field parse table for 2D animation templates */ -// ---------i--------------------------------------------------------------------------------------- -const FieldParse Anim2DTemplate::s_anim2DFieldParseTable[] = -{ - - { "NumberImages", Anim2DTemplate::parseNumImages, nullptr, 0 }, - { "Image", Anim2DTemplate::parseImage, nullptr, 0 }, - { "ImageSequence", Anim2DTemplate::parseImageSequence, nullptr, 0 }, - { "AnimationMode", INI::parseIndexList, Anim2DModeNames, offsetof( Anim2DTemplate, m_animMode ) }, - { "AnimationDelay", INI::parseDurationUnsignedShort, nullptr, offsetof( Anim2DTemplate, m_framesBetweenUpdates ) }, - { "RandomizeStartFrame", INI::parseBool, nullptr, offsetof( Anim2DTemplate, m_randomizeStartFrame ) }, - { nullptr, nullptr, nullptr, 0 } - -}; - -// ------------------------------------------------------------------------------------------------ -/** Parse the number of images we will have in this animation and allocate the array for them */ -// ------------------------------------------------------------------------------------------------ -void Anim2DTemplate::parseNumImages( INI *ini, void *instance, void *store, const void *userData ) -{ - - // parse the integer data from the file - UnsignedInt numFrames; - ini->parseUnsignedInt( ini, instance, &numFrames, userData ); - - // get the template we are to store into - Anim2DTemplate *animTemplate = (Anim2DTemplate *)instance; - - // animations must have a minimum # of frames - Int minimumFrames = 1; - if( numFrames < minimumFrames ) - { - - DEBUG_CRASH(( "Anim2DTemplate::parseNumImages - Invalid animation '%s', animations must have '%d' or more frames defined", - animTemplate->getName().str(), minimumFrames )); - throw INI_INVALID_DATA; - - } - - // allocate the image array - animTemplate->allocateImages( (UnsignedShort)numFrames ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Allocate the image array for an animation template and store the number of frames we have */ -// ------------------------------------------------------------------------------------------------ -void Anim2DTemplate::allocateImages( UnsignedShort numFrames ) -{ - - // store the number of frames - m_numFrames = numFrames; - - // allocate an array to hold the image pointers - m_images = NEW const Image *[ m_numFrames ]; // pool[]ify - - // set all the images to nullptr; - for( Int i = 0; i < m_numFrames; ++i ) - m_images[ i ] = nullptr; - -} - -// ------------------------------------------------------------------------------------------------ -/** Parsing a single image definition for an animation */ -// ------------------------------------------------------------------------------------------------ -void Anim2DTemplate::parseImage( INI *ini, void *instance, void *store, const void *userData ) -{ - - // parse the image name from the file and store as an image pointer - const Image *image; - ini->parseMappedImage( ini, instance, &image, userData ); - - // sanity - if( image == nullptr ) - { - - //We don't care if we're in the builder - //DEBUG_CRASH(( "Anim2DTemplate::parseImage - Image not found" )); - //throw INI_INVALID_DATA; - - } - - // - // assign the image to the animation template list of images ... note since we've pre-allocated - // the array of images and the index an image is loaded into depends on its order specified - // in INI, we need to get the number of images currently loaded into this animation template - // so that we can put it at the next free image spot ... and then tell the animation - // template we've loaded one more - // - Anim2DTemplate *animTemplate = (Anim2DTemplate *)instance; - animTemplate->storeImage( image ); - -} - -// ------------------------------------------------------------------------------------------------ -/** This will parse the image sequence of an animation. You can use this as a shortcut to - * specifying a series of images for an animation instead of having to specify them all - * individually. Image names will be assumed to start with an appended "000" to the end - * end of the first image name and incremented up to the number of images for the - * animation. NOTE: That the number images *must* have already been specified before - * we can parse this entry so we know how many images to allocate and look for */ -// ------------------------------------------------------------------------------------------------ -/*static*/ void Anim2DTemplate::parseImageSequence( INI *ini, void *instance, - void *store, const void *userData ) -{ - - // get the animation template - Anim2DTemplate *animTemplate = (Anim2DTemplate *)instance; - - // - // before we can read, allocate, and find all the images for the sequence ... we must - // know how many total images are in this animation. Verify that now - // - if( animTemplate->getNumFrames() == NUM_FRAMES_INVALID ) - { - - DEBUG_CRASH(( "Anim2DTemplate::parseImageSequence - You must specify the number of animation frames for animation '%s' *BEFORE* specifying the image sequence name", - animTemplate->getName().str() )); - throw INI_INVALID_DATA; - - } - - // - // the image storage has already been allocated, all we have to do now is count from - // 0 to numImages - 1 and add those images to the template - // - AsciiString imageBaseName = ini->getNextAsciiString(); - AsciiString imageName; - const Image *image; - for( Int i = 0; i < animTemplate->getNumFrames(); ++i ) - { - - // construct this name - imageName.format( "%s%03d", imageBaseName.str(), i ); - - // search for this image - image = TheMappedImageCollection->findImageByName( imageName ); - - // sanity - if( image == nullptr ) - { - - DEBUG_CRASH(( "Anim2DTemplate::parseImageSequence - Image '%s' not found for animation '%s'. Check the number of images specified in INI and also make sure all the actual images exist.", - imageName.str(), animTemplate->getName().str() )); - throw INI_INVALID_DATA; - - } - - // store the image in the next free frame - animTemplate->storeImage( image ); - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Store the image at the next open image slot for the animation */ -// ------------------------------------------------------------------------------------------------ -void Anim2DTemplate::storeImage( const Image *image ) -{ - - // sanity - if( image == nullptr ) - return; - - // search through the image list and store at the next free spot - for( Int i = 0; i < m_numFrames; ++i ) - { - - if( m_images[ i ] == nullptr ) - { - - m_images[ i ] = image; - return; - - } - - } - - // if we got here we tried to store an image in an array that was too small - DEBUG_CRASH(( "Anim2DTemplate::storeImage - Unable to store image '%s' into animation '%s' because the animation is setup to only support '%d' image frames", - image->getName().str(), getName().str(), m_numFrames )); - throw INI_INVALID_DATA; - -} - -// ------------------------------------------------------------------------------------------------ -/** Return the Image* for the frame number requested */ -// ------------------------------------------------------------------------------------------------ -const Image* Anim2DTemplate::getFrame( UnsignedShort frameNumber ) const -{ - - // sanity - DEBUG_ASSERTCRASH( m_images != nullptr, - ("Anim2DTemplate::getFrame - Image data is null for animation '%s'", - getName().str()) ); - - // sanity - if( frameNumber < 0 || frameNumber >= m_numFrames ) - { - - DEBUG_CRASH(( "Anim2DTemplate::getFrame - Illegal frame number '%d' for animation '%s'", - frameNumber, getName().str() )); - return nullptr; - - } - else - { - - // return the image frame - return m_images[ frameNumber ]; - - } - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -Anim2D::Anim2D( Anim2DTemplate *animTemplate, Anim2DCollection *collectionSystem ) -{ - // sanity - DEBUG_ASSERTCRASH( animTemplate != nullptr, ("Anim2D::Anim2D - null template") ); - m_currentFrame = 0; - - // set the template - m_template = animTemplate; - - // initialize members - m_status = ANIM_2D_STATUS_NONE; - m_alpha = 1.0f; - - // set the initial frame for the animation based on the type of animation mode or randomize - if( m_template->isRandomizedStartFrame() ) - randomizeCurrentFrame(); - else - reset(); - - m_minFrame = 0; - m_maxFrame = m_template->getNumFrames() - 1; - m_framesBetweenUpdates = m_template->getNumFramesBetweenUpdates(); - - // we register ourselves to the System - m_collectionSystemNext = nullptr; - m_collectionSystemPrev = nullptr; - - m_lastUpdateFrame = 0; - - // if a system is present, register ourselves with that system - m_collectionSystem = collectionSystem; - if( m_collectionSystem ) - m_collectionSystem->registerAnimation( this ); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -Anim2D::~Anim2D() -{ - - // if we were registered with a system, un-register ourselves - if( m_collectionSystem ) - m_collectionSystem->unRegisterAnimation( this ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Set the current animation frame */ -// ------------------------------------------------------------------------------------------------ -void Anim2D::setCurrentFrame( UnsignedShort frame ) -{ - - // sanity - DEBUG_ASSERTCRASH( m_template != nullptr, ("Anim2D::reset - No template for animation") ); - - // sanity - DEBUG_ASSERTCRASH( TheGameLogic != nullptr, - ("Anim2D::setCurrentFrame - TheGameLogic must exist to use animation instances (%s)", - m_template->getName().str()) ); - - // sanity - DEBUG_ASSERTCRASH( frame >= 0 && frame < m_template->getNumFrames(), - ("Anim2D::setCurrentFrame - Illegal frame number '%d' in animation", - frame, m_template->getName().str()) ); - - // set the frame - m_currentFrame = frame; - - // record the frame of this update to our current frame - m_lastUpdateFrame = TheGameLogic->getFrame(); - -} - -// ------------------------------------------------------------------------------------------------ -/** Randomize the current frame */ -// ------------------------------------------------------------------------------------------------ -void Anim2D::randomizeCurrentFrame() -{ - - // sanity - DEBUG_ASSERTCRASH( m_template != nullptr, ("Anim2D::reset - No template for animation") ); - - // set the current frame to a random frame - setCurrentFrame( GameClientRandomValue( 0, m_template->getNumFrames() - 1 ) ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Reset this animation instance to the "start" of the animation */ -// ------------------------------------------------------------------------------------------------ -void Anim2D::reset() -{ - - // sanity - DEBUG_ASSERTCRASH( m_template != nullptr, ("Anim2D::reset - No template for animation") ); - - switch( m_template->getAnimMode() ) - { - - // -------------------------------------------------------------------------------------------- - case ANIM_2D_ONCE: - case ANIM_2D_LOOP: - case ANIM_2D_PING_PONG: - setCurrentFrame( m_minFrame ); - break; - - // -------------------------------------------------------------------------------------------- - case ANIM_2D_ONCE_BACKWARDS: - case ANIM_2D_LOOP_BACKWARDS: - case ANIM_2D_PING_PONG_BACKWARDS: - setCurrentFrame( m_maxFrame ); - break; - - // -------------------------------------------------------------------------------------------- - default: - DEBUG_CRASH(( "Anim2D::reset - Unknown animation mode '%d' for '%s'", - m_template->getAnimMode(), m_template->getName().str() )); - break; - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** This is called after we are drawn ... if sufficient time has passed since our last - * frame update we will update our current frame */ -// ------------------------------------------------------------------------------------------------ -void Anim2D::tryNextFrame() -{ - - // sanity - DEBUG_ASSERTCRASH( TheGameLogic != nullptr, - ("Anim2D::tryNextFrame - TheGameLogic must exist to use animation instances (%s)", - m_template->getName().str()) ); - - // how many frames have passed since our last update - if( TheGameLogic->getFrame() - m_lastUpdateFrame >= m_framesBetweenUpdates ) - { - - switch( m_template->getAnimMode() ) - { - - // ------------------------------------------------------------------------------------------ - case ANIM_2D_ONCE: - { - - if( m_currentFrame < m_maxFrame ) - setCurrentFrame( m_currentFrame + 1 ); - else - setStatus( ANIM_2D_STATUS_COMPLETE ); - break; - - } - - // ------------------------------------------------------------------------------------------- - case ANIM_2D_ONCE_BACKWARDS: - { - - if( m_currentFrame > m_minFrame ) - setCurrentFrame( m_currentFrame - 1 ); - else - setStatus( ANIM_2D_STATUS_COMPLETE ); - break; - - } - - // ------------------------------------------------------------------------------------------- - case ANIM_2D_LOOP: - { - - if( m_currentFrame == m_maxFrame ) - setCurrentFrame( m_minFrame ); - else - setCurrentFrame( m_currentFrame + 1 ); - break; - - } - - // ------------------------------------------------------------------------------------------- - case ANIM_2D_LOOP_BACKWARDS: - { - - if( m_currentFrame > m_minFrame ) - setCurrentFrame( m_currentFrame - 1 ); - else - setCurrentFrame( m_maxFrame ); - break; - - } - - // ------------------------------------------------------------------------------------------- - case ANIM_2D_PING_PONG: - case ANIM_2D_PING_PONG_BACKWARDS: - { - - if( BitIsSet( m_status, ANIM_2D_STATUS_REVERSED ) ) - { - // - // decrement frame, unless we're at frame 0 in which case we - // increment and reverse directions - // - if( m_currentFrame == m_minFrame ) - { - - setCurrentFrame( m_currentFrame + 1 ); - clearStatus( ANIM_2D_STATUS_REVERSED ); - - } - else - { - - setCurrentFrame( m_currentFrame - 1 ); - - } - - } - else - { - - // - // increment frame, unless we're at the end in which case we decrement - // and reverse directions - // - if( m_currentFrame == m_maxFrame ) - { - - setCurrentFrame( m_currentFrame - 1 ); - setStatus( ANIM_2D_STATUS_REVERSED ); - - } - else - { - - setCurrentFrame( m_currentFrame + 1 ); - - } - - } - - break; - - } - - // ------------------------------------------------------------------------------------------- - default: - { - - DEBUG_CRASH(( "Anim2D::tryNextFrame - Unknown animation mode '%d' for '%s'", - m_template->getAnimMode(), m_template->getName().str() )); - break; - - } - - } - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Set status bit */ -// ------------------------------------------------------------------------------------------------ -void Anim2D::setStatus( UnsignedByte statusBits ) -{ - - // set the bits - BitSet( m_status, statusBits ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Clear status bit */ -// ------------------------------------------------------------------------------------------------ -void Anim2D::clearStatus( UnsignedByte statusBits ) -{ - - // clear bits - BitClear( m_status, statusBits ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Return the "natural" width of the image for our current frame */ -// ------------------------------------------------------------------------------------------------ -UnsignedInt Anim2D::getCurrentFrameWidth() const -{ - const Image *currentFrameImage = m_template->getFrame( m_currentFrame ); - - if( currentFrameImage ) - return currentFrameImage->getImageWidth(); - - return 0; - -} - -// ------------------------------------------------------------------------------------------------ -/** Return the "natural" height of the image for our current frame */ -// ------------------------------------------------------------------------------------------------ -UnsignedInt Anim2D::getCurrentFrameHeight() const -{ - const Image *currentFrameImage = m_template->getFrame( m_currentFrame ); - - if( currentFrameImage ) - return currentFrameImage->getImageHeight(); - - return 0; - -} - -// ------------------------------------------------------------------------------------------------ -/** Draw an Anim2D using the natural width and height of the image data */ -// ------------------------------------------------------------------------------------------------ -void Anim2D::draw( Int x, Int y ) -{ - - // get the current image - const Image *image = m_template->getFrame( m_currentFrame ); - - // sanity - DEBUG_ASSERTCRASH( image != nullptr, ("Anim2D::draw - Image not found for frame '%d' on animation '%s'", - m_currentFrame, m_template->getName().str()) ); - - // get the natural width and height of this image - const ICoord2D *imageSize = image->getImageSize(); - - // draw the image - Color color = GameMakeColor( 255, 255, 255, 255 * m_alpha ); - TheDisplay->drawImage( image, x, y, x + imageSize->x, y + imageSize->y, color ); - - // - // see if it's time for us to go to the next frame in the sequence, we do not update - // frame numbers for animation instances that are registered with a system as the - // system will update them during its update phase - // - if( m_collectionSystem == nullptr && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) - tryNextFrame(); - -} - -// ------------------------------------------------------------------------------------------------ -/** Drawing an Anim2D using a forced width and height */ -// ------------------------------------------------------------------------------------------------ -void Anim2D::draw( Int x, Int y, Int width, Int height ) -{ - - // get the current image - const Image *image = m_template->getFrame( m_currentFrame ); - - // sanity - DEBUG_ASSERTCRASH( image != nullptr, ("Anim2D::draw - Image not found for frame '%d' on animation '%s'", - m_currentFrame, m_template->getName().str()) ); - - - // draw image to the display - Color color = GameMakeColor( 255, 255, 255, 255 * m_alpha ); - TheDisplay->drawImage( image, x, y, x + width, y + height, color ); - - // - // see if it's time for us to go to the next frame in the sequence, we do not update - // frame numbers for animation instances that are registered with a system as the - // system will update them during its update phase - // - if( m_collectionSystem == nullptr && BitIsSet( m_status, ANIM_2D_STATUS_FROZEN ) == FALSE ) - tryNextFrame(); - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer Method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void Anim2D::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // current frame - xfer->xferUnsignedShort( &m_currentFrame ); - - // last update frame - xfer->xferUnsignedInt( &m_lastUpdateFrame ); - - // status - xfer->xferUnsignedByte( &m_status ); - - // min frame - xfer->xferUnsignedShort( &m_minFrame ); - - // max frame - xfer->xferUnsignedShort( &m_maxFrame ); - - // frames between updates - xfer->xferUnsignedInt( &m_framesBetweenUpdates ); - - // alpha - xfer->xferReal( &m_alpha ); - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -Anim2DCollection::Anim2DCollection() -{ - - m_templateList = nullptr; - m_instanceList = nullptr; -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -Anim2DCollection::~Anim2DCollection() -{ - - // there should not be any animation instances registered with us since we're being destroyed - DEBUG_ASSERTCRASH( m_instanceList == nullptr, ("Anim2DCollection - instance list is not null") ); - - // delete all the templates - Anim2DTemplate *nextTemplate; - while( m_templateList ) - { - - // get next template - nextTemplate = m_templateList->friend_getNextTemplate(); - - // delete this template - deleteInstance(m_templateList); - - // set the head of our list to the next template - m_templateList = nextTemplate; - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Initialize 2D animation collection */ -// ------------------------------------------------------------------------------------------------ -void Anim2DCollection::init() -{ - INI ini; - - ini.loadFileDirectory( "Data\\INI\\Animation2D", INI_LOAD_OVERWRITE, nullptr ); - -} - -// ------------------------------------------------------------------------------------------------ -/** System update phase */ -// ------------------------------------------------------------------------------------------------ -void Anim2DCollection::update() -{ - Anim2D *anim; - - // go through all our animations - for( anim = m_instanceList; anim; anim = anim->m_collectionSystemNext ) - { - - // try to update the frame - if( BitIsSet( anim->getStatus(), ANIM_2D_STATUS_FROZEN ) == FALSE ) - anim->tryNextFrame(); - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Search the template list for a template with a matching name */ -// ------------------------------------------------------------------------------------------------ -Anim2DTemplate *Anim2DCollection::findTemplate( const AsciiString& name ) -{ - - // search the list - for( Anim2DTemplate *animTemplate = m_templateList; - animTemplate; - animTemplate = animTemplate->friend_getNextTemplate() ) - { - - if( animTemplate->getName() == name ) - return animTemplate; - - } - - return nullptr; // template not found - -} - -//------------------------------------------------------------------------------------------------- -Anim2DTemplate* Anim2DCollection::getNextTemplate( Anim2DTemplate *animTemplate ) const -{ - if( animTemplate ) - { - return animTemplate->friend_getNextTemplate(); - } - return nullptr; -} - -// ------------------------------------------------------------------------------------------------ -/** Allocate a new template, assign name, and link to our internal list */ -// ------------------------------------------------------------------------------------------------ -Anim2DTemplate *Anim2DCollection::newTemplate( const AsciiString& name ) -{ - - // allocate a new template - Anim2DTemplate *animTemplate = newInstance(Anim2DTemplate)( name ); - - // link to our template list - animTemplate->friend_setNextTemplate( m_templateList ); - m_templateList = animTemplate; - - // return the new template - return animTemplate; - -} - -// ------------------------------------------------------------------------------------------------ -/** Register animation instance with us. When an animation instance is registered it can - * be updated even when it's not drawn */ -// ------------------------------------------------------------------------------------------------ -void Anim2DCollection::registerAnimation( Anim2D *anim ) -{ - - // sanity - if( anim == nullptr ) - return; - - // sanity - DEBUG_ASSERTCRASH( anim->m_collectionSystemNext == nullptr && - anim->m_collectionSystemPrev == nullptr, - ("Registering animation instance, instance '%s' is already in a system", - anim->getAnimTemplate()->getName().str()) ); - - // tie to our list - anim->m_collectionSystemPrev = nullptr; - anim->m_collectionSystemNext = m_instanceList; - if( m_instanceList ) - m_instanceList->m_collectionSystemPrev = anim; - m_instanceList = anim; - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void Anim2DCollection::unRegisterAnimation( Anim2D *anim ) -{ - - // sanity - if( anim == nullptr ) - return; - - // if animation is not registered with us do nothing - if( anim->m_collectionSystem != this ) - return; - - // unlink from our instance list - if( anim->m_collectionSystemNext ) - anim->m_collectionSystemNext->m_collectionSystemPrev = anim->m_collectionSystemPrev; - if( anim->m_collectionSystemPrev ) - anim->m_collectionSystemPrev->m_collectionSystemNext = anim->m_collectionSystemNext; - else - m_instanceList = anim->m_collectionSystemNext; - -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/System/DebugDisplay.cpp b/Generals/Code/GameEngine/Source/GameClient/System/DebugDisplay.cpp deleted file mode 100644 index 0132456a953..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/System/DebugDisplay.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//---------------------------------------------------------------------------- -// -// Project: Generals -// -// Module: Debug -// -// File name: DebugDisplay.cpp -// -// Created: 11/13/01 TR -// -//---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------------- - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/DebugDisplay.h" - -//---------------------------------------------------------------------------- -// Externals -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Defines -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Types -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Data -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Public Data -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Prototypes -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Functions -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Public Functions -//---------------------------------------------------------------------------- - - -//============================================================================ -// DebugDisplay::DebugDisplay -//============================================================================ - -DebugDisplay::DebugDisplay() -: m_width(0), - m_height(0) -{ - reset(); -} - -//============================================================================ -// DebugDisplay::reset -//============================================================================ - -void DebugDisplay::reset() -{ - setCursorPos( 0, 0 ); - setTextColor( WHITE ); - setRightMargin( 0 ); - setLeftMargin( getWidth() ); -} -//============================================================================ -// DebugDisplay::setCursorPos -//============================================================================ - -void DebugDisplay::setCursorPos( Int x, Int y ) -{ - m_xPos = x; - m_yPos = y; -} - -//============================================================================ -// DebugDisplay::getCursorXPos -//============================================================================ - -Int DebugDisplay::getCursorXPos() -{ - return m_xPos; -} - -//============================================================================ -// DebugDisplay::getCursorYPos -//============================================================================ - -Int DebugDisplay::getCursorYPos() -{ - return m_yPos; -} - -//============================================================================ -// DebugDisplay::getWidth -//============================================================================ - -Int DebugDisplay::getWidth() -{ - return m_width; -} - -//============================================================================ -// DebugDisplay::getHeight -//============================================================================ - -Int DebugDisplay::getHeight() -{ - return m_height; -} - -//============================================================================ -// DebugDisplay::setTextColor -//============================================================================ - -void DebugDisplay::setTextColor( Color color ) -{ - m_textColor = color; -} - -//============================================================================ -// DebugDisplay::setRightMargin -//============================================================================ - -void DebugDisplay::setRightMargin( Int rightPos ) -{ - m_rightMargin = rightPos; -} - -//============================================================================ -// DebugDisplay::setLeftMargin -//============================================================================ - -void DebugDisplay::setLeftMargin( Int leftPos ) -{ - m_leftMargin = leftPos; -} - -//============================================================================ -// DebugDisplay::printf -//============================================================================ - -void DebugDisplay::printf( const Char *format, ...) -{ - va_list args; - int result; - static char text[5*1024]; - - va_start( args, format ); - result = vsprintf( text, format, args ); - va_end( args ); - - if ( result < 0 ) - { - // error while printing string - return; - } - - DEBUG_ASSERTCRASH( result < sizeof(text), ("text overflow in DebugDisplay::printf() - string too long")); - - // find every line and print it - Char *ptr = text; - Char *lineStart = ptr; - Int lineLen = 0; - Char ch; - - while ( (ch = *ptr++) != 0 ) - { - switch ( ch ) - { - case '\n': - { - if ( lineLen > 0 ) - { - *(ptr -1) = 0; // replace '/n' with null - drawText( m_rightMargin + m_xPos, m_yPos, lineStart ); - lineLen = 0; - } - lineStart = ptr; - m_yPos++; - m_xPos = 0; - break; - } - - default: - { - lineLen++; - break; - } - } - } - - if ( lineLen > 0 ) - { - drawText( m_rightMargin + m_xPos, m_yPos, lineStart ); - m_xPos += lineLen; - } -} diff --git a/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp b/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp deleted file mode 100644 index 4df68a78836..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/System/Image.cpp +++ /dev/null @@ -1,273 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Image.cpp //////////////////////////////////////////////////////////////////////////////// -// Created: Colin Day, June 2001 -// Desc: High level representation of images, this is currently being -// written so we have a way to refer to images in the windows -// GUI, this system should be replaced with something that can -// handle real image management or written to accommodate -// all parts of the engine that need images. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#define DEFINE_IMAGE_STATUS_NAMES -#include "Lib/BaseType.h" -#include "Common/Debug.h" -#include "Common/INI.h" -#include "Common/GlobalData.h" -#include "GameClient/Image.h" -#include "Common/NameKeyGenerator.h" - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -const FieldParse Image::m_imageFieldParseTable[] = -{ - - { "Texture", INI::parseAsciiString, nullptr, offsetof( Image, m_filename ) }, - { "TextureWidth", INI::parseInt, nullptr, offsetof( Image, m_textureSize.x ) }, - { "TextureHeight", INI::parseInt, nullptr, offsetof( Image, m_textureSize.y ) }, - { "Coords", Image::parseImageCoords, nullptr, offsetof( Image, m_UVCoords ) }, - { "Status", Image::parseImageStatus, nullptr, offsetof( Image, m_status ) }, - - { nullptr, nullptr, nullptr, 0 } - -}; - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// -//------------------------------------------------------------------------------------------------- -/** Parse an image coordinates in the form of - * - * COORDS = Left:AAA Top:BBB Right:CCC Bottom:DDD */ -//------------------------------------------------------------------------------------------------- -void Image::parseImageCoords( INI* ini, void *instance, void *store, const void* /*userData*/ ) -{ - Int left = INI::scanInt(ini->getNextSubToken("Left")); - Int top = INI::scanInt(ini->getNextSubToken("Top")); - Int right = INI::scanInt(ini->getNextSubToken("Right")); - Int bottom = INI::scanInt(ini->getNextSubToken("Bottom")); - - // get the image we're storing in - Image *theImage = (Image *)instance; - - // - // store the UV coords based on what we've read in and the texture size - // defined for this image - // - Region2D uvCoords; - - uvCoords.lo.x = (Real)left; - uvCoords.lo.y = (Real)top; - uvCoords.hi.x = (Real)right; - uvCoords.hi.y = (Real)bottom; - - // adjust the coords by texture size - const ICoord2D *textureSize = theImage->getTextureSize(); - if( textureSize->x ) - { - uvCoords.lo.x /= (Real)textureSize->x; - uvCoords.hi.x /= (Real)textureSize->x; - } - if( textureSize->y ) - { - uvCoords.lo.y /= (Real)textureSize->y; - uvCoords.hi.y /= (Real)textureSize->y; - } - - // store the uv coords - theImage->setUV( &uvCoords ); - - // compute the image size based on the coords we read and store - ICoord2D imageSize; - imageSize.x = right - left; - imageSize.y = bottom - top; - theImage->setImageSize( &imageSize ); - -} - -//------------------------------------------------------------------------------------------------- -/** Parse the image status line */ -//------------------------------------------------------------------------------------------------- -void Image::parseImageStatus( INI* ini, void *instance, void *store, const void* /*userData*/) -{ - // use existing INI parsing for the bit strings - INI::parseBitString32(ini, instance, store, imageStatusNames); - - // - // if we are rotated 90 degrees clockwise we need to swap our width and height as - // they were computed from the page location rect, which was for the rotated image - // (see ImagePacker tool for more details) - // - UnsignedInt *theStatusBits = (UnsignedInt *)store; - if( BitIsSet( *theStatusBits, IMAGE_STATUS_ROTATED_90_CLOCKWISE ) ) - { - Image *theImage = (Image *)instance; - ICoord2D imageSize; - - imageSize.x = theImage->getImageHeight(); // note it's height not width - imageSize.y = theImage->getImageWidth(); // note it's width not height - theImage->setImageSize( &imageSize ); - - } - -} - -// PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -ImageCollection *TheMappedImageCollection = nullptr; ///< mapped images - -// PUBLIC FUNCTIONS//////////////////////////////////////////////////////////////////////////////// -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -Image::Image() -{ - - m_name.clear(); - m_filename.clear(); - m_textureSize.x = 0; - m_textureSize.y = 0; - m_UVCoords.lo.x = 0.0f; - m_UVCoords.lo.y = 0.0f; - m_UVCoords.hi.x = 1.0f; - m_UVCoords.hi.y = 1.0f; - m_imageSize.x = 0; - m_imageSize.y = 0; - m_rawTextureData = nullptr; - m_status = IMAGE_STATUS_NONE; - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -Image::~Image() -{ - -} - -//------------------------------------------------------------------------------------------------- -/** Set a status bit into the existing status, return the previous status - * bit collection from before the set */ -//------------------------------------------------------------------------------------------------- -UnsignedInt Image::setStatus( UnsignedInt bit ) -{ - UnsignedInt prevStatus = m_status; - - BitSet( m_status, bit ); - return prevStatus; - -} - -//------------------------------------------------------------------------------------------------- -/** Clear a status bit from the existing status, return the previous - * status bit collection from before the clear */ -//------------------------------------------------------------------------------------------------- -UnsignedInt Image::clearStatus( UnsignedInt bit ) -{ - UnsignedInt prevStatus = m_status; - - BitClear( m_status, bit ); - return prevStatus; - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -ImageCollection::ImageCollection() -{ -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -ImageCollection::~ImageCollection() -{ - for (ImageMap::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) - deleteInstance(i->second); -} - -//------------------------------------------------------------------------------------------------- -/** Return the next image in the collection */ -//------------------------------------------------------------------------------------------------- -void ImageCollection::addImage( Image *image ) -{ - m_imageMap[TheNameKeyGenerator->nameToLowercaseKey(image->getName())]=image; -} - -//------------------------------------------------------------------------------------------------- -const Image *ImageCollection::findImage( NameKeyType namekey ) const -{ - ImageMap::const_iterator i = m_imageMap.find(namekey); - return i == m_imageMap.end() ? nullptr : i->second; -} - -//------------------------------------------------------------------------------------------------- -/** Find an image given the image name */ -//------------------------------------------------------------------------------------------------- -const Image *ImageCollection::findImageByName( const AsciiString& name ) const -{ - return findImage(TheNameKeyGenerator->nameToLowercaseKey(name)); -} - -//------------------------------------------------------------------------------------------------- -/** Find an image given the image name */ -//------------------------------------------------------------------------------------------------- -const Image *ImageCollection::findImageByName( const char* name ) const -{ - return findImage(TheNameKeyGenerator->nameToLowercaseKey(name)); -} - -//------------------------------------------------------------------------------------------------- -/** Load this image collection with all the images specified in the INI files - * for the proper texture size directory */ -//------------------------------------------------------------------------------------------------- -void ImageCollection::load( Int textureSize ) -{ - char buffer[ _MAX_PATH ]; - INI ini; - // first load in the user created mapped image files if we have them. - WIN32_FIND_DATA findData; - AsciiString userDataPath; - if(TheGlobalData) - { - userDataPath.format("%sINI\\MappedImages\\*.ini",TheGlobalData->getPath_UserData().str()); - if(FindFirstFile(userDataPath.str(), &findData) !=INVALID_HANDLE_VALUE) - { - userDataPath.format("%sINI\\MappedImages",TheGlobalData->getPath_UserData().str()); - ini.loadDirectory(userDataPath, INI_LOAD_OVERWRITE, nullptr ); - } - } - - // construct path to the mapped images folder of the correct texture size - sprintf( buffer, "Data\\INI\\MappedImages\\TextureSize_%d", textureSize ); - - // load all the ine files in that directory - - ini.loadDirectory( AsciiString( buffer ), INI_LOAD_OVERWRITE, nullptr ); - - ini.loadDirectory("Data\\INI\\MappedImages\\HandCreated", INI_LOAD_OVERWRITE, nullptr ); - - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/System/RayEffect.cpp b/Generals/Code/GameEngine/Source/GameClient/System/RayEffect.cpp deleted file mode 100644 index 55ec4ac7efa..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/System/RayEffect.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: RayEffect.cpp //////////////////////////////////////////////////////////////////////////// -// Created: Colin Day, May 2001 -// Desc: Ray effect system manager -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/RayEffect.h" -#include "GameClient/Drawable.h" - -// PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -class RayEffectSystem *TheRayEffects = nullptr; - -// PRIVATE METHODS //////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -/** Find an effect entry given a drawable */ -//------------------------------------------------------------------------------------------------- -RayEffectData *RayEffectSystem::findEntry( const Drawable *draw ) -{ - Int i; - RayEffectData *effectData = nullptr; - - // find the matching effect data entry - for( i = 0; i < MAX_RAY_EFFECTS; i++ ) - { - - if( m_effectData[ i ].draw == draw ) - { - - effectData = &m_effectData[ i ]; - break; // exit for i - - } - - } - - return effectData; - -} - -// PUBLIC METHODS ///////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -RayEffectSystem::RayEffectSystem() -{ - - init(); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -RayEffectSystem::~RayEffectSystem() -{ - -} - -//------------------------------------------------------------------------------------------------- -/** initialize the system */ -//------------------------------------------------------------------------------------------------- -void RayEffectSystem::init() -{ - Int i; - - for( i = 0; i < MAX_RAY_EFFECTS; i++ ) - { - - m_effectData[ i ].draw = nullptr; - m_effectData[ i ].startLoc.zero(); - m_effectData[ i ].endLoc.zero(); - - } - -} - -//------------------------------------------------------------------------------------------------- -/** Reset */ -//------------------------------------------------------------------------------------------------- -void RayEffectSystem::reset() -{ - - // nothing dynamic going on here, just initialize it - init(); - -} - -//------------------------------------------------------------------------------------------------- -/** add a ray effect entry for this drawable */ -//------------------------------------------------------------------------------------------------- -void RayEffectSystem::addRayEffect( const Drawable *draw, - const Coord3D *startLoc, - const Coord3D *endLoc ) -{ - Int i; - RayEffectData *effectData = nullptr; - - // sanity - if( draw == nullptr || startLoc == nullptr || endLoc == nullptr ) - return; - - /** @todo this should be more intelligent and should not be limited - to any kind of max ray effects, this is all a temporary hack system for - the demo anyway right now though */ - - // search for a free effect slot - for( i = 0; i < MAX_RAY_EFFECTS; i++ ) - { - - if( m_effectData[ i ].draw == nullptr ) - { - - effectData = &m_effectData[ i ]; - break; // exit for - - } - - } - - // if no free slots we can't do it - if( effectData == nullptr ) - return; - - // add the data to the entry - effectData->draw = draw; - effectData->startLoc = *startLoc; - effectData->endLoc = *endLoc; - -} - -//------------------------------------------------------------------------------------------------- -/** given a drawable, remove its effect from the system */ -//------------------------------------------------------------------------------------------------- -void RayEffectSystem::deleteRayEffect( const Drawable *draw ) -{ - RayEffectData *effectData = nullptr; - - // sanity - if( draw == nullptr ) - return; - - // find the effect entry - effectData = findEntry( draw ); - if( effectData ) - { - - // remove the data for this entry - effectData->draw = nullptr; - - } - -} - -//------------------------------------------------------------------------------------------------- -/** given a drawable, if it is in the ray effect system list retrieve - * the ray effect data for its entry */ -//------------------------------------------------------------------------------------------------- -void RayEffectSystem::getRayEffectData( const Drawable *draw, - RayEffectData *effectData ) -{ - RayEffectData *entry = nullptr; - - // sanity - if( draw == nullptr || effectData == nullptr ) - return; - - // find the effect data entry - entry = findEntry( draw ); - if( entry ) - { - - // data has been found, copy to parameter - *effectData = *entry; - - } - -} - diff --git a/Generals/Code/GameEngineDevice/CMakeLists.txt b/Generals/Code/GameEngineDevice/CMakeLists.txt index 59678dbfcb8..655813788c0 100644 --- a/Generals/Code/GameEngineDevice/CMakeLists.txt +++ b/Generals/Code/GameEngineDevice/CMakeLists.txt @@ -25,47 +25,47 @@ set(GAMEENGINEDEVICE_SRC # Include/W3DDevice/GameClient/TerrainTex.h # Include/W3DDevice/GameClient/TileData.h Include/W3DDevice/GameClient/W3DAssetManager.h - Include/W3DDevice/GameClient/W3DAssetManagerExposed.h - Include/W3DDevice/GameClient/W3DBibBuffer.h +# Include/W3DDevice/GameClient/W3DAssetManagerExposed.h +# Include/W3DDevice/GameClient/W3DBibBuffer.h Include/W3DDevice/GameClient/W3DBridgeBuffer.h - Include/W3DDevice/GameClient/W3DBufferManager.h - Include/W3DDevice/GameClient/W3DCustomEdging.h - Include/W3DDevice/GameClient/W3DCustomScene.h - Include/W3DDevice/GameClient/W3DDebugDisplay.h - Include/W3DDevice/GameClient/W3DDebugIcons.h - Include/W3DDevice/GameClient/W3DDisplay.h - Include/W3DDevice/GameClient/W3DDisplayString.h - Include/W3DDevice/GameClient/W3DDisplayStringManager.h +# Include/W3DDevice/GameClient/W3DBufferManager.h +# Include/W3DDevice/GameClient/W3DCustomEdging.h +# Include/W3DDevice/GameClient/W3DCustomScene.h +# Include/W3DDevice/GameClient/W3DDebugDisplay.h +# Include/W3DDevice/GameClient/W3DDebugIcons.h +# Include/W3DDevice/GameClient/W3DDisplay.h +# Include/W3DDevice/GameClient/W3DDisplayString.h +# Include/W3DDevice/GameClient/W3DDisplayStringManager.h Include/W3DDevice/GameClient/W3DDynamicLight.h - Include/W3DDevice/GameClient/W3DFileSystem.h - Include/W3DDevice/GameClient/W3DGadget.h +# Include/W3DDevice/GameClient/W3DFileSystem.h +# Include/W3DDevice/GameClient/W3DGadget.h Include/W3DDevice/GameClient/W3DGameClient.h - Include/W3DDevice/GameClient/W3DGameFont.h - Include/W3DDevice/GameClient/W3DGameWindow.h - Include/W3DDevice/GameClient/W3DGameWindowManager.h - Include/W3DDevice/GameClient/W3DGUICallbacks.h - Include/W3DDevice/GameClient/W3DInGameUI.h - Include/W3DDevice/GameClient/W3DMirror.h +# Include/W3DDevice/GameClient/W3DGameFont.h +# Include/W3DDevice/GameClient/W3DGameWindow.h +# Include/W3DDevice/GameClient/W3DGameWindowManager.h +# Include/W3DDevice/GameClient/W3DGUICallbacks.h +# Include/W3DDevice/GameClient/W3DInGameUI.h +# Include/W3DDevice/GameClient/W3DMirror.h # Include/W3DDevice/GameClient/W3DMouse.h - Include/W3DDevice/GameClient/W3DParticleSys.h - Include/W3DDevice/GameClient/W3DPoly.h - Include/W3DDevice/GameClient/W3DProjectedShadow.h +# Include/W3DDevice/GameClient/W3DParticleSys.h +# Include/W3DDevice/GameClient/W3DPoly.h +# Include/W3DDevice/GameClient/W3DProjectedShadow.h Include/W3DDevice/GameClient/W3DRoadBuffer.h Include/W3DDevice/GameClient/W3DScene.h # Include/W3DDevice/GameClient/W3DShaderManager.h - Include/W3DDevice/GameClient/W3DShadow.h - Include/W3DDevice/GameClient/W3DShroud.h - Include/W3DDevice/GameClient/W3DStatusCircle.h +# Include/W3DDevice/GameClient/W3DShadow.h +# Include/W3DDevice/GameClient/W3DShroud.h +# Include/W3DDevice/GameClient/W3DStatusCircle.h # Include/W3DDevice/GameClient/W3DTerrainTracks.h # Include/W3DDevice/GameClient/W3DTerrainVisual.h # Include/W3DDevice/GameClient/W3DTreeBuffer.h # Include/W3DDevice/GameClient/W3DVideoBuffer.h # Include/W3DDevice/GameClient/W3DView.h - Include/W3DDevice/GameClient/W3DVolumetricShadow.h +# Include/W3DDevice/GameClient/W3DVolumetricShadow.h # Include/W3DDevice/GameClient/W3DWater.h # Include/W3DDevice/GameClient/W3DWaterTracks.h - Include/W3DDevice/GameClient/W3DWaypointBuffer.h - Include/W3DDevice/GameClient/W3DWebBrowser.h +# Include/W3DDevice/GameClient/W3DWaypointBuffer.h +# Include/W3DDevice/GameClient/W3DWebBrowser.h # Include/W3DDevice/GameClient/WorldHeightMap.h Include/W3DDevice/GameLogic/W3DGameLogic.h Include/W3DDevice/GameLogic/W3DGhostObject.h @@ -99,55 +99,55 @@ set(GAMEENGINEDEVICE_SRC # Source/W3DDevice/GameClient/Drawable/Draw/W3DTankTruckDraw.cpp # Source/W3DDevice/GameClient/Drawable/Draw/W3DTracerDraw.cpp # Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp - Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp - Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp - Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp - Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp - Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp +# Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp +# Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp +# Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp +# Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp +# Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp - Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp +# Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp - Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp - Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp - Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp - Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp - Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp - Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp - Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp - Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp - Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp +# Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp +# Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp +# Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp +# Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp +# Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +# Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp +# Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp +# Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp +# Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp # Source/W3DDevice/GameClient/HeightMap.cpp - Source/W3DDevice/GameClient/Shaders/invmonochrome.nvp - Source/W3DDevice/GameClient/Shaders/monochrome.nvp - Source/W3DDevice/GameClient/Shaders/motionblur.nvp - Source/W3DDevice/GameClient/Shaders/MotionBlur.nvv - Source/W3DDevice/GameClient/Shaders/roadnoise2.nvp - Source/W3DDevice/GameClient/Shaders/terrain.nvp - Source/W3DDevice/GameClient/Shaders/terrainnoise.nvp - Source/W3DDevice/GameClient/Shaders/terrainnoise2.nvp - Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp +# Source/W3DDevice/GameClient/Shaders/invmonochrome.nvp +# Source/W3DDevice/GameClient/Shaders/monochrome.nvp +# Source/W3DDevice/GameClient/Shaders/motionblur.nvp +# Source/W3DDevice/GameClient/Shaders/MotionBlur.nvv +# Source/W3DDevice/GameClient/Shaders/roadnoise2.nvp +# Source/W3DDevice/GameClient/Shaders/terrain.nvp +# Source/W3DDevice/GameClient/Shaders/terrainnoise.nvp +# Source/W3DDevice/GameClient/Shaders/terrainnoise2.nvp +# Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp - Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp +# Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp Source/W3DDevice/GameClient/Shadow/W3DVolumetricShadow.cpp # Source/W3DDevice/GameClient/TerrainTex.cpp # Source/W3DDevice/GameClient/TileData.cpp Source/W3DDevice/GameClient/W3DAssetManager.cpp - Source/W3DDevice/GameClient/W3DAssetManagerExposed.cpp +# Source/W3DDevice/GameClient/W3DAssetManagerExposed.cpp Source/W3DDevice/GameClient/W3DBibBuffer.cpp Source/W3DDevice/GameClient/W3DBridgeBuffer.cpp - Source/W3DDevice/GameClient/W3DCustomEdging.cpp - Source/W3DDevice/GameClient/W3DDebugDisplay.cpp - Source/W3DDevice/GameClient/W3DDebugIcons.cpp +# Source/W3DDevice/GameClient/W3DCustomEdging.cpp +# Source/W3DDevice/GameClient/W3DDebugDisplay.cpp +# Source/W3DDevice/GameClient/W3DDebugIcons.cpp Source/W3DDevice/GameClient/W3DDisplay.cpp - Source/W3DDevice/GameClient/W3DDisplayString.cpp - Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp - Source/W3DDevice/GameClient/W3DDynamicLight.cpp +# Source/W3DDevice/GameClient/W3DDisplayString.cpp +# Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp +# Source/W3DDevice/GameClient/W3DDynamicLight.cpp Source/W3DDevice/GameClient/W3DFileSystem.cpp Source/W3DDevice/GameClient/W3DGameClient.cpp - Source/W3DDevice/GameClient/W3DInGameUI.cpp +# Source/W3DDevice/GameClient/W3DInGameUI.cpp # Source/W3DDevice/GameClient/W3DMouse.cpp Source/W3DDevice/GameClient/W3DParticleSys.cpp - Source/W3DDevice/GameClient/W3DPoly.cpp +# Source/W3DDevice/GameClient/W3DPoly.cpp Source/W3DDevice/GameClient/W3DRoadBuffer.cpp Source/W3DDevice/GameClient/W3DScene.cpp # Source/W3DDevice/GameClient/W3DShaderManager.cpp @@ -159,7 +159,7 @@ set(GAMEENGINEDEVICE_SRC # Source/W3DDevice/GameClient/W3DVideoBuffer.cpp # Source/W3DDevice/GameClient/W3DView.cpp Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp - Source/W3DDevice/GameClient/W3DWebBrowser.cpp +# Source/W3DDevice/GameClient/W3DWebBrowser.cpp # Source/W3DDevice/GameClient/Water/W3DWater.cpp # Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp # Source/W3DDevice/GameClient/Water/wave.nvp diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManagerExposed.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManagerExposed.h deleted file mode 100644 index 64740387307..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManagerExposed.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DAssetManagerExposed.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: W3DAssetManagerExposed.h */ -/* Created: John K. McDonald, Jr., 4/27/2002 */ -/* Desc: A hack to get around our build structure. */ -/* Revision History: */ -/* 4/27/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////// -// DEFINES //////////////////////////////////////////////////////////////////// -// TYPE DEFINES /////////////////////////////////////////////////////////////// -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// - -// This function is here because the particle editor needs to be able to force -// the asset manager to release all his textures and then reload them on demand. -// Unfortunately, the asset manager can't be called directly from the gamelogic, -// so this function is here. It should only be called by the particle editor, -// @todo Remove this function when we are no longer editing particles. -void ReloadAllTextures(); diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBibBuffer.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBibBuffer.h deleted file mode 100644 index 5eac713a89d..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBibBuffer.h +++ /dev/null @@ -1,130 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DBibBuffer.h ////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DBibBuffer.h -// -// Created: John Ahlquist, May 2001 -// -// Desc: Draw buffer to handle all the bibs in a scene. -// -//----------------------------------------------------------------------------- - -#pragma once - -//----------------------------------------------------------------------------- -// Includes -//----------------------------------------------------------------------------- -#include "always.h" -#include "rendobj.h" -#include "w3d_file.h" -#include "dx8vertexbuffer.h" -#include "dx8indexbuffer.h" -#include "shader.h" -#include "vertmaterial.h" -#include "Lib/BaseType.h" -#include "Common/GameType.h" -#include "Common/AsciiString.h" - -//----------------------------------------------------------------------------- -// Forward References -//----------------------------------------------------------------------------- -class MeshClass; - -//----------------------------------------------------------------------------- -// Type Defines -//----------------------------------------------------------------------------- - -/// The individual data for a Bib. -typedef struct { - Vector3 m_corners[4]; ///< Drawing location - Bool m_highlight; ///< Use the highlight texture. - Int m_color; ///< Tint perhaps. - ObjectID m_objectID; ///< The object id this bib corresponds to. - DrawableID m_drawableID; ///< The object id this bib corresponds to. - Bool m_unused; ///< True if this bib is currently unused. -} TBib; - -// -// W3DBibBuffer: Draw buffer for the bibs. -// -// -class W3DBibBuffer -{ -friend class BaseHeightMapRenderObjClass; -public: - - W3DBibBuffer(); - ~W3DBibBuffer(); - /// Add a bib at location. Name is the w3d model name. - void addBib(Vector3 corners[4], ObjectID id, Bool highlight); - void addBibDrawable(Vector3 corners[4], DrawableID id, Bool highlight); - /// Add a bib at location. Name is the w3d model name. - void removeBib(ObjectID id); - void removeBibDrawable(DrawableID id); - /// Empties the bib buffer. - void clearAllBibs(); - /// Removes highlighting. - void removeHighlighting(); - /// Draws the bibs. - void renderBibs(); - /// Called when the view changes, and sort key needs to be recalculated. - /// Normally sortKey gets calculated when a bib becomes visible. -protected: - enum { INITIAL_BIB_VERTEX=256, - INITIAL_BIB_INDEX=384, - MAX_BIBS=1000}; - DX8VertexBufferClass *m_vertexBib; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DBufferManager.h /////////////////////////////////////////////////////////////////////////// -// Author: Mark Wilczynski -// Desc: A system for managing partial vertex buffer allocations. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "Lib/BaseType.h" -#include "dx8vertexbuffer.h" -#include "dx8indexbuffer.h" - -// TheSuperHackers @info The max sizes correspond to a number of vertices and indices of a mesh casting shadows -// in the scene. The more vertices the meshes are supposed to have, the higher these limits need to be. -// Multiplying these numbers by MIN_SLOT_SIZE gives the max supported amount of vertices and indices. -#define MAX_VB_SIZES 128 //number of different sized VB slots allowed. -#define MAX_IB_SIZES 128 //number of different sized IB slots allowed (goes all the way up to 65536) - -#define MIN_SLOT_SIZE_SHIFT 5 //used for division by MIN_SLOT_SIZE -#define MIN_SLOT_SIZE (1 << MIN_SLOT_SIZE_SHIFT) //minimum number of vertices allocated per slot (power of 2). - -// TheSuperHackers @info The number of slots corresponds to number of meshes casting shadows in the scene. -// The more meshes there are, the larger the slots needs to be. -// TheSuperHackers @tweak Double the original sizes to allow for twice as many shadows to be created in the scene. -#define SLOTS_MULTIPLIER 2 -#define MAX_NUMBER_SLOTS (4096 * SLOTS_MULTIPLIER) //maximum number of slots that can be allocated. -#define MAX_VERTEX_BUFFERS_CREATED (32 * SLOTS_MULTIPLIER) //maximum number of D3D vertex buffers allowed to create per vertex type. -#define MAX_INDEX_BUFFERS_CREATED (32 * SLOTS_MULTIPLIER) - -#define DEFAULT_VERTEX_BUFFER_SIZE 8192 //this size ends up generating VB's of about 256Kbytes -#define DEFAULT_INDEX_BUFFER_SIZE 32768 - -class W3DBufferManager -{ -public: - //List of all possible vertex formats available to the game. - enum VBM_FVF_TYPES - { - VBM_FVF_XYZ, //position - VBM_FVF_XYZD, //position, diffuse - VBM_FVF_XYZUV, //position, uv - VBM_FVF_XYZDUV, //position, diffuse, uv - VBM_FVF_XYZUV2, //position, uv1, uv2 - VBM_FVF_XYZDUV2, //position, diffuse, uv1, uv2 - VBM_FVF_XYZN, //position, normal - VBM_FVF_XYZND, //position, normal, diffuse - VBM_FVF_XYZNUV, //position, normal, uv - VBM_FVF_XYZNDUV, //position, normal, diffuse, uv - VBM_FVF_XYZNUV2, //position, normal, uv1, uv2 - VBM_FVF_XYZNDUV2, //position, normal, diffuse, uv1, uv2 - VBM_FVF_XYZRHW, //transformed position - VBM_FVF_XYZRHWD, //transformed position, diffuse - VBM_FVF_XYZRHWUV, //transformed position, uv - VBM_FVF_XYZRHWDUV, //transformed position, diffuse, uv - VBM_FVF_XYZRHWUV2, //transformed position, uv1, uv2 - VBM_FVF_XYZRHWDUV2, //transformed position, diffuse, uv1, uv2 - MAX_FVF - }; - - struct W3DRenderTask - { - W3DRenderTask *m_nextTask; ///m_nextVB; - }; - - static Int getDX8Format(VBM_FVF_TYPES format); ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DCustomEdging.h ////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DCustomEdging.h -// -// Created: John Ahlquist, May 2001 -// -// Desc: Draw buffer to handle all the trees in a scene. -// -//----------------------------------------------------------------------------- - -#pragma once - -//----------------------------------------------------------------------------- -// Includes -//----------------------------------------------------------------------------- -#include "always.h" -#include "rendobj.h" -#include "w3d_file.h" -#include "dx8vertexbuffer.h" -#include "dx8indexbuffer.h" -#include "shader.h" -#include "vertmaterial.h" -#include "Lib/BaseType.h" -#include "Common/GameType.h" -#include "Common/AsciiString.h" - -//----------------------------------------------------------------------------- -// Forward References -//----------------------------------------------------------------------------- - -class WorldHeightMap; -//----------------------------------------------------------------------------- -// Type Defines -//----------------------------------------------------------------------------- - -// -// W3DCustomEdging: Draw buffer for the trees. -// -// -class W3DCustomEdging -{ -friend class HeightMapRenderObjClass; -public: - - W3DCustomEdging(); - ~W3DCustomEdging(); - void addEdging(Coord3D location, Real scale, Real angle, AsciiString name, Bool visibleInMirror); - /// Empties the tree buffer. - void clearAllEdging(); - /// Draws the trees. Uses camera for culling. - void drawEdging( WorldHeightMap *pMap, Int minX, Int maxX, Int minY, Int maxY, - TextureClass * terrainTexture, TextureClass * cloudTexture, TextureClass * noiseTexture ); - /// Called when the view changes, and sort key needs to be recalculated. - /// Normally sortKey gets calculated when a tree becomes visible. - void doFullUpdate() {clearAllEdging();}; -protected: -#define MAX_BLENDS 2000 - enum { MAX_EDGE_VERTEX=4*MAX_BLENDS, - MAX_EDGE_INDEX=6*MAX_BLENDS}; - DX8VertexBufferClass *m_vertexEdging; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -#pragma once - -enum CustomScenePassModes CPP_11(: Int) -{ - SCENE_PASS_DEFAULT, - SCENE_PASS_ALPHA_MASK -}; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugDisplay.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugDisplay.h deleted file mode 100644 index cdf3c0e91e2..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugDisplay.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//---------------------------------------------------------------------------- -// -// Project: Generals -// -// Module: Debug -// -// File name: W3DDevice/GameClient/W3DDebugDisplay.h -// -// Created: 11/13/01 TR -// -//---------------------------------------------------------------------------- - -#pragma once - -//---------------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------------- - -#include "GameClient/DebugDisplay.h" - - -//---------------------------------------------------------------------------- -// Forward References -//---------------------------------------------------------------------------- - -class GameFont; -class DisplayString; - -//---------------------------------------------------------------------------- -// Type Defines -//---------------------------------------------------------------------------- - - -//=============================== -// W3DDebugDisplay -//=============================== - -class W3DDebugDisplay : public DebugDisplay -{ - - public: - - W3DDebugDisplay(); - virtual ~W3DDebugDisplay() override; - - void init(); ///< Initialized the display - void setFont( GameFont *font ); ///< Set the font to render with - void setFontWidth( Int width ) { m_fontWidth = width; }; ///< Set the font width - void setFontHeight( Int height ) { m_fontHeight = height; }; ///< Set the font height - - protected: - - GameFont *m_font; ///< Font to render text with - Int m_fontWidth; - Int m_fontHeight; - DisplayString *m_displayString; - - virtual void drawText( Int x, Int y, Char *text ) override; ///< Render null ternimated string at current cursor position - -}; - - -//---------------------------------------------------------------------------- -// Inlining -//---------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugIcons.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugIcons.h deleted file mode 100644 index d5f65bb82ff..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDebugIcons.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "always.h" -#include "rendobj.h" -#include "vertmaterial.h" -#include "Lib/BaseType.h" - -#if defined(RTS_DEBUG) -struct DebugIcon; -// -/// W3DDebugIcons: Draws huge numbers of debug icons for pathfinding quickly. -// -// -class W3DDebugIcons : public RenderObjClass -{ - -public: - - W3DDebugIcons(Int mapWidth, Int mapHeight); - W3DDebugIcons(const W3DDebugIcons & src); - W3DDebugIcons & operator = (const W3DDebugIcons &); - ~W3DDebugIcons(); - - ///////////////////////////////////////////////////////////////////////////// - // Render Object Interface - ///////////////////////////////////////////////////////////////////////////// - virtual RenderObjClass * Clone() const; - virtual int Class_ID() const; - virtual void Render(RenderInfoClass & rinfo); - - virtual bool Cast_Ray(RayCollisionTestClass & raytest); - - virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & aabox) const; - -protected: - VertexMaterialClass *m_vertexMaterialClass; - -protected: - static DebugIcon *m_debugIcons; - static Int m_numDebugIcons; - static Int m_maxDebugIcons; - -protected: - void allocateIconsArray(); - void compressIconsArray(); - -public: - static void addIcon(const Coord3D *pos, Real width, Int numFramesDuration, RGBColor color); -}; -#endif // RTS_DEBUG diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h deleted file mode 100644 index 5f079d4324d..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplay.h +++ /dev/null @@ -1,202 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DDisplay.h ///////////////////////////////////////////////////////// -// -// W3D Implementation for the W3D Display which is responsible for creating -// and maintaning the entire visual display -// -// Author: Colin Day, April 2001 -// -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "GameClient/Display.h" -#include "WW3D2/lightenvironment.h" - -class VideoBuffer; -class W3DDebugDisplay; -class DisplayString; -class W3DAssetManager; -class LightClass; -class Render2DClass; -class RTS3DScene; -class RTS2DScene; -class RTS3DInterfaceScene; - - -//============================================================================= -/** W3D implementation of the game display which is responsible for creating - * all interaction with the screen and updating the display - */ -class W3DDisplay : public Display -{ - -public: - W3DDisplay(); - virtual ~W3DDisplay() override; - - virtual void init() override; ///< initialize or re-initialize the sytsem - virtual void reset() override; ///< Reset system - - virtual void setWidth( UnsignedInt width ) override; - virtual void setHeight( UnsignedInt height ) override; - virtual Bool setDisplayMode( UnsignedInt xres, UnsignedInt yres, UnsignedInt bitdepth, Bool windowed ) override; - virtual Int getDisplayModeCount() override; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DDisplayString.h /////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DDisplayString.h -// -// Created: Colin Day, July 2001 -// -// Desc: Display string W3D implementation, display strings hold -// double byte characters and all the data we need to render -// those strings to the screen. -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/GameMemory.h" -#include "GameClient/DisplayString.h" -#include "WW3D2/render2dsentence.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -class W3DDisplayStringManager; - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -// W3DDisplayString ----------------------------------------------------------- -/** */ -//----------------------------------------------------------------------------- -class W3DDisplayString : public DisplayString -{ - - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( W3DDisplayString, "W3DDisplayString" ) - -public: - - friend W3DDisplayStringManager; - - W3DDisplayString(); - // ~W3DDisplayString(); // destructor defined by memory pool - - virtual void notifyTextChanged() override; ///< called when text contents change - virtual void draw( Int x, Int y, Color color, Color dropColor ) override; ///< render text - virtual void draw( Int x, Int y, Color color, Color dropColor, Int xDrop, Int yDrop ) override; ///< render text with the drop shadow being at the offsets passed in - virtual void getSize( Int *width, Int *height ) override; ///< get render size - virtual Int getWidth( Int charPos = -1) override; - virtual void setWordWrap( Int wordWrap ) override; ///< set the word wrap width - virtual void setWordWrapCentered( Bool isCentered ) override; ///< If this is set to true, the text on a new line is centered - virtual void setFont( GameFont *font ) override; ///< set a font for display - virtual void setUseHotkey( Bool useHotkey, Color hotKeyColor = 0xffffffff ) override; - virtual void setClipRegion( IRegion2D *region ) override; ///< clip text in this region - -protected: - - void checkForChangedTextData(); /**< called when we need to update our - render sentence and update extents */ - void usingResources( UnsignedInt frame ); /**< call this whenever display - resources are in use */ - void computeExtents(); ///< compupte text width and height - - Render2DSentenceClass m_textRenderer; ///< for drawing text - Render2DSentenceClass m_textRendererHotKey; ///< for drawing text - Bool m_textChanged; ///< when contents of string change this is TRUE - Bool m_fontChanged; ///< when font has chagned this is TRUE - UnicodeString m_hotkey; ///< holds the current hotkey marker. - Bool m_useHotKey; - ICoord2D m_hotKeyPos; - Color m_hotKeyColor; - ICoord2D m_textPos; ///< current text pos set in text renderer - Color m_currTextColor, ///< current color used in text renderer - m_currDropColor; ///< current color used for shadow in text - ICoord2D m_size; ///< (width,height) size of rendered text - IRegion2D m_clipRegion; ///< the clipping region for text - UnsignedInt m_lastResourceFrame; ///< last frame resources were used on - -}; - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -inline void W3DDisplayString::usingResources( UnsignedInt frame ) { m_lastResourceFrame = frame; } - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplayStringManager.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplayStringManager.h deleted file mode 100644 index e350c9c70fa..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DDisplayStringManager.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DDisplayStringManager.h //////////////////////////////////////////////////////////////// -// Created: Colin Day, July 2001 -// Desc: Access for creating game managed display strings -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "GameClient/DisplayStringManager.h" -#include "W3DDevice/GameClient/W3DDisplayString.h" - -//------------------------------------------------------------------------------------------------- -/** Access for creating game managed display strings */ -//------------------------------------------------------------------------------------------------- - -#define MAX_GROUPS 10 - -class W3DDisplayStringManager : public DisplayStringManager -{ - -public: - - W3DDisplayStringManager(); - virtual ~W3DDisplayStringManager() override; - - // Initialize our numeral strings in postProcessLoad - virtual void postProcessLoad() override; - - /// update method for all our display strings - virtual void update() override; - - /// allocate a new display string - virtual DisplayString *newDisplayString() override; - - /// free a display string - virtual void freeDisplayString( DisplayString *string ) override; - - // This is used to save us a few FPS and storage space. There's no reason to - // duplicate the DisplayString on every drawable when 1 copy will suffice. - virtual DisplayString *getGroupNumeralString( Int numeral ) override; - virtual DisplayString *getFormationLetterString() override { return m_formationLetterDisplayString; }; - -protected: - DisplayString *m_groupNumeralStrings[ MAX_GROUPS ]; - DisplayString *m_formationLetterDisplayString; - -}; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h deleted file mode 100644 index 3203d6133cb..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DFileSystem.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DFileSystem.h //////////////////////////////////////////////////////// -// -// W3D implementation of a file factory. Uses GDI assets, so that -// W3D files and targa files are loaded using the GDI file interface. -// -// Author: John Ahlquist, Sept 2001 -// -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "WWLib/ffactory.h" -#include "Common/ArchiveFileSystem.h" -#include "Common/file.h" - -//------------------------------------------------------------------------------------------------- -/** Game file access. At present this allows us to access test assets, assets from - * legacy GDI assets, and the current flat directory access for textures, models etc */ -//------------------------------------------------------------------------------------------------- -class GameFileClass : public FileClass -{ - -public: - - GameFileClass(char const *filename); - GameFileClass(); - virtual ~GameFileClass() override; - - virtual char const * File_Name() const override; - virtual char const * Set_Name(char const *filename) override; - - // (gth) had to re-instate these functions in the base class, for now just give empty implementations... - virtual int Create() override { assert(0); return 1; } - virtual int Delete() override { assert(0); return 1; } - - virtual bool Is_Available(int forced=false) override; - virtual bool Is_Open() const override; - virtual int Open(char const *filename, int rights=READ) override; - virtual int Open(int rights=READ) override; - virtual int Read(void *buffer, int len) override; - virtual int Seek(int pos, int dir=SEEK_CUR) override; - virtual int Size() override; - virtual int Write(void const *buffer, int len) override; - virtual void Close() override; - -protected: - - File *m_theFile; /// < The file - Bool m_fileExists; ///< TRUE if the file exists - char m_filePath[_MAX_PATH]; ///< the file name *and* path (relative) - char m_filename[_MAX_PATH]; ///< The file name only - -}; - - -/* -** W3DFileSystem is a derived FileFactoryClass which -** uses GDI assets. -*/ -class W3DFileSystem : public FileFactoryClass { -public: - W3DFileSystem(); - virtual ~W3DFileSystem() override; - - virtual FileClass * Get_File( char const *filename ) override; - virtual void Return_File( FileClass *file ) override; - -private: - - static void reprioritizeTexturesBySize(); - static void reprioritizeTexturesBySize(ArchivedDirectoryInfo& dirInfo); -}; - -extern W3DFileSystem *TheW3DFileSystem; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGUICallbacks.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGUICallbacks.h deleted file mode 100644 index d3fd1d245cb..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGUICallbacks.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DGUICallbacks.h //////////////////////////////////////////////////////////////////////// -// Created: Colin Day, August 2001 -// Desc: Callbacks for GUI elements that are specifically tied to -// a W3D implementation -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -class GameWindow; -class WindowLayout; -class WinInstanceData; - -// EXTERNALS ////////////////////////////////////////////////////////////////////////////////////// - -// Message of the day message window -------------------------------------------------------------- -extern void W3DLeftHUDDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DCameoMovieDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DRightHUDDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DPowerDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DMainMenuDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DMainMenuFourDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DMetalBarMenuDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DCreditsMenuDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DClockDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DMainMenuMapBorder( GameWindow *window, WinInstanceData *instData ); -extern void W3DMainMenuButtonDropShadowDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DMainMenuRandomTextDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DThinBorderDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DShellMenuSchemeDraw( GameWindow *window, WinInstanceData *instData ); - -extern void W3DCommandBarGridDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DCommandBarGenExpDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DCommandBarHelpPopupDraw( GameWindow *window, WinInstanceData *instData ); - -extern void W3DCommandBarBackgroundDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DCommandBarForegroundDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DCommandBarTopDraw( GameWindow *window, WinInstanceData *instData ); - -extern void W3DNoDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DDrawMapPreview( GameWindow *window, WinInstanceData *instData ); - -void W3DMainMenuInit( WindowLayout *layout, void *userData ); diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGadget.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGadget.h deleted file mode 100644 index da32cf9773a..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGadget.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DGadget.h ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DGadget.h -// -// Created: Colin Day, June 2001 -// -// Desc: Implementation details for various gadgets as they pertain to -// W3D will go here -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/Gadget.h" -#include "W3DDevice/GameClient/W3DGameWindow.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// -/// when drawing line art for gadgets, the borders are this size -#define WIN_DRAW_LINE_WIDTH (1.0f) - -// INLINING /////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// EXTERNALS ////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -extern void W3DGadgetPushButtonDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetPushButtonImageDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetCheckBoxDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetCheckBoxImageDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetRadioButtonDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetRadioButtonImageDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetTabControlDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetTabControlImageDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetListBoxDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetListBoxImageDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetComboBoxDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetComboBoxImageDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetHorizontalSliderDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetHorizontalSliderImageDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetVerticalSliderDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetVerticalSliderImageDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetStaticTextDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetStaticTextImageDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ); -extern void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData ); diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameFont.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameFont.h deleted file mode 100644 index 382aed134da..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameFont.h +++ /dev/null @@ -1,79 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DGameFont.h //////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DGameFont.h -// -// Created: Colin Day, June 2001 -// -// Desc: W3D implementation for managing font definitions -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameFont.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -// W3DFontLibrary ------------------------------------------------------------- -/** Our font library that uses W3D font implementations */ -//----------------------------------------------------------------------------- -class W3DFontLibrary : public FontLibrary -{ - -public: - - W3DFontLibrary() { } - virtual ~W3DFontLibrary() override { } - -protected: - - /// load the font data pointer based on everything else we already have set - virtual Bool loadFontData( GameFont *font ) override; - /// release the font data pointer - virtual void releaseFontData( GameFont *font ) override; - -}; - -// INLINING /////////////////////////////////////////////////////////////////// - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindow.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindow.h deleted file mode 100644 index 25afd838e3b..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindow.h +++ /dev/null @@ -1,99 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DGameWindow.h ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DGameWindow.h -// -// Created: Colin Day, June 2001 -// -// Desc: W3D implementations for the game windowing system -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" -#include "WW3D2/render2dsentence.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -// W3DGameWindow -------------------------------------------------------------- -/** W3D implementation for a game window */ -// ---------------------------------------------------------------------------- -class W3DGameWindow : public GameWindow -{ - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(W3DGameWindow, "W3DGameWindow") - -public: - - W3DGameWindow(); - // already defined by MPO. - //~W3DGameWindow(); - - /// draw borders for this window only, NO child windows or anything else - virtual void winDrawBorder() override; - - Int winSetPosition( Int x, Int y ); ///< set window position - virtual Int winSetText( UnicodeString newText ) override; ///< set text string - virtual void winSetFont( GameFont *font ) override; ///< set font for window - - void getTextSize( Int *width, Int *height ); ///< get size of text - void setTextLoc( Int x, Int y ); ///< set text screen coord loc - void drawText( Color color ); ///< draw text in the text renderer - -protected: - - /// helper function to draw borders - void blitBorderRect( Int x, Int y, Int width, Int height ); - - Render2DSentenceClass m_textRenderer; ///< for drawing text - ICoord2D m_textPos; ///< current text pos set in text renderer - Color m_currTextColor; ///< current color used in text renderer - Bool m_needPolyDraw; ///< TRUE need to redo the text polys - Bool m_newTextPos; ///< TRUE when our window has moved and we need a new text pos - -}; - -// INLINING /////////////////////////////////////////////////////////////////// - -// EXTERNALS ////////////////////////////////////////////////////////////////// -extern void W3DGameWinDefaultDraw( GameWindow *window, - WinInstanceData *instData ); diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindowManager.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindowManager.h deleted file mode 100644 index 952eb79b00e..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameWindowManager.h +++ /dev/null @@ -1,106 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DGameWindowManager.h /////////////////////////////////////////////////////////////////// -// Created: Colin Day, June 2001 -// Desc: W3D implementation specific parts for the game window manager, -// which controls all access to the game windows for the in and -// of game GUI controls and windows -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "GameClient/GameWindowManager.h" -#include "W3DDevice/GameClient/W3DGameWindow.h" -#include "W3DDevice/GameClient/W3DGadget.h" - -//------------------------------------------------------------------------------------------------- -/** W3D implementation of the game window manager which controls all windows - * and user interface controls */ -//------------------------------------------------------------------------------------------------- -class W3DGameWindowManager : public GameWindowManager -{ - -public: - - W3DGameWindowManager(); - virtual ~W3DGameWindowManager() override; - - virtual void init() override; ///< initialize the singlegon - - virtual GameWindow *allocateNewWindow() override; ///< allocate a new game window - virtual GameWinDrawFunc getDefaultDraw() override; ///< return default draw func to use - - virtual GameWinDrawFunc getPushButtonImageDrawFunc() override; - virtual GameWinDrawFunc getPushButtonDrawFunc() override; - virtual GameWinDrawFunc getCheckBoxImageDrawFunc() override; - virtual GameWinDrawFunc getCheckBoxDrawFunc() override; - virtual GameWinDrawFunc getRadioButtonImageDrawFunc() override; - virtual GameWinDrawFunc getRadioButtonDrawFunc() override; - virtual GameWinDrawFunc getTabControlImageDrawFunc() override; - virtual GameWinDrawFunc getTabControlDrawFunc() override; - virtual GameWinDrawFunc getListBoxImageDrawFunc() override; - virtual GameWinDrawFunc getListBoxDrawFunc() override; - virtual GameWinDrawFunc getComboBoxImageDrawFunc() override; - virtual GameWinDrawFunc getComboBoxDrawFunc() override; - virtual GameWinDrawFunc getHorizontalSliderImageDrawFunc() override; - virtual GameWinDrawFunc getHorizontalSliderDrawFunc() override; - virtual GameWinDrawFunc getVerticalSliderImageDrawFunc() override; - virtual GameWinDrawFunc getVerticalSliderDrawFunc() override; - virtual GameWinDrawFunc getProgressBarImageDrawFunc() override; - virtual GameWinDrawFunc getProgressBarDrawFunc() override; - virtual GameWinDrawFunc getStaticTextImageDrawFunc() override; - virtual GameWinDrawFunc getStaticTextDrawFunc() override; - virtual GameWinDrawFunc getTextEntryImageDrawFunc() override; - virtual GameWinDrawFunc getTextEntryDrawFunc() override; - -protected: - -}; - -// INLINE ////////////////////////////////////////////////////////////////////////////////////////// -inline GameWindow *W3DGameWindowManager::allocateNewWindow() { return newInstance(W3DGameWindow); } -inline GameWinDrawFunc W3DGameWindowManager::getDefaultDraw() { return W3DGameWinDefaultDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getPushButtonImageDrawFunc() { return W3DGadgetPushButtonImageDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getPushButtonDrawFunc() { return W3DGadgetPushButtonDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getCheckBoxImageDrawFunc() { return W3DGadgetCheckBoxImageDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getCheckBoxDrawFunc() { return W3DGadgetCheckBoxDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getRadioButtonImageDrawFunc() { return W3DGadgetRadioButtonImageDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getRadioButtonDrawFunc() { return W3DGadgetRadioButtonDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getTabControlImageDrawFunc() { return W3DGadgetTabControlImageDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getTabControlDrawFunc() { return W3DGadgetTabControlDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getListBoxImageDrawFunc() { return W3DGadgetListBoxImageDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getListBoxDrawFunc() { return W3DGadgetListBoxDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getComboBoxImageDrawFunc() { return W3DGadgetComboBoxImageDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getComboBoxDrawFunc() { return W3DGadgetComboBoxDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getHorizontalSliderImageDrawFunc() { return W3DGadgetHorizontalSliderImageDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getHorizontalSliderDrawFunc() { return W3DGadgetHorizontalSliderDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getVerticalSliderImageDrawFunc() { return W3DGadgetVerticalSliderImageDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getVerticalSliderDrawFunc() { return W3DGadgetVerticalSliderDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getProgressBarImageDrawFunc() { return W3DGadgetProgressBarImageDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getProgressBarDrawFunc() { return W3DGadgetProgressBarDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getStaticTextImageDrawFunc() { return W3DGadgetStaticTextImageDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getStaticTextDrawFunc() { return W3DGadgetStaticTextDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getTextEntryImageDrawFunc() { return W3DGadgetTextEntryImageDraw; } -inline GameWinDrawFunc W3DGameWindowManager::getTextEntryDrawFunc() { return W3DGadgetTextEntryDraw; } diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DInGameUI.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DInGameUI.h deleted file mode 100644 index dd45e1d0bd8..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DInGameUI.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DInGameUI.h //////////////////////////////////////////////////////// -// -// W3D implementation of the in game user interface, the in game ui is -// responsible for -// -// Author: Colin Day, April 2001 -// -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/InGameUI.h" -#include "GameClient/View.h" -#include "W3DDevice/GameClient/W3DView.h" -#include "WW3D2/render2d.h" -#include "WW3D2/rendobj.h" -#include "WW3D2/line3d.h" - -class HAnimClass; - -// W3DInGameUI ---------------------------------------------------------------- -/** Implementation for the W3D game user interface. This singleton is - * responsible for all user interaction and feedback with as part of the - * user interface */ -//----------------------------------------------------------------------------- -class W3DInGameUI : public InGameUI -{ - -public: - - W3DInGameUI(); - virtual ~W3DInGameUI() override; - - // Inherited from subsystem interface ----------------------------------------------------------- - virtual void init() override; ///< Initialize the in-game user interface - virtual void update() override; //< Update the UI by calling preDraw(), draw(), and postDraw() - virtual void reset() override; ///< Reset - //----------------------------------------------------------------------------------------------- - - virtual void draw() override; ///< Render the in-game user interface - -protected: - - /// factory for views - virtual View *createView(bool dummy) override - { - 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 - virtual void drawAttackHints( View *view ); ///< draw attack hint visual feedback - virtual void drawPlaceAngle( View *view ); ///< draw place building angle if needed - - RenderObjClass *m_moveHintRenderObj[ MAX_MOVE_HINTS ]; - HAnimClass *m_moveHintAnim[ MAX_MOVE_HINTS ]; - RenderObjClass *m_buildingPlacementAnchor; - RenderObjClass *m_buildingPlacementArrow; - -}; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DMirror.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DMirror.h deleted file mode 100644 index c5070468912..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DMirror.h +++ /dev/null @@ -1,113 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "always.h" -#include "rendobj.h" -#include "w3d_file.h" -#include "dx8vertexbuffer.h" -#include "dx8indexbuffer.h" -#include "shader.h" -#include "vertmaterial.h" -#include "Lib/BaseType.h" -#include "Common/GameType.h" - -/// Custom render object that draws mirrors, water, and skies. -/** -This render object handles drawing reflected W3D scenes. It will only work -with rectangular planar surfaces and was tuned with an emphasis on water. -Since skies are only visible in reflections, this code will also -render clouds and sky bodies. -*/ -class MirrorRenderObjClass : public RenderObjClass -{ - -public: - - MirrorRenderObjClass(); - ~MirrorRenderObjClass(); - - ///////////////////////////////////////////////////////////////////////////// - // Render Object Interface (W3D methods) - ///////////////////////////////////////////////////////////////////////////// - virtual RenderObjClass * Clone() const; - virtual int Class_ID() const; - virtual void Render(RenderInfoClass & rinfo); -/// @todo: Add methods for collision detection with mirror surface -// virtual Bool Cast_Ray(RayCollisionTestClass & raytest); -// virtual Bool Cast_AABox(AABoxCollisionTestClass & boxtest); -// virtual Bool Cast_OBBox(OBBoxCollisionTestClass & boxtest); -// virtual Bool Intersect_AABox(AABoxIntersectionTestClass & boxtest); -// virtual Bool Intersect_OBBox(OBBoxIntersectionTestClass & boxtest); - - virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & aabox) const; - - ///allocate W3D resources needed to render mirror - Int init(Real waterLevel, Real dx, Real dy, SceneClass *parentScene); - static void setTimeOfDay(TimeOfDay tod) {m_tod=tod;} ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DParticleSys.h ///////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "GameClient/ParticleSys.h" -#include "WW3D2/pointgr.h" -#include "WW3D2/streak.h" -#include "WW3D2/rinfo.h" -#include "WWLib/bittype.h" - -//============================================================================= -/** W3D implementation of the game display which is responsible for creating - * all interaction with the screen and updating the display - */ -class W3DParticleSystemManager : public ParticleSystemManager -{ - -public: - W3DParticleSystemManager(); - virtual ~W3DParticleSystemManager() override; - - virtual void doParticles(RenderInfoClass &rinfo) override; - virtual void queueParticleRender() override; - ///< returns the number of particles shown on screen per frame - virtual Int getOnScreenParticleCount() override { return m_onScreenParticleCount; } - -private: - enum { MAX_POINTS_PER_GROUP = 512 }; - - PointGroupClass *m_pointGroup; ///< the point group that contains all of the particles - StreakLineClass *m_streakLine; ///< the streak class that contains all of the streaks - ShareBufferClass *m_posBuffer; ///< array of particle positions - ShareBufferClass *m_RGBABuffer; ///< array of particle color and alpha - ShareBufferClass *m_sizeBuffer; ///< array of particle sizes - ShareBufferClass *m_angleBuffer; ///< array of particle orientations - Bool m_readyToRender; ///< if true, it is OK to render -}; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DPoly.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DPoly.h deleted file mode 100644 index 8d442bec035..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DPoly.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DPoly.h ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DPoly.h -// -// Created: Mark Wilczynski, Jan 2002 -// -// Desc: Generic Polgon operations. -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "vector3.h" -#include "plane.h" -#include "simplevec.h" - -//------------------------------------------------------------------------------------------------- -/**VisPolyClass - This class is used to clip a polygon to a plane. Useful for manually - * clipping polys to the frustum or other geometry. Based on internal WW3D2 code. */ -//------------------------------------------------------------------------------------------------- - -class ClipPolyClass -{ -public: - void Reset(); - void Add_Vertex(const Vector3 & point); - void Clip(const PlaneClass & plane,ClipPolyClass & dest) const; - - SimpleDynVecClass Verts; -}; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h deleted file mode 100644 index 1f7b4fc96d2..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DProjectedShadow.h +++ /dev/null @@ -1,136 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DProjectedShadow.h /////////////////////////////////////////////////////////// -// -// Real time shadow projection through textures. -// -// Author: Mark Wilczynski, February 2002 -// -// -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "GameClient/Shadow.h" - -class W3DShadowTexture; //forward reference -class W3DShadowTextureManager; //forward reference -class Drawable; //forward reference -class W3DProjectedShadow; //forward reference. -class TexProjectClass; - -class W3DProjectedShadowManager : public ProjectedShadowManager -{ -/* enum ShadowTextureType { - STT_STATIC = 0x0001, - STT_DYNAMIC = 0x0002, - STT_SHARED - }; -*/ - public: - W3DProjectedShadowManager(); - virtual ~W3DProjectedShadowManager() override; - Bool init(); ///removeShadow(this);} ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "matrix4.h" -#include "GameClient/Shadow.h" - -class Drawable; //forward reference - -// ShadowManager ------------------------------------------------------------- -class W3DShadowManager -{ - -public: - - W3DShadowManager(); - ~W3DShadowManager(); - Bool init(); ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "WW3D2/matpass.h" -#include "WW3D2/dx8wrapper.h" - -class AABoxClass; -class WorldHeightMap; - -typedef UnsignedByte W3DShroudLevel; -// In Global Data now -//const W3DShroudLevel FULL_SHROUD_LEVEL=0; -//const W3DShroudLevel FOG_SHROUD_LEVEL=127; -//const W3DShroudLevel NO_SHROUD_LEVEL=255; - -/** Custom W3D material pass which has been modified to apply - a shroud texture projection. -*/ -class W3DShroudMaterialPassClass : public MaterialPassClass -{ -public: - W3DShroudMaterialPassClass() : m_isTransparentObjectPass(FALSE) {} - virtual void Install_Materials() const override; - virtual void UnInstall_Materials() const override; - void enableTransparentObjectPass(Bool enable) {m_isTransparentObjectPass = enable;} -protected: - //customized version to deal with transparent (alpha-tested) polys. - Bool m_isTransparentObjectPass; -}; - -/** Custom W3D material pass which has been modified to apply - a texture projection. Similar to the above code except - that it's more generic so could be used for non-shroud - projection of various masks. -*/ -class W3DMaskMaterialPassClass : public MaterialPassClass -{ -public: - W3DMaskMaterialPassClass() : m_texture(nullptr), m_allowUninstall(TRUE) {} - virtual void Install_Materials() const override; - virtual void UnInstall_Materials() const override; - void setTexture(TextureClass *texture) {m_texture=texture;} - void setAllowUninstall(Bool state) { m_allowUninstall = state;} - -protected: - TextureClass *m_texture; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "always.h" -#include "rendobj.h" -#include "w3d_file.h" -#include "dx8vertexbuffer.h" -#include "dx8indexbuffer.h" -#include "shader.h" -#include "vertmaterial.h" -#include "Lib/BaseType.h" - - -// -// W3DStatusCircle: Object generated from 2D Height grid -// -// -class W3DStatusCircle : public RenderObjClass -{ - -public: - - W3DStatusCircle(); - W3DStatusCircle(const W3DStatusCircle & src); - W3DStatusCircle & operator = (const W3DStatusCircle &); - virtual ~W3DStatusCircle() override; - - ///////////////////////////////////////////////////////////////////////////// - // Render Object Interface - ///////////////////////////////////////////////////////////////////////////// - virtual RenderObjClass * Clone() const override; - virtual int Class_ID() const override; - virtual void Render(RenderInfoClass & rinfo) override; -// virtual void Special_Render(SpecialRenderInfoClass & rinfo); -// virtual void Set_Transform(const Matrix3D &m); -// virtual void Set_Position(const Vector3 &v); -//TODO: MW: do these later - only needed for collision detection - virtual bool Cast_Ray(RayCollisionTestClass & raytest) override; -// virtual Bool Cast_AABox(AABoxCollisionTestClass & boxtest); -// virtual Bool Cast_OBBox(OBBoxCollisionTestClass & boxtest); -// virtual Bool Intersect_AABox(AABoxIntersectionTestClass & boxtest); -// virtual Bool Intersect_OBBox(OBBoxIntersectionTestClass & boxtest); - - virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const override; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & aabox) const override; - - -// virtual int Get_Num_Polys() const; -// virtual const char * Get_Name() const; -// virtual void Set_Name(const char * name); - -// unsigned int Get_Flags() { return Flags; } -// void Set_Flags(unsigned int flags) { Flags = flags; } -// void Set_Flag(unsigned int flag, Bool onoff) { Flags &= (~flag); if (onoff) Flags |= flag; } - - int updateBlock(); - Int freeMapResources(); - void static setColor(Int r, Int g, Int b) {m_needUpdate = true; m_diffuse = (b) + (g<<8) + (r<<16);}; -protected: - Int m_numTriangles; //dimensions of list - static Int m_diffuse; - static Bool m_needUpdate; - - DX8IndexBufferClass *m_indexBuffer; //indices defining a triangle strip the covers full terrain - ShaderClass m_shaderClass; //shader or rendering state for heightmap - VertexMaterialClass *m_vertexMaterialClass; - DX8VertexBufferClass *m_vertexBufferCircle; //collection of vertexes that make the circle. - DX8VertexBufferClass *m_vertexBufferScreen; //2 triangle quad that covers the screen. - - int initData(); - Int updateCircleVB(); - Int updateScreenVB(Int diffuse); -}; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h deleted file mode 100644 index f285bcb7cea..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DVolumetricShadow.h +++ /dev/null @@ -1,188 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "matrix4.h" -#include "W3DDevice/GameClient/W3DBufferManager.h" -#include "GameClient/Shadow.h" - -///@todo Make the 100 below a 'better' number. Was 32, increased because of overcomplex models. -#define MAX_SHADOW_CASTER_MESHES 160 //number of meshes allowed in animated hierarchy (must be <256 since index is a byte). - -class W3DShadowGeometry; //forward reference -class W3DShadowGeometryManager; //forward reference -struct Geometry; //forward reference -struct PolyNeighbor; //forward reference -class W3DVolumetricShadow; //forward reference -class Drawable; //forward reference - -struct W3DVolumetricShadowRenderTask : public W3DBufferManager::W3DRenderTask -{ - W3DVolumetricShadow *m_parentShadow; ///
m_nextTask=oldTask; - } - void invalidateCachedLightPositions(); ///removeShadow(this);} ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DWaypointBuffer.h //////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: Command & Conquers: Generals -// -// File name: W3DWaypointBuffer.h -// -// Created: Kris Morness, October 2002 -// -// Desc: Draw buffer to handle all the waypoints in the scene. Waypoints -// are rendered after terrain, after roads & bridges, and after -// global fog, but before structures, objects, units, trees, etc. -// This way if we have two waypoints at the bottom of a hill but -// going through the hill, the line won't get cut off. However, -// structures and units on top of paths will render above it. Waypoints -// are only shown for selected units while in waypoint plotting mode. -// -//----------------------------------------------------------------------------- - -#pragma once - -//----------------------------------------------------------------------------- -// Includes -//----------------------------------------------------------------------------- -#include "always.h" -#include "rendobj.h" -#include "w3d_file.h" -#include "dx8vertexbuffer.h" -#include "dx8indexbuffer.h" -#include "shader.h" -#include "vertmaterial.h" -#include "Lib/BaseType.h" -#include "Common/GameType.h" - -class SegmentedLineClass; - -class W3DWaypointBuffer -{ - friend class HeightMapRenderObjClass; -public: - - W3DWaypointBuffer(); - ~W3DWaypointBuffer(); - - void drawWaypoints(RenderInfoClass &rinfo); - void freeWaypointBuffers(); - - -private: - void setDefaultLineStyle(); - - RenderObjClass *m_waypointNodeRobj; - SegmentedLineClass *m_line; - TextureClass *m_texture; -}; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWebBrowser.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWebBrowser.h deleted file mode 100644 index edd4c9a3e30..00000000000 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DWebBrowser.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -///// W3DWebBrowser.h //////////////////////// -// July 2002, Bryan Cleveland - -#pragma once - -#include "GameNetwork/WOLBrowser/WebBrowser.h" - -class TextureClass; -class Image; -class GameWindow; - -class W3DWebBrowser : public WebBrowser -{ - public: - W3DWebBrowser(); - - virtual Bool createBrowserWindow(const char *tag, GameWindow *win) override; - virtual void closeBrowserWindow(GameWindow *win) override; - -}; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp deleted file mode 100644 index fa6e7ba0d33..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp +++ /dev/null @@ -1,1014 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DControlBar.cpp //////////////////////////////////////////////////////////////////////// -// Author: Colin Day -// Desc: Control bar callbacks -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "Common/GameUtility.h" -#include "Common/GlobalData.h" -#include "Common/Radar.h" -#include "Common/Player.h" -#include "Common/PlayerList.h" -#include "GameClient/GameWindow.h" -#include "W3DDevice/GameClient/W3DGameWindow.h" -#include "GameClient/InGameUI.h" -#include "GameClient/Display.h" -#include "GameClient/ControlBar.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/ControlBarScheme.h" -#include "GameClient/MapUtil.h" -#include "GameLogic/GameLogic.h" - -//------------------------------------------------------------------------------------------------- -void W3DCameoMovieDraw( GameWindow *window, WinInstanceData *instData ) -{ - // draw video buffer - VideoBuffer *video = TheInGameUI->cameoVideoBuffer(); - if ( video ) - { - ICoord2D pos, size; - window->winGetScreenPosition( &pos.x, &pos.y ); - window->winGetSize( &size.x, &size.y ); - - TheDisplay->drawVideoBuffer( video, pos.x, pos.y, pos.x + size.x, pos.y + size.y ); - } -} - - -//------------------------------------------------------------------------------------------------- -void W3DLeftHUDDraw( GameWindow *window, WinInstanceData *instData ) -{ - // draw the default stuff - // draw video buffer - VideoBuffer *video = TheInGameUI->videoBuffer(); - if ( video ) - { - ICoord2D pos, size; - window->winGetScreenPosition( &pos.x, &pos.y ); - window->winGetSize( &size.x, &size.y ); - - TheDisplay->drawVideoBuffer( video, pos.x, pos.y, pos.x + size.x, pos.y + size.y ); - } - else if( rts::localPlayerHasRadar() ) - { - ICoord2D pos, size; - //W3DGameWinDefaultDraw( window, instData ); - // window position and size on the display - window->winGetScreenPosition( &pos.x, &pos.y ); - window->winGetSize( &size.x, &size.y ); - //TheDisplay->drawOpenRect(pos.x, pos.y, size.x,size.y, 1,GameMakeColor(100,100,255,255)); - // draw the radar on the screen now - TheRadar->draw( pos.x + 1, pos.y + 1, size.x - 2, size.y - 2 ); - - } -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void W3DRightHUDDraw( GameWindow *window, WinInstanceData *instData ) -{ - - // draw the default stuff - if( BitIsSet(window->winGetStatus(), WIN_STATUS_IMAGE )) - W3DGameWinDefaultDraw( window, instData ); - -} - -Real logN(Real value, Real logBase) -{ - return (Real)log10(value)/ log10(logBase); -} - -//------------------------------------------------------------------------------------------------- -/** Temporary power meter drawing ... there are some problems with this meter, that is - * what to do when the player doesn't have power, builds a building before a power plant - * etc, but I don't want to spend time on this since it's not a task right now and I'm - * sure it will be in the future. This is just down and dirty to see SOMETHING (CD) */ -//------------------------------------------------------------------------------------------------- -void W3DPowerDraw( GameWindow *window, WinInstanceData *instData ) -{ - //static const Image *endBarYellow = TheMappedImageCollection->findImageByName("PowerBarYellowEndR"); - //static const Image *beginBarYellow = TheMappedImageCollection->findImageByName("PowerBarYellowEndL"); - static const Image *centerBarYellow = TheMappedImageCollection->findImageByName("PowerPointY"); - //static const Image *endBarRed = TheMappedImageCollection->findImageByName("PowerBarRedEndR"); - //static const Image *beginBarRed = TheMappedImageCollection->findImageByName("PowerBarRedEndL"); - static const Image *centerBarRed = TheMappedImageCollection->findImageByName("PowerPointR"); - //static const Image *endBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreenEndR"); - //static const Image *beginBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreenEndL"); - static const Image *centerBarGreen = TheMappedImageCollection->findImageByName("PowerPointG"); - //const Image *endBar = nullptr; - //const Image *beginBar = nullptr; - const Image *centerBar = nullptr; - static const Image *slider = TheMappedImageCollection->findImageByName("PowerBarSlider"); - Player* player = TheControlBar->getCurrentlyViewedPlayer(); - - if(!player || !TheGlobalData) - return; - Energy *energy = player->getEnergy(); - if( energy == nullptr ) - return; - - Int consumption = energy->getConsumption(); - Int production = energy->getProduction(); - - ICoord2D pos, size; - window->winGetScreenPosition( &pos.x, &pos.y ); - window->winGetSize( &size.x, &size.y ); - - static Real pixelsPerInterval = size.x / TheGlobalData->m_powerBarIntervals; - Int delta = TheGlobalData->m_powerBarYellowRange; - - if((consumption > energy->getProduction() - delta) && (consumption <= energy->getProduction())) - { - // 6 and 1 is Green, 6 and 2 is yellow, 6 and 6 is yellow - //endBar = endBarYellow; - //beginBar = beginBarYellow; - centerBar = centerBarYellow; - } - else if( consumption > production) - { - // endBar = endBarRed; -// beginBar = beginBarRed; - centerBar = centerBarRed; - } - else - { - // endBar = endBarGreen; -// beginBar = beginBarGreen; - centerBar = centerBarGreen; - } - //slider = TheMappedImageCollection->findImageByName("PowerBarSlider"); - if( !slider || !centerBar) - return; - - Int range; - range = logN(production, TheGlobalData->m_powerBarBase) * (size.x / TheGlobalData->m_powerBarIntervals); - if(range >= size.x) - range = size.x; -// if(range < endBar->getImageWidth() + beginBar->getImageWidth()) -// range = endBar->getImageWidth() + beginBar->getImageWidth(); - - - -// // get image sizes for the ends -// ICoord2D leftSize, rightSize, start, end; -// leftSize.x = beginBar->getImageWidth(); -// leftSize.y = beginBar->getImageHeight(); -// rightSize.x = endBar->getImageWidth(); -// rightSize.y = endBar->getImageHeight(); -// -// // get two key points used in the end drawing -// ICoord2D leftEnd, rightStart; -// leftEnd.x = pos.x + leftSize.x; -// leftEnd.y = pos.y + size.y; -// rightStart.x = pos.x + range - rightSize.x; -// rightStart.y = pos.y; - - // draw the center repeating bar - Int centerWidth, pieces; - - // get width we have to draw our repeating center in - centerWidth = range; //rightStart.x - leftEnd.x; - - if( centerWidth > 0) - { - - // how many whole repeating pieces will fit in that width - pieces = centerWidth / centerBar->getImageWidth(); - ICoord2D start, end; - // draw the pieces - start.x = pos.x; - start.y = pos.y; - end.y = start.y + size.y;// + yOffset; - for( Int i = 0; i < pieces; i++ ) - { - - end.x = start.x + centerBar->getImageWidth(); - TheWindowManager->winDrawImage( centerBar, - start.x, start.y, - end.x, end.y ); - start.x += centerBar->getImageWidth(); - - } - - // we will draw the image but clip the parts we don't want to show - IRegion2D reg; - reg.lo.x = start.x; - reg.lo.y = start.y; - reg.hi.x = pos.x + size.x;//rightStart.x; - reg.hi.y = pos.y + size.y; - centerWidth = pos.x +size.x - start.x; - if( centerWidth > 0) - { - TheDisplay->setClipRegion(®); - end.x = start.x + centerBar->getImageWidth(); - TheWindowManager->winDrawImage( centerBar, - start.x, start.y, - end.x, end.y ); - TheDisplay->enableClipping(FALSE); - } - -// // draw left end -// start.x = pos.x; -// start.y = pos.y; -// end = leftEnd; -// TheWindowManager->winDrawImage(beginBar, start.x, start.y, end.x, end.y); -// -// // draw right end -// start = rightStart; -// end.x = start.x + rightSize.x; -// end.y = start.y + size.y; -// TheWindowManager->winDrawImage(endBar, start.x, start.y, end.x, end.y); - } - Int posXstart; - Int posXend; - Real consumptionForNeedle = (consumption == 1) ? 1.5f : INT_TO_REAL(consumption);//Log(1) == 0, but we need to show something for 1 power used. - range = logN(consumptionForNeedle, TheGlobalData->m_powerBarBase) * (size.x / TheGlobalData->m_powerBarIntervals); - if(centerWidth <= 0 && range <= 0) - return; - if(range >= size.x) - { - posXstart = pos.x + size.x - slider->getImageWidth(); - posXend = pos.x + size.x; - } - else - { - posXstart = pos.x + range - slider->getImageWidth()/2; - posXend = pos.x + range + slider->getImageWidth()/2; - } - if(posXstart <=pos.x) - { - posXstart = pos.x; - posXend = pos.x + slider->getImageWidth(); - } - TheWindowManager->winDrawImage(slider, posXstart, pos.y + size.y - slider->getImageHeight(), posXend, pos.y + size.y); -} - -void W3DPowerDrawA( GameWindow *window, WinInstanceData *instData ) -{ - static const Image *endBarYellow = TheMappedImageCollection->findImageByName("PowerBarYellowEndR"); - static const Image *beginBarYellow = TheMappedImageCollection->findImageByName("PowerBarYellowEndL"); - static const Image *centerBarYellow = TheMappedImageCollection->findImageByName("PowerBarYellow"); - static const Image *endBarRed = TheMappedImageCollection->findImageByName("PowerBarRedEndR"); - static const Image *beginBarRed = TheMappedImageCollection->findImageByName("PowerBarRedEndL"); - static const Image *centerBarRed = TheMappedImageCollection->findImageByName("PowerBarRed"); - static const Image *endBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreenEndR"); - static const Image *beginBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreenEndL"); - static const Image *centerBarGreen = TheMappedImageCollection->findImageByName("PowerBarGreen"); - const Image *endBar = nullptr; - const Image *beginBar = nullptr; - const Image *centerBar = nullptr; - static const Image *slider = TheMappedImageCollection->findImageByName("PowerBarSlider"); - Player* player = TheControlBar->getCurrentlyViewedPlayer(); - - if(!player || !TheGlobalData) - return; - Energy *energy = player->getEnergy(); - if( energy == nullptr ) - return; - - Int consumption = energy->getConsumption(); - Int production = energy->getProduction(); - - ICoord2D pos, size; - window->winGetScreenPosition( &pos.x, &pos.y ); - window->winGetSize( &size.x, &size.y ); - - static Real pixelsPerInterval = size.x / TheGlobalData->m_powerBarIntervals; - Int delta = TheGlobalData->m_powerBarYellowRange; - - if((consumption > energy->getProduction() - delta) && (consumption <= energy->getProduction())) - { - // 6 and 1 is Green, 6 and 2 is yellow, 6 and 6 is yellow - endBar = endBarYellow; - beginBar = beginBarYellow; - centerBar = centerBarYellow; - } - else if( consumption > production) - { - endBar = endBarRed; - beginBar = beginBarRed; - centerBar = centerBarRed; - } - else - { - endBar = endBarGreen; - beginBar = beginBarGreen; - centerBar = centerBarGreen; - } - //slider = TheMappedImageCollection->findImageByName("PowerBarSlider"); - if( !slider || !endBar || !beginBar || !centerBar) - return; - - Int range; - range = logN(production, TheGlobalData->m_powerBarBase) * (size.x / TheGlobalData->m_powerBarIntervals); - if(range >= size.x) - range = size.x; - if(range < endBar->getImageWidth() + beginBar->getImageWidth()) - range = endBar->getImageWidth() + beginBar->getImageWidth(); - - - - // get image sizes for the ends - ICoord2D leftSize, rightSize, start, end; - leftSize.x = beginBar->getImageWidth(); - leftSize.y = beginBar->getImageHeight(); - rightSize.x = endBar->getImageWidth(); - rightSize.y = endBar->getImageHeight(); - - // get two key points used in the end drawing - ICoord2D leftEnd, rightStart; - leftEnd.x = pos.x + leftSize.x; - leftEnd.y = pos.y + size.y; - rightStart.x = pos.x + range - rightSize.x; - rightStart.y = pos.y; - - // draw the center repeating bar - Int centerWidth, pieces; - - // get width we have to draw our repeating center in - centerWidth = rightStart.x - leftEnd.x; - - if( centerWidth <= 0) - { - // draw left end - start.x = pos.x; - start.y = pos.y; - end.y = leftEnd.y; - end.x = pos.x + range/2; - TheWindowManager->winDrawImage(beginBar, start.x, start.y, end.x, end.y); - - // draw right end - start.y = rightStart.y; - start.x = end.x; - end.x = pos.x + range; - end.y = start.y + size.y; - TheWindowManager->winDrawImage(endBar, start.x, start.y, end.x, end.y); - } - else - { - - // how many whole repeating pieces will fit in that width - pieces = centerWidth / centerBar->getImageWidth(); - - // draw the pieces - start.x = leftEnd.x; - start.y = pos.y; - end.y = start.y + size.y; //centerImage->getImageHeight() + yOffset; - for( Int i = 0; i < pieces; i++ ) - { - - end.x = start.x + centerBar->getImageWidth(); - TheWindowManager->winDrawImage( centerBar, - start.x, start.y, - end.x, end.y ); - start.x += centerBar->getImageWidth(); - - } - - // we will draw the image but clip the parts we don't want to show - IRegion2D reg; - reg.lo.x = start.x; - reg.lo.y = start.y; - reg.hi.x = rightStart.x; - reg.hi.y = end.y; - centerWidth = rightStart.x - start.x; - if( centerWidth > 0) - { - TheDisplay->setClipRegion(®); - end.x = start.x + centerBar->getImageWidth(); - TheWindowManager->winDrawImage( centerBar, - start.x, start.y, - end.x, end.y ); - TheDisplay->enableClipping(FALSE); - } - - // draw left end - start.x = pos.x; - start.y = pos.y; - end = leftEnd; - TheWindowManager->winDrawImage(beginBar, start.x, start.y, end.x, end.y); - - // draw right end - start = rightStart; - end.x = start.x + rightSize.x; - end.y = start.y + size.y; - TheWindowManager->winDrawImage(endBar, start.x, start.y, end.x, end.y); - } - Int posXstart; - Int posXend; - Real consumptionForNeedle = (consumption == 1) ? 1.5f : INT_TO_REAL(consumption);//Log(1) == 0, but we need to show something for 1 power used. - range = logN(consumptionForNeedle, TheGlobalData->m_powerBarBase) * (size.x / TheGlobalData->m_powerBarIntervals); - if(range >= size.x) - { - posXstart = pos.x + size.x - slider->getImageWidth(); - posXend = pos.x + size.x; - } - else - { - posXstart = pos.x + range - slider->getImageWidth()/2; - posXend = pos.x + range + slider->getImageWidth()/2; - } - if(posXstart <=pos.x) - { - posXstart = pos.x; - posXend = pos.x + slider->getImageWidth(); - } - TheWindowManager->winDrawImage(slider, posXstart, pos.y + size.y - slider->getImageHeight(), posXend, pos.y + size.y); -} - -void W3DCommandBarGridDraw( GameWindow *window, WinInstanceData *instData ) -{ - if( BitIsSet(window->winGetStatus(), WIN_STATUS_IMAGE )) - { - W3DGameWinDefaultDraw( window, instData ); - return; - } - - ICoord2D pos, size; - window->winGetScreenPosition( &pos.x, &pos.y ); - window->winGetSize( &size.x, &size.y ); - - Color color = TheControlBar->getBorderColor(); - window->winSetEnabledBorderColor(0, color); - W3DGameWinDefaultDraw( window, instData ); - - TheDisplay->drawLine(pos.x, pos.y + size.y * .33, pos.x + size.x, pos.y+ size.y*.33, 1,color); - TheDisplay->drawLine(pos.x, pos.y + size.y * .66, pos.x + size.x, pos.y+ size.y*.66, 1,color); - TheDisplay->drawLine(pos.x + size.x * .33, pos.y, pos.x + size.x *.33, pos.y +size.y, 1,color); - TheDisplay->drawLine(pos.x + size.x * .66, pos.y, pos.x + size.x *.66, pos.y + size.y, 1,color); - - - - -} - -void W3DCommandBarGenExpDraw( GameWindow *window, WinInstanceData *instData ) -{ - // TheSuperHackers @bugfix Stubbjax 08/08/2025 Show the experience bar for observers - Player* player = TheControlBar->getCurrentlyViewedPlayer(); - - if (!player) - return; - - static const Image *endBar = TheMappedImageCollection->findImageByName("GenExpBarTop1"); - static const Image *beginBar = TheMappedImageCollection->findImageByName("GenExpBarBottom1"); - static const Image *centerBar = TheMappedImageCollection->findImageByName("GenExpBar1"); - Int progress = 0; - Int skillPointsRequired = player->getSkillPointsLevelUp() - player->getSkillPointsLevelDown(); - - // TheSuperHackers @bugfix Mauller 04/05/2025 Prevent possible division by zero - if ( skillPointsRequired > 0) - { - progress = ( ((player->getSkillPoints() - player->getSkillPointsLevelDown()) * 100) / skillPointsRequired ); - } - - if(progress <= 0) - return; - - // GS This should never be necessary, but scripts can change the points required or even disable a level. - // A disabled level will be -1 for points required. Just be totally safe and bind to 100, and we will - // fix the scripts to bind the points gained later. - if( progress > 100 ) - progress = 100; - - ICoord2D pos, size; - window->winGetScreenPosition( &pos.x, &pos.y ); - window->winGetSize( &size.x, &size.y ); - - - - if( !endBar || !beginBar || !centerBar) - return; - - Int range; - range = size.y * progress / 100; - - - // get image sizes for the ends - ICoord2D topSize, bottomSize, start, end; - bottomSize.x = beginBar->getImageWidth(); - bottomSize.y = beginBar->getImageHeight(); - topSize.x = endBar->getImageWidth(); - topSize.y = endBar->getImageHeight(); - - // get two key points used in the end drawing - ICoord2D bottomEnd, topStart; - bottomEnd.x = pos.x + size.x; - bottomEnd.y = pos.y + size.y - bottomSize.y; - topStart.x = pos.x; - topStart.y = pos.y +size.y - range - topSize.y; - - // draw the center repeating bar - Int centerWidth, pieces; - - // get width we have to draw our repeating center in - centerWidth = bottomEnd.y - topStart.y; - - if( centerWidth <= 0) - { - // draw left end - start.x = pos.x; - start.y = pos.y + size.y - bottomSize.y; - end.y = pos.y + size.y; - end.x = pos.x + size.x; - TheWindowManager->winDrawImage(beginBar, start.x, start.y, end.x, end.y); - - // draw right end - start.y = pos.y + size.y - bottomSize.y - topSize.y; - start.x = pos.x; - end.x = pos.x + size.x; - end.y = start.y + topSize.y; - TheWindowManager->winDrawImage(endBar, start.x, start.y, end.x, end.y); - } - else - { - - // how many whole repeating pieces will fit in that width - pieces = centerWidth / centerBar->getImageHeight(); - - // draw the pieces - start.x = pos.x; - start.y = topStart.y; - end.x = start.x + size.x; //centerImage->getImageHeight() + yOffset; - for( Int i = 0; i < pieces; i++ ) - { - - end.y = start.y + centerBar->getImageHeight(); - TheWindowManager->winDrawImage( centerBar, - start.x, start.y, - end.x, end.y ); - start.y += centerBar->getImageHeight(); - - } - - // we will draw the image but clip the parts we don't want to show - IRegion2D reg; - reg.lo.x = start.x; - reg.lo.y = start.y; - reg.hi.x = bottomEnd.x; - reg.hi.y = bottomEnd.y; - centerWidth = bottomEnd.y - start.y; - if( centerWidth > 0) - { - TheDisplay->setClipRegion(®); - end.y = start.y + centerBar->getImageHeight(); - TheWindowManager->winDrawImage( centerBar, - start.x, start.y, - end.x, end.y ); - TheDisplay->enableClipping(FALSE); - } - - // draw left end - end.x = pos.x + size.x; - end.y = pos.y + size.y; - start.x = pos.x; - start.y = bottomEnd.y; - TheWindowManager->winDrawImage(beginBar, start.x, start.y, end.x, end.y); - - // draw right end - start.x = pos.x; - start.y = pos.y +size.y - range; - end.x = pos.x + size.x; - end.y = pos.y +size.y - range - topSize.y; - TheWindowManager->winDrawImage(endBar, start.x, start.y, end.x, end.y); - } - -} - -void W3DCommandBarTopDraw( GameWindow *window, WinInstanceData *instData ) -{ - GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonGeneral")); - if(!win || win->winIsHidden() || !ThePlayerList->getLocalPlayer()->isPlayerActive()) - return; - -// TheControlBar->drawTransitionHandler(); - -// ICoord2D pos, size, imageStart, imageEnd; -// win->winGetScreenPosition(&pos.x, &pos.y); -// win->winGetSize(&size.x, &size.y); -//// const Image *image =TheControlBar->getStarImage(); -// imageStart.x = pos.x + size.x/2 - image->getImageWidth()/2; -// imageStart.y = pos.y + size.y/2 - image->getImageHeight()/2; -// imageEnd.x = imageStart.x + image->getImageWidth(); -// imageEnd.y = imageStart.y + image->getImageHeight(); -// TheDisplay->drawImage(TheControlBar->getStarImage(), imageStart.x, imageStart.y, imageEnd.x, imageEnd.y); -} - - -void W3DCommandBarBackgroundDraw( GameWindow *window, WinInstanceData *instData ) -{ - - ControlBarSchemeManager *man = TheControlBar->getControlBarSchemeManager(); - if(!man) - return; - static NameKeyType winNamekey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" ); - GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr,winNamekey); - static ICoord2D basePos; - if(!win) - { - return; - //win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); - } - TheControlBar->getBackgroundMarkerPos(&basePos.x, &basePos.y); - ICoord2D pos, offset; - win->winGetScreenPosition(&pos.x,&pos.y); - offset.x = pos.x - basePos.x; - offset.y = pos.y - basePos.y; - - man->drawBackground(offset); -} - - -void W3DCommandBarForegroundDraw( GameWindow *window, WinInstanceData *instData ) -{ - - ControlBarSchemeManager *man = TheControlBar->getControlBarSchemeManager(); - if(!man) - return; - - static NameKeyType winNamekey = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" ); - GameWindow *win = TheWindowManager->winGetWindowFromId(nullptr,winNamekey); - static ICoord2D basePos; - if(!win) - { - return; - //win = TheWindowManager->winGetWindowFromId(nullptr,TheNameKeyGenerator->nameToKey( "ControlBar.wnd:BackgroundMarker" )); - } - TheControlBar->getForegroundMarkerPos(&basePos.x, &basePos.y); - ICoord2D pos, offset; - win->winGetScreenPosition(&pos.x,&pos.y); - offset.x = pos.x - basePos.x; - offset.y = pos.y - basePos.y; - - man->drawForeground(offset); - -} - -void W3DNoDraw( GameWindow *window, WinInstanceData *instData ) -{ - - // draw the default stuff -// W3DGameWinDefaultDraw( window, instData ); - -} - -void drawSkinnyBorder( Int x, Int y, Int width, Int height); -void W3DDrawMapPreview( GameWindow *window, WinInstanceData *instData) -{ - MapMetaData *mmData = (MapMetaData *)window->winGetUserData(); - Int pixelX, pixelY, width, height; - // if the local player does not have a radar then we can't draw anything - window->winGetScreenPosition(&pixelX, &pixelY); - window->winGetSize(&width, &height); - if(!mmData) - { - W3DGameWinDefaultDraw( window, instData ); - drawSkinnyBorder(pixelX - 1, pixelY - 1, width + 2, height + 2); - return; - } - - - - - // - // given a upper left corner at pixelX|Y and a width and height to draw into, figure out - // where we should start and end the image so that the final drawn image has the - // same ratio as the map and isn't stretched or distorted - // - ICoord2D ul, lr; - findDrawPositions( pixelX, pixelY, width, height, mmData->m_extent, &ul, &lr ); - -// Int scaledWidth = lr.x - ul.x; -// Int scaledHeight = lr.y - ul.y; - - // draw black border areas where we need map - Color fillColor = GameMakeColor( 0, 0, 0, 255 ); - Color lineColor = GameMakeColor( 50, 50, 50, 255 ); - - if( mmData->m_extent.width()/width >= mmData->m_extent.height()/height ) - { - - // draw horizontal bars at top and bottom - TheDisplay->drawFillRect( pixelX, pixelY, width, ul.y - pixelY - 1, fillColor ); - TheDisplay->drawFillRect( pixelX, lr.y + 1, width, pixelY + height - lr.y - 1, fillColor); - TheDisplay->drawLine(pixelX, ul.y, pixelX + width, ul.y, 1, lineColor); - TheDisplay->drawLine(pixelX, lr.y + 1, pixelX + width, lr.y + 1, 1, lineColor); - - } - else - { - - // draw vertical bars to the left and right - TheDisplay->drawFillRect( pixelX, pixelY, ul.x - pixelX - 1, height, fillColor ); - TheDisplay->drawFillRect( lr.x + 1, pixelY, width - (lr.x - pixelX) - 1, height, fillColor ); - TheDisplay->drawLine(ul.x, pixelY, ul.x, pixelY + height, 1, lineColor); - TheDisplay->drawLine(lr.x + 1, pixelY, lr.x + 1, pixelY + height, 1, lineColor); - - } - - if(!BitIsSet(window->winGetStatus(), WIN_STATUS_IMAGE) || !window->winGetEnabledImage(0)) - TheDisplay->drawFillRect(ul.x, ul.y, lr.x -ul.x, lr.y-ul.y, lineColor); - else - TheDisplay->drawImage(window->winGetEnabledImage(0) , ul.x, ul.y, lr.x, lr.y ); - - const Image *image = TheMappedImageCollection->findImageByName("TecBuilding"); - ICoord2DList::iterator it = TheSupplyAndTechImageLocations.m_techPosList.begin(); - if(image) - while(it != TheSupplyAndTechImageLocations.m_techPosList.end()) - { - TheDisplay->drawImage(image, pixelX + it->x, pixelY + it->y, pixelX + it->x + SUPPLY_TECH_SIZE, pixelY + it->y +SUPPLY_TECH_SIZE); - it++; - } - - image = TheMappedImageCollection->findImageByName("Cash"); - it = TheSupplyAndTechImageLocations.m_supplyPosList.begin(); - if(image) - while(it != TheSupplyAndTechImageLocations.m_supplyPosList.end()) - { - TheDisplay->drawImage(image, pixelX + it->x, pixelY + it->y, pixelX + it->x + SUPPLY_TECH_SIZE, pixelY + it->y +SUPPLY_TECH_SIZE); - it++; - } - drawSkinnyBorder(pixelX - 1, pixelY - 1, width + 2, height + 2); -} - -void drawSkinnyBorder( Int x, Int y, Int width, Int height) -{ - - enum - { - BORDER_CORNER_SIZE = 5, - BORDER_LINE_SIZE = 5, - }; - Int Offset = 2; - Int OffsetLower = 5; - - // save original x, y - Int originalX = x; - Int originalY = y; - Int maxX = x + width; - Int maxY = y + height; - Int x2, y2; // used for simultaneous drawing of line pairs - Int size = 5; - Int halfSize = size / 2; - const Image *image1, *image2; - // Draw Horizontal Lines - // All border pieces are based on a 10 pixel offset from the centerline - y = originalY - Offset; - y2 = maxY - OffsetLower; - x2 = maxX - (OffsetLower + BORDER_LINE_SIZE); - image1 = TheMappedImageCollection->findImageByName("FrameT"); - image2 = TheMappedImageCollection->findImageByName("FrameB"); - for( x=(originalX + 3); x <= x2; x += BORDER_LINE_SIZE ) - { - - TheDisplay->drawImage( image1, - x, y, x + size, y + size ); - TheDisplay->drawImage( image2, - x, y2, x + size, y2 + size ); - - } - - x2 = maxX - 5;//BORDER_CORNER_SIZE; - - // x == place to draw remainder if any - if( (x2 - x) >= (BORDER_LINE_SIZE / 2) ) - { - - //Blit Half piece - TheDisplay->drawImage( image1, - x, y, x + halfSize, y + size ); - TheDisplay->drawImage( image2, - x, y2, x + halfSize, y2 + size ); - - x += (BORDER_LINE_SIZE / 2); - - } - - // x2 - x ... must now be less than a half piece - // check for equals and if not blit an adjusted half piece border pieces have - // a two pixel repeat so we will blit one pixel over if necessary to line up - // the art, but we'll cover-up the overlap with the corners - if( x < x2 ) - { - x -= ((BORDER_LINE_SIZE / 2) - (((x2 - x) + 1) & ~1)); - - //Blit Half piece - TheDisplay->drawImage(image1, - x, y, x + halfSize, y + size ); - TheDisplay->drawImage( image2, - x, y2, x + halfSize, y2 + size ); - - } - - // Draw Vertical Lines - // All border pieces are based on a 10 pixel offset from the centerline - image1 = TheMappedImageCollection->findImageByName("FrameL"); - image2 = TheMappedImageCollection->findImageByName("FrameR"); - - x = originalX - Offset; - x2 = maxX - OffsetLower; - y2 = maxY - (OffsetLower + BORDER_LINE_SIZE); - - for( y=(originalY + 3); y <= y2; y += BORDER_LINE_SIZE ) - { - - TheDisplay->drawImage( image1, - x, y, x + size, y + size ); - TheDisplay->drawImage( image2, - x2, y, x2 + size, y + size ); - - } - - y2 = maxY - OffsetLower;//BORDER_CORNER_SIZE; - - // y == place to draw remainder if any - if( (y2 - y) >= (BORDER_LINE_SIZE / 2) ) - { - - //Blit Half piece - TheDisplay->drawImage( image1, - x, y, x + size, y + halfSize ); - TheDisplay->drawImage( image2, - x2, y, x2 + size, y + halfSize ); - - y += (BORDER_LINE_SIZE / 2); - } - - // y2 - y ... must now be less than a half piece - // check for equals and if not blit an adjusted half piece border pieces have - // a two pixel repeat so we will blit one pixel over if necessary to line up - // the art, but we'll cover-up the overlap with the corners - if( y < y2 ) - { - y -= ((BORDER_LINE_SIZE / 2) - (((y2 - y) + 1) & ~1)); - - //Blit Half piece - TheDisplay->drawImage( image1, - x, y, x + size, y + halfSize ); - TheDisplay->drawImage( image2, - x2, y, x2 + size, y + halfSize ); - - } - - // Draw Corners - x = originalX - 2;//BORDER_CORNER_SIZE ; - y = originalY - 2;//BORDER_CORNER_SIZE; - image1 = TheMappedImageCollection->findImageByName("FrameCornerUL"); - TheDisplay->drawImage( image1, - x, y, x + size, y + size ); - x = maxX - 5;//BORDER_CORNER_SIZE; - y = originalY - 2;//BORDER_CORNER_SIZE; - image1 = TheMappedImageCollection->findImageByName("FrameCornerUR"); - TheDisplay->drawImage(image1, - x, y, x + size, y + size ); - x = originalX - 2;//BORDER_CORNER_SIZE; - y = maxY - 5;//BORDER_CORNER_SIZE; - image1 = TheMappedImageCollection->findImageByName("FrameCornerLL"); - TheDisplay->drawImage( image1, - x, y, x + size, y + size ); - x = maxX - 5;//BORDER_CORNER_SIZE; - y = maxY - 5;//BORDER_CORNER_SIZE; - image1 = TheMappedImageCollection->findImageByName("FrameCornerLR"); - TheDisplay->drawImage(image1, - x, y, x + size, y + size ); - - -} - - -void W3DCommandBarHelpPopupDraw( GameWindow *window, WinInstanceData *instData ) -{ - - static const Image *endBar = TheMappedImageCollection->findImageByName("Helpbox-top"); - static const Image *beginBar = TheMappedImageCollection->findImageByName("Helpbox-bottom"); - static const Image *centerBar = TheMappedImageCollection->findImageByName("Helpbox-middle"); - - ICoord2D pos, size; - window->winGetScreenPosition( &pos.x, &pos.y ); - window->winGetSize( &size.x, &size.y ); - - - - if( !endBar || !beginBar || !centerBar) - return; - - -// Int range; -// range = size.y; - - - // get image sizes for the ends - ICoord2D topSize, bottomSize, start, end; - bottomSize.x = beginBar->getImageWidth(); - bottomSize.y = beginBar->getImageHeight(); - topSize.x = endBar->getImageWidth(); - topSize.y = endBar->getImageHeight(); - - // get two key points used in the end drawing - ICoord2D bottomEnd, topStart; - bottomEnd.x = pos.x + size.x; - bottomEnd.y = pos.y + size.y - bottomSize.y; - topStart.x = pos.x; - topStart.y = pos.y +size.y - topSize.y; - - // draw the center repeating bar - Int centerWidth, pieces; - - // get width we have to draw our repeating center in - centerWidth = size.y - topSize.y - bottomSize.y; - - if( centerWidth <= 0) - { - // draw left end - start.x = pos.x; - start.y = pos.y + size.y - bottomSize.y; - end.y = pos.y + size.y; - end.x = pos.x + size.x; - TheWindowManager->winDrawImage(beginBar, start.x, start.y, end.x, end.y); - - // draw right end - start.y = pos.y + size.y - bottomSize.y - topSize.y; - start.x = pos.x; - end.x = pos.x + size.x; - end.y = start.y + topSize.y; - TheWindowManager->winDrawImage(endBar, start.x, start.y, end.x, end.y); - } - else - { - - // how many whole repeating pieces will fit in that width - pieces = centerWidth / centerBar->getImageHeight(); - - // draw the pieces - start.x = pos.x; - start.y = pos.y + topSize.y ; - end.x = start.x + size.x; //centerImage->getImageHeight() + yOffset; - for( Int i = 0; i < pieces; i++ ) - { - - end.y = start.y + centerBar->getImageHeight(); - TheWindowManager->winDrawImage( centerBar, - start.x, start.y, - end.x, end.y ); - start.y += centerBar->getImageHeight(); - - } - - // we will draw the image but clip the parts we don't want to show - IRegion2D reg; - reg.lo.x = start.x; - reg.lo.y = start.y; - reg.hi.x = pos.x + size.x; - reg.hi.y = pos.y + size.y - bottomSize.y; - centerWidth = pos.y + size.y - bottomSize.y - start.y; - if( centerWidth > 0) - { - TheDisplay->setClipRegion(®); - end.y = start.y + centerBar->getImageHeight(); - TheWindowManager->winDrawImage( centerBar, - start.x, start.y, - end.x, end.y ); - TheDisplay->enableClipping(FALSE); - } - - // draw left end - end.x = pos.x + size.x; - end.y = pos.y + size.y; - start.x = pos.x; - start.y = pos.y + size.y - bottomSize.y; - TheWindowManager->winDrawImage(beginBar, start.x, start.y, end.x, end.y); - - // draw right end - start.x = pos.x; - start.y = pos.y ; - end.x = pos.x + size.x; - end.y = pos.y + topSize.y; - TheWindowManager->winDrawImage(endBar, start.x, start.y, end.x, end.y); - } - - -} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp deleted file mode 100644 index 5e194c35a32..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMOTD.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DMOTD.cpp ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DMOTD.cpp -// -// Created: Colin Day, August 2001 -// -// Desc: Message of the day -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/NameKeyGenerator.h" -#include "GameClient/GameWindow.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/GadgetSlider.h" - -/////////////////////////////////////////////////////////////////////////////// -// DEFINES //////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC DATA //////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static NameKeyType closeButtonID = NAMEKEY_INVALID; - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// MOTDSystem ================================================================= -/** Message of the day */ -//============================================================================= -WindowMsgHandledType MOTDSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GWM_CREATE: - { - - // load id's needed - closeButtonID = TheNameKeyGenerator->nameToKey( "MOTD.wnd:CloseMOTD" ); - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - - break; - - } - - // ------------------------------------------------------------------------ - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == closeButtonID ) - window->winHide( !window->winIsHidden() ); - - break; - - } - - default: - return MSG_IGNORED; - } - - return MSG_HANDLED; - -} - - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp deleted file mode 100644 index d8119539ddb..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DMainMenu.cpp +++ /dev/null @@ -1,1002 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DMainMenu.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Apr 2002 -// -// Filename: W3DMainMenu.cpp -// -// author: Chris Huybregts -// -// purpose: The Draw Routine for the main menu -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#define WIN32_LEAN_AND_MEAN -#include -#include -#include -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "GameClient/GameWindow.h" -#include "Lib/BaseType.h" -#include "W3DDevice/GameClient/W3DGameWindow.h" -#include "GameClient/Display.h" -#include "GameLogic/GameLogic.h" -#include "GameClient/Shell.h" -#include "GameClient/ShellMenuScheme.h" -#include "GameClient/Credits.h" - -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetPushButton.h" -#include "W3DDevice/GameClient/W3DDisplay.h" -#include "W3DDevice/GameClient/W3DGadget.h" - -#include "GameClient/GUICallbacks.h" - -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -void drawText( GameWindow *window, WinInstanceData *instData ); -static Color BrownishColor = GameMakeColor(167,134,94,255); -static IRegion2D clipRegion; -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -static void advancePosition(GameWindow *window, const Image *image, UnsignedInt posX, UnsignedInt posY, UnsignedInt sizeX, UnsignedInt sizeY) -{ - if(!image) - return; - - static Bool goingForward = TRUE; - - ICoord2D pos, size; - if(!window) - { - pos.x = posX; - pos.y = posY; - size.x = sizeX; - size.y = sizeY; - } - else - { - window->winGetScreenPosition(&pos.x, &pos.y); - window->winGetSize(&size.x,&size.y); - } - static Int Width = size.x + image->getImageWidth(); - - static Int x = -DEFAULT_DISPLAY_WIDTH; - static Int y = pos.y - (image->getImageHeight()/2); - - static UnsignedInt m_startTime = timeGetTime(); - Int time = timeGetTime() - m_startTime; - Real percentDone = INT_TO_REAL(time) / 10000; - - if(goingForward) - { - if(percentDone >= 1) - { - y = pos.y + size.y - (image->getImageHeight()/2); - m_startTime = timeGetTime(); - goingForward = FALSE; - } - else - { - y = pos.y - (image->getImageHeight()/2); - x = (percentDone * Width) - image->getImageWidth(); - } - } - else - { - if(percentDone >= 1) - { - y = pos.y - (image->getImageHeight()/2); - m_startTime = timeGetTime(); - goingForward = TRUE; - } - else - { - y = pos.y + size.y - (image->getImageHeight()/2); - x = size.x - (percentDone * Width); - } - } - TheDisplay->drawImage(image,x, y, x + image->getImageWidth(), y + image->getImageHeight()); - -} - -void W3DShellMenuSchemeDraw( GameWindow *window, WinInstanceData *instData ) -{ - if(TheShell && TheShell->isShellActive()) - TheShell->getShellMenuSchemeManager()->draw(); -} - -void W3DMainMenuDraw( GameWindow *window, WinInstanceData *instData ) -{ - //W3DGameWinDefaultDraw( window, instData ); - - //R:83 G:78 B:52 - - static UnsignedInt color = BrownishColor; - static UnsignedInt colorDrop = GameMakeColor(38,30,21,255); - ICoord2D pos, size; - Int height = TheDisplay->getHeight(); - - window->winGetScreenPosition(&pos.x, &pos.y); - window->winGetSize(&size.x,&size.y); - - - - IRegion2D topHorizontal1 ={pos.x, pos.y, pos.x + size.x, pos.y }; - IRegion2D topHorizontal1drop ={pos.x, pos.y+1, pos.x + size.x, pos.y+1 }; - - IRegion2D topHorizontal2 ={pos.x, pos.y + Int(size.y * .1) , pos.x + size.x, pos.y + Int(size.y * .1) }; - IRegion2D topHorizontal2drop ={pos.x, pos.y + Int(size.y * .12) , pos.x + size.x, pos.y + Int(size.y * .12) }; - - IRegion2D bottomHorizontal1={pos.x, pos.y + Int(size.y * .9), pos.x + size.x, pos.y + Int(size.y * .9) }; - IRegion2D bottomHorizontal1drop={pos.x, pos.y + Int(size.y * .92), pos.x + size.x, pos.y + Int(size.y * .92) }; - - IRegion2D bottomHorizontal2= {pos.x, pos.y + size.y, pos.x + size.x, pos.y + size.y }; - IRegion2D bottomHorizontal2drop= {pos.x, pos.y + size.y + 1, pos.x + size.x, pos.y + size.y + 1 }; - - IRegion2D vertical1 ={pos.x + Int(size.x * .225), pos.y , pos.x + Int(size.x * .225), height }; - IRegion2D vertical2 ={pos.x + Int(size.x * .445), pos.y, pos.x + Int(size.x * .445), height }; - IRegion2D vertical3 ={pos.x + Int(size.x * .6662), pos.y, pos.x + Int(size.x * .6662), height }; - IRegion2D vertical4 ={pos.x + Int(size.x * .885), pos.y , pos.x + Int(size.x * .885), height }; -// static IRegion2D verticle5 ={pos.x + (size.x * .7250), pos.y + (size.y * .12), pos.x + (size.x * .7250), pos.y + (size.y * .86) }; -// static IRegion2D verticle6 ={pos.x + (size.x * .9062), pos.y + (size.y * .12), pos.x + (size.x * .9062), pos.y + (size.y * .86) }; - - - TheDisplay->drawLine(topHorizontal1.lo.x,topHorizontal1.lo.y,topHorizontal1.hi.x,topHorizontal1.hi.y,2,color); - TheDisplay->drawLine(topHorizontal1drop.lo.x,topHorizontal1drop.lo.y,topHorizontal1drop.hi.x,topHorizontal1drop.hi.y,2,colorDrop); - TheDisplay->drawLine(topHorizontal2.lo.x,topHorizontal2.lo.y,topHorizontal2.hi.x,topHorizontal2.hi.y,1,color); - TheDisplay->drawLine(topHorizontal2drop.lo.x,topHorizontal2drop.lo.y,topHorizontal2drop.hi.x,topHorizontal2drop.hi.y,1,colorDrop); - TheDisplay->drawLine(bottomHorizontal1.lo.x,bottomHorizontal1.lo.y,bottomHorizontal1.hi.x,bottomHorizontal1.hi.y,1,color); - TheDisplay->drawLine(bottomHorizontal1drop.lo.x,bottomHorizontal1drop.lo.y,bottomHorizontal1drop.hi.x,bottomHorizontal1drop.hi.y,1,colorDrop); - TheDisplay->drawLine(bottomHorizontal2.lo.x,bottomHorizontal2.lo.y,bottomHorizontal2.hi.x,bottomHorizontal2.hi.y,2,color); - TheDisplay->drawLine(bottomHorizontal2drop.lo.x,bottomHorizontal2drop.lo.y,bottomHorizontal2drop.hi.x,bottomHorizontal2drop.hi.y,2,colorDrop); - - - - TheDisplay->drawLine(vertical1.lo.x,vertical1.lo.y,vertical1.hi.x,vertical1.hi.y,3,color); - TheDisplay->drawLine(vertical2.lo.x,vertical2.lo.y,vertical2.hi.x,vertical2.hi.y,3,color); - TheDisplay->drawLine(vertical3.lo.x,vertical3.lo.y,vertical3.hi.x,vertical3.hi.y,3,color); - TheDisplay->drawLine(vertical4.lo.x,vertical4.lo.y,vertical4.hi.x,vertical4.hi.y,3,color); -// TheDisplay->drawLine(verticle5.lo.x,verticle5.lo.y,verticle5.hi.x,verticle5.hi.y,3,color); -// TheDisplay->drawLine(verticle6.lo.x,verticle6.lo.y,verticle6.hi.x,verticle6.hi.y,3,color); -// TheDisplay->drawLine(m_rightLineFromButton.lo.x,m_rightLineFromButton.lo.y,m_rightLineFromButton.hi.x,m_rightLineFromButton.hi.y,3,color1,color2); - - - - - advancePosition(nullptr, TheMappedImageCollection->findImageByName("MainMenuPulse"),pos.x,pos.y,size.x, size.y); - - //TheDisplay->drawLine(); - -} - -void W3DMainMenuFourDraw( GameWindow *window, WinInstanceData *instData ) -{ - //W3DGameWinDefaultDraw( window, instData ); - - //R:83 G:78 B:52 - - static UnsignedInt color = BrownishColor; - static UnsignedInt colorDrop = GameMakeColor(38,30,21,255); - ICoord2D pos, size; - Int height = TheDisplay->getHeight(); - - window->winGetScreenPosition(&pos.x, &pos.y); - window->winGetSize(&size.x,&size.y); - - - - IRegion2D topHorizontal1 ={pos.x, pos.y, pos.x + size.x, pos.y }; - IRegion2D topHorizontal1drop ={pos.x, pos.y+1, pos.x + size.x, pos.y+1 }; - - IRegion2D topHorizontal2 ={pos.x, pos.y + Int(size.y * .1) , pos.x + size.x, pos.y + Int(size.y * .1) }; - IRegion2D topHorizontal2drop ={pos.x, pos.y + Int(size.y * .12) , pos.x + size.x, pos.y + Int(size.y * .12) }; - - IRegion2D bottomHorizontal1={pos.x, pos.y + Int(size.y * .9), pos.x + size.x, pos.y + Int(size.y * .9) }; - IRegion2D bottomHorizontal1drop={pos.x, pos.y + Int(size.y * .92), pos.x + size.x, pos.y + Int(size.y * .92) }; - - IRegion2D bottomHorizontal2= {pos.x, pos.y + size.y, pos.x + size.x, pos.y + size.y }; - IRegion2D bottomHorizontal2drop= {pos.x, pos.y + size.y + 1, pos.x + size.x, pos.y + size.y + 1 }; - - IRegion2D vertical1 ={pos.x + Int(size.x * .295), pos.y , pos.x + Int(size.x * .295), height }; - IRegion2D vertical2 ={pos.x + Int(size.x * .59), pos.y, pos.x + Int(size.x * .59), height }; - //IRegion2D vertical3 ={pos.x + (size.x * .6662), pos.y, pos.x + (size.x * .6662), height }; - IRegion2D vertical4 ={pos.x + Int(size.x * .885), pos.y , pos.x + Int(size.x * .885), height }; -// static IRegion2D verticle5 ={pos.x + (size.x * .7250), pos.y + (size.y * .12), pos.x + (size.x * .7250), pos.y + (size.y * .86) }; -// static IRegion2D verticle6 ={pos.x + (size.x * .9062), pos.y + (size.y * .12), pos.x + (size.x * .9062), pos.y + (size.y * .86) }; - - - TheDisplay->drawLine(topHorizontal1.lo.x,topHorizontal1.lo.y,topHorizontal1.hi.x,topHorizontal1.hi.y,2,color); - TheDisplay->drawLine(topHorizontal1drop.lo.x,topHorizontal1drop.lo.y,topHorizontal1drop.hi.x,topHorizontal1drop.hi.y,2,colorDrop); - TheDisplay->drawLine(topHorizontal2.lo.x,topHorizontal2.lo.y,topHorizontal2.hi.x,topHorizontal2.hi.y,1,color); - TheDisplay->drawLine(topHorizontal2drop.lo.x,topHorizontal2drop.lo.y,topHorizontal2drop.hi.x,topHorizontal2drop.hi.y,1,colorDrop); - TheDisplay->drawLine(bottomHorizontal1.lo.x,bottomHorizontal1.lo.y,bottomHorizontal1.hi.x,bottomHorizontal1.hi.y,1,color); - TheDisplay->drawLine(bottomHorizontal1drop.lo.x,bottomHorizontal1drop.lo.y,bottomHorizontal1drop.hi.x,bottomHorizontal1drop.hi.y,1,colorDrop); - TheDisplay->drawLine(bottomHorizontal2.lo.x,bottomHorizontal2.lo.y,bottomHorizontal2.hi.x,bottomHorizontal2.hi.y,2,color); - TheDisplay->drawLine(bottomHorizontal2drop.lo.x,bottomHorizontal2drop.lo.y,bottomHorizontal2drop.hi.x,bottomHorizontal2drop.hi.y,2,colorDrop); - - - - TheDisplay->drawLine(vertical1.lo.x,vertical1.lo.y,vertical1.hi.x,vertical1.hi.y,3,color); - TheDisplay->drawLine(vertical2.lo.x,vertical2.lo.y,vertical2.hi.x,vertical2.hi.y,3,color); - //TheDisplay->drawLine(vertical3.lo.x,vertical3.lo.y,vertical3.hi.x,vertical3.hi.y,3,color); - TheDisplay->drawLine(vertical4.lo.x,vertical4.lo.y,vertical4.hi.x,vertical4.hi.y,3,color); -// TheDisplay->drawLine(verticle5.lo.x,verticle5.lo.y,verticle5.hi.x,verticle5.hi.y,3,color); -// TheDisplay->drawLine(verticle6.lo.x,verticle6.lo.y,verticle6.hi.x,verticle6.hi.y,3,color); -// TheDisplay->drawLine(m_rightLineFromButton.lo.x,m_rightLineFromButton.lo.y,m_rightLineFromButton.hi.x,m_rightLineFromButton.hi.y,3,color1,color2); - - - - - advancePosition(nullptr, TheMappedImageCollection->findImageByName("MainMenuPulse"),pos.x,pos.y,size.x, size.y); - - //TheDisplay->drawLine(); - -} - - -void W3DMetalBarMenuDraw( GameWindow *window, WinInstanceData *instData ) -{ - //ICoord2D original, size; -// TheDisplay->setClipRegion(&clipRegion); - window->winDrawBorder(); - //window->winGetScreenPosition(&original.x, &original.y); - //window->winGetSize(&size.x, &size.y); - //blitBorderRect( original.x, original.y, size.x, size.y ); - //W3DGameWinDefaultDraw( window, instData ); -// TheDisplay->enableClipping(FALSE); -} - - - //W3DGameWinDefaultDraw( window, instData ); -// -// //R:83 G:78 B:52 -// -// -//// UnsignedInt color = GameMakeColor(113,108,82,212); -// ICoord2D pos, size; -// -// window->winGetScreenPosition(&pos.x, &pos.y); -// window->winGetSize(&size.x,&size.y); -// -// const Image *image = TheMappedImageCollection->findImageByName("LogoGlow"); -// -// if(!image) -// return; -// -// Int Width = size.x + image->getImageWidth(); -// -// static Int x = pos.x - image->getImageWidth(); -// static Int y = pos.y - (image->getImageHeight()/2); -// -// static UnsignedInt m_startTime = timeGetTime(); -// Int time = timeGetTime() - m_startTime; -// Real percentDone = INT_TO_REAL(time) / 15624; -// -// if(percentDone >= 1) -// { -//// y = pos.y + size.y - (image->getImageHeight()/2) - 2; -// m_startTime = timeGetTime(); -// } -// else -// { -// x = (percentDone * Width) - image->getImageWidth(); -// } -// -// IRegion2D clip; -// clip.lo.x = pos.x; -// clip.lo.y = pos.y - image->getImageHeight(); -// clip.hi.x = pos.x + size.x; -// clip.hi.y = pos.y + size.y; -// TheDisplay->setClipRegion(&clip); -// Int alpha; -// if(percentDone > .5) -// alpha = ((1-percentDone) * 2) * 255; -// else -// alpha = ( percentDone * 2) * 255; -// -// TheDisplay->drawImage(image,x, y , x + image->getImageWidth(), y + image->getImageHeight(), GameMakeColor(255,255,255,alpha)); -// //TheDisplay->drawImage(image,x, y , x + image->getImageWidth(), y + image->getImageHeight(), GameMakeColor(255,200,250,alpha)); -// TheDisplay->enableClipping(FALSE ); -// //TheDisplay->drawLine(); -// - - -void W3DClockDraw( GameWindow *window, WinInstanceData *instData ) -{ - W3DGameWinDefaultDraw( window, instData ); - ICoord2D pos, size; - - window->winGetScreenPosition(&pos.x, &pos.y); - window->winGetSize(&size.x,&size.y); - - char datestr[256] = ""; - time_t longTime; - struct tm *curtime; - time(&longTime); - curtime = localtime(&longTime); - strftime(datestr, 256, "%H:%M:%S", curtime); - UnicodeString temp; - temp.translate(datestr); - instData->setText(temp); - - DisplayString *dString; - dString = instData->getTextDisplayString(); - - - dString->setFont(TheFontLibrary->getFont("Arial",16,0)); - - Int textWidth, textHeight; - ICoord2D textPos; - IRegion2D clockClipRegion; - // sanity - - // how much space will this text take up - dString->getSize( &textWidth, &textHeight ); - - //Init the clip region - clockClipRegion.lo.x = pos.x + 1; - clockClipRegion.lo.y = pos.y + 1; - clockClipRegion.hi.x = pos.x + size.x - 1; - clockClipRegion.hi.y = pos.y + size.y - 1; - - textPos.x = pos.x + (size.x / 2) - (textWidth / 2); - textPos.y = pos.y + (size.y / 2) - (textHeight / 2); - dString->setClipRegion(&clockClipRegion); - dString->draw( textPos.x, textPos.y, GameMakeColor(255,255,255,255), GameMakeColor(0,0,0,255) ); - - - -} - -void W3DMainMenuMapBorder( GameWindow *window, WinInstanceData *instData ) -{ - enum - { - BORDER_CORNER_SIZE = 10, - BORDER_LINE_SIZE = 20, - }; - //( Int x, Int y, Int width, Int height ) - -// save original x, y - Int x, y, width, height; - window->winGetScreenPosition(&x, &y); - window->winGetSize(&width,&height); - -// TheDisplay->setClipRegion(&clipRegion); - Int originalX = x; - Int originalY = y; - Int maxX = x + width; - Int maxY = y + height; - Int x2, y2; // used for simultaneous drawing of line pairs - Int size = 20; - Int halfSize = size / 2; - - const Image *image = nullptr; - - // Draw Horizontal Lines - // All border pieces are based on a 10 pixel offset from the centerline - y = originalY - 10; - y2 = maxY - 10; - x2 = maxX - (10 + BORDER_LINE_SIZE); - - image = TheMappedImageCollection->findImageByName("FrameCornerHorizontal"); - if(image) - { - - for( x=(originalX + 10); x <= x2; x += BORDER_LINE_SIZE ) - { - - TheDisplay->drawImage( image, - x, y, x + size, y + size ); - TheDisplay->drawImage( image, - x, y2, x + size, y2 + size ); - - } - - - x2 = maxX - BORDER_CORNER_SIZE; - - // x == place to draw remainder if any - if( (x2 - x) >= (BORDER_LINE_SIZE / 2) ) - { - - //Blit Half piece - TheDisplay->drawImage( image, - x, y, x + halfSize, y + size ); - TheDisplay->drawImage( image, - x, y2, x + halfSize, y2 + size ); - - x += (BORDER_LINE_SIZE / 2); - - } - - - // x2 - x ... must now be less than a half piece - // check for equals and if not blit an adjusted half piece border pieces have - // a two pixel repeat so we will blit one pixel over if necessary to line up - // the art, but we'll cover-up the overlap with the corners - if( x < x2 ) - { - x -= ((BORDER_LINE_SIZE / 2) - (((x2 - x) + 1) & ~1)); - - //Blit Half piece - TheDisplay->drawImage( image, - x, y, x + halfSize, y + size ); - TheDisplay->drawImage( image, - x, y2, x + halfSize, y2 + size ); - - } - } - image = TheMappedImageCollection->findImageByName("FrameCornerVertical"); - - if( image ) - { - - // Draw Vertical Lines - // All border pieces are based on a 10 pixel offset from the centerline - x = originalX - 10; - x2 = maxX - 10; - y2 = maxY - (10 + BORDER_LINE_SIZE); - - for( y=(originalY + 10); y <= y2; y += BORDER_LINE_SIZE ) - { - - TheDisplay->drawImage( image, - x, y, x + size, y + size ); - TheDisplay->drawImage( image, - x2, y, x2 + size, y + size ); - - } - - y2 = maxY - BORDER_CORNER_SIZE; - - // y == place to draw remainder if any - if( (y2 - y) >= (BORDER_LINE_SIZE / 2) ) - { - - //Blit Half piece - TheDisplay->drawImage( image, - x, y, x + size, y + halfSize ); - TheDisplay->drawImage( image, - x2, y, x2 + size, y + halfSize ); - - y += (BORDER_LINE_SIZE / 2); - } - - // y2 - y ... must now be less than a half piece - // check for equals and if not blit an adjusted half piece border pieces have - // a two pixel repeat so we will blit one pixel over if necessary to line up - // the art, but we'll cover-up the overlap with the corners - if( y < y2 ) - { - y -= ((BORDER_LINE_SIZE / 2) - (((y2 - y) + 1) & ~1)); - - //Blit Half piece - TheDisplay->drawImage( image, - x, y, x + size, y + halfSize ); - TheDisplay->drawImage( image, - x2, y, x2 + size, y + halfSize ); - - } - } - - // Draw Corners - x = originalX - BORDER_CORNER_SIZE; - y = originalY - BORDER_CORNER_SIZE; - TheDisplay->drawImage( TheMappedImageCollection->findImageByName("FrameCornerUL"), - x, y, x + size, y + size ); - x = maxX - BORDER_CORNER_SIZE; - y = originalY - BORDER_CORNER_SIZE; - TheDisplay->drawImage( TheMappedImageCollection->findImageByName("FrameCornerUR"), - x, y, x + size, y + size ); - x = originalX - BORDER_CORNER_SIZE; - y = maxY - BORDER_CORNER_SIZE; - TheDisplay->drawImage( TheMappedImageCollection->findImageByName("FrameCornerLL"), - x, y, x + size, y + size ); - x = maxX - BORDER_CORNER_SIZE; - y = maxY - BORDER_CORNER_SIZE; - TheDisplay->drawImage(TheMappedImageCollection->findImageByName("FrameCornerLR"), - x, y, x + size, y + size ); - - TheDisplay->enableClipping(FALSE); - -} - - -//Specialized drawing function for the buttons with the weird drop shadow -// W3DMainMenuButtonDropShadowDraw =============================================== -/** Draw pushbutton with user supplied images */ -//============================================================================= -void W3DMainMenuButtonDropShadowDraw( GameWindow *window, - WinInstanceData *instData ) -{ - const Image *leftImage, *rightImage, *centerImage; - ICoord2D origin, size, start, end; - Int xOffset, yOffset; - Int i; - - // get screen position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get image offset - xOffset = instData->m_imageOffset.x; - yOffset = instData->m_imageOffset.y; - - - // - // get pointer to image we want to draw depending on our state, - // see GadgetPushButton.h for info - // - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - leftImage = GadgetButtonGetLeftDisabledSelectedImage( window ); - rightImage = GadgetButtonGetRightDisabledSelectedImage( window ); - centerImage = GadgetButtonGetMiddleDisabledSelectedImage( window ); - } - else - { - - leftImage = GadgetButtonGetLeftDisabledImage( window ); - rightImage = GadgetButtonGetRightDisabledImage( window ); - centerImage = GadgetButtonGetMiddleDisabledImage( window ); - - } - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - leftImage = GadgetButtonGetLeftHiliteSelectedImage( window ); - rightImage = GadgetButtonGetRightHiliteSelectedImage( window ); - centerImage = GadgetButtonGetMiddleHiliteSelectedImage( window ); - } - else - { - - leftImage = GadgetButtonGetLeftHiliteImage( window ); - rightImage = GadgetButtonGetRightHiliteImage( window ); - centerImage = GadgetButtonGetMiddleHiliteImage( window ); - - } - - } - else - { - - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - leftImage = GadgetButtonGetLeftEnabledSelectedImage( window ); - rightImage = GadgetButtonGetRightEnabledSelectedImage( window ); - centerImage = GadgetButtonGetMiddleEnabledSelectedImage( window ); - } - else - { - - leftImage = GadgetButtonGetLeftEnabledImage( window ); - rightImage = GadgetButtonGetRightEnabledImage( window ); - centerImage = GadgetButtonGetMiddleEnabledImage( window ); - - } - - } - - // sanity, we need to have these images to make it look right - if( leftImage == nullptr || rightImage == nullptr || - centerImage == nullptr ) - return; - - // get image sizes for the ends - ICoord2D leftSize, rightSize; - leftSize.x = leftImage->getImageWidth(); - leftSize.y = leftImage->getImageHeight(); - rightSize.x = rightImage->getImageWidth(); - rightSize.y = rightImage->getImageHeight(); - - // get two key points used in the end drawing - ICoord2D leftEnd, rightStart; - leftEnd.x = origin.x + leftSize.x + xOffset; - leftEnd.y = origin.y + size.y + yOffset; - rightStart.x = origin.x + size.x - rightSize.x + xOffset; - rightStart.y = origin.y + yOffset; - - // draw the center repeating bar - Int centerWidth, pieces; - - // get width we have to draw our repeating center in - centerWidth = rightStart.x - leftEnd.x; - - if( centerWidth <= 0) - { -// TheDisplay->setClipRegion(&clipRegion); - // draw left end - start.x = origin.x + xOffset; - start.y = origin.y + yOffset; - end.y = leftEnd.y; - end.x = origin.x + xOffset + size.x/2; - TheWindowManager->winDrawImage(leftImage, start.x, start.y, end.x, end.y); - - // draw right end - start.y = rightStart.y; - start.x = end.x; - end.x = origin.x + size.x; - end.y = start.y + size.y; - TheWindowManager->winDrawImage(rightImage, start.x, start.y, end.x, end.y); - } - else - { - - // how many whole repeating pieces will fit in that width - pieces = centerWidth / centerImage->getImageWidth(); - - // draw the pieces - start.x = leftEnd.x; - start.y = origin.y + yOffset; - end.y = start.y + size.y + yOffset; //centerImage->getImageHeight() + yOffset; -// TheDisplay->setClipRegion(&clipRegion); - for( i = 0; i < pieces; i++ ) - { - - end.x = start.x + centerImage->getImageWidth(); - TheWindowManager->winDrawImage( centerImage, - start.x, start.y, - end.x, end.y ); - start.x += centerImage->getImageWidth(); - - } - - // we will draw the image but clip the parts we don't want to show - IRegion2D reg; - reg.lo.x = start.x; - reg.lo.y = clipRegion.lo.y; - reg.hi.x = rightStart.x; - reg.hi.y = clipRegion.hi.y; - centerWidth = rightStart.x - start.x; - if( centerWidth > 0) - { - TheDisplay->setClipRegion(®); - end.x = start.x + centerImage->getImageWidth(); - TheWindowManager->winDrawImage( centerImage, - start.x, start.y, - end.x, end.y ); - TheDisplay->enableClipping(FALSE); - } - -// TheDisplay->setClipRegion(&clipRegion); - // draw left end - start.x = origin.x + xOffset; - start.y = origin.y + yOffset; - end = leftEnd; - TheWindowManager->winDrawImage(leftImage, start.x, start.y, end.x, end.y); - - // draw right end - start = rightStart; - end.x = start.x + rightSize.x; - end.y = start.y + size.y; - TheWindowManager->winDrawImage(rightImage, start.x, start.y, end.x, end.y); - } - - // draw the button text - if( instData->getTextLength() ) - drawText( window, instData ); - - // get window position - window->winGetScreenPosition( &start.x, &start.y ); - window->winGetSize( &size.x, &size.y ); - - - // if we have a video buffer, draw the video buffer - if ( instData->m_videoBuffer ) - { - TheDisplay->drawVideoBuffer( instData->m_videoBuffer, start.x, start.y, start.x + size.x, start.y + size.y ); - } - PushButtonData *pData = (PushButtonData *)window->winGetUserData(); - if( pData ) - { - if( pData->overlayImage ) - { - TheDisplay->drawImage( pData->overlayImage, start.x, start.y, start.x + size.x, start.y + size.y ); - } - - if( pData->drawClock ) - { - if( pData->drawClock == NORMAL_CLOCK ) - { - TheDisplay->drawRectClock(start.x, start.y, size.x, size.y, pData->percentClock,pData->colorClock); - } - else if( pData->drawClock == INVERSE_CLOCK ) - { - TheDisplay->drawRemainingRectClock( start.x, start.y, size.x, size.y, pData->percentClock,pData->colorClock ); - } - pData->drawClock = NO_CLOCK; - window->winSetUserData(pData); - } - - if( pData->drawBorder && pData->colorBorder != GAME_COLOR_UNDEFINED ) - { - TheDisplay->drawOpenRect(start.x - 1, start.y - 1, size.x + 2, size.y + 2, 1, pData->colorBorder); - } - } - -// TheDisplay->enableClipping(FALSE); -} - - -// drawButtonText ============================================================= -/** Draw button text to the screen */ -//============================================================================= -void drawText( GameWindow *window, WinInstanceData *instData ) -{ - ICoord2D origin, size, textPos; - Int width, height; - Color textColor, dropColor; - DisplayString *text = instData->getTextDisplayString(); - - // sanity - if( text == nullptr || text->getTextLength() == 0 ) - return; - - // get window position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // set whether or not we center the wrapped text - text->setWordWrapCentered( BitIsSet( instData->getStatus(), WIN_STATUS_WRAP_CENTERED )); - text->setWordWrap(size.x); - // get the right text color - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - textColor = window->winGetDisabledTextColor(); - dropColor = window->winGetDisabledTextBorderColor(); - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - textColor = window->winGetHiliteTextColor(); - dropColor = window->winGetHiliteTextBorderColor(); - } - else - { - textColor = window->winGetEnabledTextColor(); - dropColor = window->winGetEnabledTextBorderColor(); - } - - // set our font to that of our parent if not the same - if( text->getFont() != window->winGetFont() ) - text->setFont( window->winGetFont() ); - - // get text size - text->getSize( &width, &height ); - - // where to draw - textPos.x = origin.x + (size.x / 2) - (width / 2); - textPos.y = origin.y + (size.y / 2) - (height / 2); -// text->setClipRegion(&clipRegion); - // draw it - text->draw( textPos.x, textPos.y, textColor, dropColor ); - -} - -// W3DMainMenuRandomTextDraw ================================================== -/** Specialized drawing function for the random text */ -//============================================================================= -void W3DMainMenuRandomTextDraw( GameWindow *window, WinInstanceData *instData ) -{ - TextData *tData = (TextData *)window->winGetUserData(); - Color textColor, textOutlineColor; - ICoord2D size, origin, textPos; - Int textWidth, textHeight; - IRegion2D textclipRegion; - // get window position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - textColor = window->winGetDisabledTextColor(); - textOutlineColor = window->winGetDisabledTextBorderColor(); - // draw the text - - if( !(tData->text && (textColor != WIN_COLOR_UNDEFINED)) ) - return; - - DisplayString *text = tData->text; - //Init the clip region - textclipRegion.lo.x = origin.x + 1; - textclipRegion.lo.y = origin.y + 1; - textclipRegion.hi.x = origin.x + size.x - 1; - textclipRegion.hi.y = origin.y + size.y - 1; - - // how much space will this text take up - text->getSize( &textWidth, &textHeight ); - - // draw the text - textPos.x = origin.x; - textPos.y = origin.y + (size.y / 2) - (textHeight / 2); - text->setClipRegion(&textclipRegion); - text->draw( textPos.x, textPos.y, textColor, textOutlineColor ); - -} -void W3DThinBorderDraw( GameWindow *window, WinInstanceData *instData ) -{ - ICoord2D start, size; - const Image *image; - - //W3DGameWinDefaultDraw( window, instData ); -// TheDisplay->setClipRegion(&clipRegion); - window->winGetScreenPosition( &start.x, &start.y ); - window->winGetSize( &size.x, &size.y ); - image = window->winGetEnabledImage( 0 ); - - if( image ) - { - ICoord2D begin, end; - - begin.x = start.x + instData->m_imageOffset.x; - begin.y = start.y + instData->m_imageOffset.y; - end.x = begin.x + size.x; - end.y = begin.y + size.y; - TheWindowManager->winDrawImage( image, begin.x, begin.y, end.x, end.y ); - - } - // get window position - -// TheDisplay->drawOpenRect(start.x - 1, start.y - 1, size.x + 2, size.y + 2, 1, BrownishColor); - TheDisplay->enableClipping(FALSE); -} - -void W3DMainMenuInit( WindowLayout *layout, void *userData ) -{ -/* - GameWindow *parent = layout->getFirstWindow(); -// NameKeyType buttonWorldBuilderID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:ButtonWorldBuilder" ); -// GameWindow *buttonWorldBuilder = TheWindowManager->winGetWindowFromId( parent, buttonWorldBuilderID ); -// if (buttonWorldBuilder) -// buttonWorldBuilder->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - - NameKeyType staticTextRandom1ID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:StaticTextRandom1" ); - NameKeyType staticTextRandom2ID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:StaticTextRandom2" ); - GameWindow *staticTextRandom1 = TheWindowManager->winGetWindowFromId( parent, staticTextRandom1ID); - GameWindow *staticTextRandom2 = TheWindowManager->winGetWindowFromId( parent, staticTextRandom2ID); - if (staticTextRandom1) - staticTextRandom1->winSetDrawFunc(W3DMainMenuRandomTextDraw); - if (staticTextRandom2) - staticTextRandom2->winSetDrawFunc(W3DMainMenuRandomTextDraw); - -// //NameKeyType getUpdateID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:ButtonGetUpdate" ); - NameKeyType buttonUSAID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:ButtonUSA" ); - NameKeyType buttonGLAID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:ButtonGLA" ); - NameKeyType buttonChinaID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:ButtonChina" ); - NameKeyType skirmishID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:ButtonSkirmish" ); - NameKeyType onlineID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:ButtonOnline" ); - NameKeyType networkID = TheNameKeyGenerator->nameToKey( "MainMenu.wnd:ButtonNetwork" ); - - GameWindow *button = TheWindowManager->winGetWindowFromId( parent, skirmishID ); - if (button) - button->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - button = TheWindowManager->winGetWindowFromId( parent, onlineID ); - if (button) - button->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - button = TheWindowManager->winGetWindowFromId( parent, networkID ); - if (button) - button->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - -//GameWindow *getUpdate = TheWindowManager->winGetWindowFromId( parent, getUpdateID ); - // if (getUpdate) - // getUpdate->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - - GameWindow *buttonUSA = TheWindowManager->winGetWindowFromId( parent, buttonUSAID ); - if (buttonUSA) - buttonUSA->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - GameWindow *buttonGLA = TheWindowManager->winGetWindowFromId( parent, buttonGLAID ); - if (buttonGLA) - buttonGLA->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - GameWindow *buttonChina = TheWindowManager->winGetWindowFromId( parent, buttonChinaID ); - if (buttonChina) - buttonChina->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - - GameWindow *win = nullptr; - win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonMultiBack")); - if(win) - win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonSingleBack")); - if(win) - win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonExit")); - if(win) - win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonOptions")); - if(win) - win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonMultiplayer")); - if(win) - win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonSinglePlayer")); - if(win) - win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonReplay")); - if(win) - win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonLoadGame")); - if(win) - win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonLoadReplay")); - if(win) - win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonLoadReplayBack")); - if(win) - win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - - win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonTRAINING")); - if(win) - win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - - win = TheWindowManager->winGetWindowFromId(parent, TheNameKeyGenerator->nameToKey("MainMenu.wnd:ButtonCredits")); - if(win) - win->winSetDrawFunc(W3DMainMenuButtonDropShadowDraw); - - GameWindow *clipRegionWin = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey( "MainMenu.wnd:MapBorder" )); - Int x,y,width,height; - clipRegionWin->winGetScreenPosition(&x, &y); - clipRegionWin->winGetSize(&width, &height); - clipRegion.lo.x = x - 10; - clipRegion.lo.y = y ; - clipRegion.hi.x = x + width + 10; - clipRegion.hi.y = y + height + 10; -*/ - MainMenuInit( layout, userData ); -} - -void W3DCreditsMenuDraw( GameWindow *window, WinInstanceData *instData ) -{ - TheCredits->draw(); -} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp deleted file mode 100644 index 981e8ac0eea..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DCheckBox.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DCheckBox.cpp ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DCheckBox.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: W3D methods needed to implement the checkbox UI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GadgetCheckBox.h" -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/GameWindowManager.h" -#include "W3DDevice/GameClient/W3DGadget.h" -#include "W3DDevice/GameClient/W3DDisplay.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// drawCheckBoxText =========================================================== -/** Draw the text for a checkbox */ -//============================================================================= -static void drawCheckBoxText( GameWindow *window, WinInstanceData *instData ) -{ - ICoord2D origin, size, textPos; - Int width, height; - Color textColor, dropColor; - DisplayString *text = instData->getTextDisplayString(); - - // sanity - if( text == nullptr || text->getTextLength() == 0 ) - return; - - // get window position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get the right text color - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - textColor = window->winGetDisabledTextColor(); - dropColor = window->winGetDisabledTextBorderColor(); - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - textColor = window->winGetHiliteTextColor(); - dropColor = window->winGetHiliteTextBorderColor(); - } - else - { - textColor = window->winGetEnabledTextColor(); - dropColor = window->winGetEnabledTextBorderColor(); - } - - // set our font to that of our parent if not the same - if( text->getFont() != window->winGetFont() ) - text->setFont( window->winGetFont() ); - - // get text size - text->getSize( &width, &height ); - - // where to draw - textPos.x = origin.x + size.y;//(size.x / 2) - (width / 2); - textPos.y = origin.y + (size.y / 2) - (height / 2); - - // draw it - text->draw( textPos.x, textPos.y, textColor, dropColor ); - -} - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// W3DGadgetCheckBoxDraw ====================================================== -/** Draw colored check box using standard graphics */ -//============================================================================= -void W3DGadgetCheckBoxDraw( GameWindow *window, WinInstanceData *instData ) -{ - Int checkOffsetFromLeft; - Color backColor, - backBorder, - boxColor, - boxBorder; - ICoord2D origin, size, start, end; - - // get window position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // compute start of check offset - checkOffsetFromLeft = size.x / 16; - - // - // get the colors we should be using to draw, see GadgetCheckBox.h - // draw appropriate state, see GadgetCheckBox.h for info - // - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - // disabled background - backColor = GadgetCheckBoxGetDisabledColor( window ); - backBorder = GadgetCheckBoxGetDisabledBorderColor( window ); - - // check box - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - boxColor = GadgetCheckBoxGetDisabledCheckedBoxColor( window ); - boxBorder = GadgetCheckBoxGetDisabledCheckedBoxBorderColor( window ); - } - else - { - boxColor = GadgetCheckBoxGetDisabledUncheckedBoxColor( window ); - boxBorder = GadgetCheckBoxGetDisabledUncheckedBoxBorderColor( window ); - } - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - // hilited background - backColor = GadgetCheckBoxGetHiliteColor( window ); - backBorder = GadgetCheckBoxGetHiliteBorderColor( window ); - - // check box - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - boxColor = GadgetCheckBoxGetHiliteCheckedBoxColor( window ); - boxBorder = GadgetCheckBoxGetHiliteCheckedBoxBorderColor( window ); - } - else - { - boxColor = GadgetCheckBoxGetHiliteUncheckedBoxColor( window ); - boxBorder = GadgetCheckBoxGetHiliteUncheckedBoxBorderColor( window ); - } - - } - else - { - - // enabled background - backColor = GadgetCheckBoxGetEnabledColor( window ); - backBorder = GadgetCheckBoxGetEnabledBorderColor( window ); - - // check box - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - boxColor = GadgetCheckBoxGetEnabledCheckedBoxColor( window ); - boxBorder = GadgetCheckBoxGetEnabledCheckedBoxBorderColor( window ); - } - else - { - boxColor = GadgetCheckBoxGetEnabledUncheckedBoxColor( window ); - boxBorder = GadgetCheckBoxGetEnabledUncheckedBoxBorderColor( window ); - } - - } - - // draw background border - start.x = origin.x; - start.y = origin.y; - end.x = start.x + size.x; - end.y = start.y + size.y; - TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - // draw the background - start.x++; - start.y++; - end.x--; - end.y--; - TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - // draw box border - start.x = origin.x + checkOffsetFromLeft; - start.y = origin.y + (size.y / 3); - end.x = start.x + (size.y / 3); - end.y = start.y + (size.y / 3); - TheWindowManager->winOpenRect( boxBorder, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - // draw "x" for button - if( boxColor != WIN_COLOR_UNDEFINED ) - { - - TheWindowManager->winDrawLine( boxColor, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - TheWindowManager->winDrawLine( boxColor, WIN_DRAW_LINE_WIDTH, - start.x, end.y, end.x, start.y ); - - } - - // draw the button text - if( instData->getTextLength() ) - drawCheckBoxText( window, instData ); - -} - -// W3DGadgetCheckBoxImageDraw ================================================= -/** Draw check box with user supplied images */ -//============================================================================= -void W3DGadgetCheckBoxImageDraw( GameWindow *window, WinInstanceData *instData ) -{ - Int checkOffsetFromLeft; - const Image *boxImage = nullptr;//*backgroundImage = nullptr, - ICoord2D origin, start, end, size; - - // get window position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // compute screen coords - start.x = origin.x + instData->m_imageOffset.x; - start.y = origin.y + instData->m_imageOffset.y; - end.x = start.x + size.x; - end.y = start.y + size.y; - - // compute start of check offset - checkOffsetFromLeft = 0; - - // - // get the colors we should be using to draw, see GadgetCheckBoxButton.h - // draw appropriate state, see GadgetCheckBoxButton.h for info - // - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - // disabled background -// backgroundImage = GadgetCheckBoxGetDisabledImage( window ); - - // check box - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - boxImage = GadgetCheckBoxGetDisabledCheckedBoxImage( window ); - else - boxImage = GadgetCheckBoxGetDisabledUncheckedBoxImage( window ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - // hilited background -// backgroundImage = GadgetCheckBoxGetHiliteImage( window ); - - // check box - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - boxImage = GadgetCheckBoxGetHiliteCheckedBoxImage( window ); - else - boxImage = GadgetCheckBoxGetHiliteUncheckedBoxImage( window ); - - } - else - { - - // enabled background -// backgroundImage = GadgetCheckBoxGetEnabledImage( window ); - - // check box - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - boxImage = GadgetCheckBoxGetEnabledCheckedBoxImage( window ); - else - boxImage = GadgetCheckBoxGetEnabledUncheckedBoxImage( window ); - - } - - // draw background image -// if( backgroundImage ) -// TheWindowManager->winDrawImage( backgroundImage, start.x, start.y, -// end.x, end.y ); - - // draw the box image - if( boxImage ) - { - - start.x = origin.x + instData->m_imageOffset.x + checkOffsetFromLeft; - start.y = origin.y + 3; - end.x = start.x + (size.y - 6); - end.y = start.y + (size.y - 6); - TheWindowManager->winDrawImage( boxImage, start.x, start.y, - end.x, end.y ); - - } - - // draw the text - if( instData->getTextLength() ) - drawCheckBoxText( window, instData ); - -} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp deleted file mode 100644 index 062c966d6b6..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DComboBox.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DComboBox.cpp /////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DComboBox.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: W3D implementation for the Combo box control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetComboBox.h" -#include "GameClient/GadgetListBox.h" -#include "W3DDevice/GameClient/W3DGadget.h" -#include "W3DDevice/GameClient/W3DDisplay.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// W3DGadgetComboBoxDraw ======================================================= -/** Draw colored list box using standard graphics */ -//============================================================================= -void W3DGadgetComboBoxDraw( GameWindow *window, WinInstanceData *instData ) -{ - Int width, height, fontHeight, x, y; - Color background, border, titleColor, titleBorder; -// ComboBoxData *combo = (ComboBoxData *)window->winGetUserData(); - ICoord2D size; - DisplayString *title = instData->getTextDisplayString(); - - // get window position and size - window->winGetScreenPosition( &x, &y ); - window->winGetSize( &size.x, &size.y ); - - // get font height - fontHeight = TheWindowManager->winFontHeight( instData->getFont() ); - - // alias width and height from size - width = size.x; - height = size.y; - - // get the right colors - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - background = GadgetComboBoxGetDisabledColor( window ); - border = GadgetComboBoxGetDisabledBorderColor( window ); - titleColor = window->winGetDisabledTextColor(); - titleBorder = window->winGetDisabledTextBorderColor(); - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - background = GadgetComboBoxGetHiliteColor( window ); - border = GadgetComboBoxGetHiliteBorderColor( window ); - titleColor = window->winGetHiliteTextColor(); - titleBorder = window->winGetHiliteTextBorderColor(); - } - else - { - background = GadgetComboBoxGetEnabledColor( window ); - border = GadgetComboBoxGetEnabledBorderColor( window ); - titleColor = window->winGetEnabledTextColor(); - titleBorder = window->winGetEnabledTextBorderColor(); - } - - // Draw the title - if( title && title->getTextLength() ) - { - - // set the font of this text to that of the window if not already - if( title->getFont() != window->winGetFont() ) - title->setFont( window->winGetFont() ); - - // draw the text - title->draw( x + 1, y, titleColor, titleBorder ); - - y += fontHeight + 1; - height -= fontHeight + 1; - - } - - // draw the back border - if( border != WIN_COLOR_UNDEFINED ) - TheWindowManager->winOpenRect( border, WIN_DRAW_LINE_WIDTH, - x, y, x + width, y + height ); - - // draw background - if( background != WIN_COLOR_UNDEFINED ) - TheWindowManager->winFillRect( background, WIN_DRAW_LINE_WIDTH, - x + 1, y + 1, - x + width - 1, y + height - 1 ); - -} - -// W3DGadgetComboBoxImageDraw ================================================== -/** Draw combo box with user supplied images */ -//============================================================================= -void W3DGadgetComboBoxImageDraw( GameWindow *window, WinInstanceData *instData ) -{ - Int width, height, x, y; - const Image *image; -// ComboBoxData *combo = (ComboBoxData *)window->winGetUserData(); - ICoord2D size; - Color titleColor, titleBorder; - DisplayString *title = instData->getTextDisplayString(); - - // get window position and size - window->winGetScreenPosition( &x, &y ); - window->winGetSize( &size.x, &size.y ); - - // save off width and height so we can change them - width = size.x; - height = size.y; - - // get the image - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - image = GadgetComboBoxGetDisabledImage( window ); - titleColor = window->winGetDisabledTextColor(); - titleBorder = window->winGetDisabledTextBorderColor(); - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - image = GadgetComboBoxGetHiliteImage( window ); - titleColor = window->winGetHiliteTextColor(); - titleBorder = window->winGetHiliteTextBorderColor(); - } - else - { - image = GadgetComboBoxGetEnabledImage( window ); - titleColor = window->winGetEnabledTextColor(); - titleBorder = window->winGetEnabledTextBorderColor(); - } - - // draw the back image - if( image ) - { - ICoord2D start, end; - - start.x = x + instData->m_imageOffset.x; - start.y = y + instData->m_imageOffset.y; - end.x = start.x + width; - end.y = start.y + height; - TheWindowManager->winDrawImage( image, - start.x, start.y, - end.x, end.y ); - - } - - // Draw the title - if( title && title->getTextLength() ) - { - - // set font to font of the window if not already - if( title->getFont() != window->winGetFont() ) - title->setFont( window->winGetFont() ); - - // draw the text - title->draw( x + 1, y, titleColor, titleBorder ); - - y += TheWindowManager->winFontHeight( instData->getFont() ); - height -= TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - } - - -} - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp deleted file mode 100644 index b5a72407fa6..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DHorizontalSlider.cpp +++ /dev/null @@ -1,479 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: .cpp ///////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: -// -// File name: .cpp -// -// Created: -// -// Desc: -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetSlider.h" -#include "W3DDevice/GameClient/W3DGadget.h" -#include "W3DDevice/GameClient/W3DDisplay.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// W3DGadgetHorizontalSliderDraw ============================================== -/** Draw colored horizontal slider using standard graphics */ -//============================================================================= -void W3DGadgetHorizontalSliderDraw( GameWindow *window, WinInstanceData *instData ) -{ - Color backBorder, backColor; - ICoord2D origin, size, start, end; - - // get screen position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get the right colors - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - backBorder = GadgetSliderGetDisabledBorderColor( window ); - backColor = GadgetSliderGetDisabledColor( window ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - backBorder = GadgetSliderGetHiliteBorderColor( window ); - backColor = GadgetSliderGetHiliteColor( window ); - - } - else - { - - backBorder = GadgetSliderGetEnabledBorderColor( window ); - backColor = GadgetSliderGetEnabledColor( window ); - - } - - // draw background border and rect over whole control - if( backBorder != WIN_COLOR_UNDEFINED ) - { - - start.x = origin.x; - start.y = origin.y; - end.x = start.x + size.x; - end.y = start.y + size.y; - TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - } - if( backColor != WIN_COLOR_UNDEFINED ) - { - - start.x = origin.x + 1; - start.y = origin.y + 1; - end.x = start.x + size.x - 2; - end.y = start.y + size.y - 2; - TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - } - - -} - -// W3DGadgetHorizontalSliderImageDraw ========================================= -/** Draw horizontal slider with user supplied images */ -//============================================================================= -void W3DGadgetHorizontalSliderImageDraw( GameWindow *window, - WinInstanceData *instData ) -{ - const Image *fillSquare, *blankSquare, *highlightSquare; - ICoord2D origin, size, start, end, highlightOffset; - - // get screen position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - highlightSquare = GadgetSliderGetHiliteImageLeft( window ); - blankSquare = GadgetSliderGetDisabledImageRight( window ); - fillSquare = GadgetSliderGetDisabledImageLeft( window ); - - SliderData *s = (SliderData *)window->winGetUserData(); - - Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / DEFAULT_DISPLAY_WIDTH; - - // figure out how many boxes we draw for this slider - Int numBoxes = 0; - Int numSelectedBoxes = 0; - Int numHighlightBoxes = 0; - Int boxWidth = fillSquare->getImageWidth()* xMulti; - Int boxPadding = 2; - start.x = origin.x; - end.x = start.x + boxWidth; - Real selectedPercent = (s->position - s->minVal)/INT_TO_REAL((s->maxVal - s->minVal)); - Int maxSelectedX = origin.x + REAL_TO_INT(selectedPercent * size.x); - while(end.x < origin.x + size.x ) - { - if (start.x <= maxSelectedX && end.x < origin.x + size.x && s->position != s->minVal) - ++numSelectedBoxes; - start.x = end.x + boxPadding; - end.x = start.x + boxWidth; - ++numBoxes; - } - numHighlightBoxes = numBoxes + 1; - Int distanceCovered = end.x - origin.x - boxWidth; - highlightOffset.x = -(boxWidth + boxPadding)/2; - highlightOffset.y = boxWidth/3; - Int blankness = size.x - distanceCovered; - origin.x += blankness/2; - - Int i; - if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - ICoord2D backgroundStart, backgroundEnd; - backgroundStart.y = origin.y + highlightOffset.y; - backgroundEnd.y = backgroundStart.y + boxWidth + boxPadding; - for (i=0; iwinDrawImage( highlightSquare, - backgroundStart.x, backgroundStart.y, - backgroundEnd.x, backgroundEnd.y ); - } - } - - start.y = origin.y; - end.y = start.y + boxWidth; - for (i=0; iwinDrawImage( fillSquare, - start.x, start.y, - end.x, end.y ); - } - for (i=numSelectedBoxes; iwinDrawImage( blankSquare, - start.x, start.y, - end.x, end.y ); - } -} - -// W3DGadgetHorizontalSliderImageDraw ========================================= -/** Draw horizontal slider with user supplied images */ -//============================================================================= -void W3DGadgetHorizontalSliderImageDrawB( GameWindow *window, - WinInstanceData *instData ) -{ - const Image *fillSquare, *blankSquare, *highlightSquare;//, *progressArrow; - ICoord2D origin, size, start, end; - Int xOffset, yOffset; - - // get screen position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - SliderData *s = (SliderData *)window->winGetUserData(); - - Real xMulti = INT_TO_REAL(TheDisplay->getWidth()) / DEFAULT_DISPLAY_WIDTH; - Real yMulti = INT_TO_REAL(TheDisplay->getHeight()) / DEFAULT_DISPLAY_HEIGHT; - // get image offset - xOffset = instData->m_imageOffset.x; - yOffset = instData->m_imageOffset.y; - - UnicodeString tooltip, tmp; - tooltip.format(L"mult:%g/%g, img offset:%d,%d", xMulti, yMulti, xOffset, yOffset); - - tmp.format(L"\norigin: %d,%d size:%d,%d", origin.x, origin.y, size.x, size.y); - tooltip.concat(tmp); - - tmp.format(L"\ns= %d <--> %d, numTicks=%g, pos = %d", s->minVal, s->maxVal, s->numTicks, s->position); - tooltip.concat(tmp); - - if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - highlightSquare = GadgetSliderGetHiliteImageLeft( window ); - ICoord2D backgroundStart, backgroundEnd; - backgroundStart.x = origin.x - (highlightSquare->getImageWidth() * xMulti)/2; - backgroundStart.y = origin.y + (highlightSquare->getImageHeight() *yMulti)/3; - backgroundEnd.y = backgroundStart.y + highlightSquare->getImageHeight()* yMulti; - backgroundEnd.x = backgroundStart.x + highlightSquare->getImageWidth() * xMulti; - - tmp.format(L"\nHighlighted: (%d,%d) -> (%d,%d), step %d/%g, full %d/%d", backgroundStart.x, backgroundStart.y, - backgroundEnd.x, backgroundEnd.y, highlightSquare->getImageWidth(), highlightSquare->getImageWidth() * xMulti, - origin.x, size.x); - tooltip.concat(tmp); - - while(backgroundStart.x < origin.x + size.x) - { - TheWindowManager->winDrawImage( highlightSquare, - backgroundStart.x, backgroundStart.y, - backgroundEnd.x, backgroundEnd.y ); - backgroundStart.x = backgroundEnd.x; - backgroundEnd.x = backgroundStart.x + highlightSquare->getImageWidth() * xMulti; - } - tmp.format(L"\n bsX = %d, beX = %d (%d < %d+%d or %d?)", backgroundStart.x, backgroundEnd.x, - backgroundStart.x, origin.x, size.x, origin.x + size.x); - tooltip.concat(tmp); - } - - fillSquare = GadgetSliderGetDisabledImageLeft( window ); - start.x = origin.x; - start.y = origin.y; - end.y = start.y + fillSquare->getImageHeight() * yMulti; - end.x = start.x + fillSquare->getImageWidth()* xMulti; - - tmp.format(L"\ntop: start=%d,%d, end=%d,%d", start.x, start.y, end.x, end.y); - tooltip.concat(tmp); - - while(start.x <= origin.x + (s->numTicks * (s->position - s->minVal)) && end.x < origin.x + size.x && s->position != s->minVal) - { - TheWindowManager->winDrawImage( fillSquare, - start.x, start.y, - end.x, end.y ); - start.x = end.x + 2; - end.x = start.x + fillSquare->getImageWidth()* xMulti; - - } - - blankSquare = GadgetSliderGetDisabledImageRight( window ); - end.x = start.x + blankSquare->getImageWidth()* xMulti; - - while(end.x < origin.x + size.x ) - { - TheWindowManager->winDrawImage( blankSquare, - start.x, start.y, - end.x, end.y ); - start.x = end.x + 2; - end.x = start.x + blankSquare->getImageWidth()* xMulti; - } - - instData->setTooltipText(tooltip); - -// if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) -// { -// progressArrow = GadgetSliderGetHiliteImageRight( window ); -// if(!progressArrow) -// return; -// Int transPos = (s->numTicks * (s->position - s->minVal)) - progressArrow->getImageWidth() /2; -// start.x = origin.x + transPos; -// start.y = origin.y + fillSquare->getImageHeight()/3*2; -// end.y = start.y + progressArrow->getImageHeight(); -// end.x = start.x + progressArrow->getImageWidth(); -// TheWindowManager->winDrawImage( progressArrow, -// start.x, start.y, -// end.x, end.y ); -// } -} - - -// W3DGadgetHorizontalSliderImageDraw ========================================= -/** Draw horizontal slider with user supplied images */ -//============================================================================= -void W3DGadgetHorizontalSliderImageDrawA( GameWindow *window, - WinInstanceData *instData ) -{ - const Image *leftImageLeft, *rightImageLeft, *centerImageLeft, *smallCenterImageLeft; - const Image *leftImageRight, *rightImageRight, *centerImageRight, *smallCenterImageRight; - ICoord2D origin, size, start, end; - Int xOffset, yOffset; - Int i; - - // get screen position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - SliderData *s = (SliderData *)window->winGetUserData(); - Int transPos = (s->numTicks * (s->position - s->minVal)) + HORIZONTAL_SLIDER_THUMB_WIDTH/2; - IRegion2D clipLeft, clipRight; - - // get image offset - xOffset = instData->m_imageOffset.x; - yOffset = instData->m_imageOffset.y; - - // get the right images - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - leftImageRight = leftImageLeft = GadgetSliderGetDisabledImageLeft( window ); - rightImageRight = rightImageLeft = GadgetSliderGetDisabledImageRight( window ); -// centerImageRight = centerImageLeft = GadgetSliderGetDisabledImageCenter( window ); -// smallCenterImageRight = smallCenterImageLeft = GadgetSliderGetDisabledImageSmallCenter( window ); - - } - else //if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - leftImageLeft = GadgetSliderGetHiliteImageLeft( window ); - rightImageLeft = GadgetSliderGetHiliteImageRight( window ); - centerImageLeft = GadgetSliderGetHiliteImageCenter( window ); - smallCenterImageLeft = GadgetSliderGetHiliteImageSmallCenter( window ); - - leftImageRight = GadgetSliderGetEnabledImageLeft( window ); - rightImageRight = GadgetSliderGetEnabledImageRight( window ); - centerImageRight = GadgetSliderGetEnabledImageCenter( window ); - smallCenterImageRight = GadgetSliderGetEnabledImageSmallCenter( window ); - - } - - // sanity, we need to have these images to make it look right - if( leftImageLeft == nullptr || rightImageLeft == nullptr || - centerImageLeft == nullptr || smallCenterImageLeft == nullptr || - leftImageRight == nullptr || rightImageRight == nullptr || - centerImageRight == nullptr || smallCenterImageRight == nullptr ) - return; - - // get image sizes for the ends - ICoord2D leftSize, rightSize; - leftSize.x = leftImageLeft->getImageWidth(); - leftSize.y = leftImageLeft->getImageHeight(); - rightSize.x = rightImageLeft->getImageWidth(); - rightSize.y = rightImageLeft->getImageHeight(); - - // get two key points used in the end drawing - ICoord2D leftEnd, rightStart; - leftEnd.x = origin.x + leftSize.x + xOffset; - leftEnd.y = origin.y + size.y + yOffset; - rightStart.x = origin.x + size.x - rightSize.x + xOffset; - rightStart.y = origin.y + size.y - leftSize.y + yOffset; - - - - // draw the center repeating bar - Int centerWidth, pieces; - - // get width we have to draw our repeating center in - centerWidth = rightStart.x - leftEnd.x; - - // how many whole repeating pieces will fit in that width - pieces = centerWidth / centerImageLeft->getImageWidth(); - - // draw the pieces - start.x = leftEnd.x; - start.y = origin.y + size.y - leftSize.y + yOffset; - end.y =origin.y + size.y + yOffset; - - clipLeft.lo.x = origin.x; - clipLeft.lo.y = rightStart.y; - clipLeft.hi.y = leftEnd.y; - clipLeft.hi.x = origin.x + transPos; - clipRight.lo.x = origin.x + transPos; - clipRight.lo.y = rightStart.y; - clipRight.hi.y = leftEnd.y; - clipRight.hi.x = origin.x + size.x; - - - for( i = 0; i < pieces; i++ ) - { - - end.x = start.x + centerImageLeft->getImageWidth(); - TheDisplay->setClipRegion(&clipLeft); - TheWindowManager->winDrawImage( centerImageLeft, - start.x, start.y, - end.x, end.y ); - TheDisplay->setClipRegion(&clipRight); - TheWindowManager->winDrawImage( centerImageRight, - start.x, start.y, - end.x, end.y ); - start.x += centerImageLeft->getImageWidth(); - - } - - // - // how many small repeating pieces will fit in the gap from where the - // center repeating bar stopped and the right image, draw them - // and overlapping underneath where the right end will go - // - centerWidth = rightStart.x - start.x; - pieces = centerWidth / smallCenterImageLeft->getImageWidth() + 1; - end.y = leftEnd.y;//start.y + smallCenterImageLeft->getImageHeight(); - for( i = 0; i < pieces; i++ ) - { - - end.x = start.x + smallCenterImageLeft->getImageWidth(); - TheDisplay->setClipRegion(&clipLeft); - TheWindowManager->winDrawImage( smallCenterImageLeft, - start.x, start.y, - end.x, end.y ); - TheDisplay->setClipRegion(&clipRight); - TheWindowManager->winDrawImage( smallCenterImageRight, - start.x, start.y, - end.x, end.y ); - start.x += smallCenterImageLeft->getImageWidth(); - - } - - // draw left end - start.x = origin.x + xOffset; - start.y = rightStart.y; - end = leftEnd; - TheDisplay->setClipRegion(&clipLeft); - TheWindowManager->winDrawImage(leftImageLeft, start.x, start.y, end.x, end.y); - TheDisplay->setClipRegion(&clipRight); - TheWindowManager->winDrawImage(leftImageRight, start.x, start.y, end.x, end.y); - // draw right end - start = rightStart; - end.x = start.x + rightSize.x; - end.y = leftEnd.y; - TheDisplay->setClipRegion(&clipLeft); - TheWindowManager->winDrawImage(rightImageLeft, start.x, start.y, end.x, end.y); - TheDisplay->setClipRegion(&clipRight); - TheWindowManager->winDrawImage(rightImageRight, start.x, start.y, end.x, end.y); - - TheDisplay->enableClipping(FALSE); -} - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp deleted file mode 100644 index bd9bff8b9b4..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DListBox.cpp +++ /dev/null @@ -1,671 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - - -// FILE: W3DListBox.cpp /////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DListBox.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: W3D implementation for the list box control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "W3DDevice/GameClient/W3DGadget.h" -#include "W3DDevice/GameClient/W3DDisplay.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// drawHiliteBar ============================================================== -/** Draw image for the hilite bar */ -//============================================================================= -static void drawHiliteBar( const Image *left, const Image *right, - const Image *center, const Image *smallCenter, - Int startX, Int startY, - Int endX, Int endY ) -{ - ICoord2D barWindowSize; // end point of bar from window origin - Int xOffset = 0, yOffset = 0; // incase we want this functionality later - ICoord2D start, end; - Int i; - IRegion2D clipRegion; - - - - barWindowSize.x = endX - startX; - barWindowSize.y = endY - startY; - - // - // the bar window size will always be at least big enough to accommodate - // the left and right ends - // - if( barWindowSize.x < left->getImageWidth() + right->getImageWidth() ) - barWindowSize.x = left->getImageWidth() + right->getImageWidth(); - - // get image sizes for the ends - ICoord2D leftSize, rightSize; - leftSize.x = left->getImageWidth(); - leftSize.y = left->getImageHeight(); - rightSize.x = right->getImageWidth(); - rightSize.y = right->getImageHeight(); - - // get two key points used in the end drawing - ICoord2D leftEnd, rightStart; - leftEnd.x = startX + leftSize.x + xOffset; - leftEnd.y = startY + barWindowSize.y + yOffset; - rightStart.x = startX + barWindowSize.x - rightSize.x + xOffset; - rightStart.y = startY + yOffset; - - // draw the center repeating bar - Int centerWidth, pieces; - - // get width we have to draw our repeating center in - centerWidth = rightStart.x - leftEnd.x; - - // how many whole repeating pieces will fit in that width - pieces = centerWidth / center->getImageWidth(); - - - - // draw the pieces - start.x = leftEnd.x; - start.y = startY + yOffset; - end.y = start.y + barWindowSize.y; - for( i = 0; i < pieces; i++ ) - { - - end.x = start.x + center->getImageWidth(); - TheWindowManager->winDrawImage( center, - start.x, start.y, - end.x, end.y ); - start.x += center->getImageWidth(); - - } - - // - // how many small repeating pieces will fit in the gap from where the - // center repeating bar stopped and the right image, draw them - // and overlapping underneath where the right end will go - // - // set the text clip region to the outline of the listbox - clipRegion.lo.x = leftEnd.x; - clipRegion.lo.y = startY + yOffset; - clipRegion.hi.x = leftEnd.x + centerWidth; - clipRegion.hi.y = start.y + barWindowSize.y; - TheDisplay->setClipRegion(&clipRegion); - centerWidth = rightStart.x - start.x; - if( centerWidth ) - { - - pieces = centerWidth / smallCenter->getImageWidth() + 1; - end.y = start.y + barWindowSize.y; - for( i = 0; i < pieces; i++ ) - { - - end.x = start.x + smallCenter->getImageWidth(); - TheWindowManager->winDrawImage( smallCenter, - start.x, start.y, - end.x, end.y ); - start.x += smallCenter->getImageWidth(); - - } - - } - TheDisplay->enableClipping(FALSE); - // draw left end - start.x = startX + xOffset; - start.y = startY + yOffset; - end = leftEnd; - TheWindowManager->winDrawImage(left, start.x, start.y, end.x, end.y); - - // draw right end - start = rightStart; - end.x = start.x + rightSize.x; - end.y = start.y + barWindowSize.y; - TheWindowManager->winDrawImage(right, start.x, start.y, end.x, end.y); - -} - -// drawListBoxText ============================================================ -/** Draw the text for a listbox */ -//============================================================================= -static void drawListBoxText( GameWindow *window, WinInstanceData *instData, - Int x, Int y, Int width, Int height, - Bool useImages ) -{ - Int drawY; - ListboxData *list = (ListboxData *)window->winGetUserData(); - Int i; - Bool selected; - Int listLineHeight; - Color textColor; -// W3DGameWindow *w3dWindow = static_cast(window); - IRegion2D clipRegion; - ICoord2D start, end; - - // - // save the clipping information region cause we're going to use it here - // in drawing the text - // -// TheWindowManager->winGetClipRegion( &clipRegion ); - - // set clip region to inside the outline box. -// TheWindowManager->winSetClipRegion( x, y, width, height ); - - // set the text clip region to the outline of the listbox - clipRegion.lo.x = x + 1; - clipRegion.lo.y = y -3; - clipRegion.hi.x = x + width - 1; - clipRegion.hi.y = y + height - 1; - - drawY = y - list->displayPos; - - for( i = 0; ; i++ ) - { - - if( i > 0 ) - if( list->listData[(i - 1)].listHeight > - (list->displayPos + list->displayHeight) ) - break; - - if( i == list->endPos ) - break; - - if( list->listData[i].listHeight < list->displayPos ) - { - drawY += (list->listData[i].height + 1); - continue; - } - - listLineHeight = list->listData[i].height + 1; - //textColor = list->listData[i].textColor; - selected = FALSE; - - if( list->multiSelect ) - { - Int j = 0; - - while( list->selections[j] >= 0 ) - { - if( i == list->selections[j] ) - { - selected = TRUE; - break; - } - - j++; - } - } - else - { - if( i == list->selectPos ) - selected = TRUE; - } - - // this item is selected, draw the selection color or image - if( selected ) - { - - if( useImages ) - { - const Image *left, *right, *center, *smallCenter; - - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - left = GadgetListBoxGetDisabledSelectedItemImageLeft( window ); - right = GadgetListBoxGetDisabledSelectedItemImageRight( window ); - center = GadgetListBoxGetDisabledSelectedItemImageCenter( window ); - smallCenter = GadgetListBoxGetDisabledSelectedItemImageSmallCenter( window ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - left = GadgetListBoxGetHiliteSelectedItemImageLeft( window ); - right = GadgetListBoxGetHiliteSelectedItemImageRight( window ); - center = GadgetListBoxGetHiliteSelectedItemImageCenter( window ); - smallCenter = GadgetListBoxGetHiliteSelectedItemImageSmallCenter( window ); - - } - else - { - - left = GadgetListBoxGetEnabledSelectedItemImageLeft( window ); - right = GadgetListBoxGetEnabledSelectedItemImageRight( window ); - center = GadgetListBoxGetEnabledSelectedItemImageCenter( window ); - smallCenter = GadgetListBoxGetEnabledSelectedItemImageSmallCenter( window ); - - } - - // draw select image across area - - // - // where are we going to draw ... taking into account the clipping - // region of the edge of the listbox - // - start.x = x; - start.y = drawY; - end.x = start.x + width; - end.y = start.y + listLineHeight; - - if( end.y > clipRegion.hi.y ) - end.y = clipRegion.hi.y; - if( start.y < clipRegion.lo.y ) - start.y = clipRegion.lo.y; - - if( left && right && center && smallCenter ) - drawHiliteBar( left, right, center, smallCenter, start.x + 1, start.y, end.x , end.y ); - - } - else - { - Color selectColor = WIN_COLOR_UNDEFINED, - selectBorder = WIN_COLOR_UNDEFINED; - - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - selectColor = GadgetListBoxGetDisabledSelectedItemColor( window ); - selectBorder = GadgetListBoxGetDisabledSelectedItemBorderColor( window ); - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - selectColor = GadgetListBoxGetHiliteSelectedItemColor( window ); - selectBorder = GadgetListBoxGetHiliteSelectedItemBorderColor( window ); - } - else - { - selectColor = GadgetListBoxGetEnabledSelectedItemColor( window ); - selectBorder = GadgetListBoxGetEnabledSelectedItemBorderColor( window ); - } - - // draw border - - // - // where are we going to draw ... taking into account the clipping - // region of the edge of the listbox - // - start.x = x; - start.y = drawY; - end.x = start.x + width; - end.y = start.y + listLineHeight; - - if( end.y > clipRegion.hi.y ) - end.y = clipRegion.hi.y; - if( start.y < clipRegion.lo.y ) - start.y = clipRegion.lo.y; - - if( selectBorder != WIN_COLOR_UNDEFINED ) - TheWindowManager->winOpenRect( selectBorder, - WIN_DRAW_LINE_WIDTH, - start.x, start.y, - end.x, end.y ); - - // draw filled inner rect - - // - // where are we going to draw ... taking into account the clipping - // region of the edge of the listbox - // - start.x = x + 1; - start.y = drawY + 1; - end.x = start.x + width - 2; - end.y = start.y + listLineHeight - 2; - - if( end.y > clipRegion.hi.y ) - end.y = clipRegion.hi.y; - if( start.y < clipRegion.lo.y ) - start.y = clipRegion.lo.y; - - if( selectColor != WIN_COLOR_UNDEFINED ) - TheWindowManager->winFillRect( selectColor, - WIN_DRAW_LINE_WIDTH, - start.x, start.y, - end.x, end.y ); - - } - - } - - - - - Color dropColor = TheWindowManager->winMakeColor( 0, 0, 0, 255 ); - DisplayString *string; - - ListEntryCell *cells = list->listData[i].cell; - Int columnX = x; - IRegion2D columnRegion; - if( cells ) - { - // loop through all the cells - for( Int j = 0; j < list->columns; j++ ) - { - // setup the Clip Region size - - columnRegion.lo.x = columnX; - columnRegion.lo.y = drawY; - if(list->columns == 1 && list->slider && list->slider->winIsHidden()) - columnRegion.hi.x = columnX + width-3; - else - columnRegion.hi.x = columnX + list->columnWidth[j]; - columnRegion.hi.y = drawY + list->listData[i].height; - if(columnRegion.lo.y < clipRegion.lo.y ) - columnRegion.lo.y = clipRegion.lo.y; - if( columnRegion.hi.y > clipRegion.hi.y ) - columnRegion.hi.y = clipRegion.hi.y; - - // Display the Text Case; - if(cells[j].cellType == LISTBOX_TEXT) - { - textColor = cells[j].color; - string = (DisplayString *)cells[j].data; - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ONE_LINE ) == TRUE ) - { - string->setWordWrap(0); - // make sure the font of the text is the same as the windows - if( string->getFont() != window->winGetFont() ) - string->setFont( window->winGetFont() ); - - // draw this text after setting the clip region for it - string->setClipRegion( &columnRegion ); - string->draw( columnX + TEXT_X_OFFSET, - drawY, - textColor, - dropColor ); - - } - else - { - - // make sure the font of the text is the same as the windows - if( string->getFont() != window->winGetFont() ) - string->setFont( window->winGetFont() ); - - // set clip region and draw - string->setClipRegion( &columnRegion ); - string->draw( columnX + TEXT_X_OFFSET, - drawY, - textColor, - dropColor ); - } - } - else if(cells[j].cellType == LISTBOX_IMAGE && cells[j].data) - { - Int width, height; - if (cells[j].width > 0) - width = cells[j].width; - else - width = list->columnWidth[j]; - if(cells[j].height > 0) - height = cells[j].height; - else - height = list->listData[i].height; - if(j == 0) - width--; - Int offsetX,offsetY; - if(width < list->columnWidth[j]) - offsetX = columnX + ((list->columnWidth[j] - width) / 2); - else - offsetX = columnX; - if(height < list->listData[i].height) - offsetY = drawY + ((list->listData[i].height - height) / 2); - else - offsetY = drawY; - - offsetY++; - if(offsetX setClipRegion( &columnRegion ); - TheWindowManager->winDrawImage( (const Image *)cells[j].data, - offsetX, offsetY, - offsetX + width, offsetY + height,cells[j].color ); - - } - columnX = columnX + list->columnWidth[j]; - } - } - - - drawY += listLineHeight; - TheDisplay->enableClipping(FALSE); - } - -// TheWindowManager->winSetClipRegion( clipRegion.lo.x, clipRegion.lo.y, -// clipRegion.hi.x, clipRegion.hi.y ); - -} - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// W3DGadgetListBoxDraw ======================================================= -/** Draw colored list box using standard graphics */ -//============================================================================= -void W3DGadgetListBoxDraw( GameWindow *window, WinInstanceData *instData ) -{ - Int width, height, fontHeight, x, y; - Color background, border, titleColor, titleBorder; - ListboxData *list = (ListboxData *)window->winGetUserData(); - ICoord2D size; - DisplayString *title = instData->getTextDisplayString(); - - // get window position and size - window->winGetScreenPosition( &x, &y ); - window->winGetSize( &size.x, &size.y ); - - // get font height - fontHeight = TheWindowManager->winFontHeight( instData->getFont() ); - - // alias width and height from size - width = size.x; - height = size.y; - - // get the right colors - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - background = GadgetListBoxGetDisabledColor( window ); - border = GadgetListBoxGetDisabledBorderColor( window ); - titleColor = window->winGetDisabledTextColor(); - titleBorder = window->winGetDisabledTextBorderColor(); - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - background = GadgetListBoxGetHiliteColor( window ); - border = GadgetListBoxGetHiliteBorderColor( window ); - titleColor = window->winGetHiliteTextColor(); - titleBorder = window->winGetHiliteTextBorderColor(); - } - else - { - background = GadgetListBoxGetEnabledColor( window ); - border = GadgetListBoxGetEnabledBorderColor( window ); - titleColor = window->winGetEnabledTextColor(); - titleBorder = window->winGetEnabledTextBorderColor(); - } - - // Draw the title - if( title && title->getTextLength() ) - { - - // set the font of this text to that of the window if not already - if( title->getFont() != window->winGetFont() ) - title->setFont( window->winGetFont() ); - - // draw the text - title->draw( x + 1, y, titleColor, titleBorder ); - - y += fontHeight + 1; - height -= fontHeight + 1; - - } - - // draw the back border - if( border != WIN_COLOR_UNDEFINED ) - TheWindowManager->winOpenRect( border, WIN_DRAW_LINE_WIDTH, - x, y, x + width, y + height ); - - // draw background - if( background != WIN_COLOR_UNDEFINED ) - TheWindowManager->winFillRect( background, WIN_DRAW_LINE_WIDTH, - x + 1, y + 1, - x + width - 1, y + height - 1 ); - - // If ScrollBar was requested ... adjust width. - if( list->slider && !list->slider->winIsHidden()) - { - ICoord2D sliderSize; - - list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - width -= (sliderSize.x +3); - - } - - // draw the text - drawListBoxText( window, instData, x, y + 4 , width, height-4, TRUE ); - - - -} - -// W3DGadgetListBoxImageDraw ================================================== -/** Draw list box with user supplied images */ -//============================================================================= -void W3DGadgetListBoxImageDraw( GameWindow *window, WinInstanceData *instData ) -{ - Int width, height, x, y; - const Image *image; - ListboxData *list = (ListboxData *)window->winGetUserData(); - ICoord2D size; - Color titleColor, titleBorder; - DisplayString *title = instData->getTextDisplayString(); - - // get window position and size - window->winGetScreenPosition( &x, &y ); - window->winGetSize( &size.x, &size.y ); - - // save off width and height so we can change them - width = size.x; - height = size.y; - - // If ScrollBar was requested ... adjust width. - if( list->slider ) - { - ICoord2D sliderSize; - - list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - width -= sliderSize.x; - - } - - // get the image - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - image = GadgetListBoxGetDisabledImage( window ); - titleColor = window->winGetDisabledTextColor(); - titleBorder = window->winGetDisabledTextBorderColor(); - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - image = GadgetListBoxGetHiliteImage( window ); - titleColor = window->winGetHiliteTextColor(); - titleBorder = window->winGetHiliteTextBorderColor(); - } - else - { - image = GadgetListBoxGetEnabledImage( window ); - titleColor = window->winGetEnabledTextColor(); - titleBorder = window->winGetEnabledTextBorderColor(); - } - - // draw the back image - if( image ) - { - ICoord2D start, end; - - start.x = x + instData->m_imageOffset.x; - start.y = y + instData->m_imageOffset.y; - end.x = start.x + width; - end.y = start.y + height; - TheWindowManager->winDrawImage( image, - start.x, start.y, - end.x, end.y ); - - } - - // Draw the title - if( title && title->getTextLength() ) - { - - // set font to font of the window if not already - if( title->getFont() != window->winGetFont() ) - title->setFont( window->winGetFont() ); - - // draw the text - title->draw( x + 1, y, titleColor, titleBorder ); - - y += TheWindowManager->winFontHeight( instData->getFont() ); - height -= TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - } - - // draw the listbox text - drawListBoxText( window, instData, x, y+4, width, height-4, TRUE ); - - - -} - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp deleted file mode 100644 index 9baf04b4fd8..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DProgressBar.cpp +++ /dev/null @@ -1,416 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DProgressBar.cpp /////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DProgressBar.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: W3D implementation for the progress bar GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetProgressBar.h" -#include "W3DDevice/GameClient/W3DGadget.h" -#include "W3DDevice/GameClient/W3DDisplay.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// W3DGadgetProgressBarDraw =================================================== -/** Draw colored Progress Bar using standard graphics */ -//============================================================================= -void W3DGadgetProgressBarDraw( GameWindow *window, WinInstanceData *instData ) -{ - ICoord2D origin, size, start, end; - Color backColor, backBorder, barColor, barBorder; - Int progress = (Int)window->winGetUserData(); - - // get window size and position - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get the right colors to use - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - backColor = GadgetProgressBarGetDisabledColor( window ); - backBorder = GadgetProgressBarGetDisabledBorderColor( window ); - barColor = GadgetProgressBarGetDisabledBarColor( window ); - barBorder = GadgetProgressBarGetDisabledBarBorderColor( window ); - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - backColor = GadgetProgressBarGetHiliteColor( window ); - backBorder = GadgetProgressBarGetHiliteBorderColor( window ); - barColor = GadgetProgressBarGetHiliteBarColor( window ); - barBorder = GadgetProgressBarGetHiliteBarBorderColor( window ); - } - else - { - backColor = GadgetProgressBarGetEnabledColor( window ); - backBorder = GadgetProgressBarGetEnabledBorderColor( window ); - barColor = GadgetProgressBarGetEnabledBarColor( window ); - barBorder = GadgetProgressBarGetEnabledBarBorderColor( window ); - } - - // draw background border - if( backBorder != WIN_COLOR_UNDEFINED ) - { - - start.x = origin.x; - start.y = origin.y; - end.x = start.x + size.x; - end.y = start.y + size.y; - TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - } - - // draw background fill - if( backColor != WIN_COLOR_UNDEFINED ) - { - - start.x = origin.x + 1; - start.y = origin.y + 1; - end.x = start.x + size.x - 2; - end.y = start.y + size.y - 2; - TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - } - - // draw the progress so far - if( progress ) - { - - // draw bar border - if( barBorder != WIN_COLOR_UNDEFINED ) - { - - start.x = origin.x; - start.y = origin.y; - end.x = start.x + (size.x * progress) / 100; - end.y = start.y + size.y; - if(end.x- start.x > 1 ) - { - TheWindowManager->winOpenRect( barBorder, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - } - - } - - // draw bar fill - if( barColor != WIN_COLOR_UNDEFINED ) - { - - start.x = origin.x + 1; - start.y = origin.y + 1; - end.x = start.x + (size.x * progress) / 100 - 2; - end.y = start.y + size.y - 2; -// TheWindowManager->winOpenRect( barColor, WIN_DRAW_LINE_WIDTH, -// start.x, start.y, end.x, end.y ); - - if(end.x- start.x > 1 ) - { - TheWindowManager->winFillRect( barColor,WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - TheWindowManager->winDrawLine(GameMakeColor(255,255,255,255),WIN_DRAW_LINE_WIDTH, start.x, start.y, end.x, start.y); - TheWindowManager->winDrawLine(GameMakeColor(200,200,200,255),WIN_DRAW_LINE_WIDTH, start.x, start.y, start.x, end.y); - } - - } - - } - - - -} - -// W3DGadgetProgressBarImageDraw ============================================== -/** Draw Progress Bar with user supplied images */ -//============================================================================= -void W3DGadgetProgressBarImageDrawA( GameWindow *window, WinInstanceData *instData ) -{ - ICoord2D origin, size; - const Image *barCenter, *barRight, *left, *right, *center; - Int progress = (Int)window->winGetUserData(); - Int xOffset, yOffset; - Int i; - // get window size and position - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get offset - xOffset = instData->m_imageOffset.x; - yOffset = instData->m_imageOffset.y; - - barCenter = GadgetProgressBarGetEnabledBarImageCenter( window ); - barRight = GadgetProgressBarGetEnabledBarImageRight( window ); - left = GadgetProgressBarGetEnabledImageLeft( window ); - right = GadgetProgressBarGetEnabledImageRight( window ); - center = GadgetProgressBarGetEnabledImageCenter( window ); - - if(!barCenter || !barRight || !left || !right || !center) - return; - - Int width = barCenter->getImageWidth(); -// Int height = barCenter->getImageHeight(); - - Int drawWidth = (size.x * progress) / 100; - Int pieces = drawWidth / width; - Int x = origin.x; - for( i = 0; i < pieces; i ++) - { - - TheWindowManager->winDrawImage( barCenter, - x, origin.y, - x + width, origin.y + size.y ); - x += width; - } - - -} - -void W3DGadgetProgressBarImageDraw( GameWindow *window, WinInstanceData *instData ) -{ - ICoord2D origin, size, start, end; - const Image *backLeft, *backRight, *backCenter, - *barRight, *barCenter;//*backSmallCenter,*barLeft,, *barSmallCenter; - Int progress = (Int)window->winGetUserData(); - Int xOffset, yOffset; - Int i; - - // get window size and position - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get offset - xOffset = instData->m_imageOffset.x; - yOffset = instData->m_imageOffset.y; - - // get the right images to use - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - backLeft = GadgetProgressBarGetDisabledImageLeft( window ); - //barLeft = GadgetProgressBarGetDisabledBarImageLeft( window ); - backRight = GadgetProgressBarGetDisabledImageRight( window ); - barRight = GadgetProgressBarGetDisabledBarImageRight( window ); - backCenter = GadgetProgressBarGetDisabledImageCenter( window ); - barCenter = GadgetProgressBarGetDisabledBarImageCenter( window ); - //backSmallCenter = GadgetProgressBarGetDisabledImageSmallCenter( window ); - //barSmallCenter = GadgetProgressBarGetDisabledBarImageSmallCenter( window ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - backLeft = GadgetProgressBarGetHiliteImageLeft( window ); - //barLeft = GadgetProgressBarGetHiliteBarImageLeft( window ); - backRight = GadgetProgressBarGetHiliteImageRight( window ); - barRight = GadgetProgressBarGetHiliteBarImageRight( window ); - backCenter = GadgetProgressBarGetHiliteImageCenter( window ); - barCenter = GadgetProgressBarGetHiliteBarImageCenter( window ); - //backSmallCenter = GadgetProgressBarGetHiliteImageSmallCenter( window ); - //barSmallCenter = GadgetProgressBarGetHiliteBarImageSmallCenter( window ); - - } - else - { - - backLeft = GadgetProgressBarGetEnabledImageLeft( window ); - //barLeft = GadgetProgressBarGetEnabledBarImageLeft( window ); - backRight = GadgetProgressBarGetEnabledImageRight( window ); - barRight = GadgetProgressBarGetEnabledBarImageRight( window ); - backCenter = GadgetProgressBarGetEnabledImageCenter( window ); - barCenter = GadgetProgressBarGetEnabledBarImageCenter( window ); - //backSmallCenter = GadgetProgressBarGetEnabledImageSmallCenter( window ); - //barSmallCenter = GadgetProgressBarGetEnabledBarImageSmallCenter( window ); - - } - - // sanity - if( backLeft == nullptr || backRight == nullptr || - backCenter == nullptr || - barRight == nullptr) - // backSmallCenter == nullptr ||barLeft == nullptr ||barCenter == nullptr || barSmallCenter == nullptr ) - return; - - // get image sizes for the ends - ICoord2D leftSize, rightSize; - leftSize.x = backLeft->getImageWidth(); - leftSize.y = backLeft->getImageHeight(); - rightSize.x = backRight->getImageWidth(); - rightSize.y = backRight->getImageHeight(); - - // get two key points used in the end drawing - ICoord2D leftEnd, rightStart; - leftEnd.x = origin.x + leftSize.x + xOffset; - leftEnd.y = origin.y + size.y + yOffset; - rightStart.x = origin.x + size.x - rightSize.x + xOffset; - rightStart.y = origin.y + yOffset; - - // draw the center repeating bar - Int centerWidth, pieces; - - // get width we have to draw our repeating center in - centerWidth = rightStart.x - leftEnd.x; - - // how many whole repeating pieces will fit in that width - pieces = centerWidth / backCenter->getImageWidth(); - - // draw the pieces - start.x = leftEnd.x; - start.y = origin.y + yOffset; - end.y = start.y + size.y; - for( i = 0; i < pieces; i++ ) - { - - end.x = start.x + backCenter->getImageWidth(); - TheWindowManager->winDrawImage( backCenter, - start.x, start.y, - end.x, end.y ); - start.x += backCenter->getImageWidth(); - - } - - // - // how many small repeating pieces will fit in the gap from where the - // center repeating bar stopped and the right image, draw them - // and overlapping underneath where the right end will go - // -// centerWidth = rightStart.x - start.x; -// pieces = centerWidth / backCenter->getImageWidth() + 1; -// end.y = start.y + size.y; -// IRegion2D clipRegion; -// -// TheDisplay->setClipRegion() -// for( i = 0; i < pieces; i++ ) -// { -// -// end.x = start.x + backCenter->getImageWidth(); -// TheWindowManager->winDrawImage( backCenter, -// start.x, start.y, -// end.x, end.y ); -// start.x += backCenter->getImageWidth(); -// -// } // end for i -// - IRegion2D reg; - reg.lo.x = start.x; - reg.lo.y = start.y; - reg.hi.x = rightStart.x; - reg.hi.y = end.y; - centerWidth = rightStart.x - start.x; - if( centerWidth > 0) - { - TheDisplay->setClipRegion(®); - end.x = start.x + backCenter->getImageWidth(); - TheWindowManager->winDrawImage( backCenter, - start.x, start.y, - end.x, end.y ); - TheDisplay->enableClipping(FALSE); - } - - - // draw left end - start.x = origin.x + xOffset; - start.y = origin.y + yOffset; - end = leftEnd; - TheWindowManager->winDrawImage(backLeft, start.x, start.y, end.x, end.y); - - // draw right end - start = rightStart; - end.x = start.x + rightSize.x; - end.y = start.y + size.y; - TheWindowManager->winDrawImage(backRight, start.x, start.y, end.x, end.y); - - - ICoord2D barWindowSize; // end point of bar from window origin - - barWindowSize.x = ((size.x - 20) * progress) / 100; - barWindowSize.y = size.y; - - pieces = barWindowSize.x / barCenter->getImageWidth(); - // draw the pieces - start.x = origin.x +10; - start.y = origin.y + yOffset +5; - end.y = start.y + size.y - 10; - for( i = 0; i < pieces; i++ ) - { - - end.x = start.x + barCenter->getImageWidth(); - TheWindowManager->winDrawImage( barCenter, - start.x, start.y, - end.x, end.y ); - start.x += barCenter->getImageWidth(); - - } - start.x = origin.x + 10 + barCenter->getImageWidth() * pieces; - //pieces = (size.x - barWindowSize.x -20) / barRight->getImageWidth(); - pieces = ((size.x - 20) / barCenter->getImageWidth()) - pieces; - for( i = 0; i < pieces; i++ ) - { - - end.x = start.x + barRight->getImageWidth(); - TheWindowManager->winDrawImage( barRight, - start.x, start.y, - end.x, end.y ); - start.x += barRight->getImageWidth(); - - } - -} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp deleted file mode 100644 index fe463b8ecf4..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DRadioButton.cpp +++ /dev/null @@ -1,387 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DRadioButton.cpp /////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DRadioButton.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: W3D methods needed to implement the RadioButton UI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetRadioButton.h" -#include "W3DDevice/GameClient/W3DGadget.h" -#include "W3DDevice/GameClient/W3DDisplay.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// drawRadioButtonText ======================================================== -/** Draw the text for a RadioButton */ -//============================================================================= -static void drawRadioButtonText( GameWindow *window, WinInstanceData *instData ) -{ - ICoord2D origin, size, textPos; - Int width, height; - Color textColor, dropColor; - DisplayString *text = instData->getTextDisplayString(); - - // sanity - if( text == nullptr || text->getTextLength() == 0 ) - return; - - // get window position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get the right text color - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - textColor = window->winGetDisabledTextColor(); - dropColor = window->winGetDisabledTextBorderColor(); - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - textColor = window->winGetHiliteTextColor(); - dropColor = window->winGetHiliteTextBorderColor(); - } - else - { - textColor = window->winGetEnabledTextColor(); - dropColor = window->winGetEnabledTextBorderColor(); - } - - // set our font to that of our parent if not the same - if( text->getFont() != window->winGetFont() ) - text->setFont( window->winGetFont() ); - - // get text size - text->getSize( &width, &height ); - - // set the location for our text - textPos.x = origin.x + (size.x / 2) - (width / 2); - textPos.y = origin.y + (size.y / 2) - (height / 2); - - // draw it - text->draw( textPos.x, textPos.y, textColor, dropColor ); - -} - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// W3DGadgetRadioButtonDraw =================================================== -/** Draw colored check box using standard graphics */ -//============================================================================= -void W3DGadgetRadioButtonDraw( GameWindow *window, WinInstanceData *instData ) -{ - Int checkOffsetFromLeft; - Color backColor, - backBorder, - boxColor, - boxBorder; - ICoord2D origin, size, start, end; - - // get window position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // compute start of check offset - checkOffsetFromLeft = size.x / 16; - - // - // get the colors we should be using to draw, see GadgetRadioButton.h - // draw appropriate state, see GadgetRadioButton.h for info - // - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - // disabled background - backColor = GadgetRadioGetDisabledColor( window ); - backBorder = GadgetRadioGetDisabledBorderColor( window ); - - // check box - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - boxColor = GadgetRadioGetDisabledCheckedBoxColor( window ); - boxBorder = GadgetRadioGetDisabledCheckedBoxBorderColor( window ); - } - else - { - boxColor = GadgetRadioGetDisabledUncheckedBoxColor( window ); - boxBorder = GadgetRadioGetDisabledUncheckedBoxBorderColor( window ); - } - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - // hilited background - backColor = GadgetRadioGetHiliteColor( window ); - backBorder = GadgetRadioGetHiliteBorderColor( window ); - - // check box - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - boxColor = GadgetRadioGetHiliteCheckedBoxColor( window ); - boxBorder = GadgetRadioGetHiliteCheckedBoxBorderColor( window ); - } - else - { - boxColor = GadgetRadioGetHiliteUncheckedBoxColor( window ); - boxBorder = GadgetRadioGetHiliteUncheckedBoxBorderColor( window ); - } - - } - else - { - - // enabled background - backColor = GadgetRadioGetEnabledColor( window ); - backBorder = GadgetRadioGetEnabledBorderColor( window ); - - // check box - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - boxColor = GadgetRadioGetEnabledCheckedBoxColor( window ); - boxBorder = GadgetRadioGetEnabledCheckedBoxBorderColor( window ); - } - else - { - boxColor = GadgetRadioGetEnabledUncheckedBoxColor( window ); - boxBorder = GadgetRadioGetEnabledUncheckedBoxBorderColor( window ); - } - - } - - // draw background border - start.x = origin.x; - start.y = origin.y; - end.x = start.x + size.x; - end.y = start.y + size.y; - TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - // draw the background - start.x++; - start.y++; - end.x--; - end.y--; - TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - - - // draw box border - start.x = origin.x + size.y; - start.y = origin.y; - end.x = start.x; - end.y = start.y + size.y; - TheWindowManager->winDrawLine( backBorder, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - // draw box for button - start.x = origin.x + 1; - start.y = origin.y + 1; - end.x = origin.x + size.y -1; - end.y = origin.y + size.y -1; - TheWindowManager->winFillRect( boxColor, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - // draw box border - start.x = origin.x + size.x - size.y; - start.y = origin.y; - end.x = start.x; - end.y = start.y + size.y; - TheWindowManager->winDrawLine( backBorder, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - // draw box for button - start.x = origin.x + size.x - size.y; - start.y = origin.y + 1; - end.x = origin.x + size.x -1; - end.y = origin.y + size.y -1; - TheWindowManager->winFillRect( boxColor, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - // draw the button text - if( instData->getTextLength() ) - drawRadioButtonText( window, instData ); - - - -} - - -void W3DGadgetRadioButtonImageDraw( GameWindow *window, - WinInstanceData *instData ) -{ - const Image *leftImage, *rightImage, *centerImage; - ICoord2D origin, size, start, end; - Int xOffset, yOffset; - Int i; - - // get screen position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - IRegion2D clipLeft; - - // get image offset - xOffset = instData->m_imageOffset.x; - yOffset = instData->m_imageOffset.y; - - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - //backgroundImage = GadgetRadioGetEnabledCheckedBoxImage( window ); - leftImage = GadgetRadioGetSelectedImage( window ); - centerImage = GadgetRadioGetSelectedUncheckedBoxImage( window ); - rightImage = GadgetRadioGetSelectedCheckedBoxImage( window ); - - } - else if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - // disabled background - leftImage = GadgetRadioGetDisabledImage( window ); - centerImage = GadgetRadioGetDisabledUncheckedBoxImage( window ); - rightImage = GadgetRadioGetDisabledCheckedBoxImage( window ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - // hilited background - leftImage = GadgetRadioGetHiliteImage( window ); - centerImage = GadgetRadioGetHiliteUncheckedBoxImage( window ); - rightImage = GadgetRadioGetHiliteCheckedBoxImage( window ); - - } - else - { - // enabled background - leftImage = GadgetRadioGetEnabledImage( window ); - centerImage = GadgetRadioGetEnabledUncheckedBoxImage( window ); - rightImage = GadgetRadioGetEnabledCheckedBoxImage( window ); - - } - - // sanity, we need to have these images to make it look right - if( leftImage == nullptr || centerImage == nullptr || - rightImage == nullptr ) - return; - - // get image sizes for the ends - ICoord2D leftSize, rightSize; - leftSize.x = leftImage->getImageWidth(); - leftSize.y = leftImage->getImageHeight(); - rightSize.x = rightImage->getImageWidth(); - rightSize.y = rightImage->getImageHeight(); - - // get two key points used in the end drawing - ICoord2D leftEnd, rightStart; - leftEnd.x = origin.x + leftSize.x + xOffset; - leftEnd.y = origin.y + size.y + yOffset; - rightStart.x = origin.x + size.x - rightSize.x + xOffset; - rightStart.y = origin.y + size.y + yOffset; - - - - // draw the center repeating bar - Int centerWidth, pieces; - - // get width we have to draw our repeating center in - centerWidth = rightStart.x - leftEnd.x; - - // how many whole repeating pieces will fit in that width - pieces = centerWidth / centerImage->getImageWidth(); - pieces++; - // draw the pieces - start.x = leftEnd.x; - start.y = origin.y + yOffset; - end.y =origin.y + size.y + yOffset; - - clipLeft.lo.x = leftEnd.x; - clipLeft.lo.y = origin.y; - clipLeft.hi.y = leftEnd.y; - clipLeft.hi.x = rightStart.x ; - - - TheDisplay->setClipRegion(&clipLeft); - - for( i = 0; i < pieces; i++ ) - { - end.x = start.x + centerImage->getImageWidth(); - TheWindowManager->winDrawImage( centerImage, - start.x, start.y, - end.x, end.y ); - start.x += centerImage->getImageWidth(); - } - - TheDisplay->enableClipping(FALSE); - // draw left end - start.x = origin.x + xOffset; - start.y = origin.y + yOffset; - end = leftEnd; - TheWindowManager->winDrawImage(leftImage, start.x, start.y, end.x, end.y); - // draw right end - start.x = rightStart.x; - start.y = origin.y + yOffset; - end.x = origin.x + size.x; - end.y = leftEnd.y; - TheWindowManager->winDrawImage(rightImage, start.x, start.y, end.x, end.y); - - // draw the text - if( instData->getTextLength() ) - drawRadioButtonText( window, instData ); - - -} - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp deleted file mode 100644 index baea0758923..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTabControl.cpp +++ /dev/null @@ -1,652 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DTabControl.cpp /////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: projects\RTS\code\gameenginedevice\Source\W3DDevice\GameClient\GUI\Gadget\W3DTabControl.cpp -// -// Created: Graham Smallwood, November 2001 -// -// Desc: W3D methods needed to implement the TabControl UI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetTabControl.h" -#include "W3DDevice/GameClient/W3DGameWindow.h" -#include "W3DDevice/GameClient/W3DGadget.h" -#include "W3DDevice/GameClient/W3DDisplay.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// W3DGadgetRadioButtonDraw =================================================== -/** Draw tabs with standard graphics */ -//============================================================================= -void W3DGadgetTabControlDraw( GameWindow *tabControl, WinInstanceData *instData ) -{ - ICoord2D origin, size; - - // get window position and size - tabControl->winGetScreenPosition( &origin.x, &origin.y ); - tabControl->winGetSize( &size.x, &size.y ); - - W3DGameWinDefaultDraw(tabControl, instData);//draw the background - - if( BitIsSet( tabControl->winGetStatus(), WIN_STATUS_BORDER ) == TRUE && - !BitIsSet( tabControl->winGetStatus(), WIN_STATUS_SEE_THRU ) ) - {//draw border if desired - tabControl->winDrawBorder(); - } - - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - - Int tabX, tabY, tabWidth, tabHeight, tabDeltaX, tabDeltaY; - tabX = origin.x + tabData->tabsLeftLimit; - tabY = origin.y + tabData->tabsTopLimit; - tabWidth = tabData->tabWidth; - tabHeight = tabData->tabHeight; - if( (tabData->tabEdge == TP_TOP_SIDE) || (tabData->tabEdge == TP_BOTTOM_SIDE) ) - { - tabDeltaX = tabWidth; - tabDeltaY = 0; - } - else - { - tabDeltaX = 0; - tabDeltaY = tabHeight; - } - - Color color, border; - - if( tabData->tabCount >= 1 )//Does exist - { - if( tabData->subPaneDisabled[0] ) - {//Disabled - color = GadgetTabControlGetDisabledColorTabZero( tabControl ); - border = GadgetTabControlGetDisabledBorderColorTabZero( tabControl ); - } - else if( tabData->activeTab == 0 ) - {//Hilited/Active - color = GadgetTabControlGetHiliteColorTabZero( tabControl ); - border = GadgetTabControlGetHiliteBorderColorTabZero( tabControl ); - } - else - {//Just enabled - color = GadgetTabControlGetEnabledColorTabZero( tabControl ); - border = GadgetTabControlGetEnabledBorderColorTabZero( tabControl ); - } - - // box and border - if( border != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winOpenRect( border, WIN_DRAW_LINE_WIDTH, - tabX, tabY, tabX + tabWidth, tabY + tabHeight ); - } - if( color != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winFillRect( color, WIN_DRAW_LINE_WIDTH, - tabX + 1, tabY + 1, tabX + tabWidth - 1, tabY + tabHeight - 1 ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 2 )//Does exist - { - if( tabData->subPaneDisabled[1] ) - {//Disabled - color = GadgetTabControlGetDisabledColorTabOne( tabControl ); - border = GadgetTabControlGetDisabledBorderColorTabOne( tabControl ); - } - else if( tabData->activeTab == 1 ) - {//Hilited/Active - color = GadgetTabControlGetHiliteColorTabOne( tabControl ); - border = GadgetTabControlGetHiliteBorderColorTabOne( tabControl ); - } - else - {//Just enabled - color = GadgetTabControlGetEnabledColorTabOne( tabControl ); - border = GadgetTabControlGetEnabledBorderColorTabOne( tabControl ); - } - - // box and border - if( border != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winOpenRect( border, WIN_DRAW_LINE_WIDTH, - tabX, tabY, tabX + tabWidth, tabY + tabHeight ); - } - if( color != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winFillRect( color, WIN_DRAW_LINE_WIDTH, - tabX + 1, tabY + 1, tabX + tabWidth - 1, tabY + tabHeight - 1 ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 3 )//Does exist - { - if( tabData->subPaneDisabled[2] ) - {//Disabled - color = GadgetTabControlGetDisabledColorTabTwo( tabControl ); - border = GadgetTabControlGetDisabledBorderColorTabTwo( tabControl ); - } - else if( tabData->activeTab == 2 ) - {//Hilited/Active - color = GadgetTabControlGetHiliteColorTabTwo( tabControl ); - border = GadgetTabControlGetHiliteBorderColorTabTwo( tabControl ); - } - else - {//Just enabled - color = GadgetTabControlGetEnabledColorTabTwo( tabControl ); - border = GadgetTabControlGetEnabledBorderColorTabTwo( tabControl ); - } - - // box and border - if( border != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winOpenRect( border, WIN_DRAW_LINE_WIDTH, - tabX, tabY, tabX + tabWidth, tabY + tabHeight ); - } - if( color != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winFillRect( color, WIN_DRAW_LINE_WIDTH, - tabX + 1, tabY + 1, tabX + tabWidth - 1, tabY + tabHeight - 1 ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 4 )//Does exist - { - if( tabData->subPaneDisabled[3] ) - {//Disabled - color = GadgetTabControlGetDisabledColorTabThree( tabControl ); - border = GadgetTabControlGetDisabledBorderColorTabThree( tabControl ); - } - else if( tabData->activeTab == 3 ) - {//Hilited/Active - color = GadgetTabControlGetHiliteColorTabThree( tabControl ); - border = GadgetTabControlGetHiliteBorderColorTabThree( tabControl ); - } - else - {//Just enabled - color = GadgetTabControlGetEnabledColorTabThree( tabControl ); - border = GadgetTabControlGetEnabledBorderColorTabThree( tabControl ); - } - - // box and border - if( border != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winOpenRect( border, WIN_DRAW_LINE_WIDTH, - tabX, tabY, tabX + tabWidth, tabY + tabHeight ); - } - if( color != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winFillRect( color, WIN_DRAW_LINE_WIDTH, - tabX + 1, tabY + 1, tabX + tabWidth - 1, tabY + tabHeight - 1 ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 5 )//Does exist - { - if( tabData->subPaneDisabled[4] ) - {//Disabled - color = GadgetTabControlGetDisabledColorTabFour( tabControl ); - border = GadgetTabControlGetDisabledBorderColorTabFour( tabControl ); - } - else if( tabData->activeTab == 4 ) - {//Hilited/Active - color = GadgetTabControlGetHiliteColorTabFour( tabControl ); - border = GadgetTabControlGetHiliteBorderColorTabFour( tabControl ); - } - else - {//Just enabled - color = GadgetTabControlGetEnabledColorTabFour( tabControl ); - border = GadgetTabControlGetEnabledBorderColorTabFour( tabControl ); - } - - // box and border - if( border != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winOpenRect( border, WIN_DRAW_LINE_WIDTH, - tabX, tabY, tabX + tabWidth, tabY + tabHeight ); - } - if( color != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winFillRect( color, WIN_DRAW_LINE_WIDTH, - tabX + 1, tabY + 1, tabX + tabWidth - 1, tabY + tabHeight - 1 ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 6 )//Does exist - { - if( tabData->subPaneDisabled[5] ) - {//Disabled - color = GadgetTabControlGetDisabledColorTabFive( tabControl ); - border = GadgetTabControlGetDisabledBorderColorTabFive( tabControl ); - } - else if( tabData->activeTab == 5 ) - {//Hilited/Active - color = GadgetTabControlGetHiliteColorTabFive( tabControl ); - border = GadgetTabControlGetHiliteBorderColorTabFive( tabControl ); - } - else - {//Just enabled - color = GadgetTabControlGetEnabledColorTabFive( tabControl ); - border = GadgetTabControlGetEnabledBorderColorTabFive( tabControl ); - } - - // box and border - if( border != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winOpenRect( border, WIN_DRAW_LINE_WIDTH, - tabX, tabY, tabX + tabWidth, tabY + tabHeight ); - } - if( color != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winFillRect( color, WIN_DRAW_LINE_WIDTH, - tabX + 1, tabY + 1, tabX + tabWidth - 1, tabY + tabHeight - 1 ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 7 )//Doesn't exist - { - if( tabData->subPaneDisabled[6] ) - {//Disabled - color = GadgetTabControlGetDisabledColorTabSix( tabControl ); - border = GadgetTabControlGetDisabledBorderColorTabSix( tabControl ); - } - else if( tabData->activeTab == 6 ) - {//Hilited/Active - color = GadgetTabControlGetHiliteColorTabSix( tabControl ); - border = GadgetTabControlGetHiliteBorderColorTabSix( tabControl ); - } - else - {//Just enabled - color = GadgetTabControlGetEnabledColorTabSix( tabControl ); - border = GadgetTabControlGetEnabledBorderColorTabSix( tabControl ); - } - - // box and border - if( border != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winOpenRect( border, WIN_DRAW_LINE_WIDTH, - tabX, tabY, tabX + tabWidth, tabY + tabHeight ); - } - if( color != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winFillRect( color, WIN_DRAW_LINE_WIDTH, - tabX + 1, tabY + 1, tabX + tabWidth - 1, tabY + tabHeight - 1 ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 8 )//Doesn't exist - { - if( tabData->subPaneDisabled[7] ) - {//Disabled - color = GadgetTabControlGetDisabledColorTabSeven( tabControl ); - border = GadgetTabControlGetDisabledBorderColorTabSeven( tabControl ); - } - else if( tabData->activeTab == 7 ) - {//Hilited/Active - color = GadgetTabControlGetHiliteColorTabSeven( tabControl ); - border = GadgetTabControlGetHiliteBorderColorTabSeven( tabControl ); - } - else - {//Just enabled - color = GadgetTabControlGetEnabledColorTabSeven( tabControl ); - border = GadgetTabControlGetEnabledBorderColorTabSeven( tabControl ); - } - - // box and border - if( border != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winOpenRect( border, WIN_DRAW_LINE_WIDTH, - tabX, tabY, tabX + tabWidth, tabY + tabHeight ); - } - if( color != WIN_COLOR_UNDEFINED ) - { - TheWindowManager->winFillRect( color, WIN_DRAW_LINE_WIDTH, - tabX + 1, tabY + 1, tabX + tabWidth - 1, tabY + tabHeight - 1 ); - } - } - -} - -// W3DGadgetRadioButtonImageDraw ============================================== -/** Draw tabs with user supplied images */ -//============================================================================= -void W3DGadgetTabControlImageDraw( GameWindow *tabControl, - WinInstanceData *instData ) -{ - ICoord2D origin, size; - - // get window position and size - tabControl->winGetScreenPosition( &origin.x, &origin.y ); - tabControl->winGetSize( &size.x, &size.y ); - - W3DGameWinDefaultDraw(tabControl, instData);//draw the background - - if( BitIsSet( tabControl->winGetStatus(), WIN_STATUS_BORDER ) == TRUE && - !BitIsSet( tabControl->winGetStatus(), WIN_STATUS_SEE_THRU ) ) - {//draw border if desired - tabControl->winDrawBorder(); - } - - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - - Int tabX, tabY, tabWidth, tabHeight, tabDeltaX, tabDeltaY; - tabX = origin.x + tabData->tabsLeftLimit; - tabY = origin.y + tabData->tabsTopLimit; - tabWidth = tabData->tabWidth; - tabHeight = tabData->tabHeight; - if( (tabData->tabEdge == TP_TOP_SIDE) || (tabData->tabEdge == TP_BOTTOM_SIDE) ) - { - tabDeltaX = tabWidth; - tabDeltaY = 0; - } - else - { - tabDeltaX = 0; - tabDeltaY = tabHeight; - } - - const Image *image = nullptr; - - if( tabData->tabCount >= 1 )//Does exist - { - if( tabData->subPaneDisabled[0] ) - {//Disabled - image = GadgetTabControlGetDisabledImageTabZero( tabControl ); - } - else if( tabData->activeTab == 0 ) - {//Hilited/Active - image = GadgetTabControlGetHiliteImageTabZero( tabControl ); - } - else - {//Just enabled - image = GadgetTabControlGetEnabledImageTabZero( tabControl ); - } - - if( image != nullptr ) - { - TheWindowManager->winDrawImage( image, - tabX, - tabY, - tabX + tabWidth, - tabY + tabHeight - ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 2 )//Does exist - { - if( tabData->subPaneDisabled[1] ) - {//Disabled - image = GadgetTabControlGetDisabledImageTabOne( tabControl ); - } - else if( tabData->activeTab == 1 ) - {//Hilited/Active - image = GadgetTabControlGetHiliteImageTabOne( tabControl ); - } - else - {//Just enabled - image = GadgetTabControlGetEnabledImageTabOne( tabControl ); - } - - if( image != nullptr ) - { - TheWindowManager->winDrawImage( image, - tabX, - tabY, - tabX + tabWidth, - tabY + tabHeight - ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 3 )//Does exist - { - if( tabData->subPaneDisabled[2] ) - {//Disabled - image = GadgetTabControlGetDisabledImageTabTwo( tabControl ); - } - else if( tabData->activeTab == 2 ) - {//Hilited/Active - image = GadgetTabControlGetHiliteImageTabTwo( tabControl ); - } - else - {//Just enabled - image = GadgetTabControlGetEnabledImageTabTwo( tabControl ); - } - - if( image != nullptr ) - { - TheWindowManager->winDrawImage( image, - tabX, - tabY, - tabX + tabWidth, - tabY + tabHeight - ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 4 )//Does exist - { - if( tabData->subPaneDisabled[3] ) - {//Disabled - image = GadgetTabControlGetDisabledImageTabThree( tabControl ); - } - else if( tabData->activeTab == 3 ) - {//Hilited/Active - image = GadgetTabControlGetHiliteImageTabThree( tabControl ); - } - else - {//Just enabled - image = GadgetTabControlGetEnabledImageTabThree( tabControl ); - } - - if( image != nullptr ) - { - TheWindowManager->winDrawImage( image, - tabX, - tabY, - tabX + tabWidth, - tabY + tabHeight - ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 5 )//Does exist - { - if( tabData->subPaneDisabled[4] ) - {//Disabled - image = GadgetTabControlGetDisabledImageTabFour( tabControl ); - } - else if( tabData->activeTab == 4 ) - {//Hilited/Active - image = GadgetTabControlGetHiliteImageTabFour( tabControl ); - } - else - {//Just enabled - image = GadgetTabControlGetEnabledImageTabFour( tabControl ); - } - - if( image != nullptr ) - { - TheWindowManager->winDrawImage( image, - tabX, - tabY, - tabX + tabWidth, - tabY + tabHeight - ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 6 )//Does exist - { - if( tabData->subPaneDisabled[5] ) - {//Disabled - image = GadgetTabControlGetDisabledImageTabFive( tabControl ); - } - else if( tabData->activeTab == 5 ) - {//Hilited/Active - image = GadgetTabControlGetHiliteImageTabFive( tabControl ); - } - else - {//Just enabled - image = GadgetTabControlGetEnabledImageTabFive( tabControl ); - } - - if( image != nullptr ) - { - TheWindowManager->winDrawImage( image, - tabX, - tabY, - tabX + tabWidth, - tabY + tabHeight - ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 7 )//Doesn't exist - { - if( tabData->subPaneDisabled[6] ) - {//Disabled - image = GadgetTabControlGetDisabledImageTabSix( tabControl ); - } - else if( tabData->activeTab == 6 ) - {//Hilited/Active - image = GadgetTabControlGetHiliteImageTabSix( tabControl ); - } - else - {//Just enabled - image = GadgetTabControlGetEnabledImageTabSix( tabControl ); - } - - if( image != nullptr ) - { - TheWindowManager->winDrawImage( image, - tabX, - tabY, - tabX + tabWidth, - tabY + tabHeight - ); - } - } - - tabX += tabDeltaX; - tabY += tabDeltaY; - - if( tabData->tabCount >= 8 )//Doesn't exist - { - if( tabData->subPaneDisabled[7] ) - {//Disabled - image = GadgetTabControlGetDisabledImageTabSeven( tabControl ); - } - else if( tabData->activeTab == 7 ) - {//Hilited/Active - image = GadgetTabControlGetHiliteImageTabSeven( tabControl ); - } - else - {//Just enabled - image = GadgetTabControlGetEnabledImageTabSeven( tabControl ); - } - - if( image != nullptr ) - { - TheWindowManager->winDrawImage( image, - tabX, - tabY, - tabX + tabWidth, - tabY + tabHeight - ); - } - } - -} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp deleted file mode 100644 index 36e7b452bf9..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DTextEntry.cpp +++ /dev/null @@ -1,463 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DTextEntry.cpp ///////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DTextEntry.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: W3D implementation for the text entry gadget -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/IMEManager.h" -#include "W3DDevice/GameClient/W3DGadget.h" -#include "W3DDevice/GameClient/W3DDisplay.h" - - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// drawTextEntryText ========================================================== -//============================================================================= -static void drawTextEntryText( GameWindow *window, WinInstanceData *instData, - Color textColor, Color textDropColor, - Color compositeColor, Color compositeDropColor, - Int x, Int y, Int width, Int fontHeight ) -{ - static Byte drawCnt = 0; - EntryData *e = (EntryData *)window->winGetUserData(); -// Int charPos = e->charPos; - Int cursorPos; - -// WideChar buffer[ ENTRY_TEXT_LEN + 1 ]; -// WideChar *bufptr = buffer; -// Color constructColor = TheWindowManager->winMakeColor( 192, 0, 192, 255 ); - DisplayString *text = e->text; - IRegion2D clipRegion; - ICoord2D origin, size; - Int compositeCursorPos = 0; - - // Check to see if the IME manager is composing text - e->constructText->setText(UnicodeString::TheEmptyString); - if ( TheIMEManager && TheIMEManager->isAttachedTo( window) && TheIMEManager->isComposing()) - { - // The user is composing a string. - // Show the composition in the text gadget. - UnicodeString composition; - - TheIMEManager->getCompositionString( composition ); - - if ( e->secretText ) - { - e->sText->setText( UnicodeString::TheEmptyString ); - Int len = composition.getLength() + e->text->getTextLength(); - for ( int i = 0; i < len; i++ ) - { - e->sText->appendChar( '*' ); - } - } - else - { - e->constructText->setText( composition ); - compositeCursorPos = TheIMEManager->getCompositionCursorPosition(); - } - - } - - - // get out of here if no text color to show up - if( textColor == WIN_COLOR_UNDEFINED ) - return; - - // if our text is "secret" we will print only '*' characters - if( e->secretText ) - text = e->sText; - - // make sure our font is the same as our parents - if( text->getFont() != window->winGetFont() ) - text->setFont( window->winGetFont() ); - if( e->constructText->getFont() != window->winGetFont() ) - e->constructText->setFont( window->winGetFont() ); - - // get the size of our text, and construct text - Int textWidth = text->getWidth(); - - if (!e->drawTextFromStart) - { - // clip the text to the edit window size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - clipRegion.lo.x = x; - clipRegion.hi.x = x + width ; - clipRegion.lo.y = y; - clipRegion.hi.y = y + fontHeight; - text->setClipRegion( &clipRegion ); - e->constructText->setClipRegion( &clipRegion ); - - // set construct window position if needed - //if( e->constructList && e->constructText->getTextLength() ) - // e->constructList->winSetPosition( (x + textWidth1), (y + fontHeight) ); - - x+= 2; - // draw the text - if(textWidth < width) - { - text->draw( x, y, textColor, textDropColor ); - cursorPos = textWidth + x; - } - else - { - Int div = textWidth / (width / 2) - 1; - text->draw(x - (div * (width/2)), y, textColor, textDropColor); - cursorPos = textWidth - (div * (width/2)) + x; - } - - //cursorPos = x + textWidth; - } - else - { - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - clipRegion.lo.x = origin.x; - clipRegion.hi.x = origin.x + size.x; - clipRegion.lo.y = origin.y; - clipRegion.hi.y = origin.y + size.y; - text->setClipRegion( &clipRegion ); - e->constructText->setClipRegion( &clipRegion ); - - // set construct window position if needed - //if( e->constructList && e->constructText->getTextLength() ) - // e->constructList->winSetPosition( (x + textWidth1), (y + fontHeight) ); - - x+= 5; - // draw the text - text->draw( x, y, textColor, textDropColor ); - cursorPos = textWidth + x; - } - - if (e->constructText->getTextLength() > 0 ) - { - e->constructText->draw( x + textWidth, y, compositeColor, compositeDropColor ); - cursorPos += e->constructText->getWidth( compositeCursorPos ); - } - - // draw blinking cursor - GameWindow *parent; - parent = window->winGetParent(); - if(parent && !BitIsSet(parent->winGetStyle(), GWS_COMBO_BOX)) - parent = nullptr; - - if( (window == TheWindowManager->winGetFocus() || (parent && parent == TheWindowManager->winGetFocus())) && ((drawCnt++ >> 3) & 0x1) ) - TheWindowManager->winFillRect( textColor, WIN_DRAW_LINE_WIDTH, - cursorPos, origin.y + 3, - cursorPos + 2, origin.y + size.y - 3 ); - window->winSetCursorPosition( cursorPos + 2 - origin.x, 0 ); - -} - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// W3DGadgetTextEntryDraw ===================================================== -/** Draw colored entry field using standard graphics */ -//============================================================================= -void W3DGadgetTextEntryDraw( GameWindow *window, WinInstanceData *instData ) -{ - EntryData *e = (EntryData *)window->winGetUserData(); - ICoord2D origin, size, start, end; - Color backBorder, backColor, textColor, textBorder, - compositeColor, compositeBorder; - - // cancel unichar flag - e->receivedUnichar = FALSE; - - // get size and position of window - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get the right colors - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - compositeColor = window->winGetDisabledTextColor(); - compositeBorder = window->winGetDisabledTextBorderColor(); - textColor = window->winGetDisabledTextColor(); - textBorder = window->winGetDisabledTextBorderColor(); - backColor = GadgetTextEntryGetDisabledColor( window ); - backBorder = GadgetTextEntryGetDisabledBorderColor( window ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - compositeColor = window->winGetIMECompositeTextColor(); - compositeBorder = window->winGetIMECompositeBorderColor(); - textColor = window->winGetHiliteTextColor(); - textBorder = window->winGetHiliteTextBorderColor(); - backColor = GadgetTextEntryGetHiliteColor( window ); - backBorder = GadgetTextEntryGetHiliteBorderColor( window ); - - } - else - { - - compositeColor = window->winGetIMECompositeTextColor(); - compositeBorder = window->winGetIMECompositeBorderColor(); - textColor = window->winGetEnabledTextColor(); - textBorder = window->winGetEnabledTextBorderColor(); - backColor = GadgetTextEntryGetEnabledColor( window ); - backBorder = GadgetTextEntryGetEnabledBorderColor( window ); - - } - - // draw the back border - if( backBorder != WIN_COLOR_UNDEFINED ) - { - - start.x = origin.x; - start.y = origin.y; - end.x = start.x + size.x; - end.y = start.y + size.y; - TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - } - - // draw the filled back - if( backColor != WIN_COLOR_UNDEFINED ) - { - - start.x = origin.x + 1; - start.y = origin.y + 1; - end.x = start.x + size.x - 2; - end.y = start.y + size.y - 2; - TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - } - - // draw the text - Int fontHeight = TheWindowManager->winFontHeight( instData->getFont() ); - Int startOffset = 5; - Int width; - - width = size.x - (2 * startOffset); - start.x = origin.x + startOffset; // offset a little bit into the entry - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ONE_LINE ) ) - start.y = size.y / 2 - fontHeight / 2; - else - start.y = origin.y + startOffset; // offset a little bit into the entry - - // draw the edit text - drawTextEntryText( window, instData, textColor, textBorder, compositeColor, compositeBorder, - start.x, start.y, width, fontHeight ); - - - -} - -// W3DGadgetTextEntryImageDraw ================================================ -/** Draw horizontal slider with user supplied images */ -//============================================================================= -void W3DGadgetTextEntryImageDraw( GameWindow *window, WinInstanceData *instData ) -{ - EntryData *e = (EntryData *)window->winGetUserData(); - ICoord2D origin, size, start, end; - Color textColor, textBorder; - Color compositeColor, compositeBorder; - const Image *leftImage, *rightImage, *centerImage, *smallCenterImage; - Int xOffset, yOffset; - Int i; - - // cancel unichar flag - e->receivedUnichar = FALSE; - - // get size and position of window - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get image offset - xOffset = instData->m_imageOffset.x; - yOffset = instData->m_imageOffset.y; - - // get the right colors - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - textColor = window->winGetDisabledTextColor(); - textBorder = window->winGetDisabledTextBorderColor(); - compositeColor = window->winGetDisabledTextColor(); - compositeBorder = window->winGetDisabledTextBorderColor(); - leftImage = GadgetTextEntryGetDisabledImageLeft( window ); - rightImage = GadgetTextEntryGetDisabledImageRight( window ); - centerImage = GadgetTextEntryGetDisabledImageCenter( window ); - smallCenterImage = GadgetTextEntryGetDisabledImageSmallCenter( window ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - textColor = window->winGetHiliteTextColor(); - textBorder = window->winGetHiliteTextBorderColor(); - compositeColor = window->winGetIMECompositeTextColor(); - compositeBorder = window->winGetIMECompositeBorderColor(); - leftImage = GadgetTextEntryGetHiliteImageLeft( window ); - rightImage = GadgetTextEntryGetHiliteImageRight( window ); - centerImage = GadgetTextEntryGetHiliteImageCenter( window ); - smallCenterImage = GadgetTextEntryGetHiliteImageSmallCenter( window ); - - } - else - { - - textColor = window->winGetEnabledTextColor(); - textBorder = window->winGetEnabledTextBorderColor(); - compositeColor = window->winGetIMECompositeTextColor(); - compositeBorder = window->winGetIMECompositeBorderColor(); - leftImage = GadgetTextEntryGetEnabledImageLeft( window ); - rightImage = GadgetTextEntryGetEnabledImageRight( window ); - centerImage = GadgetTextEntryGetEnabledImageCenter( window ); - smallCenterImage = GadgetTextEntryGetEnabledImageSmallCenter( window ); - - } - - // get image sizes for the ends - ICoord2D leftSize, rightSize; - leftSize.x = leftImage->getImageWidth(); - leftSize.y = leftImage->getImageHeight(); - rightSize.x = rightImage->getImageWidth(); - rightSize.y = rightImage->getImageHeight(); - - // get two key points used in the end drawing - ICoord2D leftEnd, rightStart; - leftEnd.x = origin.x + leftSize.x + xOffset; - leftEnd.y = origin.y + size.y + yOffset; - rightStart.x = origin.x + size.x - rightSize.x + xOffset; - rightStart.y = origin.y + yOffset; - - // draw the center repeating bar - Int centerWidth, pieces; - - // get width we have to draw our repeating center in - centerWidth = rightStart.x - leftEnd.x; - - // how many whole repeating pieces will fit in that width - pieces = centerWidth / centerImage->getImageWidth(); - - // draw the pieces - start.x = leftEnd.x; - start.y = origin.y + yOffset; - end.y = start.y + size.y; - for( i = 0; i < pieces; i++ ) - { - - end.x = start.x + centerImage->getImageWidth(); - TheWindowManager->winDrawImage( centerImage, - start.x, start.y, - end.x, end.y ); - start.x += centerImage->getImageWidth(); - - } - - // - // how many small repeating pieces will fit in the gap from where the - // center repeating bar stopped and the right image, draw them - // and overlapping underneath where the right end will go - // - centerWidth = rightStart.x - start.x; - pieces = centerWidth / smallCenterImage->getImageWidth() + 1; - end.y = start.y + size.y; - for( i = 0; i < pieces; i++ ) - { - - end.x = start.x + smallCenterImage->getImageWidth(); - TheWindowManager->winDrawImage( smallCenterImage, - start.x, start.y, - end.x, end.y ); - start.x += smallCenterImage->getImageWidth(); - - } - - // draw left end - start.x = origin.x + xOffset; - start.y = origin.y + yOffset; - end = leftEnd; - TheWindowManager->winDrawImage(leftImage, start.x, start.y, end.x, end.y); - - // draw right end - start = rightStart; - end.x = start.x + rightSize.x; - end.y = start.y + size.y; - TheWindowManager->winDrawImage(rightImage, start.x, start.y, end.x, end.y); - - // draw the text - Int fontHeight = TheWindowManager->winFontHeight( instData->getFont() ); - Int startOffset = 5; - Int width; - - width = size.x - (2 * startOffset); - start.x = origin.x + startOffset; // offset a little bit into the entry - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ONE_LINE ) ) - start.y = size.y / 2 - fontHeight / 2; - else - start.y = origin.y + startOffset; // offset a little bit into the entry - - // draw the edit text - drawTextEntryText( window, instData, textColor, textBorder, compositeColor, compositeBorder, - start.x, start.y, width, fontHeight ); - - - -} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp deleted file mode 100644 index 5593517ccd9..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DVerticalSlider.cpp +++ /dev/null @@ -1,281 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: .cpp ///////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: -// -// File name: .cpp -// -// Created: -// -// Desc: -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GadgetSlider.h" -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/GameWindowManager.h" -#include "W3DDevice/GameClient/W3DGadget.h" -#include "W3DDevice/GameClient/W3DDisplay.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// W3DGadgetVerticalSliderDraw ================================================ -/** Draw colored vertical slider using standard graphics */ -//============================================================================= -void W3DGadgetVerticalSliderDraw( GameWindow *window, - WinInstanceData *instData ) -{ - Color backBorder, backColor; - ICoord2D origin, size, start, end; - - // get screen position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get the right colors - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - backBorder = GadgetSliderGetDisabledBorderColor( window ); - backColor = GadgetSliderGetDisabledColor( window ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - backBorder = GadgetSliderGetHiliteBorderColor( window ); - backColor = GadgetSliderGetHiliteColor( window ); - - } - else - { - - backBorder = GadgetSliderGetEnabledBorderColor( window ); - backColor = GadgetSliderGetEnabledColor( window ); - - } - - // draw background border and rect over whole control - if( backBorder != WIN_COLOR_UNDEFINED ) - { - - start.x = origin.x; - start.y = origin.y; - end.x = start.x + size.x; - end.y = start.y + size.y; - TheWindowManager->winOpenRect( backBorder, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - } - if( backColor != WIN_COLOR_UNDEFINED ) - { - - start.x = origin.x + 1; - start.y = origin.y + 1; - end.x = start.x + size.x - 2; - end.y = start.y + size.y - 2; - TheWindowManager->winFillRect( backColor, WIN_DRAW_LINE_WIDTH, - start.x, start.y, end.x, end.y ); - - } - - - -} - -// W3DGadgetVerticalSliderImageDraw =========================================== -/** Draw vertical slider with user supplied images */ -//============================================================================= -void W3DGadgetVerticalSliderImageDraw( GameWindow *window, - WinInstanceData *instData ) -{ - const Image *topImage, *bottomImage, *centerImage, *smallCenterImage; - ICoord2D origin, size, start, end; - Int xOffset, yOffset; - Int i; - - // get screen position and size - window->winGetScreenPosition( &origin.x, &origin.y ); - window->winGetSize( &size.x, &size.y ); - - // get image offset - xOffset = instData->m_imageOffset.x; - yOffset = instData->m_imageOffset.y; - - // get the right images - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - topImage = GadgetSliderGetDisabledImageTop( window ); - bottomImage = GadgetSliderGetDisabledImageBottom( window ); - centerImage = GadgetSliderGetDisabledImageCenter( window ); - smallCenterImage = GadgetSliderGetDisabledImageSmallCenter( window ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - topImage = GadgetSliderGetHiliteImageTop( window ); - bottomImage = GadgetSliderGetHiliteImageBottom( window ); - centerImage = GadgetSliderGetHiliteImageCenter( window ); - smallCenterImage = GadgetSliderGetHiliteImageSmallCenter( window ); - - } - else - { - - topImage = GadgetSliderGetEnabledImageTop( window ); - bottomImage = GadgetSliderGetEnabledImageBottom( window ); - centerImage = GadgetSliderGetEnabledImageCenter( window ); - smallCenterImage = GadgetSliderGetEnabledImageSmallCenter( window ); - - } - - // sanity, we need to have these images to make it look right - if( topImage == nullptr || bottomImage == nullptr || - centerImage == nullptr || smallCenterImage == nullptr ) - return; - - // get image sizes for the ends - ICoord2D topSize, bottomSize; - topSize.x = topImage->getImageWidth(); - topSize.y = topImage->getImageHeight(); - bottomSize.x = bottomImage->getImageWidth(); - bottomSize.y = bottomImage->getImageHeight(); - - if(topSize.y + bottomSize.y >= size.y) - { - // draw top end - start.x = origin.x + xOffset; - start.y = origin.y + yOffset; - end.x = origin.x + xOffset + topSize.x; - end.y = origin.y + size.y /2; - TheWindowManager->winDrawImage(topImage, start.x, start.y, end.x, end.y); - - // draw bottom end - start.y = origin.y + size.y /2; - end.x = origin.x + xOffset + bottomSize.x; - end.y = origin.y + yOffset + size.y; - TheWindowManager->winDrawImage(bottomImage, start.x, start.y, end.x, end.y); - } - else - { - - // get two key points used in the end drawing - ICoord2D topEnd, bottomStart; - topEnd.x = origin.x + topSize.x + xOffset; - topEnd.y = origin.y + topSize.y + yOffset; - bottomStart.x = origin.x + xOffset; - bottomStart.y = origin.y + size.y - bottomSize.y + yOffset; - - // draw the center repeating bar - Int centerHeight, pieces; - - // get size we have to draw our repeating center in - centerHeight = bottomStart.y - topEnd.y; - - // how many whole repeating pieces will fit in that size - pieces = centerHeight / centerImage->getImageHeight(); - - // draw the pieces - start.x = origin.x + xOffset; - start.y = topEnd.y; - end.x = start.x + centerImage->getImageWidth(); - end.y = start.y + centerImage->getImageHeight(); - for( i = 0; i < pieces; i++ ) - { - - TheWindowManager->winDrawImage( centerImage, - start.x, start.y, - end.x, end.y ); - start.y += centerImage->getImageHeight(); - end.y += centerImage->getImageHeight(); - - } - - // - // how many small repeating pieces will fit in the gap from where the - // center repeating bar stopped and the bottom image, draw them - // and overlapping underneath where the bottom end will go - // - centerHeight = bottomStart.y - start.y; - pieces = centerHeight / smallCenterImage->getImageHeight() + 1; - end.y = start.y + smallCenterImage->getImageHeight(); - for( i = 0; i < pieces; i++ ) - { - - TheWindowManager->winDrawImage( smallCenterImage, - start.x, start.y, - end.x, end.y ); - start.y += smallCenterImage->getImageHeight(); - end.y += smallCenterImage->getImageHeight(); - - } - - // draw top end - start.x = origin.x + xOffset; - start.y = origin.y + yOffset; - end = topEnd; - TheWindowManager->winDrawImage(topImage, start.x, start.y, end.x, end.y); - - // draw bottom end - start = bottomStart; - end.x = start.x + bottomSize.x; - end.y = start.y + bottomSize.y; - TheWindowManager->winDrawImage(bottomImage, start.x, start.y, end.x, end.y); - } - - -} - - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp deleted file mode 100644 index c90931db767..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameFont.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DGameFont.cpp ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DGameFont.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: W3D implementation for managing font definitions -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Debug.h" -#include "W3DDevice/GameClient/W3DGameFont.h" -#include "WW3D2/ww3d.h" -#include "WW3D2/assetmgr.h" -#include "WW3D2/render2dsentence.h" -#include "GameClient/GlobalLanguage.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// W3DFontLibrary::loadFontData =============================================== -/** Load a font */ -//============================================================================= -Bool W3DFontLibrary::loadFontData( GameFont *font ) -{ - // sanity - if( font == nullptr ) - return FALSE; - - const char* name = font->nameString.str(); - const Int size = font->pointSize; - const Bool bold = font->bold; - - // get the font data from the asset manager - FontCharsClass *fontChar = WW3DAssetManager::Get_Instance()->Get_FontChars( name, size, bold ); - - if( fontChar == nullptr ) - { - DEBUG_CRASH(( "Unable to find font '%s' in Asset Manager", name )); - return FALSE; - } - - // assign font data - font->fontData = fontChar; - font->height = fontChar->Get_Char_Height(); - - // load Unicode of same point size - name = TheGlobalLanguageData ? TheGlobalLanguageData->m_unicodeFontName.str() : "Arial Unicode MS"; - fontChar->AlternateUnicodeFont = WW3DAssetManager::Get_Instance()->Get_FontChars( name, size, bold ); - - return TRUE; -} - -// W3DFontLibrary::releaseFontData ============================================ -/** Release font data */ -//============================================================================= -void W3DFontLibrary::releaseFontData( GameFont *font ) -{ - - // presently we don't need to do anything because fonts are handled in - // the W3D asset manager which is all taken for of us - if (font && font->fontData) - { - if(((FontCharsClass *)(font->fontData))->AlternateUnicodeFont) - ((FontCharsClass *)(font->fontData))->AlternateUnicodeFont->Release_Ref(); - ((FontCharsClass *)(font->fontData))->Release_Ref(); - - font->fontData = nullptr; - } - -} - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp deleted file mode 100644 index 1fea607f890..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindow.cpp +++ /dev/null @@ -1,666 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DGameWindow.cpp //////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DGameWindow.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: W3D implementation of a game window -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowGlobal.h" -#include "W3DDevice/GameClient/W3DGameWindow.h" -#include "W3DDevice/GameClient/W3DGameWindowManager.h" -#include "W3DDevice/GameClient/W3DDisplay.h" - -// DEFINES //////////////////////////////////////////////////////////////////// -enum -{ - BORDER_CORNER_SIZE = 15, - BORDER_LINE_SIZE = 20, -}; - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE DATA /////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static Bool bordersInit = FALSE; -static const Image *borderPieces[NUM_BORDER_PIECES] = { nullptr }; - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// initBorders ================================================================ -//============================================================================= -static void initBorders() -{ - - borderPieces[ BORDER_CORNER_UL ] = - TheMappedImageCollection->findImageByName( "BorderCornerUL" ); - - borderPieces[ BORDER_CORNER_UR ] = - TheMappedImageCollection->findImageByName( "BorderCornerUR" ); - - borderPieces[ BORDER_CORNER_LL ] = - TheMappedImageCollection->findImageByName( "BorderCornerLL" ); - - borderPieces[ BORDER_CORNER_LR ] = - TheMappedImageCollection->findImageByName( "BorderCornerLR" ); - - borderPieces[ BORDER_VERTICAL_LEFT ] = - TheMappedImageCollection->findImageByName( "BorderLeft" ); - - borderPieces[ BORDER_VERTICAL_LEFT_SHORT ] = - TheMappedImageCollection->findImageByName( "BorderLeftShort" ); - - borderPieces[ BORDER_HORIZONTAL_TOP ] = - TheMappedImageCollection->findImageByName( "BorderTop" ); - - borderPieces[ BORDER_HORIZONTAL_TOP_SHORT ] = - TheMappedImageCollection->findImageByName( "BorderTopShort" ); - - borderPieces[ BORDER_VERTICAL_RIGHT ] = - TheMappedImageCollection->findImageByName( "BorderRight" ); - - borderPieces[ BORDER_VERTICAL_RIGHT_SHORT ] = - TheMappedImageCollection->findImageByName( "BorderRightShort" ); - - borderPieces[ BORDER_HORIZONTAL_BOTTOM ] = - TheMappedImageCollection->findImageByName( "BorderBottom" ); - - borderPieces[ BORDER_HORIZONTAL_BOTTOM_SHORT ] = - TheMappedImageCollection->findImageByName( "BorderBottomShort" ); - - bordersInit = TRUE; - -} - -// W3DGameWindow::blitBorderRect ============================================== -//============================================================================= -void W3DGameWindow::blitBorderRect( Int x, Int y, Int width, Int height ) -{ - Int Offset = 15; - Int OffsetLower = 5; - // init image loc if needed - if( bordersInit == FALSE ) - initBorders(); - - // save original x, y - Int originalX = x; - Int originalY = y; - Int maxX = x + width; - Int maxY = y + height; - Int x2, y2; // used for simultaneous drawing of line pairs - Int size = 20; - Int halfSize = size / 2; - - // Draw Horizontal Lines - // All border pieces are based on a 10 pixel offset from the centerline - y = originalY - Offset; - y2 = maxY - OffsetLower; - x2 = maxX - (OffsetLower + BORDER_LINE_SIZE); - - for( x=(originalX + OffsetLower); x <= x2; x += BORDER_LINE_SIZE ) - { - - TheDisplay->drawImage( borderPieces[ BORDER_HORIZONTAL_TOP ], - x, y, x + size, y + size ); - TheDisplay->drawImage( borderPieces[ BORDER_HORIZONTAL_BOTTOM ], - x, y2, x + size, y2 + size ); - - } - - x2 = maxX - 5;//BORDER_CORNER_SIZE; - - // x == place to draw remainder if any - if( (x2 - x) >= (BORDER_LINE_SIZE / 2) ) - { - - //Blit Half piece - TheDisplay->drawImage( borderPieces[ BORDER_HORIZONTAL_TOP_SHORT ], - x, y, x + halfSize, y + size ); - TheDisplay->drawImage( borderPieces[ BORDER_HORIZONTAL_BOTTOM_SHORT ], - x, y2, x + halfSize, y2 + size ); - - x += (BORDER_LINE_SIZE / 2); - - } - - // x2 - x ... must now be less than a half piece - // check for equals and if not blit an adjusted half piece border pieces have - // a two pixel repeat so we will blit one pixel over if necessary to line up - // the art, but we'll cover-up the overlap with the corners - if( x < x2 ) - { - x -= ((BORDER_LINE_SIZE / 2) - (((x2 - x) + 1) & ~1)); - - //Blit Half piece - TheDisplay->drawImage( borderPieces[ BORDER_HORIZONTAL_TOP_SHORT ], - x, y, x + halfSize, y + size ); - TheDisplay->drawImage( borderPieces[ BORDER_HORIZONTAL_BOTTOM_SHORT ], - x, y2, x + halfSize, y2 + size ); - - } - - // Draw Vertical Lines - // All border pieces are based on a 10 pixel offset from the centerline - x = originalX - Offset; - x2 = maxX - OffsetLower; - y2 = maxY - (OffsetLower + BORDER_LINE_SIZE); - - for( y=(originalY + OffsetLower); y <= y2; y += BORDER_LINE_SIZE ) - { - - TheDisplay->drawImage( borderPieces[ BORDER_VERTICAL_LEFT ], - x, y, x + size, y + size ); - TheDisplay->drawImage( borderPieces[ BORDER_VERTICAL_RIGHT ], - x2, y, x2 + size, y + size ); - - } - - y2 = maxY - OffsetLower;//BORDER_CORNER_SIZE; - - // y == place to draw remainder if any - if( (y2 - y) >= (BORDER_LINE_SIZE / 2) ) - { - - //Blit Half piece - TheDisplay->drawImage( borderPieces[ BORDER_VERTICAL_LEFT_SHORT ], - x, y, x + size, y + halfSize ); - TheDisplay->drawImage( borderPieces[ BORDER_VERTICAL_RIGHT_SHORT ], - x2, y, x2 + size, y + halfSize ); - - y += (BORDER_LINE_SIZE / 2); - } - - // y2 - y ... must now be less than a half piece - // check for equals and if not blit an adjusted half piece border pieces have - // a two pixel repeat so we will blit one pixel over if necessary to line up - // the art, but we'll cover-up the overlap with the corners - if( y < y2 ) - { - y -= ((BORDER_LINE_SIZE / 2) - (((y2 - y) + 1) & ~1)); - - //Blit Half piece - TheDisplay->drawImage( borderPieces[ BORDER_VERTICAL_LEFT_SHORT ], - x, y, x + size, y + halfSize ); - TheDisplay->drawImage( borderPieces[ BORDER_VERTICAL_RIGHT_SHORT ], - x2, y, x2 + size, y + halfSize ); - - } - - // Draw Corners - x = originalX - BORDER_CORNER_SIZE ; - y = originalY - BORDER_CORNER_SIZE; - TheDisplay->drawImage( borderPieces[ BORDER_CORNER_UL ], - x, y, x + size, y + size ); - x = maxX - 5;//BORDER_CORNER_SIZE; - y = originalY - BORDER_CORNER_SIZE; - TheDisplay->drawImage( borderPieces[ BORDER_CORNER_UR ], - x, y, x + size, y + size ); - x = originalX - BORDER_CORNER_SIZE; - y = maxY - 5;//BORDER_CORNER_SIZE; - TheDisplay->drawImage( borderPieces[ BORDER_CORNER_LL ], - x, y, x + size, y + size ); - x = maxX - 5;//BORDER_CORNER_SIZE; - y = maxY - 5;//BORDER_CORNER_SIZE; - TheDisplay->drawImage( borderPieces[ BORDER_CORNER_LR ], - x, y, x + size, y + size ); - -} - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// W3DGameWindow::W3DGameWindow =============================================== -//============================================================================= -W3DGameWindow::W3DGameWindow() -{ - - // override the default draw with our own default draw function for W3D - winSetDrawFunc( TheWindowManager->getDefaultDraw() ); - - m_textPos.x = m_textPos.y = 0; - m_currTextColor = WIN_COLOR_UNDEFINED; - m_needPolyDraw = FALSE; - m_newTextPos = FALSE; - -} - -// W3DGameWindow::~W3DGameWindow ============================================== -//============================================================================= -W3DGameWindow::~W3DGameWindow() -{ - -} - -// W3DGameWinDefaultDraw ====================================================== -/** The default redraw callback. Draws the background using either - * the drawData or the background color unless the background color - * is set to -1 indicating that default drawing is turned off. */ -//============================================================================= -void W3DGameWinDefaultDraw( GameWindow *window, WinInstanceData *instData ) -{ - Real borderWidth = 1.0f; - ICoord2D origin; - ICoord2D size; - W3DGameWindow *w3dWindow = (W3DGameWindow *)window; - - /** @todo NOTE that we're making a W3DGameWindow cast here, it seems - logical because we are in a W3D draw function so it's reasonable to assume - that we have a W3DGameWindow. However, we may want to revisit this - type of casting in the future, we have the same problems with the - ObjectModules where we cast object modules for their individual methods. - Also note that the other W3D implementations of GUI controls are making - a similar cast for their device implementation functions */ - - // get the window position in the screen coordinates - w3dWindow->winGetScreenPosition( &origin.x, &origin.y ); - - // get size of window - w3dWindow->winGetSize( &size.x, &size.y ); - - // image drawing vs color drawing - if( BitIsSet( window->winGetStatus(), WIN_STATUS_IMAGE ) ) - { - const Image *image; - - // get image - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - image = window->winGetDisabledImage( 0 ); - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - image = window->winGetHiliteImage( 0 ); - else - image = window->winGetEnabledImage( 0 ); - - if( image ) - { - ICoord2D start, end; - - start.x = origin.x + instData->m_imageOffset.x; - start.y = origin.y + instData->m_imageOffset.y; - end.x = start.x + size.x; - end.y = start.y + size.y; - TheWindowManager->winDrawImage( image, start.x, start.y, end.x, end.y ); - - } - - } - else - { - Color color, borderColor; - - // get colors - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ENABLED ) == FALSE ) - { - - color = window->winGetDisabledColor( 0 ); - borderColor = window->winGetDisabledBorderColor( 0 ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) ) - { - - color = window->winGetHiliteColor( 0 ); - borderColor = window->winGetHiliteBorderColor( 0 ); - - } - else - { - - color = window->winGetEnabledColor( 0 ); - borderColor = window->winGetEnabledBorderColor( 0 ); - - } - - // - // draw the border at the edges - // - if( borderColor != WIN_COLOR_UNDEFINED ) - TheWindowManager->winOpenRect( borderColor, borderWidth, - origin.x, origin.y, - origin.x + size.x, origin.y + size.y ); - - // draw filled background - if( color != WIN_COLOR_UNDEFINED ) - TheWindowManager->winFillRect( color, borderWidth, - origin.x + borderWidth, - origin.y + borderWidth, - origin.x + size.x - borderWidth, - origin.y + size.y - borderWidth ); - - } - - // if we have a video buffer, draw the video buffer - if ( instData->m_videoBuffer ) - { - ICoord2D pos, size; - window->winGetScreenPosition( &pos.x, &pos.y ); - window->winGetSize( &size.x, &size.y ); - - TheDisplay->drawVideoBuffer( instData->m_videoBuffer, pos.x, pos.y, pos.x + size.x, pos.y + size.y ); - } - -} - -// W3DGameWindow::winDrawBorder =============================================== -//============================================================================= -void W3DGameWindow::winDrawBorder() -{ - Bool found = FALSE; - Int originalX, originalY; - Int x, y; - Int width; - Int i, bits; - -/** @todo this WinDrawBorder is the old Nox function for drawing the borders - * on various windows and controls. We should derive classes of game - * windows for the different GUI controls and move the specific pieces of - * code that apply for those gadgets to those classes */ - - // based on window class pass different regions to real draw - - winGetScreenPosition( &originalX, &originalY ); - - for( i = 0; (i < (sizeof(UnsignedInt) * 8)) && (found == FALSE); i++ ) - { - - bits = (1 << i); - - if( m_instData.getStyle() & bits ) - { - - switch( m_instData.getStyle() & bits ) - { - case GWS_CHECK_BOX: - found = TRUE; - break; - - case GWS_ENTRY_FIELD: - { -// EntryData *e = (EntryData *)m_userData; - width = m_size.x; - - x = originalX; - y = originalY; - - // Calculate space for Label - if( m_instData.getTextLength() ) - { - Int textWidth = 0; - - TheWindowManager->winGetTextSize( m_instData.getFont(), - m_instData.getText(), - &textWidth, nullptr, 0 ); - width -= textWidth + 6; - x += textWidth + 6; - - } - -/* -// Colin: The very notion of entry width makes no sense to me since -// we already have a gadget width, and the max characters for -// an entry box so I am removing this. - // Adjust entry box if an entryWidth is provided - if( (e->entryWidth > 0) && (width > e->entryWidth) ) - { - width = e->entryWidth; - x = originalX + (m_size.x - e->entryWidth); - } -*/ - - blitBorderRect( x, y, width, m_size.y ); - - found = TRUE; - break; - } - - // Sliders may need a bar for the button - // it is assumed that the smaller size component (width, height) - // is the axis of the slider - case GWS_VERT_SLIDER: - case GWS_HORZ_SLIDER: -// blitBorderLine( originalX, originalY, window->size.x, window->size.y ); - - found = TRUE; - break; - - case GWS_SCROLL_LISTBOX: - { - ListboxData *list = (ListboxData *)m_userData; - Int sliderAdjustment = 0; - Int labelAdjustment = 0; - - if( list->scrollBar ) - { - GameWindow *child = list->slider->winGetChild(); - ICoord2D size; - - child->winGetSize( &size.x, &size.y ); - sliderAdjustment = size.y; - - } - - if( m_instData.getTextLength() ) - labelAdjustment = 4; - - blitBorderRect( (originalX - 3), - (originalY - (3 + labelAdjustment)), - (m_size.x + 3 - sliderAdjustment), - (m_size.y + 6) ); - - found = TRUE; - break; - } - - case GWS_RADIO_BUTTON: - case GWS_STATIC_TEXT: - case GWS_PROGRESS_BAR: - case GWS_PUSH_BUTTON: - case GWS_USER_WINDOW: - case GWS_TAB_CONTROL: - blitBorderRect( originalX, originalY, m_size.x, m_size.y ); - - found = TRUE; - break; - - } - - } - - } - -} - -// W3DGameWindow::winSetFont ================================================== -/** Set the font for a window */ -//============================================================================= -void W3DGameWindow::winSetFont( GameFont *font ) -{ - - if (font == nullptr) - return; - - // extending functionality - GameWindow::winSetFont( font ); - - // assign font to text renderer - m_textRenderer.Set_Font( static_cast(font->fontData) ); - - // this is a visual change - m_needPolyDraw = TRUE; - -} - -// W3DGameWindow::winSetText ================================================== -/** Set the text for window */ -//============================================================================= -Int W3DGameWindow::winSetText( UnicodeString newText ) -{ - - // extending functionality - GameWindow::winSetText( newText ); - - // rebuild the sentence in our text renderer - m_textRenderer.Build_Sentence( m_instData.getText().str(),nullptr, nullptr ); - - // this is a visual change - m_needPolyDraw = TRUE; - - return WIN_ERR_OK; - -} - -// W3DGameWindow::winSetPosition ============================================== -/** Set window position */ -//============================================================================= -Int W3DGameWindow::winSetPosition( Int x, Int y ) -{ - ICoord2D prevPos; - - // get previous position - prevPos.x = m_region.lo.x; - prevPos.y = m_region.lo.y; - - // extending functionality - GameWindow::winSetPosition( x, y ); - - // update any text position change - m_textPos.x += m_region.lo.x - prevPos.x; - m_textPos.y += m_region.lo.y - prevPos.y; - m_newTextPos = TRUE; - - return WIN_ERR_OK; - -} - -// W3DGameWindow::getTextSize ================================================= -/** Get the size of the text in our inst data */ -//============================================================================= -void W3DGameWindow::getTextSize( Int *width, Int *height ) -{ - Vector2 extents = m_textRenderer.Get_Text_Extents( m_instData.getText().str() ); - - if( width ) - *width = extents.X; - if( height ) - *height = extents.Y; - -} - -// W3DGameWindow::getTextLoc ================================================== -// Set our text rendering location */ -//============================================================================= -void W3DGameWindow::setTextLoc( Int x, Int y ) -{ - - if( m_textPos.x != x ) - { - - m_textPos.x = x; - m_newTextPos = TRUE; - - } - if( m_textPos.y != y ) - { - - m_textPos.y = y; - m_newTextPos = TRUE; - - } - -} - -// W3DGameWindow::drawText ==================================================== -/** Draw the text in our 2d sentence renderer */ -//============================================================================= -void W3DGameWindow::drawText( Color color ) -{ - Bool needDraw = FALSE; - - // if new text pos we need to redraw - if( m_newTextPos ) - { - - m_newTextPos = FALSE; - needDraw = TRUE; - - } - - // if color switch, set new color - if( m_currTextColor != color ) - { - - m_currTextColor = color; - needDraw = TRUE; - - } - - // draw the quads if needed - if( needDraw || m_needPolyDraw ) - { - UnsignedInt outline = TheWindowManager->winMakeColor( 0, 0, 0, 255 ); - - m_textRenderer.Reset_Polys(); - m_textRenderer.Set_Location( Vector2( m_textPos.x + 1, m_textPos.y + 1 ) ); - m_textRenderer.Draw_Sentence( outline ); - - m_textRenderer.Set_Location( Vector2( m_textPos.x, m_textPos.y ) ); - m_textRenderer.Draw_Sentence( m_currTextColor ); - - m_needPolyDraw = FALSE; - - } - - // do the render - m_textRenderer.Render(); - -} - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp deleted file mode 100644 index d9cd4f2a677..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/W3DGameWindowManager.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DGameWindowManager.cpp ///////////////////////////////////////////////////////////////// -// Created: Colin Day, June 2001 -// Desc: W3D implementation of the window manager, responsible for all -// interactions with the game windowing system for menus and -// window controls. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include - -#include "GameClient/Image.h" -#include "W3DDevice/GameClient/W3DGameWindowManager.h" - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -W3DGameWindowManager::W3DGameWindowManager() -{ - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -W3DGameWindowManager::~W3DGameWindowManager() -{ - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void W3DGameWindowManager::init() -{ - - // extend - GameWindowManager::init(); - -} - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/MotionBlur.nvv b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/MotionBlur.nvv deleted file mode 100644 index 7b3aef1057b..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/MotionBlur.nvv +++ /dev/null @@ -1,45 +0,0 @@ -; -; Command & Conquer Generals(tm) -; Copyright 2025 Electronic Arts Inc. -; -; This program is free software: you can redistribute it and/or modify -; it under the terms of the GNU General Public License as published by -; the Free Software Foundation, either version 3 of the License, or -; (at your option) any later version. -; -; This program is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with this program. If not, see . -; - -;//////////////////////////////////////////////////////////////////////////////// -;// // -;// (c) 2001-2003 Electronic Arts Inc. // -;// // -;//////////////////////////////////////////////////////////////////////////////// - -; Motion blur vertex shader -; John Ahlquist April 2002 -; Currently unused prototype code. jba. - -#define CV_ZERO 0 -#define CV_ONE 1 - -#define V_POSITION v0 -#define V_DIFFUSE v1 -#define V_TEXTURE v2 - -vs.1.1 - - -mov oPos, V_POSITION -mov oT0, V_TEXTURE -mov oT1, V_TEXTURE -mov oT2, V_TEXTURE -mov oT3, V_TEXTURE -mov oD0, V_DIFFUSE - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/invmonochrome.nvp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/invmonochrome.nvp deleted file mode 100644 index 714f1dfb5cf..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/invmonochrome.nvp +++ /dev/null @@ -1,55 +0,0 @@ -; -; Command & Conquer Generals(tm) -; Copyright 2025 Electronic Arts Inc. -; -; This program is free software: you can redistribute it and/or modify -; it under the terms of the GNU General Public License as published by -; the Free Software Foundation, either version 3 of the License, or -; (at your option) any later version. -; -; This program is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with this program. If not, see . -; - -;//////////////////////////////////////////////////////////////////////////////// -;// // -;// (c) 2001-2003 Electronic Arts Inc. // -;// // -;//////////////////////////////////////////////////////////////////////////////// - -; Terrain pixel shader -; Created: Mark Wilczynski, August 2001 - -; Declare pixel shader version 1.1 -ps.1.1 - -tex t0 ; get texture 0 -;dp3 r1, c1, t0 -;add r0,r1,-c2 -;mul r0,r0,c3 -;mov r0,t0 ;do nothing - -//Inverted image -;dp3 r1, t0, c0 ;black & white conversion -;mul r0, 1-r1, c1 ;modulate inverted by filter color -;lrp r0, c2, r0, t0 ;blend modified image into original image so smooth fade in/out - -//Red inverted image -dp3 r1, t0, c0 ;black & white conversion -mul r1, r1, c1 ;modulate by filter color (inverse of red) -lrp r0, c2, 1-r1, t0 ;blend modified image into original image so smooth fade in/out - -;Code to clamp and expand dynamic range -;add_sat r1,r1,-c7 ;clamp out low values - 30 -;add_sat r1,r1,c5 ;clamp out upper values +60 -;add r1,r1,-c6 ;shift to center range at 0 - - -;add r0,r0,-c5 -;mul_x4 r0,r0,c6 - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/monochrome.nvp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/monochrome.nvp deleted file mode 100644 index 65742029460..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/monochrome.nvp +++ /dev/null @@ -1,49 +0,0 @@ -; -; Command & Conquer Generals(tm) -; Copyright 2025 Electronic Arts Inc. -; -; This program is free software: you can redistribute it and/or modify -; it under the terms of the GNU General Public License as published by -; the Free Software Foundation, either version 3 of the License, or -; (at your option) any later version. -; -; This program is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with this program. If not, see . -; - -;//////////////////////////////////////////////////////////////////////////////// -;// // -;// (c) 2001-2003 Electronic Arts Inc. // -;// // -;//////////////////////////////////////////////////////////////////////////////// - -; Terrain pixel shader -; Created: Mark Wilczynski, August 2001 - -; Declare pixel shader version 1.1 -ps.1.1 - -tex t0 ; get texture 0 -;dp3 r1, c1, t0 -;add r0,r1,-c2 -;mul r0,r0,c3 -;mov r0,t0 ;do nothing - -dp3 r1, t0, c0 ;black & white conversion -mul r1, r1, c1 ;modulate by filter color -lrp r0, c2, r1, t0 ;blend modified image into original image so smooth fade in/out - -;Code to clamp and expand dynamic range -;add_sat r1,r1,-c7 ;clamp out low values - 30 -;add_sat r1,r1,c5 ;clamp out upper values +60 -;add r1,r1,-c6 ;shift to center range at 0 - - -;add r0,r0,-c5 -;mul_x4 r0,r0,c6 - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/motionblur.nvp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/motionblur.nvp deleted file mode 100644 index 09d35ec34dc..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/motionblur.nvp +++ /dev/null @@ -1,47 +0,0 @@ -; -; Command & Conquer Generals(tm) -; Copyright 2025 Electronic Arts Inc. -; -; This program is free software: you can redistribute it and/or modify -; it under the terms of the GNU General Public License as published by -; the Free Software Foundation, either version 3 of the License, or -; (at your option) any later version. -; -; This program is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with this program. If not, see . -; - -;//////////////////////////////////////////////////////////////////////////////// -;// // -;// (c) 2001-2003 Electronic Arts Inc. // -;// // -;//////////////////////////////////////////////////////////////////////////////// - -; Motion blur pixel shader -; Created: John Ahlquist, April 2002 -; Currently unused prototype code. jba. - -; Declare pixel shader version 1.1 -ps.1.1 - -tex t0 -; Define t0 as a standard 3-vector from bumpmap -tex t1 - -; Perform EMBM to get a local normal bump reflection. -texbem t2, t1 ; compute new (u,v) values -tex t3 -; result goes in output color multiplied by diffuse -;mul r0, t2, v0 - -mul r0.rgb, v0, t0 -+add r0.a, v0, t0 -mul r1, t2, c0 -add r0.rgb, r0, r1 -+mul r0.a, r0, t3 - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/roadnoise2.nvp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/roadnoise2.nvp deleted file mode 100644 index 965666876c0..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/roadnoise2.nvp +++ /dev/null @@ -1,37 +0,0 @@ -; -; Command & Conquer Generals(tm) -; Copyright 2025 Electronic Arts Inc. -; -; This program is free software: you can redistribute it and/or modify -; it under the terms of the GNU General Public License as published by -; the Free Software Foundation, either version 3 of the License, or -; (at your option) any later version. -; -; This program is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with this program. If not, see . -; - -;//////////////////////////////////////////////////////////////////////////////// -;// // -;// (c) 2001-2003 Electronic Arts Inc. // -;// // -;//////////////////////////////////////////////////////////////////////////////// - -; Terrain pixel shader -; Created: Mark Wilczynski, June 2002 - -; Declare pixel shader version 1.1 -ps.1.1 - -tex t0 ; get road texture -tex t1 ; get cloud shadow texture -tex t2 ; get noise texture - -mul r0, t0, t1 ;modulate with cloud -mul r0, r0, t2 ;modulate with noise -mul r0, r0, v0 ;apply diffuse lighting diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrain.nvp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrain.nvp deleted file mode 100644 index 3733bbc7321..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrain.nvp +++ /dev/null @@ -1,35 +0,0 @@ -; -; Command & Conquer Generals(tm) -; Copyright 2025 Electronic Arts Inc. -; -; This program is free software: you can redistribute it and/or modify -; it under the terms of the GNU General Public License as published by -; the Free Software Foundation, either version 3 of the License, or -; (at your option) any later version. -; -; This program is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with this program. If not, see . -; - -;//////////////////////////////////////////////////////////////////////////////// -;// // -;// (c) 2001-2003 Electronic Arts Inc. // -;// // -;//////////////////////////////////////////////////////////////////////////////// - -; Terrain pixel shader -; Created: Mark Wilczynski, August 2001 - -; Declare pixel shader version 1.1 -ps.1.1 - -tex t0 ; get texture 0 -tex t1 ; get texture 1 - -lrp r0, v0.a, t1, t0 ;alpha blend between 2 textures -mul r0, r0, v0 ;apply diffuse lighting diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise.nvp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise.nvp deleted file mode 100644 index 22ba040603c..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise.nvp +++ /dev/null @@ -1,37 +0,0 @@ -; -; Command & Conquer Generals(tm) -; Copyright 2025 Electronic Arts Inc. -; -; This program is free software: you can redistribute it and/or modify -; it under the terms of the GNU General Public License as published by -; the Free Software Foundation, either version 3 of the License, or -; (at your option) any later version. -; -; This program is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with this program. If not, see . -; - -;//////////////////////////////////////////////////////////////////////////////// -;// // -;// (c) 2001-2003 Electronic Arts Inc. // -;// // -;//////////////////////////////////////////////////////////////////////////////// - -; Terrain pixel shader -; Created: Mark Wilczynski, August 2001 - -; Declare pixel shader version 1.1 -ps.1.1 - -tex t0 ; get texture 0 -tex t1 ; get texture 1 -tex t2 ; get texture 2 - -lrp r0, v0.a, t1, t0 ;alpha blend between 2 textures -mul r0, r0, v0 ;apply diffuse lighting -mul r0, r0, t2 ;modulate with texture2 diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise2.nvp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise2.nvp deleted file mode 100644 index 1ca4e3fc82d..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shaders/terrainnoise2.nvp +++ /dev/null @@ -1,39 +0,0 @@ -; -; Command & Conquer Generals(tm) -; Copyright 2025 Electronic Arts Inc. -; -; This program is free software: you can redistribute it and/or modify -; it under the terms of the GNU General Public License as published by -; the Free Software Foundation, either version 3 of the License, or -; (at your option) any later version. -; -; This program is distributed in the hope that it will be useful, -; but WITHOUT ANY WARRANTY; without even the implied warranty of -; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -; GNU General Public License for more details. -; -; You should have received a copy of the GNU General Public License -; along with this program. If not, see . -; - -;//////////////////////////////////////////////////////////////////////////////// -;// // -;// (c) 2001-2003 Electronic Arts Inc. // -;// // -;//////////////////////////////////////////////////////////////////////////////// - -; Terrain pixel shader -; Created: Mark Wilczynski, August 2001 - -; Declare pixel shader version 1.1 -ps.1.1 - -tex t0 ; get texture 0 -tex t1 ; get texture 1 -tex t2 ; get texture 2 -tex t3 ; get texture 3 - -lrp r0, v0.a, t1, t0 ;alpha blend between 2 textures -mul r0, r0, v0 ;apply diffuse lighting -mul r0, r0, t2 ;modulate with texture 2 -mul r0, r0, t3 ;modulate with texture 3 \ No newline at end of file diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp deleted file mode 100644 index e4aaf5891fe..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DBufferManager.cpp +++ /dev/null @@ -1,448 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - - -#include "Common/Debug.h" -#include "W3DDevice/GameClient/W3DBufferManager.h" - -W3DBufferManager *TheW3DBufferManager=nullptr; //singleton - -static int FVFTypeIndexList[W3DBufferManager::MAX_FVF]= -{ - D3DFVF_XYZ, - D3DFVF_XYZ|D3DFVF_DIFFUSE, - D3DFVF_XYZ|D3DFVF_TEX1, - D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1, - D3DFVF_XYZ|D3DFVF_TEX2, - D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX2, - D3DFVF_XYZ|D3DFVF_NORMAL, - D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE, - D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1, - D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX1, - D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX2, - D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_DIFFUSE|D3DFVF_TEX2, - D3DFVF_XYZRHW, - D3DFVF_XYZRHW|D3DFVF_DIFFUSE, - D3DFVF_XYZRHW|D3DFVF_TEX1, - D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1, - D3DFVF_XYZRHW|D3DFVF_TEX2, - D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX2 -}; - -Int W3DBufferManager::getDX8Format(VBM_FVF_TYPES format) -{ - return FVFTypeIndexList[format]; -} - -W3DBufferManager::W3DBufferManager() -{ - m_numEmptySlotsAllocated=0; - m_numEmptyVertexBuffersAllocated=0; - m_numEmptyIndexSlotsAllocated=0; - m_numEmptyIndexBuffersAllocated=0; - - Int i=0; - for (; im_prevSameVB) - vbSlot->m_prevSameVB->m_nextSameVB=vbSlot->m_nextSameVB; - else - vbSlot->m_VB->m_usedSlots=nullptr; - - if (vbSlot->m_nextSameVB) - vbSlot->m_nextSameVB->m_prevSameVB=vbSlot->m_prevSameVB; - vbSlot=vbSlot->m_nextSameSize; - m_numEmptySlotsAllocated--; - } - m_W3DVertexBufferSlots[i][j]=nullptr; - } - } - - for (j=0; jm_prevSameIB) - ibSlot->m_prevSameIB->m_nextSameIB=ibSlot->m_nextSameIB; - else - ibSlot->m_IB->m_usedSlots=nullptr; - - if (ibSlot->m_nextSameIB) - ibSlot->m_nextSameIB->m_prevSameIB=ibSlot->m_prevSameIB; - ibSlot=ibSlot->m_nextSameSize; - m_numEmptyIndexSlotsAllocated--; - } - m_W3DIndexBufferSlots[j]=nullptr; - } - - DEBUG_ASSERTCRASH(m_numEmptySlotsAllocated==0, ("Failed to free all empty vertex buffer slots")); - DEBUG_ASSERTCRASH(m_numEmptyIndexSlotsAllocated==0, ("Failed to free all empty index buffer slots")); -} - -void W3DBufferManager::freeAllBuffers() -{ - Int i; - - //Make sure all slots are free - freeAllSlots(); ///m_usedSlots == nullptr, ("Freeing Non-Empty Vertex Buffer")); - REF_PTR_RELEASE(vb->m_DX8VertexBuffer); - m_numEmptyVertexBuffersAllocated--; - vb=vb->m_nextVB; //get next vertex buffer of this type - } - m_W3DVertexBuffers[i]=nullptr; - } - - W3DIndexBuffer *ib = m_W3DIndexBuffers; - while (ib) - { DEBUG_ASSERTCRASH(ib->m_usedSlots == nullptr, ("Freeing Non-Empty Index Buffer")); - REF_PTR_RELEASE(ib->m_DX8IndexBuffer); - m_numEmptyIndexBuffersAllocated--; - ib=ib->m_nextIB; //get next vertex buffer of this type - } - m_W3DIndexBuffers=nullptr; - - DEBUG_ASSERTCRASH(m_numEmptyVertexBuffersAllocated==0, ("Failed to free all empty vertex buffers")); - DEBUG_ASSERTCRASH(m_numEmptyIndexBuffersAllocated==0, ("Failed to free all empty index buffers")); -} - -void W3DBufferManager::ReleaseResources() -{ - for (Int i=0; im_DX8VertexBuffer); - vb=vb->m_nextVB; //get next vertex buffer of this type - } - } - - W3DIndexBuffer *ib = m_W3DIndexBuffers; - while (ib) - { - REF_PTR_RELEASE(ib->m_DX8IndexBuffer); - ib=ib->m_nextIB; //get next vertex buffer of this type - } -} - -Bool W3DBufferManager::ReAcquireResources() -{ - for (Int i=0; im_DX8VertexBuffer == nullptr, ("ReAcquire of existing vertex buffer")); - vb->m_DX8VertexBuffer=NEW_REF(DX8VertexBufferClass,(FVFTypeIndexList[vb->m_format],vb->m_size,DX8VertexBufferClass::USAGE_DEFAULT)); - DEBUG_ASSERTCRASH( vb->m_DX8VertexBuffer, ("Failed ReAcquire of vertex buffer")); - if (!vb->m_DX8VertexBuffer) - return FALSE; - vb=vb->m_nextVB; //get next vertex buffer of this type - } - } - - W3DIndexBuffer *ib = m_W3DIndexBuffers; - while (ib) - { DEBUG_ASSERTCRASH( ib->m_DX8IndexBuffer == nullptr, ("ReAcquire of existing index buffer")); - ib->m_DX8IndexBuffer=NEW_REF(DX8IndexBufferClass,(ib->m_size,DX8IndexBufferClass::USAGE_DEFAULT)); - DEBUG_ASSERTCRASH( ib->m_DX8IndexBuffer, ("Failed ReAcquire of index buffer")); - if (!ib->m_DX8IndexBuffer) - return FALSE; - ib=ib->m_nextIB; //get next vertex buffer of this type - } - - return TRUE; -} - -/**Searches through previously allocated vertex buffer slots and returns a matching type. If none found, - creates a new slot and adds it to the pool. Returns a pointer to the VB slot. - Returns nullptr in case of failure. -*/ -W3DBufferManager::W3DVertexBufferSlot *W3DBufferManager::getSlot(VBM_FVF_TYPES fvfType, Int size) -{ - W3DVertexBufferSlot *vbSlot=nullptr; - - //round size to next multiple of minimum slot size. - //should help avoid fragmentation. - size = (size + (MIN_SLOT_SIZE-1)) & (~(MIN_SLOT_SIZE-1)); - Int sizeIndex = (size >> MIN_SLOT_SIZE_SHIFT)-1; - - DEBUG_ASSERTCRASH(sizeIndex < MAX_VB_SIZES && size > 0, ("Allocating too large vertex buffer slot")); - // TheSuperHackers @bugfix xezon 18/05/2025 Protect against indexing slots beyond the max size. - // This will happen when a mesh is too complex to draw shadows with. - if (sizeIndex >= MAX_VB_SIZES || size <= 0) { - return nullptr; - } - - if ((vbSlot=m_W3DVertexBufferSlots[fvfType][sizeIndex]) != nullptr) - { //found a previously allocated slot matching required size - m_W3DVertexBufferSlots[fvfType][sizeIndex]=vbSlot->m_nextSameSize; - if (vbSlot->m_nextSameSize) - vbSlot->m_nextSameSize->m_prevSameSize=nullptr; - return vbSlot; - } - else - { //need to allocate a new slot - return allocateSlotStorage(fvfType, size); - } - - return nullptr; -} - -/**Returns vertex buffer space back to pool so it can be reused later*/ -void W3DBufferManager::releaseSlot(W3DVertexBufferSlot *vbSlot) -{ - Int sizeIndex = (vbSlot->m_size >> MIN_SLOT_SIZE_SHIFT)-1; - - vbSlot->m_nextSameSize=m_W3DVertexBufferSlots[vbSlot->m_VB->m_format][sizeIndex]; - if (m_W3DVertexBufferSlots[vbSlot->m_VB->m_format][sizeIndex]) - m_W3DVertexBufferSlots[vbSlot->m_VB->m_format][sizeIndex]->m_prevSameSize=vbSlot; - - m_W3DVertexBufferSlots[vbSlot->m_VB->m_format][sizeIndex]=vbSlot; -} - -/**Reserves space inside existing vertex buffer or allocates a new one to fit the required size. -*/ -W3DBufferManager::W3DVertexBufferSlot * W3DBufferManager::allocateSlotStorage(VBM_FVF_TYPES fvfType, Int size) -{ - - W3DVertexBuffer *pVB; - W3DVertexBufferSlot *vbSlot; -// Int sizeIndex = (size >> MIN_SLOT_SIZE_SHIFT)-1; - - DEBUG_ASSERTCRASH(m_numEmptySlotsAllocated < MAX_NUMBER_SLOTS, ("No more VB Slots")); - // TheSuperHackers @bugfix xezon 18/05/2025 Protect against allocating slot storage beyond the max size. - // This will happen when there are too many meshes in the scene to draw shadows with. - if (m_numEmptySlotsAllocated >= MAX_NUMBER_SLOTS) { - return nullptr; - } - - pVB=m_W3DVertexBuffers[fvfType]; - while (pVB) - { - if ((pVB->m_size - pVB->m_startFreeIndex) >= size) - { //found enough free space in this vertex buffer - vbSlot=&m_W3DVertexBufferEmptySlots[m_numEmptySlotsAllocated]; - vbSlot->m_size=size; - vbSlot->m_start=pVB->m_startFreeIndex; - vbSlot->m_VB=pVB; - //Link to VB list of slots - vbSlot->m_nextSameVB=pVB->m_usedSlots; - vbSlot->m_prevSameVB=nullptr; //this will be the new head - if (pVB->m_usedSlots) - pVB->m_usedSlots->m_prevSameVB=vbSlot; - vbSlot->m_prevSameSize=vbSlot->m_nextSameSize=nullptr; - pVB->m_usedSlots=vbSlot; - pVB->m_startFreeIndex += size; - m_numEmptySlotsAllocated++; - return vbSlot; - } - pVB = pVB->m_nextVB; - } - - pVB=m_W3DVertexBuffers[fvfType]; //save old list head - - //Didn't find any vertex buffers with room, create a new one - DEBUG_ASSERTCRASH(m_numEmptyVertexBuffersAllocated < MAX_VERTEX_BUFFERS_CREATED, ("Reached Max Static VB Shadow Geometry")); - - if (m_numEmptyVertexBuffersAllocated < MAX_VERTEX_BUFFERS_CREATED) - { - m_W3DVertexBuffers[fvfType] = &m_W3DEmptyVertexBuffers[m_numEmptyVertexBuffersAllocated]; - m_W3DVertexBuffers[fvfType]->m_nextVB=pVB; //link to list - m_numEmptyVertexBuffersAllocated++; - - pVB=m_W3DVertexBuffers[fvfType]; //get new list head - - Int vbSize=__max(DEFAULT_VERTEX_BUFFER_SIZE,size); - - pVB->m_DX8VertexBuffer=NEW_REF(DX8VertexBufferClass,(FVFTypeIndexList[fvfType],vbSize,DX8VertexBufferClass::USAGE_DEFAULT)); - pVB->m_format=fvfType; - pVB->m_startFreeIndex=size; - pVB->m_size=vbSize; - vbSlot=&m_W3DVertexBufferEmptySlots[m_numEmptySlotsAllocated]; - m_numEmptySlotsAllocated++; - pVB->m_usedSlots=vbSlot; - vbSlot->m_size=size; - vbSlot->m_start=0; - vbSlot->m_VB=pVB; - vbSlot->m_prevSameVB=vbSlot->m_nextSameVB=nullptr; - vbSlot->m_prevSameSize=vbSlot->m_nextSameSize=nullptr; - return vbSlot; - } - - return nullptr; -} - -//******************************** Index Buffer code ****************************************************** -/**Searches through previously allocated index buffer slots and returns a matching type. If none found, - creates a new slot and adds it to the pool. Returns a pointer to the IB slot. - Returns nullptr in case of failure. -*/ -W3DBufferManager::W3DIndexBufferSlot *W3DBufferManager::getSlot(Int size) -{ - W3DIndexBufferSlot *ibSlot=nullptr; - - //round size to next multiple of minimum slot size. - //should help avoid fragmentation. - size = (size + (MIN_SLOT_SIZE-1)) & (~(MIN_SLOT_SIZE-1)); - Int sizeIndex = (size >> MIN_SLOT_SIZE_SHIFT)-1; - - DEBUG_ASSERTCRASH(sizeIndex < MAX_IB_SIZES && size > 0, ("Allocating too large index buffer slot")); - // TheSuperHackers @bugfix xezon 18/05/2025 Protect against indexing slots beyond the max size. - // This will happen when a mesh is too complex to draw shadows with. - if (sizeIndex >= MAX_IB_SIZES || size <= 0) { - return nullptr; - } - - if ((ibSlot=m_W3DIndexBufferSlots[sizeIndex]) != nullptr) - { //found a previously allocated slot matching required size - m_W3DIndexBufferSlots[sizeIndex]=ibSlot->m_nextSameSize; - if (ibSlot->m_nextSameSize) - ibSlot->m_nextSameSize->m_prevSameSize=nullptr; - return ibSlot; - } - else - { //need to allocate a new slot - return allocateSlotStorage(size); - } - - return nullptr; -} - -/**Returns index buffer space back to pool so it can be reused later*/ -void W3DBufferManager::releaseSlot(W3DIndexBufferSlot *ibSlot) -{ - Int sizeIndex = (ibSlot->m_size >> MIN_SLOT_SIZE_SHIFT)-1; - - ibSlot->m_nextSameSize=m_W3DIndexBufferSlots[sizeIndex]; - if (m_W3DIndexBufferSlots[sizeIndex]) - m_W3DIndexBufferSlots[sizeIndex]->m_prevSameSize=ibSlot; - - m_W3DIndexBufferSlots[sizeIndex]=ibSlot; -} - -/**Reserves space inside existing index buffer or allocates a new one to fit the required size. -*/ -W3DBufferManager::W3DIndexBufferSlot * W3DBufferManager::allocateSlotStorage(Int size) -{ - - W3DIndexBuffer *pIB; - W3DIndexBufferSlot *ibSlot; -// Int sizeIndex = (size >> MIN_SLOT_SIZE_SHIFT)-1; - - DEBUG_ASSERTCRASH(m_numEmptyIndexSlotsAllocated < MAX_NUMBER_SLOTS, ("No more IB Slots")); - // TheSuperHackers @bugfix xezon 18/05/2025 Protect against allocating slot storage beyond the max size. - // This will happen when there are too many meshes in the scene to draw shadows with. - if (m_numEmptyIndexSlotsAllocated >= MAX_NUMBER_SLOTS) { - return nullptr; - } - - pIB=m_W3DIndexBuffers; - while (pIB) - { - if ((pIB->m_size - pIB->m_startFreeIndex) >= size) - { //found enough free space in this index buffer - ibSlot=&m_W3DIndexBufferEmptySlots[m_numEmptyIndexSlotsAllocated]; - ibSlot->m_size=size; - ibSlot->m_start=pIB->m_startFreeIndex; - ibSlot->m_IB=pIB; - //Link to IB list of slots - ibSlot->m_nextSameIB=pIB->m_usedSlots; - ibSlot->m_prevSameIB=nullptr; //this will be the new head - if (pIB->m_usedSlots) - pIB->m_usedSlots->m_prevSameIB=ibSlot; - ibSlot->m_prevSameSize=ibSlot->m_nextSameSize=nullptr; - pIB->m_usedSlots=ibSlot; - pIB->m_startFreeIndex += size; - m_numEmptyIndexSlotsAllocated++; - return ibSlot; - } - pIB = pIB->m_nextIB; - } - - pIB=m_W3DIndexBuffers; //save old list head - - //Didn't find any index buffers with room, create a new one - DEBUG_ASSERTCRASH(m_numEmptyIndexBuffersAllocated < MAX_INDEX_BUFFERS_CREATED, ("Reached Max Static IB Shadow Geometry")); - - if (m_numEmptyIndexBuffersAllocated < MAX_INDEX_BUFFERS_CREATED) - { - m_W3DIndexBuffers = &m_W3DEmptyIndexBuffers[m_numEmptyIndexBuffersAllocated]; - m_W3DIndexBuffers->m_nextIB=pIB; //link to list - m_numEmptyIndexBuffersAllocated++; - - pIB=m_W3DIndexBuffers; //get new list head - - Int ibSize=__max(DEFAULT_INDEX_BUFFER_SIZE,size); - - pIB->m_DX8IndexBuffer=NEW_REF(DX8IndexBufferClass,(ibSize,DX8IndexBufferClass::USAGE_DEFAULT)); - pIB->m_startFreeIndex=size; - pIB->m_size=ibSize; - ibSlot=&m_W3DIndexBufferEmptySlots[m_numEmptyIndexSlotsAllocated]; - m_numEmptyIndexSlotsAllocated++; - pIB->m_usedSlots=ibSlot; - ibSlot->m_size=size; - ibSlot->m_start=0; - ibSlot->m_IB=pIB; - ibSlot->m_prevSameIB=ibSlot->m_nextSameIB=nullptr; - ibSlot->m_prevSameSize=ibSlot->m_nextSameSize=nullptr; - return ibSlot; - } - - return nullptr; -} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp deleted file mode 100644 index 0c8ad50e65c..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DShadow.cpp +++ /dev/null @@ -1,251 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - - -// FILE: W3DShadow.cpp /////////////////////////////////////////////////////////// -// -// Real time shadow representations -// -// Author: Mark Wilczynski, February 2002 -// -// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "always.h" -#include "GameClient/View.h" -#include "WW3D2/camera.h" -#include "WW3D2/light.h" -#include "WW3D2/dx8wrapper.h" -#include "WW3D2/hlod.h" -#include "WW3D2/mesh.h" -#include "WW3D2/meshmdl.h" -#include "Lib/BaseType.h" -#include "W3DDevice/GameClient/HeightMap.h" -#include "d3dx8math.h" -#include "Common/GlobalData.h" -#include "W3DDevice/GameClient/W3DVolumetricShadow.h" -#include "W3DDevice/GameClient/W3DProjectedShadow.h" -#include "W3DDevice/GameClient/W3DShadow.h" -#include "WW3D2/statistics.h" -#include "Common/Debug.h" -#include "Common/PerfTimer.h" - -#define SUN_DISTANCE_FROM_GROUND 10000.0f //distance of sun (our only light source). - -// Global Variables and Functions ///////////////////////////////////////////// -W3DShadowManager *TheW3DShadowManager=nullptr; -const FrustumClass *shadowCameraFrustum; - -Vector3 LightPosWorld[ MAX_SHADOW_LIGHTS ] = -{ - - Vector3( 94.0161f, 50.499f, 200.0f) -}; - -void PrepareShadows() -{ - if (TheW3DProjectedShadowManager) - TheW3DProjectedShadowManager->prepareShadows(); -} - -//DECLARE_PERF_TIMER(shadowsRender) -void DoShadows(RenderInfoClass & rinfo, Bool stencilPass) -{ - //USE_PERF_TIMER(shadowsRender) - shadowCameraFrustum=&rinfo.Camera.Get_Frustum(); - Int projectionCount=0; - - //Projected shadows render first because they may fill the stencil buffer - //which will be used by the shadow volumes - if (stencilPass == FALSE && TheW3DProjectedShadowManager) - { - if (TheW3DShadowManager->isShadowScene()) - projectionCount=TheW3DProjectedShadowManager->renderShadows(rinfo); - } - - if (stencilPass == TRUE && TheW3DVolumetricShadowManager) - { - -// TheW3DShadowManager->loadTerrainShadows(); - - //This function gets called many times by the W3D renderer - //so we use this flag to make sure shadows rendered only once per frame. - if (TheW3DShadowManager->isShadowScene()) - TheW3DVolumetricShadowManager->renderShadows(projectionCount); - } - if (TheW3DShadowManager && stencilPass) //reset so no more shadow processing this frame. - TheW3DShadowManager->queueShadows(FALSE); - -} - -W3DShadowManager::W3DShadowManager() -{ - DEBUG_ASSERTCRASH(TheW3DVolumetricShadowManager == nullptr && TheW3DProjectedShadowManager == nullptr, - ("Creating new shadow managers without deleting old ones")); - - m_shadowColor = 0x7fa0a0a0; - m_isShadowScene = FALSE; - m_stencilShadowMask = 0; //all bits can be used for storing shadows. - - Vector3 lightRay(-TheGlobalData->m_terrainLightPos[0].x, - -TheGlobalData->m_terrainLightPos[0].y, -TheGlobalData->m_terrainLightPos[0].z); - lightRay.Normalize(); - - LightPosWorld[0]=lightRay*SUN_DISTANCE_FROM_GROUND; - - TheW3DVolumetricShadowManager = NEW W3DVolumetricShadowManager; - TheProjectedShadowManager = TheW3DProjectedShadowManager = NEW W3DProjectedShadowManager; -} - -W3DShadowManager::~W3DShadowManager() -{ - delete TheW3DVolumetricShadowManager; - TheW3DVolumetricShadowManager = nullptr; - delete TheW3DProjectedShadowManager; - TheProjectedShadowManager = TheW3DProjectedShadowManager = nullptr; -} - -/** Do one-time initilalization of shadow systems that need to be -active for full duration of game*/ -Bool W3DShadowManager::init() -{ - Bool result=TRUE; - - if (TheW3DVolumetricShadowManager && TheW3DVolumetricShadowManager->init()) - { - if (TheW3DVolumetricShadowManager->ReAcquireResources()) - result = TRUE; - } - if ( TheW3DProjectedShadowManager && TheW3DProjectedShadowManager->init()) - { - if (TheW3DProjectedShadowManager->ReAcquireResources()) - result = TRUE; - } - - return result; -} - -/** Do per-map reset. This frees up shadows from all objects since -they may not exist on the next map*/ -void W3DShadowManager::Reset() -{ - - if (TheW3DVolumetricShadowManager) - TheW3DVolumetricShadowManager->reset(); - if (TheW3DProjectedShadowManager) - TheW3DProjectedShadowManager->reset(); -} - -Bool W3DShadowManager::ReAcquireResources() -{ - Bool result = TRUE; - - if (TheW3DVolumetricShadowManager && !TheW3DVolumetricShadowManager->ReAcquireResources()) - result = FALSE; - if (TheW3DProjectedShadowManager && !TheW3DProjectedShadowManager->ReAcquireResources()) - result = FALSE; - - return result; -} - -void W3DShadowManager::ReleaseResources() -{ - if (TheW3DVolumetricShadowManager) - TheW3DVolumetricShadowManager->ReleaseResources(); - if (TheW3DProjectedShadowManager) - TheW3DProjectedShadowManager->ReleaseResources(); -} - -Shadow *W3DShadowManager::addShadow( RenderObjClass *robj, Shadow::ShadowTypeInfo *shadowInfo, Drawable *draw) -{ - ShadowType type = SHADOW_VOLUME; - - if (shadowInfo) - type = shadowInfo->m_type; - - switch(type) - { - case SHADOW_VOLUME: - if (TheW3DVolumetricShadowManager) - return (Shadow *)TheW3DVolumetricShadowManager->addShadow(robj, shadowInfo, draw); - break; - case SHADOW_PROJECTION: - case SHADOW_DECAL: - if (TheW3DProjectedShadowManager) - return (Shadow *)TheW3DProjectedShadowManager->addShadow(robj, shadowInfo, draw); - break; - default: - return nullptr; - } - - return nullptr; -} - -void W3DShadowManager::removeShadow(Shadow *shadow) -{ - shadow->release(); -} - -void W3DShadowManager::removeAllShadows() -{ - if (TheW3DVolumetricShadowManager) - TheW3DVolumetricShadowManager->removeAllShadows(); - if (TheW3DProjectedShadowManager) - TheW3DProjectedShadowManager->removeAllShadows(); -} - -/**Force update of all shadows even when light source and object have not moved*/ -void W3DShadowManager::invalidateCachedLightPositions() -{ - if (TheW3DVolumetricShadowManager) - TheW3DVolumetricShadowManager->invalidateCachedLightPositions(); - if (TheW3DProjectedShadowManager) - TheW3DProjectedShadowManager->invalidateCachedLightPositions(); -} - -Vector3 &W3DShadowManager::getLightPosWorld(Int lightIndex) -{ - return LightPosWorld[lightIndex]; -} - -void W3DShadowManager::setLightPosition(Int lightIndex, Real x, Real y, Real z) -{ - if (lightIndex != 0) - return; ///@todo: Add support for multiple lights - - LightPosWorld[lightIndex]=Vector3(x,y,z); -} - -void W3DShadowManager::setTimeOfDay(TimeOfDay tod) -{ - //Ray to light source - const GlobalData::TerrainLighting *ol=&TheGlobalData->m_terrainObjectsLighting[tod][0]; - - Vector3 lightRay(-ol->lightPos.x,-ol->lightPos.y,-ol->lightPos.z); - - lightRay.Normalize(); - lightRay *= SUN_DISTANCE_FROM_GROUND; - - setLightPosition(0, lightRay.X, lightRay.Y, lightRay.Z); -} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManagerExposed.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManagerExposed.cpp deleted file mode 100644 index abcf9e01245..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManagerExposed.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - - -#include "W3DDevice/GameClient/W3DAssetManagerExposed.h" -#include "W3DDevice/GameClient/W3DAssetManager.h" - -void ReloadAllTextures() -{ - W3DAssetManager::Get_Instance()->Release_All_Textures(); -} - - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp deleted file mode 100644 index c9e175f2f63..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DCustomEdging.cpp +++ /dev/null @@ -1,433 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DCustomEdging.cpp //////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DCustomEdging.cpp -// -// Created: John Ahlquist, May 2001 -// -// Desc: Draw buffer to handle all the custom tile edges in a scene. -// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// Includes -//----------------------------------------------------------------------------- - -#include "W3DDevice/GameClient/W3DCustomEdging.h" - -#include -#include -#include "Common/GlobalData.h" -#include "Common/RandomValue.h" -#include "W3DDevice/GameClient/TerrainTex.h" -#include "W3DDevice/GameClient/HeightMap.h" -#include "W3DDevice/GameClient/W3DDynamicLight.h" -#include "WW3D2/camera.h" -#include "WW3D2/dx8wrapper.h" -#include "WW3D2/dx8renderer.h" -#include "WW3D2/mesh.h" -#include "WW3D2/meshmdl.h" - -//----------------------------------------------------------------------------- -// Private Data -//----------------------------------------------------------------------------- -// A W3D shader that does alpha, texturing, tests zbuffer, doesn't update zbuffer. -#define SC_ALPHA_DETAIL ( SHADE_CNST(ShaderClass::PASS_LEQUAL, ShaderClass::DEPTH_WRITE_DISABLE, ShaderClass::COLOR_WRITE_ENABLE, ShaderClass::SRCBLEND_SRC_ALPHA, \ - ShaderClass::DSTBLEND_ONE_MINUS_SRC_ALPHA, ShaderClass::FOG_DISABLE, ShaderClass::GRADIENT_MODULATE, ShaderClass::SECONDARY_GRADIENT_DISABLE, ShaderClass::TEXTURING_ENABLE, \ - ShaderClass::ALPHATEST_ENABLE, ShaderClass::CULL_MODE_DISABLE, \ - ShaderClass::DETAILCOLOR_DISABLE, ShaderClass::DETAILALPHA_DISABLE) ) - -static ShaderClass detailAlphaTestShader(SC_ALPHA_DETAIL); - - -#define SC_NO_ALPHA ( SHADE_CNST(ShaderClass::PASS_ALWAYS, ShaderClass::DEPTH_WRITE_DISABLE, ShaderClass::COLOR_WRITE_ENABLE, ShaderClass::SRCBLEND_ONE, \ - ShaderClass::DSTBLEND_ZERO, ShaderClass::FOG_DISABLE, ShaderClass::GRADIENT_MODULATE, ShaderClass::SECONDARY_GRADIENT_DISABLE, ShaderClass::TEXTURING_ENABLE, \ - ShaderClass::ALPHATEST_DISABLE, ShaderClass::CULL_MODE_DISABLE, \ - ShaderClass::DETAILCOLOR_DISABLE, ShaderClass::DETAILALPHA_DISABLE) ) - -static ShaderClass detailShader(SC_NO_ALPHA); - -#define SC_DETAIL_BLEND ( SHADE_CNST(ShaderClass::PASS_LEQUAL, ShaderClass::DEPTH_WRITE_ENABLE, ShaderClass::COLOR_WRITE_ENABLE, ShaderClass::SRCBLEND_ONE, \ - ShaderClass::DSTBLEND_ZERO, ShaderClass::FOG_DISABLE, ShaderClass::GRADIENT_MODULATE, ShaderClass::SECONDARY_GRADIENT_DISABLE, ShaderClass::TEXTURING_ENABLE, \ - ShaderClass::ALPHATEST_DISABLE, ShaderClass::CULL_MODE_ENABLE, ShaderClass::DETAILCOLOR_SCALE, ShaderClass::DETAILALPHA_DISABLE) ) - -static ShaderClass detailOpaqueShader(SC_DETAIL_BLEND); - -/* -#define SC_ALPHA_MIRROR ( SHADE_CNST(ShaderClass::PASS_LEQUAL, ShaderClass::DEPTH_WRITE_DISABLE, ShaderClass::COLOR_WRITE_ENABLE, ShaderClass::SRCBLEND_SRC_ALPHA, \ - ShaderClass::DSTBLEND_ONE_MINUS_SRC_ALPHA, ShaderClass::FOG_DISABLE, ShaderClass::GRADIENT_MODULATE, ShaderClass::SECONDARY_GRADIENT_DISABLE, ShaderClass::TEXTURING_ENABLE, \ - ShaderClass::DETAILCOLOR_DISABLE, ShaderClass::DETAILALPHA_DISABLE, ShaderClass::ALPHATEST_DISABLE, ShaderClass::CULL_MODE_DISABLE, \ - ShaderClass::DETAILCOLOR_DISABLE, ShaderClass::DETAILALPHA_DISABLE) ) - -static ShaderClass mirrorAlphaShader(SC_ALPHA_DETAIL); - -// ShaderClass::PASS_ALWAYS, - -#define SC_ALPHA_2D ( SHADE_CNST(PASS_ALWAYS, DEPTH_WRITE_DISABLE, COLOR_WRITE_ENABLE, \ - SRCBLEND_SRC_ALPHA, DSTBLEND_ONE_MINUS_SRC_ALPHA, FOG_DISABLE, GRADIENT_DISABLE, \ - SECONDARY_GRADIENT_DISABLE, TEXTURING_ENABLE, DETAILCOLOR_DISABLE, DETAILALPHA_DISABLE, \ - ALPHATEST_DISABLE, CULL_MODE_ENABLE, DETAILCOLOR_DISABLE, DETAILALPHA_DISABLE) ) -ShaderClass ShaderClass::_PresetAlpha2DShader(SC_ALPHA_2D); -*/ -//----------------------------------------------------------------------------- -// Private Functions -//----------------------------------------------------------------------------- - -//============================================================================= -// W3DCustomEdging::loadEdgingsInVertexAndIndexBuffers -//============================================================================= -/** Loads the trees into the vertex buffer for drawing. */ -//============================================================================= -void W3DCustomEdging::loadEdgingsInVertexAndIndexBuffers(WorldHeightMap *pMap, Int minX, Int maxX, Int minY, Int maxY) -{ - if (!m_indexEdging || !m_vertexEdging || !m_initialized) { - return; - } - if (!m_anythingChanged) { - return; - } - m_anythingChanged = false; - m_curNumEdgingVertices = 0; - m_curNumEdgingIndices = 0; - VertexFormatXYZDUV2 *vb; - UnsignedShort *ib; - // Lock the buffers. - DX8IndexBufferClass::WriteLockClass lockIdxBuffer(m_indexEdging); - DX8VertexBufferClass::WriteLockClass lockVtxBuffer(m_vertexEdging); - vb=(VertexFormatXYZDUV2*)lockVtxBuffer.Get_Vertex_Array(); - ib = lockIdxBuffer.Get_Index_Array(); - - UnsignedShort *curIb = ib; - - VertexFormatXYZDUV2 *curVb = vb; - - if (minX<0) minX = 0; - if (minY<0) minY = 0; - if (maxX >= pMap->getXExtent()) maxX = pMap->getXExtent()-1; - if (maxY >= pMap->getYExtent()) maxY = pMap->getYExtent()-1; - Int row; - Int column; - for (row=minY; rowgetXExtent(); - Int blend = pMap->m_blendTileNdxes[cellNdx]; - if (blend == 0) continue; // no blend. - - if (pMap->m_blendedTiles[blend].customBlendEdgeClass<0) continue; // alpha blend. - Int i, j; - Real uOffset; - Real vOffset; - - if (pMap->m_blendedTiles[blend].horiz) { - uOffset = 0; - vOffset = 0.25f * (1 + (row&1)); - if (pMap->m_blendedTiles[blend].inverted) { - uOffset = 0.75f; - } - } else if (pMap->m_blendedTiles[blend].vert) { - vOffset = 0.75; - uOffset = 0.25f * (1 + (column&1)); - if (pMap->m_blendedTiles[blend].inverted) { - vOffset = 0.0f; - } - } else if (pMap->m_blendedTiles[blend].rightDiagonal) { - if (pMap->m_blendedTiles[blend].longDiagonal) { - vOffset = 0.25; - uOffset = 0.5; - if (pMap->m_blendedTiles[blend].inverted) { - uOffset = 0.5f; - vOffset = 0.5f; - } - } else { - vOffset = .75; - uOffset = 0; - if (pMap->m_blendedTiles[blend].inverted) { - uOffset = 0.0f; - vOffset = 0.0f; - } - } - } else if (pMap->m_blendedTiles[blend].leftDiagonal) { - if (pMap->m_blendedTiles[blend].longDiagonal) { - uOffset = 0.25f; - vOffset = 0.25f; - if (pMap->m_blendedTiles[blend].inverted) { - uOffset = 0.25f; - vOffset = 0.5f; - } - } else { - vOffset = 0.75; - uOffset = 0.75f; - if (pMap->m_blendedTiles[blend].inverted) { - uOffset = 0.75f; - vOffset = 0.0f; - } - } - } else { - continue; - } - Region2D range; - pMap->getUVForBlend(pMap->m_blendedTiles[blend].customBlendEdgeClass, &range); - - uOffset = range.lo.x + range.width()*uOffset; - vOffset = range.lo.y + range.height()*vOffset; - - UnsignedByte alpha[4]; - float UA[4], VA[4]; - Bool flipForBlend; - pMap->getAlphaUVData(column-pMap->getDrawOrgX(), row-pMap->getDrawOrgY(), UA, VA, alpha, &flipForBlend); - - - Int startVertex = m_curNumEdgingVertices; - for (j=0; j<2; j++) { - for (i=0; i<2; i++) { - if (m_curNumEdgingVertices >= MAX_EDGE_VERTEX) return; - cellNdx = column+i+(row+j)*pMap->getXExtent(); - - Int diffuse = TheTerrainRenderObject->getStaticDiffuse(column+i, row+j); - curVb->diffuse = 0x80000000 + (diffuse&0x00FFFFFF); // set alpha to 5b. - Real theZ; - theZ = ((float)pMap->getDataPtr()[cellNdx])*MAP_HEIGHT_SCALE; - Real X = (column+i)*MAP_XY_FACTOR; - Real Y = (row+j)*MAP_XY_FACTOR; - curVb->u2 = uOffset + i*0.25f*range.width(); - curVb->v2 = vOffset + (1-j)*0.25f*range.height(); - Int ndx; - if (j==0) ndx=i; - if (j==1) ndx = 3-i; - curVb->u1 = UA[ndx]; - curVb->v1 = VA[ndx]; - curVb->x = X; - curVb->y = Y; - curVb->z = theZ; - curVb++; - m_curNumEdgingVertices++; - } - } - Int yOffset = 2; - if (m_curNumEdgingIndices+6 > MAX_EDGE_INDEX) return; -#ifdef FLIP_TRIANGLES // jba - reduces "diamonding" in some cases, not others. Better cliffs, though. - if (flipForBlend) { - *curIb++ = startVertex + 1; - *curIb++ = startVertex + yOffset; - *curIb++ = startVertex ; - *curIb++ = startVertex + 1; - *curIb++ = startVertex + 1+yOffset; - *curIb++ = startVertex + yOffset; - } - else -#endif - { - *curIb++ = startVertex; - *curIb++ = startVertex + 1+yOffset; - *curIb++ = startVertex + yOffset; - *curIb++ = startVertex ; - *curIb++ = startVertex + 1; - *curIb++ = startVertex + 1+yOffset; - } - m_curNumEdgingIndices+=6; - } - } - m_anythingChanged = false; -} - -//----------------------------------------------------------------------------- -// Public Functions -//----------------------------------------------------------------------------- - -//============================================================================= -// W3DCustomEdging::~W3DCustomEdging -//============================================================================= -/** Destructor. Releases w3d assets. */ -//============================================================================= -W3DCustomEdging::~W3DCustomEdging() -{ - freeEdgingBuffers(); -} - -//============================================================================= -// W3DCustomEdging::W3DCustomEdging -//============================================================================= -/** Constructor. Sets m_initialized to true if it finds the w3d models it needs -for the trees. */ -//============================================================================= -W3DCustomEdging::W3DCustomEdging() -{ - m_initialized = false; - m_vertexEdging = nullptr; - m_indexEdging = nullptr; - clearAllEdging(); - allocateEdgingBuffers(); - m_initialized = true; -} - - -//============================================================================= -// W3DCustomEdging::freeEdgingBuffers -//============================================================================= -/** Frees the index and vertex buffers. */ -//============================================================================= -void W3DCustomEdging::freeEdgingBuffers() -{ - REF_PTR_RELEASE(m_vertexEdging); - REF_PTR_RELEASE(m_indexEdging); -} - -//============================================================================= -// W3DCustomEdging::allocateEdgingBuffers -//============================================================================= -/** Allocates the index and vertex buffers. */ -//============================================================================= -void W3DCustomEdging::allocateEdgingBuffers() -{ - m_vertexEdging=NEW_REF(DX8VertexBufferClass,(DX8_FVF_XYZDUV2,MAX_EDGE_VERTEX+4,DX8VertexBufferClass::USAGE_DYNAMIC)); - m_indexEdging=NEW_REF(DX8IndexBufferClass,(2*MAX_EDGE_INDEX+4, DX8IndexBufferClass::USAGE_DYNAMIC)); - m_curNumEdgingVertices=0; - m_curNumEdgingIndices=0; - //m_edgeTexture = MSGNEW("TextureClass") TextureClass("EdgingTemplate.tga","EdgingTemplate.tga", MIP_LEVELS_3); -} - -//============================================================================= -// W3DCustomEdging::clearAllEdging -//============================================================================= -/** Removes all trees. */ -//============================================================================= -void W3DCustomEdging::clearAllEdging() -{ - m_curNumEdgingVertices=0; - m_curNumEdgingIndices=0; - m_anythingChanged = true; -} - - - - -//============================================================================= -// W3DCustomEdging::drawEdging -//============================================================================= -/** Draws the trees. Uses camera to cull. */ -//============================================================================= -void W3DCustomEdging::drawEdging(WorldHeightMap *pMap, Int minX, Int maxX, Int minY, Int maxY, - TextureClass * terrainTexture, TextureClass * cloudTexture, TextureClass * noiseTexture) -{ - static Bool foo = false; - if (foo) { - return; - } - //m_anythingChanged = true; - loadEdgingsInVertexAndIndexBuffers(pMap, minX, maxX, minY, maxY); - - if (m_curNumEdgingIndices == 0) { - return; - } - TextureClass *edgeTex = pMap->getEdgeTerrainTexture(); - // Setup the vertex buffer, shader & texture. - DX8Wrapper::Set_Index_Buffer(m_indexEdging,0); - DX8Wrapper::Set_Vertex_Buffer(m_vertexEdging); - DX8Wrapper::Set_Shader(detailAlphaTestShader); -#ifdef RTS_DEBUG - //DX8Wrapper::Set_Shader(detailShader); // shows clipping. -#endif - - DX8Wrapper::Set_Texture(0,terrainTexture); - DX8Wrapper::Set_Texture(1,edgeTex); - DX8Wrapper::Apply_Render_State_Changes(); - - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHAREF,0x7B); - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHAFUNC,D3DCMP_LESSEQUAL); //pass pixels who's alpha is not zero - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHATESTENABLE, true); //test pixels if transparent(clipped) before rendering. - DX8Wrapper::Draw_Triangles( m_curEdgingIndexOffset, m_curNumEdgingIndices/3, 0, m_curNumEdgingVertices); - - DX8Wrapper::Set_Texture(0,edgeTex); - DX8Wrapper::Set_Texture(1, nullptr); - // Draw the custom edge. - DX8Wrapper::Apply_Render_State_Changes(); - - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHAREF,0x84); - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHAFUNC,D3DCMP_GREATEREQUAL); //pass pixels who's alpha is not zero - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHATESTENABLE, true); //test pixels if transparent(clipped) before rendering. - DX8Wrapper::Draw_Triangles( m_curEdgingIndexOffset, m_curNumEdgingIndices/3, 0, m_curNumEdgingVertices); - -#if 0 // Dumps out unmasked data. - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHABLENDENABLE,false); - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHATESTENABLE, false); //test pixels if transparent(clipped) before rendering. - DX8Wrapper::Draw_Triangles( m_curEdgingIndexOffset, m_curNumEdgingIndices/3, 0, m_curNumEdgingVertices); -#endif - DX8Wrapper::Set_Texture(1, nullptr); - if (cloudTexture) { - DX8Wrapper::Set_Shader(detailOpaqueShader); - DX8Wrapper::Apply_Render_State_Changes(); - DX8Wrapper::Set_Texture(1,edgeTex); - DX8Wrapper::Apply_Render_State_Changes(); - DX8Wrapper::Set_Texture(0,cloudTexture); - DX8Wrapper::Apply_Render_State_Changes(); -#if 1 - DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_ALPHAARG1, D3DTA_CURRENT ); - DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 ); - - DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_COLORARG1, D3DTA_CURRENT ); - DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_COLORARG2, D3DTA_TEXTURE ); - DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_COLOROP, D3DTOP_SELECTARG1 ); - DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAARG1, D3DTA_CURRENT ); - DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAARG2, D3DTA_TEXTURE ); - DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2 ); - DX8Wrapper::Set_DX8_Texture_Stage_State( 1, D3DTSS_TEXCOORDINDEX, 1 ); -#endif - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHAREF,0x80); - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHAFUNC,D3DCMP_NOTEQUAL); //pass pixels who's alpha is not zero - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHATESTENABLE, true); //test pixels if transparent(clipped) before rendering. - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHABLENDENABLE,true); - DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND,D3DBLEND_DESTCOLOR); - DX8Wrapper::Set_DX8_Render_State(D3DRS_DESTBLEND,D3DBLEND_ZERO); - DX8Wrapper::Draw_Triangles( m_curEdgingIndexOffset, m_curNumEdgingIndices/3, 0, m_curNumEdgingVertices); - } - if (noiseTexture) { - DX8Wrapper::Set_Texture(1, nullptr); - DX8Wrapper::Set_Texture(0,noiseTexture); - DX8Wrapper::Apply_Render_State_Changes(); - DX8Wrapper::Set_Texture(1,edgeTex); - DX8Wrapper::Apply_Render_State_Changes(); - - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHAREF,0x80); - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHAFUNC,D3DCMP_NOTEQUAL); //pass pixels who's alpha is not zero - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHATESTENABLE, true); //test pixels if transparent(clipped) before rendering. - DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHABLENDENABLE,true); - DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND,D3DBLEND_DESTCOLOR); - DX8Wrapper::Set_DX8_Render_State(D3DRS_DESTBLEND,D3DBLEND_ZERO); - DX8Wrapper::Draw_Triangles( m_curEdgingIndexOffset, m_curNumEdgingIndices/3, 0, m_curNumEdgingVertices); - } -} - - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp deleted file mode 100644 index 4ef30d60f9e..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugDisplay.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//---------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//---------------------------------------------------------------------------- -// -// Project: Generals -// -// Module: Debug -// -// File name: W3DGameDevice/GameClient/W3DDebugDisplay.cpp -// -// Created: 11/13/01 TR -// -//---------------------------------------------------------------------------- - -//---------------------------------------------------------------------------- -// Includes -//---------------------------------------------------------------------------- - -#include "W3DDevice/GameClient/W3DDebugDisplay.h" -#include "GameClient/GameFont.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/DisplayString.h" - -//---------------------------------------------------------------------------- -// Externals -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Defines -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Types -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Data -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Public Data -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Prototypes -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Private Functions -//---------------------------------------------------------------------------- - - - -//---------------------------------------------------------------------------- -// Public Functions -//---------------------------------------------------------------------------- - -//============================================================================ -// W3DDebugDisplay::W3DDebugDisplay -//============================================================================ - -W3DDebugDisplay::W3DDebugDisplay() -: m_displayString(nullptr) -{ - -} - -//============================================================================ -// W3DDebugDisplay::~W3DDebugDisplay -//============================================================================ - -W3DDebugDisplay::~W3DDebugDisplay() -{ - if ( m_displayString ) - { - TheDisplayStringManager->freeDisplayString( m_displayString ); - } -} - -//============================================================================ -// W3DDebugDisplay::init -//============================================================================ - -void W3DDebugDisplay::init() -{ - m_displayString = TheDisplayStringManager->newDisplayString(); -} - -//============================================================================ -// W3DDebugDisplay::drawText -//============================================================================ - -void W3DDebugDisplay::drawText( Int x, Int y, Char *text ) -{ - if ( m_font == nullptr || m_displayString == nullptr ) - { - return ; - } - - ::Color textColor = GameMakeColor( 255, 255, 255, 255 ); - ::Color dropColor = GameMakeColor( 0, 0, 0, 255 ); - - UnicodeString unicode; - - unicode.translate( AsciiString( text ) ); - m_displayString->setText( unicode ); - m_displayString->draw( x*m_fontWidth, 13 + y*m_fontHeight, textColor, dropColor ); -} - -//============================================================================ -// W3DDebugDisplay::setFont -//============================================================================ - -void W3DDebugDisplay::setFont( GameFont *font ) -{ - m_font = font; - if ( m_displayString ) - { - m_displayString->setFont( m_font ); - } -} - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp deleted file mode 100644 index 356012c265a..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDebugIcons.cpp +++ /dev/null @@ -1,317 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DDebugIcons.cpp //////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: Heightmap.cpp -// -// Created: John Ahlquist, March 2002 -// -// Desc: Draws huge numbers of debug icons for pathfinding quickly. -// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// Includes -//----------------------------------------------------------------------------- - -#include "W3DDevice/GameClient/W3DDebugIcons.h" - -#include "Common/GlobalData.h" -#include "GameLogic/GameLogic.h" -#include "Common/MapObject.h" -#include "WW3D2/dx8wrapper.h" - -#if defined(RTS_DEBUG) - -// Texturing, no zbuffer, disabled zbuffer write, primary gradient, alpha blending -#define SC_OPAQUE ( SHADE_CNST(ShaderClass::PASS_ALWAYS, ShaderClass::DEPTH_WRITE_DISABLE, ShaderClass::COLOR_WRITE_ENABLE, ShaderClass::SRCBLEND_ONE, \ - ShaderClass::DSTBLEND_ZERO, ShaderClass::FOG_DISABLE, ShaderClass::GRADIENT_DISABLE, ShaderClass::SECONDARY_GRADIENT_DISABLE, ShaderClass::TEXTURING_ENABLE, \ - ShaderClass::ALPHATEST_DISABLE, ShaderClass::CULL_MODE_DISABLE, \ - ShaderClass::DETAILCOLOR_DISABLE, ShaderClass::DETAILALPHA_DISABLE) ) - -// Texturing, no zbuffer, disabled zbuffer write, primary gradient, alpha blending -#define SC_ALPHA ( SHADE_CNST(ShaderClass::PASS_ALWAYS, ShaderClass::DEPTH_WRITE_DISABLE, ShaderClass::COLOR_WRITE_ENABLE, ShaderClass::SRCBLEND_SRC_ALPHA, \ - ShaderClass::DSTBLEND_ONE_MINUS_SRC_ALPHA, ShaderClass::FOG_DISABLE, ShaderClass::GRADIENT_MODULATE, ShaderClass::SECONDARY_GRADIENT_DISABLE, ShaderClass::TEXTURING_ENABLE, \ - ShaderClass::ALPHATEST_DISABLE, ShaderClass::CULL_MODE_ENABLE, \ - ShaderClass::DETAILCOLOR_DISABLE, ShaderClass::DETAILALPHA_DISABLE) ) - -// Texturing, no zbuffer, disabled zbuffer write, primary gradient, alpha blending -#define SC_ALPHA_Z ( SHADE_CNST(ShaderClass::PASS_LEQUAL, ShaderClass::DEPTH_WRITE_DISABLE, ShaderClass::COLOR_WRITE_ENABLE, ShaderClass::SRCBLEND_SRC_ALPHA, \ - ShaderClass::DSTBLEND_ONE_MINUS_SRC_ALPHA, ShaderClass::FOG_DISABLE, ShaderClass::GRADIENT_MODULATE, ShaderClass::SECONDARY_GRADIENT_DISABLE, ShaderClass::TEXTURING_ENABLE, \ - ShaderClass::ALPHATEST_DISABLE, ShaderClass::CULL_MODE_DISABLE, \ - ShaderClass::DETAILCOLOR_DISABLE, ShaderClass::DETAILALPHA_DISABLE) ) - -// Texturing, no zbuffer, disabled zbuffer write, primary gradient, alpha blending -#define SC_OPAQUE_Z ( SHADE_CNST(ShaderClass::PASS_LEQUAL, ShaderClass::DEPTH_WRITE_DISABLE, ShaderClass::COLOR_WRITE_ENABLE, ShaderClass::SRCBLEND_ONE, \ - ShaderClass::DSTBLEND_ZERO, ShaderClass::FOG_DISABLE, ShaderClass::GRADIENT_DISABLE, ShaderClass::SECONDARY_GRADIENT_DISABLE, ShaderClass::TEXTURING_ENABLE, \ - ShaderClass::ALPHATEST_DISABLE, ShaderClass::CULL_MODE_DISABLE, \ - ShaderClass::DETAILCOLOR_DISABLE, ShaderClass::DETAILALPHA_DISABLE) ) - - -void addIcon(const Coord3D *pos, Real width, Int numFramesDuration, RGBColor color) -{ - W3DDebugIcons::addIcon(pos, width, numFramesDuration, color); -} - - -struct DebugIcon { - Coord3D position; - Real width; // all are squares centered about pos. - RGBColor color; - Int endFrame; // Frame when this disappears. -}; - -DebugIcon *W3DDebugIcons::m_debugIcons = nullptr; -Int W3DDebugIcons::m_numDebugIcons = 0; -Int W3DDebugIcons::m_maxDebugIcons = 0; - -W3DDebugIcons::~W3DDebugIcons() -{ - REF_PTR_RELEASE(m_vertexMaterialClass); - delete[] m_debugIcons; - m_debugIcons = nullptr; - m_numDebugIcons = 0; -} - -W3DDebugIcons::W3DDebugIcons(Int mapWidth, Int mapHeight) -{ - m_maxDebugIcons = mapWidth * mapHeight; - //go with a preset material for now. - m_vertexMaterialClass=VertexMaterialClass::Get_Preset(VertexMaterialClass::PRELIT_DIFFUSE); - allocateIconsArray(); -} - - -bool W3DDebugIcons::Cast_Ray(RayCollisionTestClass & raytest) -{ - - return false; - -} - - -//@todo: MW Handle both of these properly!! -W3DDebugIcons::W3DDebugIcons(const W3DDebugIcons & src) -{ - *this = src; -} - -W3DDebugIcons & W3DDebugIcons::operator = (const W3DDebugIcons & that) -{ - DEBUG_CRASH(("oops")); - return *this; -} - -void W3DDebugIcons::Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const -{ - Vector3 ObjSpaceCenter(TheGlobalData->m_waterExtentX,TheGlobalData->m_waterExtentY,50*MAP_XY_FACTOR); - float length = ObjSpaceCenter.Length(); - - sphere.Init(ObjSpaceCenter, length); -} - -void W3DDebugIcons::Get_Obj_Space_Bounding_Box(AABoxClass & box) const -{ - Vector3 minPt(-2*TheGlobalData->m_waterExtentX,-2*TheGlobalData->m_waterExtentY,0); - Vector3 maxPt(2*TheGlobalData->m_waterExtentX,2*TheGlobalData->m_waterExtentY,100*MAP_XY_FACTOR); - box.Init(minPt,maxPt); -} - -Int W3DDebugIcons::Class_ID() const -{ - return RenderObjClass::CLASSID_UNKNOWN; -} - -RenderObjClass * W3DDebugIcons::Clone() const -{ - return NEW W3DDebugIcons(*this); // poolify -} - - -void W3DDebugIcons::allocateIconsArray() -{ - DEBUG_ASSERTCRASH(m_debugIcons == nullptr, ("debugIcons array already allocated!")); - m_debugIcons = NEW DebugIcon[m_maxDebugIcons]; - m_numDebugIcons = 0; -} - - -void W3DDebugIcons::compressIconsArray() -{ - if (m_debugIcons && m_numDebugIcons > 0) { - Int newNum = 0; - Int i; - for (i=0; i= TheGameLogic->getFrame() && i>newNum) { - m_debugIcons[newNum] = m_debugIcons[i]; - newNum++; - } - } - m_numDebugIcons = newNum; - } -} - -static Int maxIcons = 0; - -void W3DDebugIcons::addIcon(const Coord3D *pos, Real width, Int numFramesDuration, RGBColor color) -{ - if (pos==nullptr) { - if (m_numDebugIcons > maxIcons) { - DEBUG_LOG(("Max icons %d", m_numDebugIcons)); - maxIcons = m_numDebugIcons; - } - m_numDebugIcons = 0; - return; - } - if (m_numDebugIcons>= m_maxDebugIcons) return; - if (m_debugIcons==nullptr) return; - m_debugIcons[m_numDebugIcons].position = *pos; - m_debugIcons[m_numDebugIcons].width = width; - m_debugIcons[m_numDebugIcons].color = color; - m_debugIcons[m_numDebugIcons].endFrame = TheGameLogic->getFrame()+numFramesDuration; - m_numDebugIcons++; -} - -/** Render draws into the current 3d context. */ -void W3DDebugIcons::Render(RenderInfoClass & rinfo) -{ - // - if (WW3D::Are_Static_Sort_Lists_Enabled()) { - WW3D::Add_To_Static_Sort_List(this, 1); - return; - } - // - Bool anyVanished = false; - if (m_numDebugIcons==0) return; - DX8Wrapper::Apply_Render_State_Changes(); - - DX8Wrapper::Set_Material(m_vertexMaterialClass); - DX8Wrapper::Set_Texture(0, nullptr); - DX8Wrapper::Apply_Render_State_Changes(); - - Matrix3D tm(Transform); - DX8Wrapper::Set_Transform(D3DTS_WORLD,tm); - - Int numRect = m_numDebugIcons; - static Real offset = 30; - const Int MAX_RECT = 5000; // cap drawing n rects. - if (numRect > MAX_RECT) numRect = MAX_RECT; - offset+= 0.5f; - Int k; - for (k=0; kgetFrame(); - if (framesLeft < 1) { - anyVanished = true; - continue; - } - if (framesLeftx= pt1.x-halfWidth; - vb->y= pt1.y-halfWidth; - vb->z= pt1.z; - vb->diffuse=diffuse; // b g<<8 r<<16 a<<24. - vb->u1=0 ; - vb->v1=0 ; - vb++; - vb->x= pt1.x+halfWidth; - vb->y= pt1.y-halfWidth; - vb->z= pt1.z; - vb->diffuse=diffuse; // b g<<8 r<<16 a<<24. - vb->u1=0 ; - vb->v1=0 ; - vb++; - vb->x= pt1.x+halfWidth; - vb->y= pt1.y+halfWidth; - vb->z= pt1.z; - vb->diffuse=diffuse; // b g<<8 r<<16 a<<24. - vb->u1=0 ; - vb->v1=0 ; - vb++; - vb->x= pt1.x-halfWidth; - vb->y= pt1.y+halfWidth; - vb->z= pt1.z; - vb->diffuse=diffuse; // b g<<8 r<<16 a<<24. - vb->u1=0 ; - vb->v1=0 ; - vb++; - *curIb++ = numVertex; - *curIb++ = numVertex+1; - *curIb++ = numVertex+2; - *curIb++ = numVertex; - *curIb++ = numVertex+2; - *curIb++ = numVertex+3; - curIndex += 6; - numVertex += 4; - } - } - if (numVertex == 0) break; - DX8Wrapper::Set_Shader(ShaderClass(SC_ALPHA)); - DX8Wrapper::Set_Index_Buffer(ib_access,0); - DX8Wrapper::Set_Vertex_Buffer(vb_access); - DX8Wrapper::Draw_Triangles( 0,curIndex/3, 0, numVertex); //draw a quad, 2 triangles, 4 verts - } - - if (anyVanished) { - compressIconsArray(); - } -} - -#endif // RTS_DEBUG diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp deleted file mode 100644 index 8b046b02ffd..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayString.cpp +++ /dev/null @@ -1,396 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DDisplayString.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: W3DDisplayString.cpp -// -// Created: Colin Day, July 2001 -// -// Desc: Display string W3D implementation, display strings hold -// double byte characters and all the data we need to render -// those strings to the screen. -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameClient.h" -#include "W3DDevice/GameClient/W3DDisplayString.h" -#include "GameClient/HotKey.h" -#include "GameClient/GameFont.h" -#include "GameClient/GlobalLanguage.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// W3DDisplayString::W3DDisplayString ========================================= -/** */ -//============================================================================= -W3DDisplayString::W3DDisplayString() -{ - - m_textChanged = FALSE; - m_textPos.x = 0; - m_textPos.y = 0; - m_currTextColor = 0; - m_currDropColor = 0; - m_size.x = 0; - m_size.y = 0; - m_fontChanged = FALSE; - m_clipRegion.lo.x = 0; - m_clipRegion.lo.y = 0; - m_clipRegion.hi.x = 0; - m_clipRegion.hi.y = 0; - m_lastResourceFrame = 0; - m_useHotKey = FALSE; - m_hotKeyPos.x = 0; - m_hotKeyPos.y = 0; - m_hotKeyColor = GameMakeColor(255,255,255,255); - -} - -// W3DDisplayString::~W3DDisplayString ======================================== -/** */ -//============================================================================= -W3DDisplayString::~W3DDisplayString() -{ - -} - -// W3DDisplayString::textChanged ============================================== -/** This method automatically gets called from some methods in the display - * class so that we can write our own code here to to appropriate things - * on the changing of string data */ -//============================================================================= -void W3DDisplayString::notifyTextChanged() -{ - - // extend functionality - DisplayString::notifyTextChanged(); - if(TheGlobalLanguageData) - { - if(TheGlobalLanguageData->m_useHardWrap == TRUE) - { - m_textRenderer.Set_Use_Hard_Word_Wrap(true); - m_textRendererHotKey.Set_Use_Hard_Word_Wrap(true); - } - else - { - m_textRenderer.Set_Use_Hard_Word_Wrap(false); - m_textRendererHotKey.Set_Use_Hard_Word_Wrap(false); - } - } - - // get our new text extents - computeExtents(); - - // - // set a flag so that if it comes that we need to render this string - // we know we must first build the sentence - // - m_textChanged = TRUE; - - // reset data for our text renderer - m_textRenderer.Reset(); - m_textRendererHotKey.Reset(); - -} - -// W3DDisplayString::Draw ===================================================== -/** Draw the text at the specified location in in the specified colors - * in the parameters. Since we keep an instance of the rendered text - * texture around, this is the time to check to see if any of our - * properties have changed since the last render, like color, or - * position, or content. If they have, we need to rebuild the sentence - * texture for rendering */ -//============================================================================= -void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor ) -{ - draw(x,y, color, dropColor, 1, 1); -} -void W3DDisplayString::draw( Int x, Int y, Color color, Color dropColor, Int xDrop, Int yDrop ) -{ - Bool needNewPolys = FALSE; - - // sanity - if( getTextLength() == 0 ) - return; // nothing to draw - - // if our font or text has changed we need to build a new sentence - if( m_fontChanged || m_textChanged ) - { - if(m_useHotKey) - { - m_textRenderer.Set_Hot_Key_Parse(TRUE); - m_textRenderer.Build_Sentence( getText().str(), &m_hotKeyPos.x, &m_hotKeyPos.y ); - m_hotkey.translate(TheHotKeyManager->searchHotKey(getText())); - if(!m_hotkey.isEmpty()) - m_textRendererHotKey.Build_Sentence(m_hotkey.str(), nullptr, nullptr); - else - { - m_useHotKey = FALSE; - m_textRendererHotKey.Reset(); - } - } - else - m_textRenderer.Build_Sentence( getText().str(), nullptr, nullptr ); - m_fontChanged = FALSE; - m_textChanged = FALSE; - needNewPolys = TRUE; - - } - - // - // if our position has changed, or our colors have changed, or our - // text data has changed, we need to redo the texture quads - // - if( needNewPolys || - x != m_textPos.x || - y != m_textPos.y || - color != m_currTextColor || - dropColor != m_currDropColor ) - { - - // save the new attributes of the text position and color - m_textPos.x = x; - m_textPos.y = y; - m_currTextColor = color; - m_currDropColor = dropColor; - - // reset the quads - m_textRenderer.Reset_Polys(); - - // draw the shadow - m_textRenderer.Set_Location( Vector2( m_textPos.x + xDrop, m_textPos.y + yDrop) ); - m_textRenderer.Draw_Sentence( m_currDropColor ); - - // draw the text - m_textRenderer.Set_Location( Vector2( m_textPos.x, m_textPos.y ) ); - m_textRenderer.Draw_Sentence( m_currTextColor ); - - if(m_useHotKey) - { - m_textRendererHotKey.Reset_Polys(); - m_textRendererHotKey.Set_Location( Vector2( m_textPos.x + m_hotKeyPos.x , m_textPos.y +m_hotKeyPos.y) ); - m_textRendererHotKey.Draw_Sentence( m_hotKeyColor ); - m_textRendererHotKey.Render(); - } - - } - - // render the text - m_textRenderer.Render(); - - // we are for sure using display resources now - if( TheGameClient ) - usingResources( TheGameClient->getFrame() ); - -} - -// W3DDisplayString::getSize ================================================== -/** Get the render size width and height of the string in this instance - * with the font associated with it */ -//============================================================================= -void W3DDisplayString::getSize( Int *width, Int *height ) -{ - - // assign the width and height we have stored to parameters present - if( width ) - *width = m_size.x; - if( height ) - *height = m_size.y; - -} - -// DisplayString::appendChar ================================================== -/** Get text with up to charPos characters, -1 = all characters */ -//============================================================================= - -Int W3DDisplayString::getWidth( Int charPos ) -{ - FontCharsClass * font; - Int width = 0; - Int count = 0; - - font = m_textRenderer.Peek_Font(); - - if ( font ) - { - const WideChar *text = m_textString.str(); - WideChar ch; - - while ( (ch = *text++ ) != 0 && ( charPos == -1 || count < charPos ) ) - { - if ( ch != (WideChar)'\n' ) - { - width += font->Get_Char_Spacing( ch ); - } - count++; - } - } - - return width; -} - -// W3DDisplayString::setFont ================================================== -/** Set the font for this particular display string */ -//============================================================================= -void W3DDisplayString::setFont( GameFont *font ) -{ - - // sanity - if( font == nullptr ) - return; - - // if the new font is the same as our existing font do nothing - if( m_font == font ) - return; - - // extending functionality - DisplayString::setFont( font ); - - // set the font in our renderer - m_textRenderer.Set_Font( static_cast(m_font->fontData) ); - - m_textRendererHotKey.Set_Font( static_cast(TheFontLibrary->getFont(font->nameString,font->pointSize, TRUE)->fontData) ); - // recompute extents for text with new font - computeExtents(); - - // set flag telling us the font has changed since last render - m_fontChanged = TRUE; - -} - -// W3DDisplayString::setClipRegion ============================================ -/** Set the clipping region for the text */ -//============================================================================= -void W3DDisplayString::setClipRegion( IRegion2D *region ) -{ - - // extend functionality - DisplayString::setClipRegion( region ); - - // only consider regions that are actual changes - if( region->lo.x != m_clipRegion.lo.x || - region->lo.y != m_clipRegion.lo.y || - region->hi.x != m_clipRegion.hi.x || - region->hi.y != m_clipRegion.hi.y ) - { - - // assign new region - m_clipRegion = *region; - - // set new region in renderer - m_textRenderer.Set_Clipping_Rect( RectClass( m_clipRegion.lo.x, - m_clipRegion.lo.y, - m_clipRegion.hi.x, - m_clipRegion.hi.y ) ); - m_textRendererHotKey.Set_Clipping_Rect( RectClass( m_clipRegion.lo.x, - m_clipRegion.lo.y, - m_clipRegion.hi.x, - m_clipRegion.hi.y ) ); - } - -} - -// W3DDisplayString::computeExtents =========================================== -/** Update the width and height of our string */ -//============================================================================= -void W3DDisplayString::computeExtents() -{ - UnsignedInt len = getTextLength(); - - // if we have no string, or no font we don't have a size yet - if( len == 0 || m_font == nullptr ) - { - - m_size.x = 0; - m_size.y = 0; - - } - else - { - - Vector2 extents = m_textRenderer.Get_Formatted_Text_Extents(getText().str()); //Get_Text_Extents( getText().str() ); - m_size.x = extents.X; - m_size.y = extents.Y; - - } - -} - -// W3DDisplayString::setWordWrap =========================================== -/** Set the wordwrap of the m_textRenderer */ -//============================================================================= -void W3DDisplayString::setWordWrap( Int wordWrap ) -{ - // set the Word Wrap - if(m_textRenderer.Set_Wrapping_Width(wordWrap)) - notifyTextChanged(); -} - -void W3DDisplayString::setUseHotkey( Bool useHotkey, Color hotKeyColor ) -{ - m_useHotKey = useHotkey; - m_hotKeyColor = hotKeyColor; - m_textRenderer.Set_Hot_Key_Parse(useHotkey); - notifyTextChanged(); -} - -// W3DDisplayString::setWordWrapCentered ====================================== -/** Set the whether or not we want to center each new line in a text string */ -//============================================================================= -void W3DDisplayString::setWordWrapCentered( Bool isCentered ) -{ - // set the Word Wrap - if( m_textRenderer.Set_Word_Wrap_Centered(isCentered) ) - notifyTextChanged(); -} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp deleted file mode 100644 index d67d6282d30..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DDisplayStringManager.cpp ////////////////////////////////////////////////////////////// -// Created: Colin Day, July 2001 -// Desc: Display string Manager for W3D -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include - -#include "Common/Debug.h" -#include "GameClient/GameClient.h" -#include "GameClient/GameText.h" -#include "GameClient/DisplayString.h" -#include "GameClient/DrawGroupInfo.h" -#include "GameClient/GlobalLanguage.h" -#include "W3DDevice/GameClient/W3DDisplayStringManager.h" - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS -/////////////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -W3DDisplayStringManager::W3DDisplayStringManager() -{ - for (Int i = 0; i < MAX_GROUPS; ++i) - { - m_groupNumeralStrings[i] = nullptr; - } - - m_formationLetterDisplayString = nullptr; - -} - -//------------------------------------------------------------------------------------------------- -W3DDisplayStringManager::~W3DDisplayStringManager() -{ - for (Int i = 0; i < MAX_GROUPS; ++i) - { - if (m_groupNumeralStrings[i]) - freeDisplayString(m_groupNumeralStrings[i]); - m_groupNumeralStrings[i] = nullptr; - } - - if (m_formationLetterDisplayString) - freeDisplayString( m_formationLetterDisplayString ); - m_formationLetterDisplayString = nullptr; - - -} - -//------------------------------------------------------------------------------------------------- -void W3DDisplayStringManager::postProcessLoad() -{ - // Get the font. - GameFont *font = TheFontLibrary->getFont( - TheDrawGroupInfo->m_fontName, - TheDrawGroupInfo->m_fontSize, - TheDrawGroupInfo->m_fontIsBold ); - - for (Int i = 0; i < MAX_GROUPS; ++i) - { - m_groupNumeralStrings[i] = newDisplayString(); - m_groupNumeralStrings[i]->setFont(font); - AsciiString displayNumber; - displayNumber.format("NUMBER:%d", i); - m_groupNumeralStrings[i]->setText(TheGameText->fetch(displayNumber)); - } - - m_formationLetterDisplayString = newDisplayString(); - m_formationLetterDisplayString->setFont(font); - AsciiString displayLetter; - displayLetter.format("LABEL:FORMATION"); - m_formationLetterDisplayString->setText(TheGameText->fetch(displayLetter)); - - -} - -//------------------------------------------------------------------------------------------------- -/** Allocate a new display string and tie it to the master list so we - * can keep track of it */ -//------------------------------------------------------------------------------------------------- -DisplayString *W3DDisplayStringManager::newDisplayString() -{ - DisplayString *newString = newInstance(W3DDisplayString); - - // sanity - if( newString == nullptr ) - { - - DEBUG_LOG(( "newDisplayString: Could not allocate new W3D display string" )); - assert( 0 ); - return nullptr; - - } - - // assign a default font - if (TheGlobalLanguageData && TheGlobalLanguageData->m_defaultDisplayStringFont.name.isNotEmpty()) - { - newString->setFont(TheFontLibrary->getFont( - TheGlobalLanguageData->m_defaultDisplayStringFont.name, - TheGlobalLanguageData->m_defaultDisplayStringFont.size, - TheGlobalLanguageData->m_defaultDisplayStringFont.bold) ); - } - else - newString->setFont( TheFontLibrary->getFont( "Times New Roman", 12, FALSE ) ); - - // link string to list - link( newString ); - - // return our new string - return newString; - -} - -//------------------------------------------------------------------------------------------------- -/** Remove a display string from the master list and delete the data */ -//------------------------------------------------------------------------------------------------- -void W3DDisplayStringManager::freeDisplayString( DisplayString *string ) -{ - - // sanity - if( string == nullptr ) - return; - - // unlink - unLink( string ); - - // if the string happens to fall where our current checkpoint was, set the checkpoint to null - if ( m_currentCheckpoint == string) { - m_currentCheckpoint = nullptr; - } - - // free data - deleteInstance(string); - -} - -//------------------------------------------------------------------------------------------------- -/** Update method for our display string Manager ... if it's been too - * long since the last time a string has been rendered, we will free - * the rendering resources of the string, if it needs to render again - * the DisplayString will have to rebuild the rendering data before - * the draw will work */ -//------------------------------------------------------------------------------------------------- -void W3DDisplayStringManager::update() -{ - // call base in case we add something later - DisplayStringManager::update(); - - W3DDisplayString *string = static_cast(m_stringList); - - // if the m_currentCheckpoint is valid, use it for the starting point for the search - if (m_currentCheckpoint) { - string = static_cast(m_currentCheckpoint); - } - - UnsignedInt currFrame = TheGameClient->getFrame(); - const UnsignedInt w3dCleanupTime = 60; /** any string not rendered after - this many frames will have its - render resources freed */ - - int numStrings = 10; - // looping through all the strings eats up a lot of ambient time. Instead, - // loop through 10 (arbitrarily chosen) or till the end is hit. - while ( numStrings-- && string) - { - - // - // has this string "expired" in terms of using resources, a string - // with a resource frame of zero isn't using any resources at all - // - if( string->m_lastResourceFrame != 0 && - currFrame - string->m_lastResourceFrame > w3dCleanupTime ) - { - - // free the resources - string->m_textRenderer.Reset(); - string->m_textRendererHotKey.Reset(); - // - // mark data in the string as changed so that if it needs to - // be drawn again it will know to reconstruct the render data - // - string->m_textChanged = TRUE; - - // - // set the last resource frame to zero, this allows us to ignore it - // in future cleanup passes of this update routine - // - string->m_lastResourceFrame = 0; - - } - - // move to next string - string = static_cast(string->next()); - - } - - // reset the starting point for our next search - m_currentCheckpoint = string; -} - -//------------------------------------------------------------------------------------------------- -DisplayString *W3DDisplayStringManager::getGroupNumeralString( Int numeral ) -{ - if (numeral < 0 || numeral > MAX_GROUPS - 1 ) - { - DEBUG_CRASH(("Numeral '%d' out of range.", numeral)); - return m_groupNumeralStrings[0]; - } - - return m_groupNumeralStrings[numeral]; -} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDynamicLight.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDynamicLight.cpp deleted file mode 100644 index baed5159489..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDynamicLight.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// W3DDynamicLight.cpp -// Class to handle dynamic lights. -// Author: John Ahlquist, April 2001 -#include - -#include "W3DDevice/GameClient/W3DDynamicLight.h" - -W3DDynamicLight::W3DDynamicLight(): -LightClass(LightClass::POINT) -{ - - m_priorEnable = false; - m_enabled = true; - -} - -W3DDynamicLight::~W3DDynamicLight() -{ -} - -void W3DDynamicLight::On_Frame_Update() -{ - if (!m_enabled) { - return; - } - Real factor = 1.0f; - if (m_curIncreaseFrameCount>0 && m_increaseFrameCount>0) { - // increasing - m_curIncreaseFrameCount--; - factor = (m_increaseFrameCount-m_curIncreaseFrameCount)/(Real)m_increaseFrameCount; - - } else if (m_decayFrameCount==0) { - factor = 1.0; // never decays, - } else { - m_curDecayFrameCount--; - if (m_curDecayFrameCount == 0) { - m_enabled = false; - return; - } - factor = m_curDecayFrameCount/(Real)m_decayFrameCount; - } - if (m_decayRange) { - this->FarAttenEnd = factor*m_targetRange; - if (FarAttenEnd < FarAttenStart) { - FarAttenEnd = FarAttenStart; - } - } - if (m_decayColor) { - this->Ambient = m_targetAmbient*factor; - this->Diffuse = m_targetDiffuse*factor; - } -} - -void W3DDynamicLight::setFrameFade(UnsignedInt frameIncreaseTime, UnsignedInt decayFrameTime) -{ - m_decayFrameCount = decayFrameTime; - m_curDecayFrameCount = decayFrameTime; - m_curIncreaseFrameCount = frameIncreaseTime; - m_increaseFrameCount = frameIncreaseTime; - m_targetAmbient = Ambient; - m_targetDiffuse = Diffuse; - m_targetRange = FarAttenEnd; -} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp deleted file mode 100644 index dec0b3a473d..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp +++ /dev/null @@ -1,733 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: W3DInGameUI.cpp ////////////////////////////////////////////////////////////////////////// -// Author: Colin Day, April 2001 -// Desct: In game user interface implementation for W3D -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include - -#include "Common/GlobalData.h" -#include "Common/ThingTemplate.h" -#include "Common/ThingFactory.h" -#include "GameLogic/TerrainLogic.h" -#include "GameLogic/GameLogic.h" -#include "GameLogic/Object.h" -#include "GameClient/Drawable.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GameClient.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetSlider.h" -#include "GameClient/ControlBar.h" -#include "W3DDevice/GameClient/W3DAssetManager.h" -#include "W3DDevice/GameClient/W3DGUICallbacks.h" -#include "W3DDevice/GameClient/W3DInGameUI.h" -#include "W3DDevice/GameClient/W3DDisplay.h" -#include "W3DDevice/GameClient/W3DScene.h" -#include "W3DDevice/Common/W3DConvert.h" -#include "WW3D2/ww3d.h" -#include "WW3D2/hanim.h" - -#include "Common/UnitTimings.h" //Contains the DO_UNIT_TIMINGS define jba. - - - -#ifdef RTS_DEBUG -#include "W3DDevice/GameClient/HeightMap.h" -#include "WW3D2/dx8indexbuffer.h" -#include "WW3D2/dx8vertexbuffer.h" -#include "WW3D2/vertmaterial.h" -class DebugHintObject : public RenderObjClass -{ - -public: - - DebugHintObject(); - DebugHintObject(const DebugHintObject & src); - DebugHintObject & operator = (const DebugHintObject &); - ~DebugHintObject(); - - virtual RenderObjClass * Clone() const; - virtual int Class_ID() const; - virtual void Render(RenderInfoClass & rinfo); - virtual Bool Cast_Ray(RayCollisionTestClass & raytest); - - virtual void Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const; - virtual void Get_Obj_Space_Bounding_Box(AABoxClass & aabox) const; - - int updateBlock(); - void freeMapResources(); - void setLocAndColorAndSize(const Coord3D *loc, Int argb, Int size); - -protected: - - Coord3D m_myLoc; - Int m_myColor; // argb - Int m_mySize; - - DX8IndexBufferClass *m_indexBuffer; - ShaderClass m_shaderClass; //shader or rendering state for heightmap - VertexMaterialClass *m_vertexMaterialClass; - DX8VertexBufferClass *m_vertexBufferTile; //First vertex buffer. - - void initData(); -}; - -// Texturing, no zbuffer, disabled zbuffer write, primary gradient, alpha blending -#define SC_ALPHA ( SHADE_CNST(ShaderClass::PASS_ALWAYS, ShaderClass::DEPTH_WRITE_DISABLE, ShaderClass::COLOR_WRITE_ENABLE, ShaderClass::SRCBLEND_SRC_ALPHA, \ - ShaderClass::DSTBLEND_ONE_MINUS_SRC_ALPHA, ShaderClass::FOG_DISABLE, ShaderClass::GRADIENT_MODULATE, ShaderClass::SECONDARY_GRADIENT_DISABLE, ShaderClass::TEXTURING_ENABLE, \ - ShaderClass::ALPHATEST_DISABLE, ShaderClass::CULL_MODE_ENABLE, \ - ShaderClass::DETAILCOLOR_DISABLE, ShaderClass::DETAILALPHA_DISABLE) ) - - -DebugHintObject::~DebugHintObject() -{ - freeMapResources(); -} - -DebugHintObject::DebugHintObject() : - m_indexBuffer(nullptr), - m_vertexMaterialClass(nullptr), - m_vertexBufferTile(nullptr), - m_myColor(0), - m_mySize(0) -{ - initData(); -} - -Bool DebugHintObject::Cast_Ray(RayCollisionTestClass & raytest) -{ - return false; -} - -DebugHintObject::DebugHintObject(const DebugHintObject & src) -{ - *this = src; -} - -DebugHintObject & DebugHintObject::operator = (const DebugHintObject & that) -{ - DEBUG_CRASH(("oops")); - return *this; -} - -void DebugHintObject::Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const -{ - Vector3 ObjSpaceCenter((float)1000*0.5f,(float)1000*0.5f,(float)0); - float length = ObjSpaceCenter.Length(); - sphere.Init(ObjSpaceCenter, length); -} - -void DebugHintObject::Get_Obj_Space_Bounding_Box(AABoxClass & box) const -{ - Vector3 minPt(0,0,0); - Vector3 maxPt((float)1000,(float)1000,(float)1000); - box.Init(minPt,maxPt); -} - -Int DebugHintObject::Class_ID() const -{ - return RenderObjClass::CLASSID_UNKNOWN; -} - -RenderObjClass * DebugHintObject::Clone() const -{ - DEBUG_CRASH(("oops")); - return NEW DebugHintObject(*this); -} - - -void DebugHintObject::freeMapResources() -{ - REF_PTR_RELEASE(m_indexBuffer); - REF_PTR_RELEASE(m_vertexBufferTile); - REF_PTR_RELEASE(m_vertexMaterialClass); -} - -//Allocate a heightmap of x by y vertices. -//data must be an array matching this size. -void DebugHintObject::initData() -{ - freeMapResources(); //free old data and ib/vb - - m_indexBuffer = NEW_REF(DX8IndexBufferClass,(3)); - - // Fill up the IB - { - DX8IndexBufferClass::WriteLockClass lockIdxBuffer(m_indexBuffer); - UnsignedShort *ib=lockIdxBuffer.Get_Index_Array(); - ib[0]=0; - ib[1]=1; - ib[2]=2; - } - - m_vertexBufferTile = NEW_REF(DX8VertexBufferClass,(DX8_FVF_XYZDUV1,3,DX8VertexBufferClass::USAGE_DEFAULT)); - - //go with a preset material for now. - m_vertexMaterialClass = VertexMaterialClass::Get_Preset(VertexMaterialClass::PRELIT_DIFFUSE); - - //use a multi-texture shader: (text1*diffuse)*text2. - m_shaderClass = ShaderClass(SC_ALPHA); -} - -void DebugHintObject::setLocAndColorAndSize(const Coord3D *loc, Int argb, Int size) -{ - m_myLoc = *loc; - m_myColor = argb; - m_mySize = size; - - if (m_myLoc.z < 0 && TheTerrainRenderObject) - { - m_myLoc.z = TheTerrainRenderObject->getHeightMapHeight(m_myLoc.x, m_myLoc.y, nullptr); - } - - if (m_vertexBufferTile) - { - DX8VertexBufferClass::WriteLockClass lockVtxBuffer(m_vertexBufferTile); - VertexFormatXYZDUV1 *vb = (VertexFormatXYZDUV1*)lockVtxBuffer.Get_Vertex_Array(); - - Real x1 = m_mySize * 0.866; // cos(30) - Real y1 = m_mySize * 0.5; // sin(30) - - // note, pts must go in a counterclockwise order! - vb[0].x = 0; - vb[0].y = m_mySize; - vb[0].z = 0; - vb[0].diffuse = m_myColor; - vb[0].u1 = 0; - vb[0].v1 = 0; - - vb[1].x = -x1; - vb[1].y = -y1; - vb[1].z = 0; - vb[1].diffuse = m_myColor; - vb[1].u1 = 0; - vb[1].v1 = 0; - - vb[2].x = x1; - vb[2].y = -y1; - vb[2].z = 0; - vb[2].diffuse = m_myColor; - vb[2].u1 = 0; - vb[2].v1 = 0; - } -} - -void DebugHintObject::Render(RenderInfoClass & rinfo) -{ - SphereClass bounds(Vector3(m_myLoc.x, m_myLoc.y, m_myLoc.z), m_mySize); - if (!rinfo.Camera.Cull_Sphere(bounds)) - { - DX8Wrapper::Set_Material(m_vertexMaterialClass); - DX8Wrapper::Set_Shader(m_shaderClass); - DX8Wrapper::Set_Texture(0, nullptr); - DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0); - DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferTile); - - Matrix3D tm(Transform); - Vector3 vec(m_myLoc.x, m_myLoc.y, m_myLoc.z); - tm.Set_Translation(vec); - DX8Wrapper::Set_Transform(D3DTS_WORLD, tm); - - DX8Wrapper::Draw_Triangles( 0, 1, 0, 3); - } -} -#endif // RTS_DEBUG - - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// DEFINITIONS -/////////////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -W3DInGameUI::W3DInGameUI() -{ - Int i; - - for( i = 0; i < MAX_MOVE_HINTS; i++ ) - { - - m_moveHintRenderObj[ i ] = nullptr; - m_moveHintAnim[ i ] = nullptr; - - } - - m_buildingPlacementAnchor = nullptr; - m_buildingPlacementArrow = nullptr; - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -W3DInGameUI::~W3DInGameUI() -{ - Int i; - - // remove render objects for hints - for( i = 0; i < MAX_MOVE_HINTS; i++ ) - { - - REF_PTR_RELEASE( m_moveHintRenderObj[ i ] ); - REF_PTR_RELEASE( m_moveHintAnim[ i ] ); - - } - - REF_PTR_RELEASE( m_buildingPlacementAnchor ); - REF_PTR_RELEASE( m_buildingPlacementArrow ); - -} - -// loadText =================================================================== -/** Load text from the file */ -//============================================================================= -static void loadText( char *filename, GameWindow *listboxText ) -{ - if (!listboxText) - return; - GadgetListBoxReset(listboxText); - - FILE *fp; - - // open the file - fp = fopen( filename, "r" ); - if( fp == nullptr ) - return; - - char buffer[ 1024 ]; - UnicodeString line; - Color color = GameMakeColor(255, 255, 255, 255); - while( fgets( buffer, 1024, fp ) != nullptr ) - { - line.translate(buffer); - line.trim(); - if (line.isEmpty()) - line = L" "; - GadgetListBoxAddEntryText(listboxText, line, color, -1, -1); - } - - // close the file - fclose( fp ); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void W3DInGameUI::init() -{ - - // extending functionality - InGameUI::init(); - // for the beta, they didn't want the help menu showing up, but I left this as a bock - // comment because we'll probably want to add this back in. -/* - // create the MOTD - GameWindow *motd = TheWindowManager->winCreateFromScript( "MOTD.wnd" ); - if( motd ) - { - NameKeyType listboxTextID = TheNameKeyGenerator->nameToKey( "MOTD.wnd:ListboxMOTD" ); - GameWindow *listboxText = TheWindowManager->winGetWindowFromId(motd, listboxTextID); - - loadText( "HelpScreen.txt", listboxText ); - - // hide it for now - motd->winHide( TRUE ); - - } -*/ - -} - -//------------------------------------------------------------------------------------------------- -/** Update in game UI */ -//------------------------------------------------------------------------------------------------- -void W3DInGameUI::update() -{ - - // call base - InGameUI::update(); - -} - -//------------------------------------------------------------------------------------------------- -/** Reset the in game ui */ -//------------------------------------------------------------------------------------------------- -void W3DInGameUI::reset() -{ - - // call base - InGameUI::reset(); - -} - -//------------------------------------------------------------------------------------------------- -/** Draw member for the W3D implementation of the game user interface */ -//------------------------------------------------------------------------------------------------- -void W3DInGameUI::draw() -{ - preDraw(); - - // draw selection region if drag selecting - if( m_isDragSelecting ) - drawSelectionRegion(); - - // for each view draw hints - /// @todo should the UI be iterating through views like this? - if( TheDisplay ) - { - View *view; - - for( view = TheDisplay->getFirstView(); - view; - view = TheDisplay->getNextView( view ) ) - { - - // draw move hints - drawMoveHints( view ); - - // draw attack hints - drawAttackHints( view ); - - // draw placement angle selection if needed - drawPlaceAngle( view ); - - } - - } - - // repaint all our windows - -#ifdef EXTENDED_STATS - if (!DX8Wrapper::stats.m_disableConsole) { -#endif - -#ifdef DO_UNIT_TIMINGS -#pragma MESSAGE("*** WARNING *** DOING DO_UNIT_TIMINGS!!!!") - extern Bool g_UT_startTiming; - if (!g_UT_startTiming) -#endif - - postDraw(); - - TheWindowManager->winRepaint(); - - postWindowDraw(); - -#ifdef EXTENDED_STATS - } -#endif - -} - -//------------------------------------------------------------------------------------------------- -/** draw 2d selection region on screen */ -//------------------------------------------------------------------------------------------------- -void W3DInGameUI::drawSelectionRegion() -{ - Real width = 2.0f; - UnsignedInt color = 0x9933FF33; //0xAARRGGBB - - TheDisplay->drawOpenRect( m_dragSelectRegion.lo.x, - m_dragSelectRegion.lo.y, - m_dragSelectRegion.hi.x - m_dragSelectRegion.lo.x, - m_dragSelectRegion.hi.y - m_dragSelectRegion.lo.y, - width, - color ); - -} - -//------------------------------------------------------------------------------------------------- -/** Draw the visual feedback for clicking in the world and telling units - * to move there */ -//------------------------------------------------------------------------------------------------- -void W3DInGameUI::drawMoveHints( View *view ) -{ - Int i; -// Real width = 1.0f; -// UnsignedInt color = 0x9933FF33; //0xAARRGGBB - - for( i = 0; i < MAX_MOVE_HINTS; i++ ) - { - Int elapsed = TheGameClient->getFrame() - m_moveHint[i].frame; - - if( elapsed <= 40 ) - { - RectClass rect; - - // if this hint is not in this view ignore it - /// @todo write this to check if point is visible in view -// if( view->pointInView( &m_moveHint[ i ].pos == FALSE ) -// continue; - - // create render object and add to scene of needed - if( m_moveHintRenderObj[ i ] == nullptr ) - { - RenderObjClass *hint; - HAnimClass *anim; - - // create hint object - hint = W3DDisplay::m_assetManager->Create_Render_Obj(TheGlobalData->m_moveHintName.str()); - - AsciiString animName; - animName.format("%s.%s", TheGlobalData->m_moveHintName.str(), TheGlobalData->m_moveHintName.str()); - anim = W3DDisplay::m_assetManager->Get_HAnim(animName.str()); - - // sanity - if( hint == nullptr ) - { - - DEBUG_CRASH(("unable to create hint")); - return; - - } - - // assign render objects to GUI data - m_moveHintRenderObj[ i ] = hint; - - // note that 'anim' is returned from Get_HAnim with an AddRef, so we don't need to addref it again. - // however, we do need to release the contents of moveHintAnim (if any) - REF_PTR_RELEASE(m_moveHintAnim[i]); - m_moveHintAnim[i] = anim; - - } - - // show the render object if hidden - if( m_moveHintRenderObj[ i ]->Is_Hidden() == 1 ) { - m_moveHintRenderObj[ i ]->Set_Hidden( 0 ); - // add to scene - W3DDisplay::m_3DScene->Add_Render_Object( m_moveHintRenderObj[ i ] ); - if (m_moveHintAnim[i]) - m_moveHintRenderObj[i]->Set_Animation(m_moveHintAnim[i], 0, RenderObjClass::ANIM_MODE_ONCE); - } - - // move this hint render object to the position and align with terrain - Matrix3D transform; - PathfindLayerEnum layer = TheTerrainLogic->alignOnTerrain( 0, m_moveHint[ i ].pos, true, transform ); - - Real waterZ; - if (layer == LAYER_GROUND && TheTerrainLogic->isUnderwater(m_moveHint[ i ].pos.x, m_moveHint[ i ].pos.y, &waterZ)) - { - Coord3D tmp = m_moveHint[ i ].pos; - tmp.z = waterZ; - Coord3D normal; - normal.x = 0; - normal.y = 0; - normal.z = 1; - makeAlignToNormalMatrix(0, tmp, normal, transform); - } - - m_moveHintRenderObj[ i ]->Set_Transform( transform ); - -#if 0 - // if there is a source then draw line from source to destination - Object *obj = TheGameLogic->getObject( m_moveHint[ i ].sourceID ); - if( obj ) - { - Drawable *source = obj->getDrawable(); - - if( source ) - { - Coord3D pos; - ICoord2D start, end; - - // project start and end point to screen point - source->getPosition( &pos ); - view->worldToScreen( &pos, &start ); - view->worldToScreen( &hintPos, &end ); - - // draw the line - TheDisplay->drawLine( start.x, start.y, end.x, end.y, width, color ); - - } - } -#endif - - } - else - { - - // hide hint marker - if( m_moveHintRenderObj[ i ] ) - if( m_moveHintRenderObj[ i ]->Is_Hidden() == 0 ) { - m_moveHintRenderObj[ i ]->Set_Hidden( 1 ); - W3DDisplay::m_3DScene->Remove_Render_Object( m_moveHintRenderObj[ i ] ); - } - - } - - } - -} - -//------------------------------------------------------------------------------------------------- -/** Draw visual back for clicking to attack a unit in the world */ -//------------------------------------------------------------------------------------------------- -void W3DInGameUI::drawAttackHints( View *view ) -{ - -} - -//------------------------------------------------------------------------------------------------- -/** Draw the angle selection for placing building if needed */ -//------------------------------------------------------------------------------------------------- -void W3DInGameUI::drawPlaceAngle( View *view ) -{ -// Coord2D v, p, o; - //Real size = 15.0f; - - //Create the anchor & arrow if not already created! - if( !m_buildingPlacementAnchor ) - { - m_buildingPlacementAnchor = W3DDisplay::m_assetManager->Create_Render_Obj( "Locater01" ); - - // sanity - if( !m_buildingPlacementAnchor ) - { - DEBUG_CRASH( ("Unable to create BuildingPlacementAnchor (Locator01.w3d) -- cursor for placing buildings") ); - return; - } - } - if( !m_buildingPlacementArrow ) - { - m_buildingPlacementArrow = W3DDisplay::m_assetManager->Create_Render_Obj( "Locater02" ); - - // sanity - if( !m_buildingPlacementArrow ) - { - DEBUG_CRASH( ("Unable to create BuildingPlacementArrow (Locator02.w3d) -- cursor for placing buildings") ); - return; - } - } - - Bool anchorInScene = m_buildingPlacementAnchor->Peek_Scene() != nullptr; - Bool arrowInScene = m_buildingPlacementArrow->Peek_Scene() != nullptr; - - // get out of here if this display isn't up anyway - if( isPlacementAnchored() == FALSE ) - { - if( anchorInScene ) - { - //If our anchor is in the scene, remove it from the scene but don't delete it. - W3DDisplay::m_3DScene->Remove_Render_Object( m_buildingPlacementAnchor ); - } - if( arrowInScene ) - { - //If our arrow is in the scene, remove it from the scene but don't delete it. - W3DDisplay::m_3DScene->Remove_Render_Object( m_buildingPlacementArrow ); - } - return; - } - - // get the anchor points - ICoord2D start, end; - getPlacementPoints( &start, &end ); - - - - - Coord3D vector; - vector.x = end.x - start.x; - vector.y = end.y - start.y; - vector.z = 0.0f; - Real length = vector.length(); - - Bool showArrow = length >= 5.0f; - - if( showArrow ) - { - if( anchorInScene ) - { - //We're switching to the arrow! - W3DDisplay::m_3DScene->Remove_Render_Object( m_buildingPlacementAnchor ); - } - if( !arrowInScene ) - { - W3DDisplay::m_3DScene->Add_Render_Object( m_buildingPlacementArrow ); - arrowInScene = TRUE; - } - } - else - { - if( arrowInScene ) - { - //We're switching to the anchor! - W3DDisplay::m_3DScene->Remove_Render_Object( m_buildingPlacementArrow ); - } - if( !anchorInScene ) - { - W3DDisplay::m_3DScene->Add_Render_Object( m_buildingPlacementAnchor ); - anchorInScene = TRUE; - } - } - - //The proper way to orient the placement arrow is to copy the matrix from the m_placeIcon[0]! - if( anchorInScene ) - { - if ( m_placeIcon[ 0 ] ) - m_buildingPlacementAnchor->Set_Transform( *m_placeIcon[ 0 ]->getTransformMatrix() ); - } - else if( arrowInScene ) - { - if ( m_placeIcon[ 0 ] ) - m_buildingPlacementArrow->Set_Transform( *m_placeIcon[ 0 ]->getTransformMatrix() ); - } - - - //m_buildingPlacementArrow->Set_Transform( - - // draw a little box at the start to show the "anchor" point - //Real rectSize = 4.0f; - //TheDisplay->drawFillRect( start.x - rectSize / 2, start.y - rectSize / 2, - // rectSize, rectSize, color ); - - // compute vector for line - //v.x = end.x - start.x; - //v.y = end.y - start.y; - //v.normalize(); - - // compute opposite vector - //o.x = -v.x; - //o.y = -v.y; - - // compute perpendicular vector one way - //p.x = -v.y; - //p.y = v.x; - - // draw the line - //start.x = o.x * size + p.x * (size/2.0f) + end.x; - //start.y = o.y * size + p.y * (size/2.0f) + end.y; - //TheDisplay->drawLine( start.x, start.y, end.x, end.y, width, color ); - - // compute perpendicular vector other way - //p.x = v.y; - //p.y = -v.x; - - // draw the line - //start.x = o.x * size + p.x * (size/2.0f) + end.x; - //start.y = o.y * size + p.y * (size/2.0f) + end.y; - //TheDisplay->drawLine( start.x, start.y, end.x, end.y, width, color ); - -} - diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPoly.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPoly.cpp deleted file mode 100644 index f7eae2454f6..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DPoly.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -#include "W3DDevice/GameClient/W3DPoly.h" -#include "Lib/BaseType.h" - -//------------------------------------------------------------------------------------------------- -/** Delete all vertices in polygon */ -//------------------------------------------------------------------------------------------------- -void ClipPolyClass::Reset() -{ - Verts.Delete_All(false); -} - -//------------------------------------------------------------------------------------------------- -/** Add a new vertex to polygon */ -//------------------------------------------------------------------------------------------------- -void ClipPolyClass::Add_Vertex(const Vector3 & point) -{ - Verts.Add(point); -} - -//------------------------------------------------------------------------------------------------- -/** Clip polygon to given plane, returning new polygon in dest. */ -//------------------------------------------------------------------------------------------------- -void ClipPolyClass::Clip(const PlaneClass & plane,ClipPolyClass & dest) const -{ - dest.Reset(); - - // temporary variables used in clipping - Int i = 0; - Int vcount = Verts.Count(); - Int iprev = vcount - 1; - Bool cur_point_in_front; - Bool prev_point_in_front; - Real alpha; - Vector3 int_point; - - if (vcount <= 2) return; - - // perform clipping - prev_point_in_front = !plane.In_Front(Verts[iprev]); // Note, plane normal is outward so we invert this test - for (Int j=0; j=vcount) { - i = 0; - } - } -} diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp deleted file mode 100644 index 257ef93f81b..00000000000 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DWebBrowser.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -////// W3DWebBrowser.cpp /////////////// -// July 2002 Bryan Cleveland - -#include "W3DDevice/GameClient/W3DWebBrowser.h" -#include "WW3D2/texture.h" -#include "WW3D2/textureloader.h" -#include "WW3D2/surfaceclass.h" -#include "GameClient/Image.h" -#include "GameClient/GameWindow.h" -#include "vector2i.h" -#include -#include "WW3D2/dx8wrapper.h" -#include "WW3D2/dx8webbrowser.h" - -W3DWebBrowser::W3DWebBrowser() : WebBrowser() { -} - -Bool W3DWebBrowser::createBrowserWindow(const char *tag, GameWindow *win) -{ - - WinInstanceData *winData = win->winGetInstanceData(); - AsciiString windowName = winData->m_decoratedNameString; - - Int x, y, w, h; - - win->winGetSize(&w, &h); - win->winGetScreenPosition(&x, &y); - - WebBrowserURL *url = findURL( AsciiString(tag) ); - - if (url == nullptr) { - DEBUG_LOG(("W3DWebBrowser::createBrowserWindow - couldn't find URL for page %s", tag)); - return FALSE; - } - -#ifdef __GNUC__ - CComQIIDPtr idisp(m_dispatch); -#else - CComQIPtr idisp(m_dispatch); -#endif - if (m_dispatch == nullptr) - { - return FALSE; - } - - DX8WebBrowser::CreateBrowser(windowName.str(), url->m_url.str(), x, y, w, h, 0, BROWSEROPTION_SCROLLBARS | BROWSEROPTION_3DBORDER, (LPDISPATCH)this); - - return TRUE; -} - -void W3DWebBrowser::closeBrowserWindow(GameWindow *win) -{ - DX8WebBrowser::DestroyBrowser(win->winGetInstanceData()->m_decoratedNameString.str()); -} diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index 3b6d674c2b4..3abf28ade74 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -134,87 +134,87 @@ set(GAMEENGINE_SRC # Include/Common/XferDeepCRC.h # Include/Common/XferLoad.h # Include/Common/XferSave.h - Include/GameClient/Anim2D.h - Include/GameClient/AnimateWindowManager.h +# Include/GameClient/Anim2D.h +# Include/GameClient/AnimateWindowManager.h Include/GameClient/CampaignManager.h # Include/GameClient/ChallengeGenerals.h # Include/GameClient/ClientInstance.h # Include/GameClient/ClientRandomValue.h # Include/GameClient/Color.h - Include/GameClient/CommandXlat.h +# Include/GameClient/CommandXlat.h Include/GameClient/ControlBar.h - Include/GameClient/ControlBarResizer.h +# Include/GameClient/ControlBarResizer.h Include/GameClient/ControlBarScheme.h # Include/GameClient/Credits.h - Include/GameClient/DebugDisplay.h - Include/GameClient/Diplomacy.h - Include/GameClient/DisconnectMenu.h - Include/GameClient/Display.h +# Include/GameClient/DebugDisplay.h +# Include/GameClient/Diplomacy.h +# Include/GameClient/DisconnectMenu.h +# Include/GameClient/Display.h # Include/GameClient/DisplayString.h # Include/GameClient/DisplayStringManager.h Include/GameClient/Drawable.h - Include/GameClient/DrawableInfo.h +# Include/GameClient/DrawableInfo.h # Include/GameClient/DrawGroupInfo.h - Include/GameClient/EstablishConnectionsMenu.h +# Include/GameClient/EstablishConnectionsMenu.h Include/GameClient/Eva.h - Include/GameClient/ExtendedMessageBox.h - Include/GameClient/FontDesc.h +# Include/GameClient/ExtendedMessageBox.h +# Include/GameClient/FontDesc.h # Include/GameClient/FXList.h Include/GameClient/Gadget.h - Include/GameClient/GadgetCheckBox.h - Include/GameClient/GadgetComboBox.h - Include/GameClient/GadgetListBox.h - Include/GameClient/GadgetProgressBar.h - Include/GameClient/GadgetPushButton.h - Include/GameClient/GadgetRadioButton.h - Include/GameClient/GadgetSlider.h - Include/GameClient/GadgetStaticText.h - Include/GameClient/GadgetTabControl.h - Include/GameClient/GadgetTextEntry.h +# Include/GameClient/GadgetCheckBox.h +# Include/GameClient/GadgetComboBox.h +# Include/GameClient/GadgetListBox.h +# Include/GameClient/GadgetProgressBar.h +# Include/GameClient/GadgetPushButton.h +# Include/GameClient/GadgetRadioButton.h +# Include/GameClient/GadgetSlider.h +# Include/GameClient/GadgetStaticText.h +# Include/GameClient/GadgetTabControl.h +# Include/GameClient/GadgetTextEntry.h Include/GameClient/GameClient.h # Include/GameClient/GameFont.h - Include/GameClient/GameInfoWindow.h +# Include/GameClient/GameInfoWindow.h # Include/GameClient/GameText.h # Include/GameClient/GameWindow.h # Include/GameClient/GameWindowGlobal.h - Include/GameClient/GameWindowID.h - Include/GameClient/GameWindowManager.h +# Include/GameClient/GameWindowID.h +# Include/GameClient/GameWindowManager.h # Include/GameClient/GameWindowTransitions.h # Include/GameClient/GlobalLanguage.h # Include/GameClient/GraphDraw.h Include/GameClient/GUICallbacks.h - Include/GameClient/GUICommandTranslator.h +# Include/GameClient/GUICommandTranslator.h # Include/GameClient/HeaderTemplate.h - Include/GameClient/HintSpy.h - Include/GameClient/HotKey.h - Include/GameClient/Image.h +# Include/GameClient/HintSpy.h +# Include/GameClient/HotKey.h +# Include/GameClient/Image.h # Include/GameClient/IMEManager.h Include/GameClient/InGameUI.h # Include/GameClient/Keyboard.h - Include/GameClient/KeyDefs.h +# Include/GameClient/KeyDefs.h # Include/GameClient/LanguageFilter.h # Include/GameClient/Line2D.h # Include/GameClient/LoadScreen.h - Include/GameClient/LookAtXlat.h +# Include/GameClient/LookAtXlat.h # Include/GameClient/MapUtil.h - Include/GameClient/MessageBox.h - Include/GameClient/MetaEvent.h - Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h - Include/GameClient/Module/BeaconClientUpdate.h - Include/GameClient/Module/SwayClientUpdate.h +# Include/GameClient/MessageBox.h +# Include/GameClient/MetaEvent.h +# Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h +# Include/GameClient/Module/BeaconClientUpdate.h +# Include/GameClient/Module/SwayClientUpdate.h # Include/GameClient/Mouse.h # Include/GameClient/ParabolicEase.h # Include/GameClient/ParticleSys.h - Include/GameClient/PlaceEventTranslator.h +# Include/GameClient/PlaceEventTranslator.h # Include/GameClient/ProcessAnimateWindow.h # Include/GameClient/RadiusDecal.h - Include/GameClient/RayEffect.h +# Include/GameClient/RayEffect.h # Include/GameClient/SelectionInfo.h Include/GameClient/SelectionXlat.h - Include/GameClient/Shadow.h - Include/GameClient/Shell.h - Include/GameClient/ShellHooks.h - Include/GameClient/ShellMenuScheme.h +# Include/GameClient/Shadow.h +# Include/GameClient/Shell.h +# Include/GameClient/ShellHooks.h +# Include/GameClient/ShellMenuScheme.h # Include/GameClient/Smudge.h # Include/GameClient/Snow.h # Include/GameClient/Statistics.h @@ -225,7 +225,7 @@ set(GAMEENGINE_SRC # Include/GameClient/Water.h # Include/GameClient/WindowLayout.h # Include/GameClient/WindowVideoManager.h - Include/GameClient/WindowXlat.h +# Include/GameClient/WindowXlat.h # Include/GameClient/WinInstanceData.h Include/GameLogic/AI.h Include/GameLogic/AIDock.h @@ -679,112 +679,112 @@ set(GAMEENGINE_SRC # Source/GameClient/ClientInstance.cpp # Source/GameClient/Color.cpp # Source/GameClient/Credits.cpp - Source/GameClient/Display.cpp +# Source/GameClient/Display.cpp # Source/GameClient/DisplayString.cpp # Source/GameClient/DisplayStringManager.cpp Source/GameClient/Drawable.cpp - Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp - Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp - Source/GameClient/Drawable/Update/SwayClientUpdate.cpp +# Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp +# Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp +# Source/GameClient/Drawable/Update/SwayClientUpdate.cpp # Source/GameClient/DrawGroupInfo.cpp Source/GameClient/Eva.cpp # Source/GameClient/FXList.cpp Source/GameClient/GameClient.cpp - Source/GameClient/GameClientDispatch.cpp +# Source/GameClient/GameClientDispatch.cpp # Source/GameClient/GameText.cpp # Source/GameClient/GlobalLanguage.cpp # Source/GameClient/GraphDraw.cpp - Source/GameClient/GUI/AnimateWindowManager.cpp +# Source/GameClient/GUI/AnimateWindowManager.cpp # Source/GameClient/GUI/ChallengeGenerals.cpp Source/GameClient/GUI/ControlBar/ControlBar.cpp Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp - Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp - Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +# Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp +# Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp - Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp - Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +# Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp +# Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp - Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp +# Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp - Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp - Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp - Source/GameClient/GUI/Gadget/GadgetComboBox.cpp - Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp - Source/GameClient/GUI/Gadget/GadgetListBox.cpp - Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp +# Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp +# Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp +# Source/GameClient/GUI/Gadget/GadgetComboBox.cpp +# Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp +# Source/GameClient/GUI/Gadget/GadgetListBox.cpp +# Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp Source/GameClient/GUI/Gadget/GadgetPushButton.cpp - Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp - Source/GameClient/GUI/Gadget/GadgetStaticText.cpp - Source/GameClient/GUI/Gadget/GadgetTabControl.cpp - Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp - Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +# Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp +# Source/GameClient/GUI/Gadget/GadgetStaticText.cpp +# Source/GameClient/GUI/Gadget/GadgetTabControl.cpp +# Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp +# Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp # Source/GameClient/GUI/GameFont.cpp # Source/GameClient/GUI/GameWindow.cpp # Source/GameClient/GUI/GameWindowGlobal.cpp - Source/GameClient/GUI/GameWindowManager.cpp +# Source/GameClient/GUI/GameWindowManager.cpp Source/GameClient/GUI/GameWindowManagerScript.cpp # Source/GameClient/GUI/GameWindowTransitions.cpp Source/GameClient/GUI/GameWindowTransitionsStyles.cpp Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp - Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp - Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp - Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp - Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp - Source/GameClient/GUI/GUICallbacks/InGameChat.cpp - Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp +# Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp +# Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp +# Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp +# Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp +# Source/GameClient/GUI/GUICallbacks/InGameChat.cpp +# Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp - Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp - Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp - Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/DownloadMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/EstablishConnectionsWindow.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/KeyboardOptionsMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/LanMapSelectMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp - Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp - Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp - Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp - Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/QuitMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/ReplayMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp - Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/SinglePlayerMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLCustomScoreScreen.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLLadderScreen.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLLocaleSelectPopup.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLLoginMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLMessageWindow.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLQMScoreScreen.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp - Source/GameClient/GUI/GUICallbacks/MessageBox.cpp - Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp +# Source/GameClient/GUI/GUICallbacks/MessageBox.cpp +# Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp # Source/GameClient/GUI/HeaderTemplate.cpp # Source/GameClient/GUI/IMEManager.cpp # Source/GameClient/GUI/LoadScreen.cpp # Source/GameClient/GUI/ProcessAnimateWindow.cpp Source/GameClient/GUI/Shell/Shell.cpp - Source/GameClient/GUI/Shell/ShellMenuScheme.cpp +# Source/GameClient/GUI/Shell/ShellMenuScheme.cpp # Source/GameClient/GUI/WindowLayout.cpp # Source/GameClient/GUI/WindowVideoManager.cpp # Source/GameClient/GUI/WinInstanceData.cpp @@ -797,7 +797,7 @@ set(GAMEENGINE_SRC Source/GameClient/MessageStream/CommandXlat.cpp Source/GameClient/MessageStream/GUICommandTranslator.cpp Source/GameClient/MessageStream/HintSpy.cpp - Source/GameClient/MessageStream/HotKey.cpp +# Source/GameClient/MessageStream/HotKey.cpp Source/GameClient/MessageStream/LookAtXlat.cpp Source/GameClient/MessageStream/MetaEvent.cpp Source/GameClient/MessageStream/PlaceEventTranslator.cpp @@ -808,13 +808,13 @@ set(GAMEENGINE_SRC # Source/GameClient/SelectionInfo.cpp # Source/GameClient/Snow.cpp # Source/GameClient/Statistics.cpp - Source/GameClient/System/Anim2D.cpp +# Source/GameClient/System/Anim2D.cpp Source/GameClient/System/CampaignManager.cpp # "Source/GameClient/System/Debug Displayers/AudioDebugDisplay.cpp" - Source/GameClient/System/DebugDisplay.cpp - Source/GameClient/System/Image.cpp +# Source/GameClient/System/DebugDisplay.cpp +# Source/GameClient/System/Image.cpp # Source/GameClient/System/ParticleSys.cpp - Source/GameClient/System/RayEffect.cpp +# Source/GameClient/System/RayEffect.cpp # Source/GameClient/System/Smudge.cpp # Source/GameClient/Terrain/TerrainRoads.cpp # Source/GameClient/Terrain/TerrainVisual.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h index e0e4707f93c..2e2aa8b3484 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h @@ -317,7 +317,6 @@ class Drawable : public Thing, TintEnvelope *getColorTintEnvelope() { return m_colorTintEnvelope; } void setColorTintEnvelope( TintEnvelope &source ) { if (m_colorTintEnvelope) *m_colorTintEnvelope = source; } - void imitateStealthLook( Drawable& otherDraw ); void setTerrainDecal(TerrainDecalType type); ///