From 2f7233540a5fad879ea1587da1a010645f2ccf0d Mon Sep 17 00:00:00 2001 From: tomsons26 Date: Fri, 11 Apr 2025 21:41:49 +0300 Subject: [PATCH] [GEN][ZH] Cleans up inconsistencies (#654) --- .../Include/Common/ArchiveFileSystem.h | 1 - .../Include/Common/BuildAssistant.h | 12 +- .../GameEngine/Include/Common/FileSystem.h | 2 - .../GameEngine/Include/Common/GameMemory.h | 7 +- .../GameEngine/Include/Common/GlobalData.h | 3 +- .../Code/GameEngine/Include/Common/KindOf.h | 1 - .../GameEngine/Include/Common/MiscAudio.h | 2 +- .../Code/GameEngine/Include/Common/Money.h | 1 - .../Include/Common/PlayerTemplate.h | 2 - .../GameEngine/Include/Common/StackDump.h | 4 +- .../GameEngine/Include/Common/ThingTemplate.h | 2 +- .../Include/GameClient/CommandXlat.h | 1 - .../Include/GameClient/ControlBar.h | 2 +- .../Code/GameEngine/Include/GameClient/Eva.h | 2 +- .../Include/GameClient/GameClient.h | 1 - .../GameEngine/Include/GameClient/InGameUI.h | 4 +- .../GameEngine/Include/GameClient/Mouse.h | 2 +- .../Include/GameClient/TerrainVisual.h | 2 +- .../Code/GameEngine/Include/GameClient/View.h | 4 +- .../Code/GameEngine/Include/GameLogic/AI.h | 3 +- .../GameEngine/Include/GameLogic/Damage.h | 2 +- .../GameEngine/Include/GameLogic/GameLogic.h | 2 + .../Include/GameLogic/Module/BehaviorModule.h | 4 +- .../Module/ConvertToCarBombCrateCollide.h | 2 +- .../Include/GameLogic/Module/EMPUpdate.h | 2 +- .../Include/GameLogic/Module/FXListDie.h | 4 +- .../Module/FireWeaponWhenDeadBehavior.h | 1 + .../GameLogic/Module/GarrisonContain.h | 1 + .../Module/GenerateMinefieldBehavior.h | 9 +- .../Include/GameLogic/Module/OCLUpdate.h | 12 +- .../Include/GameLogic/Module/PhysicsUpdate.h | 1 + .../GameLogic/Module/StickyBombUpdate.h | 8 +- .../GameLogic/Module/SupplyCenterDockUpdate.h | 5 +- .../GameLogic/Module/TransportContain.h | 2 +- .../GameEngine/Include/GameLogic/Object.h | 5 +- .../Include/GameLogic/PartitionManager.h | 6 +- .../GameEngine/Include/GameLogic/Scripts.h | 4 +- .../Include/GameLogic/TerrainLogic.h | 2 +- .../Include/GameNetwork/DisconnectManager.h | 1 - .../GameSpy/PeerDefsImplementation.h | 2 - .../Source/Common/Audio/GameAudio.cpp | 1 + .../GameEngine/Source/Common/GlobalData.cpp | 6 +- .../Source/Common/MessageStream.cpp | 1 + .../GameEngine/Source/Common/RTS/Player.cpp | 30 +- .../GameEngine/Source/Common/Recorder.cpp | 3 +- .../GameEngine/Source/Common/StateMachine.cpp | 2 +- .../Source/Common/System/BuildAssistant.cpp | 9 +- .../GameEngine/Source/Common/System/Debug.cpp | 1 - .../Source/Common/System/DisabledTypes.cpp | 2 +- .../Source/Common/System/FileSystem.cpp | 6 +- .../Source/Common/System/GameCommon.cpp | 2 +- .../Source/Common/System/GameMemory.cpp | 5 +- .../Common/System/SaveGame/GameStateMap.cpp | 17 +- .../Source/Common/System/StackDump.cpp | 1 + .../Source/Common/Thing/ModuleFactory.cpp | 10 +- .../Source/Common/Thing/ThingFactory.cpp | 4 +- .../Source/Common/Thing/ThingTemplate.cpp | 1 + .../GameEngine/Source/GameClient/Drawable.cpp | 1 - .../GameClient/GUI/ControlBar/ControlBar.cpp | 6 +- .../GUI/ControlBar/ControlBarScheme.cpp | 1 - .../GUI/GUICallbacks/ControlBarCallback.cpp | 9 +- .../GUICallbacks/Menus/LanGameOptionsMenu.cpp | 1 - .../GUI/GUICallbacks/Menus/MainMenu.cpp | 2 + .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 22 +- .../GUICallbacks/Menus/PopupPlayerInfo.cpp | 2 + .../Menus/SkirmishGameOptionsMenu.cpp | 23 +- .../Menus/SkirmishMapSelectMenu.cpp | 8 +- .../GUICallbacks/Menus/WOLBuddyOverlay.cpp | 3 - .../GUICallbacks/Menus/WOLGameSetupMenu.cpp | 20 +- .../GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp | 5 +- .../Source/GameClient/GUI/LoadScreen.cpp | 35 +- .../Source/GameClient/GlobalLanguage.cpp | 1 + .../GameEngine/Source/GameClient/InGameUI.cpp | 20 +- .../Source/GameClient/Input/Mouse.cpp | 10 +- .../GameClient/MessageStream/CommandXlat.cpp | 12 +- .../GameClient/MessageStream/MetaEvent.cpp | 4 +- .../MessageStream/PlaceEventTranslator.cpp | 10 +- .../Source/GameClient/SelectionInfo.cpp | 10 +- .../GameClient/System/CampaignManager.cpp | 3 +- .../Source/GameLogic/AI/AIGuard.cpp | 8 +- .../Source/GameLogic/AI/AIPathfind.cpp | 12 +- .../Source/GameLogic/AI/AIPlayer.cpp | 32 +- .../Source/GameLogic/Map/TerrainLogic.cpp | 2 +- .../Object/Behavior/AutoHealBehavior.cpp | 1 - .../Behavior/GenerateMinefieldBehavior.cpp | 6 +- .../Object/Behavior/RebuildHoleBehavior.cpp | 2 - .../GameLogic/Object/Body/ActiveBody.cpp | 5 +- .../Object/Body/HiveStructureBody.cpp | 2 + .../CrateCollide/SalvageCrateCollide.cpp | 4 + .../Object/Contain/GarrisonContain.cpp | 3 + .../Object/Contain/OverlordContain.cpp | 4 +- .../Object/Contain/ParachuteContain.cpp | 8 +- .../Object/Contain/TransportContain.cpp | 3 +- .../Source/GameLogic/Object/Locomotor.cpp | 6 + .../Source/GameLogic/Object/Object.cpp | 9 +- .../GameLogic/Object/ObjectCreationList.cpp | 52 +- .../SpecialPower/BaikonurLaunchPower.cpp | 4 +- .../SpecialPower/SpecialPowerModule.cpp | 8 +- .../GameLogic/Object/Update/AIUpdate.cpp | 12 +- .../Update/AIUpdate/ChinookAIUpdate.cpp | 2 +- .../AIUpdate/DeliverPayloadAIUpdate.cpp | 11 +- .../Update/AIUpdate/MissileAIUpdate.cpp | 6 +- .../Update/AIUpdate/RailroadGuideAIUpdate.cpp | 2 +- .../Object/Update/FireWeaponUpdate.cpp | 2 +- .../GameLogic/Object/Update/HordeUpdate.cpp | 4 +- .../Update/ParticleUplinkCannonUpdate.cpp | 6 +- .../Object/Update/ProductionUpdate.cpp | 47 +- .../Object/Update/ProjectileStreamUpdate.cpp | 3 +- .../Object/Update/SpecialAbilityUpdate.cpp | 35 +- .../Object/Update/StickyBombUpdate.cpp | 3 +- .../Source/GameLogic/Object/WeaponSet.cpp | 20 +- .../GameLogic/ScriptEngine/ScriptActions.cpp | 33 +- .../ScriptEngine/ScriptConditions.cpp | 57 +- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 7 +- .../Source/GameLogic/System/Damage.cpp | 3 +- .../Source/GameLogic/System/GameLogic.cpp | 40 +- .../GameLogic/System/GameLogicDispatch.cpp | 1 + .../Source/GameNetwork/FirewallHelper.cpp | 2 +- .../Source/GameNetwork/GameInfo.cpp | 2 +- .../Source/GameNetwork/GameSpy/GSConfig.cpp | 2 +- .../Source/GameNetwork/GameSpy/LobbyUtils.cpp | 1 + .../GameSpy/StagingRoomGameInfo.cpp | 6 +- .../Thread/PersistentStorageThread.cpp | 2 +- .../Include/W3DDevice/Common/W3DRadar.h | 6 +- .../W3DDevice/GameClient/W3DAssetManager.h | 6 +- .../W3DDevice/GameClient/W3DBridgeBuffer.h | 4 +- .../GameClient/W3DDisplayStringManager.h | 10 +- .../W3DDevice/GameClient/W3DProjectedShadow.h | 2 +- .../Include/W3DDevice/GameClient/W3DView.h | 5 +- .../MilesAudioDevice/MilesAudioManager.cpp | 4 +- .../W3DDevice/Common/System/W3DRadar.cpp | 6 +- .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 2 +- .../GameClient/Drawable/Draw/W3DTruckDraw.cpp | 3 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 4 +- .../GameClient/W3DDisplayStringManager.cpp | 15 +- .../Source/W3DDevice/GameClient/W3DScene.cpp | 5 +- .../W3DDevice/GameClient/W3DTerrainVisual.cpp | 3 +- .../GameClient/W3dWaypointBuffer.cpp | 3 +- .../W3DDevice/GameClient/Water/W3DWater.cpp | 6 +- .../Source/WWVegas/WW3D2/meshmatdesc.cpp | 119 +- .../include/CFixTeamOwnerDialog.h | 2 + .../Tools/WorldBuilder/include/DrawObject.h | 2 + .../WorldBuilder/include/ImpassableOptions.h | 1 + .../Tools/WorldBuilder/include/LayersList.h | 1 - .../Code/Tools/WorldBuilder/include/MainFrm.h | 1 - .../Tools/WorldBuilder/include/SplashScreen.h | 1 + .../Tools/WorldBuilder/include/TeamGeneric.h | 1 + .../Tools/WorldBuilder/include/WBHeightMap.h | 3 +- .../Tools/WorldBuilder/include/wbview3d.h | 1 + .../Tools/WorldBuilder/src/BorderTool.cpp | 7 +- .../Tools/WorldBuilder/src/CameraOptions.cpp | 1 + .../Tools/WorldBuilder/src/SplashScreen.cpp | 1 + .../Tools/WorldBuilder/src/TeamGeneric.cpp | 1 + .../GameEngine/Include/Common/BattleHonors.h | 4 +- .../GameEngine/Include/Common/GlobalData.h | 4 +- .../Code/GameEngine/Include/Common/INI.h | 2 +- .../Code/GameEngine/Include/Common/KindOf.h | 3 +- .../GameEngine/Include/Common/MiscAudio.h | 1 - .../GameEngine/Include/Common/ModelState.h | 2 +- .../Include/Common/SpecialPowerType.h | 2 +- .../GameEngine/Include/Common/StackDump.h | 1 + .../Include/Common/SubsystemInterface.h | 2 +- .../GameEngine/Include/Common/ThingTemplate.h | 10 +- .../Include/Common/UserPreferences.h | 8 +- .../GameEngine/Include/GameClient/Drawable.h | 57 +- .../Code/GameEngine/Include/GameClient/Eva.h | 70 +- .../Include/GameClient/GameClient.h | 1 - .../Include/GameClient/GameWindow.h | 2 +- .../GameEngine/Include/GameClient/Image.h | 2 +- .../GameEngine/Include/GameClient/InGameUI.h | 15 +- .../GameEngine/Include/GameClient/Mouse.h | 1 - .../Include/GameClient/ParticleSys.h | 4 +- .../Include/GameClient/SelectionXlat.h | 8 +- .../Code/GameEngine/Include/GameClient/View.h | 8 +- .../Code/GameEngine/Include/GameLogic/AI.h | 2 +- .../GameEngine/Include/GameLogic/AIPathfind.h | 6 +- .../Include/GameLogic/FiringTracker.h | 2 +- .../Include/GameLogic/Module/AIUpdate.h | 12 +- .../Module/AssistedTargetingUpdate.h | 12 +- .../GameLogic/Module/AutoDepositUpdate.h | 3 +- .../GameLogic/Module/ChinookAIUpdate.h | 9 +- .../Include/GameLogic/Module/ContainModule.h | 20 +- .../Include/GameLogic/Module/CrateCollide.h | 4 +- .../GameLogic/Module/DeliverPayloadAIUpdate.h | 6 +- .../GameLogic/Module/DumbProjectileBehavior.h | 4 +- .../Include/GameLogic/Module/EMPUpdate.h | 48 +- .../GameLogic/Module/FireWeaponUpdate.h | 2 +- .../GameLogic/Module/GarrisonContain.h | 42 +- .../GameLogic/Module/MissileAIUpdate.h | 6 +- .../Include/GameLogic/Module/OpenContain.h | 22 +- .../GameLogic/Module/OverlordContain.h | 2 +- .../Include/GameLogic/Module/PhysicsUpdate.h | 2 +- .../GameLogic/Module/ProjectileStreamUpdate.h | 2 +- .../GameLogic/Module/RailroadGuideAIUpdate.h | 7 +- .../GameLogic/Module/SpecialAbilityUpdate.h | 18 +- .../Include/GameLogic/Module/StealthUpdate.h | 26 +- .../GameLogic/Module/SupplyCenterDockUpdate.h | 2 +- .../GameLogic/Module/SupplyTruckAIUpdate.h | 2 +- .../GameLogic/Module/TransportContain.h | 4 +- .../Include/GameLogic/Module/WorkerAIUpdate.h | 2 +- .../GameEngine/Include/GameLogic/Object.h | 4 +- .../Include/GameLogic/ScriptActions.h | 4 +- .../Include/GameLogic/TerrainLogic.h | 4 +- .../GameEngine/Include/GameLogic/Weapon.h | 8 +- .../GameEngine/Include/GameNetwork/GameInfo.h | 18 +- .../Include/GameNetwork/GameSpy/GSConfig.h | 1 + .../Include/GameNetwork/GameSpy/PeerThread.h | 4 +- .../GameNetwork/GameSpy/StagingRoomGameInfo.h | 2 +- .../Source/Common/Audio/GameAudio.cpp | 57 +- .../GameEngine/Source/Common/BitFlags.cpp | 2 +- .../GameEngine/Source/Common/CommandLine.cpp | 4 +- .../GameEngine/Source/Common/GameEngine.cpp | 2 +- .../GameEngine/Source/Common/GlobalData.cpp | 69 +- .../Code/GameEngine/Source/Common/INI/INI.cpp | 94 +- .../Source/Common/INI/INICommandButton.cpp | 1 - .../Source/Common/INI/INIMappedImage.cpp | 2 +- .../Source/Common/INI/INIMiscAudio.cpp | 2 +- .../Source/Common/INI/INIMultiplayer.cpp | 42 +- .../Source/Common/MessageStream.cpp | 17 +- .../Source/Common/MultiplayerSettings.cpp | 17 +- .../Source/Common/NameKeyGenerator.cpp | 2 +- .../GameEngine/Source/Common/PerfTimer.cpp | 82 +- .../Source/Common/RTS/ActionManager.cpp | 49 +- .../GameEngine/Source/Common/RTS/Money.cpp | 6 +- .../GameEngine/Source/Common/RTS/Player.cpp | 240 +- .../Source/Common/RTS/PlayerTemplate.cpp | 5 +- .../GameEngine/Source/Common/StateMachine.cpp | 1 - .../Source/Common/System/BuildAssistant.cpp | 2 +- .../Source/Common/System/DataChunk.cpp | 2 +- .../Source/Common/System/DisabledTypes.cpp | 6 +- .../Source/Common/System/FileSystem.cpp | 20 +- .../Source/Common/System/GameMemory.cpp | 2 +- .../Source/Common/System/KindOf.cpp | 4 +- .../Common/System/ObjectStatusTypes.cpp | 2 +- .../GameEngine/Source/Common/System/Radar.cpp | 22 +- .../Source/Common/Thing/ThingFactory.cpp | 2 +- .../Source/Common/Thing/ThingTemplate.cpp | 199 +- .../Source/Common/UserPreferences.cpp | 1 + .../GameEngine/Source/GameClient/Drawable.cpp | 673 ++-- .../Code/GameEngine/Source/GameClient/Eva.cpp | 182 +- .../GameClient/GUI/AnimateWindowManager.cpp | 2 +- .../GameClient/GUI/ControlBar/ControlBar.cpp | 4 +- .../GUI/ControlBar/ControlBarCommand.cpp | 23 +- .../ControlBarCommandProcessing.cpp | 4 +- .../ControlBarStructureInventory.cpp | 2 +- .../GUICallbacks/Menus/LanGameOptionsMenu.cpp | 158 +- .../GUI/GUICallbacks/Menus/LanLobbyMenu.cpp | 38 +- .../GUI/GUICallbacks/Menus/MainMenu.cpp | 4 +- .../GUI/GUICallbacks/Menus/OptionsMenu.cpp | 23 +- .../GUI/GUICallbacks/Menus/PopupHostGame.cpp | 26 +- .../Menus/SkirmishGameOptionsMenu.cpp | 256 +- .../Menus/SkirmishMapSelectMenu.cpp | 22 +- .../GUICallbacks/Menus/WOLGameSetupMenu.cpp | 440 +-- .../GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp | 2 +- .../GUICallbacks/Menus/WOLMapSelectMenu.cpp | 3 - .../GUICallbacks/Menus/WOLQuickMatchMenu.cpp | 26 +- .../Source/GameClient/GUI/GameWindow.cpp | 2 +- .../Source/GameClient/GUI/Shell/Shell.cpp | 6 +- .../Source/GameClient/GameClient.cpp | 30 +- .../Source/GameClient/GlobalLanguage.cpp | 1 - .../GameEngine/Source/GameClient/InGameUI.cpp | 386 +- .../Source/GameClient/Input/Mouse.cpp | 12 +- .../Source/GameClient/LanguageFilter.cpp | 2 +- .../GameEngine/Source/GameClient/MapUtil.cpp | 2 +- .../GameClient/MessageStream/CommandXlat.cpp | 200 +- .../GameClient/MessageStream/MetaEvent.cpp | 69 +- .../MessageStream/SelectionXlat.cpp | 86 +- .../Source/GameClient/SelectionInfo.cpp | 30 +- .../Source/GameClient/System/Image.cpp | 12 +- .../Source/GameClient/System/ParticleSys.cpp | 55 +- .../GameClient/Terrain/TerrainVisual.cpp | 141 +- .../GameEngine/Source/GameLogic/AI/AI.cpp | 4 +- .../Source/GameLogic/AI/AIGroup.cpp | 175 +- .../Source/GameLogic/AI/AIGuard.cpp | 8 +- .../Source/GameLogic/AI/AIPathfind.cpp | 274 +- .../Source/GameLogic/AI/AISkirmishPlayer.cpp | 12 +- .../Source/GameLogic/AI/TurretAI.cpp | 33 +- .../Source/GameLogic/Map/TerrainLogic.cpp | 38 +- .../Behavior/DumbProjectileBehavior.cpp | 68 +- .../Behavior/GenerateMinefieldBehavior.cpp | 6 +- .../Object/Behavior/JetSlowDeathBehavior.cpp | 2 +- .../Object/Behavior/ParkingPlaceBehavior.cpp | 4 +- .../Behavior/PropagandaTowerBehavior.cpp | 76 +- .../GameLogic/Object/Body/ActiveBody.cpp | 16 +- .../Object/Body/HiveStructureBody.cpp | 9 +- .../Collide/CrateCollide/CrateCollide.cpp | 68 +- .../Object/Contain/GarrisonContain.cpp | 459 ++- .../GameLogic/Object/Contain/OpenContain.cpp | 93 +- .../Object/Contain/OverlordContain.cpp | 112 +- .../Object/Contain/ParachuteContain.cpp | 18 +- .../Object/Contain/TransportContain.cpp | 112 +- .../Object/Contain/TunnelContain.cpp | 12 +- .../Object/Create/GrantUpgradeCreate.cpp | 4 +- .../Object/Die/RebuildHoleExposeDie.cpp | 21 +- .../Source/GameLogic/Object/FiringTracker.cpp | 88 +- .../Source/GameLogic/Object/Locomotor.cpp | 10 +- .../Source/GameLogic/Object/Object.cpp | 491 ++- .../GameLogic/Object/ObjectCreationList.cpp | 173 +- .../GameLogic/Object/PartitionManager.cpp | 4 +- .../SpecialPower/SpecialPowerModule.cpp | 162 +- .../GameLogic/Object/Update/AIUpdate.cpp | 78 +- .../Update/AIUpdate/ChinookAIUpdate.cpp | 413 ++- .../AIUpdate/DeliverPayloadAIUpdate.cpp | 50 +- .../Update/AIUpdate/HackInternetAIUpdate.cpp | 18 +- .../Update/AIUpdate/MissileAIUpdate.cpp | 26 +- .../Update/AIUpdate/RailroadGuideAIUpdate.cpp | 52 +- .../Object/Update/AssistedTargetingUpdate.cpp | 2 +- .../Object/Update/AutoDepositUpdate.cpp | 46 +- .../GameLogic/Object/Update/EMPUpdate.cpp | 100 +- .../Object/Update/FireWeaponUpdate.cpp | 15 +- .../GameLogic/Object/Update/HordeUpdate.cpp | 28 +- .../Update/ParticleUplinkCannonUpdate.cpp | 13 +- .../Object/Update/ProductionUpdate.cpp | 2 +- .../GameLogic/Object/Update/SlavedUpdate.cpp | 29 +- .../Object/Update/SpecialAbilityUpdate.cpp | 3110 ++++++++--------- .../Object/Update/StealthDetectorUpdate.cpp | 108 +- .../GameLogic/Object/Update/StealthUpdate.cpp | 90 +- .../Object/Update/StickyBombUpdate.cpp | 4 +- .../Source/GameLogic/Object/Weapon.cpp | 32 +- .../Source/GameLogic/Object/WeaponSet.cpp | 16 +- .../GameLogic/ScriptEngine/ScriptActions.cpp | 2 +- .../GameLogic/ScriptEngine/ScriptEngine.cpp | 11 +- .../Source/GameLogic/ScriptEngine/Scripts.cpp | 20 +- .../Source/GameLogic/System/GameLogic.cpp | 105 +- .../GameLogic/System/GameLogicDispatch.cpp | 3 +- .../Source/GameNetwork/FirewallHelper.cpp | 1 + .../GameEngine/Source/GameNetwork/GUIUtil.cpp | 60 +- .../Source/GameNetwork/GameInfo.cpp | 90 +- .../Source/GameNetwork/GameSpy/LobbyUtils.cpp | 42 +- .../Source/GameNetwork/GameSpy/PeerDefs.cpp | 24 +- .../GameNetwork/GameSpy/Thread/PeerThread.cpp | 30 +- .../Source/GameNetwork/LANAPICallbacks.cpp | 10 +- .../MilesAudioDevice/MilesAudioManager.h | 3 +- .../W3DDevice/GameClient/W3DTerrainVisual.h | 64 +- .../Include/W3DDevice/GameClient/W3DView.h | 6 +- .../W3DDevice/GameClient/W3DWaypointBuffer.h | 3 +- .../W3DDevice/GameClient/WorldHeightMap.h | 13 +- .../MilesAudioDevice/MilesAudioManager.cpp | 74 +- .../VideoDevice/Bink/BinkVideoPlayer.cpp | 2 +- .../W3DDevice/Common/System/W3DRadar.cpp | 2 +- .../Drawable/Draw/W3DDependencyModelDraw.cpp | 36 +- .../GameClient/Drawable/Draw/W3DModelDraw.cpp | 80 +- .../GameClient/GUI/Gadget/W3DStaticText.cpp | 2 +- .../W3DDevice/GameClient/W3DDisplay.cpp | 188 +- .../GameClient/W3DDisplayStringManager.cpp | 6 +- .../Source/W3DDevice/GameClient/W3DScene.cpp | 48 +- .../Source/W3DDevice/GameClient/W3DShroud.cpp | 1 - .../W3DDevice/GameClient/W3DTerrainVisual.cpp | 459 ++- .../Source/W3DDevice/GameClient/W3DView.cpp | 222 +- .../GameClient/W3dWaypointBuffer.cpp | 180 +- .../W3DDevice/GameClient/Water/W3DWater.cpp | 10 +- .../GameClient/Water/W3DWaterTracks.cpp | 6 +- .../W3DDevice/GameClient/WorldHeightMap.cpp | 6 +- .../Win32Device/Common/Win32BIGFileSystem.cpp | 18 +- .../Win32Device/Common/Win32GameEngine.cpp | 8 +- .../Tools/WorldBuilder/include/CUndoable.h | 20 +- .../Tools/WorldBuilder/include/DrawObject.h | 6 +- .../Tools/WorldBuilder/include/EditAction.h | 2 +- .../Tools/WorldBuilder/include/LayersList.h | 3 +- .../WorldBuilder/include/mapobjectprops.h | 8 +- .../Tools/WorldBuilder/include/wbview3d.h | 10 +- .../Code/Tools/WorldBuilder/src/CUndoable.cpp | 54 +- .../Tools/WorldBuilder/src/DrawObject.cpp | 4 +- .../WorldBuilder/src/GlobalLightOptions.cpp | 2 +- .../WorldBuilder/src/SelectMacrotexture.cpp | 2 +- .../Tools/WorldBuilder/src/mapobjectprops.cpp | 1978 +++++------ .../Code/Tools/WorldBuilder/src/wbview3d.cpp | 96 +- 367 files changed, 8098 insertions(+), 8251 deletions(-) diff --git a/Generals/Code/GameEngine/Include/Common/ArchiveFileSystem.h b/Generals/Code/GameEngine/Include/Common/ArchiveFileSystem.h index e9695e0c17..917c862c9f 100644 --- a/Generals/Code/GameEngine/Include/Common/ArchiveFileSystem.h +++ b/Generals/Code/GameEngine/Include/Common/ArchiveFileSystem.h @@ -172,7 +172,6 @@ class ArchiveFileSystem : public SubsystemInterface // Unprotected this for copy-protection routines AsciiString getArchiveFilenameForFile(const AsciiString& filename) const; - void loadMods( void ); protected: diff --git a/Generals/Code/GameEngine/Include/Common/BuildAssistant.h b/Generals/Code/GameEngine/Include/Common/BuildAssistant.h index 2f7bca7474..228781072e 100644 --- a/Generals/Code/GameEngine/Include/Common/BuildAssistant.h +++ b/Generals/Code/GameEngine/Include/Common/BuildAssistant.h @@ -112,12 +112,12 @@ class BuildAssistant : public SubsystemInterface enum LocalLegalToBuildOptions { - TERRAIN_RESTRICTIONS = 0x00000001, ///< Check for basic terrain restrictions - CLEAR_PATH = 0x00000002, ///< Must be able to path find to location - NO_OBJECT_OVERLAP = 0X00000004, ///< Can't overlap enemy objects, or locally controled objects that can't move out of the way - USE_QUICK_PATHFIND = 0x00000008, ///< Use the quick pathfind method for CLEAR_PATH - SHROUD_REVEALED = 0x00000010, ///< Check to make sure the shroud is revealed - NO_ENEMY_OBJECT_OVERLAP=0x00000020, ///< Can't overlap enemy objects only. + TERRAIN_RESTRICTIONS = 0x00000001, ///< Check for basic terrain restrictions + CLEAR_PATH = 0x00000002, ///< Must be able to path find to location + NO_OBJECT_OVERLAP = 0X00000004, ///< Can't overlap enemy objects, or locally controled objects that can't move out of the way + USE_QUICK_PATHFIND = 0x00000008, ///< Use the quick pathfind method for CLEAR_PATH + SHROUD_REVEALED = 0x00000010, ///< Check to make sure the shroud is revealed + NO_ENEMY_OBJECT_OVERLAP = 0x00000020, ///< Can't overlap enemy objects only. }; public: diff --git a/Generals/Code/GameEngine/Include/Common/FileSystem.h b/Generals/Code/GameEngine/Include/Common/FileSystem.h index a7513a994a..1f9164f02a 100644 --- a/Generals/Code/GameEngine/Include/Common/FileSystem.h +++ b/Generals/Code/GameEngine/Include/Common/FileSystem.h @@ -138,8 +138,6 @@ class FileSystem : public SubsystemInterface void loadMusicFilesFromCD(); void unloadMusicFilesFromCD(); protected: - - }; extern FileSystem* TheFileSystem; diff --git a/Generals/Code/GameEngine/Include/Common/GameMemory.h b/Generals/Code/GameEngine/Include/Common/GameMemory.h index 2c222407e9..0901e887cb 100644 --- a/Generals/Code/GameEngine/Include/Common/GameMemory.h +++ b/Generals/Code/GameEngine/Include/Common/GameMemory.h @@ -730,7 +730,6 @@ private: \ public: /* include this line at the end to reset visibility to 'public' */ - // ---------------------------------------------------------------------------- /** This class is provided as a simple and safe way to integrate C++ object allocation @@ -768,7 +767,6 @@ class MemoryPoolObject }; - // INLINING /////////////////////////////////////////////////////////////////// // ---------------------------------------------------------------------------- @@ -890,10 +888,9 @@ class STLSpecialAlloc static void deallocate(void* __p, size_t); }; -#endif //DISABLE_GAMEMEMORY +#endif // DISABLE_GAMEMEMORY -// ---------------------------------------------------------------------------- /** A simple utility class to ensure exception safety; this holds a MemoryPoolObject and deletes it in its destructor. Especially useful for iterators! @@ -910,7 +907,6 @@ class MemoryPoolObjectHolder }; -// ---------------------------------------------------------------------------- /** Sometimes you want to make a class's destructor protected so that it can only be destroyed under special circumstances. MemoryPoolObject short-circuits this @@ -924,4 +920,5 @@ ARGVIS: void deleteInstance() { MemoryPoolObject::deleteInstance(); } public: #define EMPTY_DTOR(CLASS) inline CLASS::~CLASS() { } + #endif // _GAME_MEMORY_H_ diff --git a/Generals/Code/GameEngine/Include/Common/GlobalData.h b/Generals/Code/GameEngine/Include/Common/GlobalData.h index 8263cafc71..b567d994a1 100644 --- a/Generals/Code/GameEngine/Include/Common/GlobalData.h +++ b/Generals/Code/GameEngine/Include/Common/GlobalData.h @@ -412,7 +412,7 @@ class GlobalData : public SubsystemInterface UnsignedInt m_unlookPersistDuration; ///< How long after unlook until the sighting info executes the undo Bool m_shouldUpdateTGAToDDS; ///< Should we attempt to update old TGAs to DDS stuff on loadup? - + UnsignedInt m_doubleClickTimeMS; ///< What is the maximum amount of time that can seperate two clicks in order ///< for us to generate a double click message? @@ -486,7 +486,6 @@ class GlobalData : public SubsystemInterface Bool m_isBreakableMovie; ///< if we enter a breakable movie, set this flag Bool m_breakTheMovie; ///< The user has hit escape! - AsciiString m_modDir; AsciiString m_modBIG; diff --git a/Generals/Code/GameEngine/Include/Common/KindOf.h b/Generals/Code/GameEngine/Include/Common/KindOf.h index 97c3bd6950..d060e1034f 100644 --- a/Generals/Code/GameEngine/Include/Common/KindOf.h +++ b/Generals/Code/GameEngine/Include/Common/KindOf.h @@ -144,7 +144,6 @@ enum KindOfType KINDOF_DONT_AUTO_CRUSH_INFANTRY, ///< These units don't try to crush the infantry if ai. KINDOF_COUNT // total number of kindofs - }; typedef BitFlags KindOfMaskType; diff --git a/Generals/Code/GameEngine/Include/Common/MiscAudio.h b/Generals/Code/GameEngine/Include/Common/MiscAudio.h index 69b09a0564..6472c1bf9c 100644 --- a/Generals/Code/GameEngine/Include/Common/MiscAudio.h +++ b/Generals/Code/GameEngine/Include/Common/MiscAudio.h @@ -73,4 +73,4 @@ struct MiscAudio }; -#endif /* _MISCAUDIO_H_ */ \ No newline at end of file +#endif /* _MISCAUDIO_H_ */ diff --git a/Generals/Code/GameEngine/Include/Common/Money.h b/Generals/Code/GameEngine/Include/Common/Money.h index 2af2524424..86b744b9f3 100644 --- a/Generals/Code/GameEngine/Include/Common/Money.h +++ b/Generals/Code/GameEngine/Include/Common/Money.h @@ -83,7 +83,6 @@ class Money : public Snapshot void setPlayerIndex(Int ndx) { m_playerIndex = ndx; } protected: - // snapshot methods virtual void crc( Xfer *xfer ); virtual void xfer( Xfer *xfer ); diff --git a/Generals/Code/GameEngine/Include/Common/PlayerTemplate.h b/Generals/Code/GameEngine/Include/Common/PlayerTemplate.h index 6d0be82cbb..481fe3a332 100644 --- a/Generals/Code/GameEngine/Include/Common/PlayerTemplate.h +++ b/Generals/Code/GameEngine/Include/Common/PlayerTemplate.h @@ -126,7 +126,6 @@ class PlayerTemplate Int getSpecialPowerShortcutButtonCount( void ) const {return m_specialPowerShortcutButtonCount; } AsciiString getLoadScreenMusic( void ) const {return m_loadScreenMusic; } - static const FieldParse* getFieldParse(); @@ -200,7 +199,6 @@ class PlayerTemplateStore : public SubsystemInterface const PlayerTemplate* getNthPlayerTemplate(Int i) const; const PlayerTemplate* findPlayerTemplate(NameKeyType namekey) const; inline Int getPlayerTemplateCount() const { return m_playerTemplates.size(); } - // This function will fill outStringList with all the sides found in all the templates void getAllSideStrings(AsciiStringList *outStringList); diff --git a/Generals/Code/GameEngine/Include/Common/StackDump.h b/Generals/Code/GameEngine/Include/Common/StackDump.h index d0f7a1ff4f..11fc3e6844 100644 --- a/Generals/Code/GameEngine/Include/Common/StackDump.h +++ b/Generals/Code/GameEngine/Include/Common/StackDump.h @@ -29,8 +29,7 @@ #ifndef IG_DEGBUG_STACKTRACE #define IG_DEBUG_STACKTRACE 1 -#endif - +#endif // Unsure about this one -ML 3/25/03 #if defined(_DEBUG) || defined(_INTERNAL) || defined(IG_DEBUG_STACKTRACE) // Writes a stackdump (provide a callback : gets called per line) @@ -71,5 +70,4 @@ __inline void DumpExceptionInfo( unsigned int u, EXCEPTION_POINTERS* e_info ) {} extern AsciiString g_LastErrorDump; - #endif // __STACKDUMP_H_ diff --git a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h index 13b7f09432..1f562c1284 100644 --- a/Generals/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/Generals/Code/GameEngine/Include/Common/ThingTemplate.h @@ -510,7 +510,7 @@ class ThingTemplate : public Overridable const FXList* getPerUnitFX(const AsciiString& fxName) const; UnsignedInt getThreatValue() const { return m_threatValue; } - UnsignedInt getMaxSimultaneousOfType() const { return m_maxSimultaneousOfType; } + UnsignedInt getMaxSimultaneousOfType() const { return m_maxSimultaneousOfType; } void validate(); diff --git a/Generals/Code/GameEngine/Include/GameClient/CommandXlat.h b/Generals/Code/GameEngine/Include/GameClient/CommandXlat.h index 7ff725d7dd..f8ba4fa497 100644 --- a/Generals/Code/GameEngine/Include/GameClient/CommandXlat.h +++ b/Generals/Code/GameEngine/Include/GameClient/CommandXlat.h @@ -105,7 +105,6 @@ enum FilterModes FM_VIEW_MB_END_PAN_ALPHA, // Moton blur on screen pan (for camera tracks object mode) - // NOTE: This has to be the last entry in this enum. // Add new entries before this one. jba. FM_VIEW_MB_PAN_ALPHA, // Moton blur on screen pan (for camera tracks object mode) diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h index 30123bb0f8..70670fc56d 100644 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBar.h +++ b/Generals/Code/GameEngine/Include/GameClient/ControlBar.h @@ -186,7 +186,7 @@ enum GUICommandType GUI_COMMAND_FIRE_WEAPON, ///< fire a weapon GUI_COMMAND_SPECIAL_POWER, ///< do a special power GUI_COMMAND_PURCHASE_SCIENCE, ///< purchase science - GUI_COMMAND_HACK_INTERNET, ///< Hey author, write me! + GUI_COMMAND_HACK_INTERNET, ///< gain income from the ether (by hacking the internet) GUI_COMMAND_TOGGLE_OVERCHARGE, ///< Overcharge command for power plants #ifdef ALLOW_SURRENDER GUI_COMMAND_POW_RETURN_TO_PRISON, ///< POW Truck, return to prison diff --git a/Generals/Code/GameEngine/Include/GameClient/Eva.h b/Generals/Code/GameEngine/Include/GameClient/Eva.h index efd07f41c4..f46e33233d 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Eva.h +++ b/Generals/Code/GameEngine/Include/GameClient/Eva.h @@ -176,4 +176,4 @@ class Eva : public SubsystemInterface extern Eva *TheEva; -#endif /* __EVA_H__ */ \ No newline at end of file +#endif /* __EVA_H__ */ diff --git a/Generals/Code/GameEngine/Include/GameClient/GameClient.h b/Generals/Code/GameEngine/Include/GameClient/GameClient.h index 2625138de4..25aa27cc57 100644 --- a/Generals/Code/GameEngine/Include/GameClient/GameClient.h +++ b/Generals/Code/GameEngine/Include/GameClient/GameClient.h @@ -183,7 +183,6 @@ class GameClient : public SubsystemInterface, virtual TerrainVisual *createTerrainVisual( void ) = 0; ///< Factory for TerrainVisual classes. Called during init to instance TheTerrainVisual virtual Keyboard *createKeyboard( void ) = 0; ///< factory for the keyboard virtual Mouse *createMouse( void ) = 0; ///< factory for the mouse - virtual void setFrameRate(Real msecsPerFrame) = 0; // ---------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h index f349892ec5..1864b00902 100644 --- a/Generals/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/Generals/Code/GameEngine/Include/GameClient/InGameUI.h @@ -37,6 +37,7 @@ #include "Common/GameType.h" #include "Common/MessageStream.h" // for GameMessageTranslator #include "Common/SpecialPowerType.h" +#include "Common/Snapshot.h" #include "Common/STLTypedefs.h" #include "Common/SubsystemInterface.h" #include "Common/UnicodeString.h" @@ -44,7 +45,6 @@ #include "GameClient/Mouse.h" #include "GameClient/RadiusDecal.h" #include "GameClient/View.h" -#include "Common/Snapshot.h" // FORWARD DECLARATIONS /////////////////////////////////////////////////////////////////////////// class Drawable; @@ -118,7 +118,7 @@ static const char *TheRadiusCursorNames[] = "CARPETBOMB", "DAISYCUTTER", "PARADROP", - "SPYSATELLITE", + "SPYSATELLITE", "NUCLEARMISSILE", "EMPPULSE", diff --git a/Generals/Code/GameEngine/Include/GameClient/Mouse.h b/Generals/Code/GameEngine/Include/GameClient/Mouse.h index 931b7ee071..966d162866 100644 --- a/Generals/Code/GameEngine/Include/GameClient/Mouse.h +++ b/Generals/Code/GameEngine/Include/GameClient/Mouse.h @@ -281,7 +281,7 @@ class Mouse : public SubsystemInterface void mouseNotifyResolutionChange(void); Bool isClick(const ICoord2D *anchor, const ICoord2D *dest, UnsignedInt previousMouseClick, UnsignedInt currentMouseClick); - + AsciiString m_tooltipFontName; ///< tooltip font Int m_tooltipFontSize; ///< tooltip font Bool m_tooltipFontIsBold; ///< tooltip font diff --git a/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h b/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h index 789460226f..f3c439c490 100644 --- a/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h +++ b/Generals/Code/GameEngine/Include/GameClient/TerrainVisual.h @@ -156,7 +156,7 @@ class TerrainVisual : public Snapshot, // Modify height. // virtual void setRawMapHeight(const ICoord2D *gridPos, Int height)=0; - + /// Replace the skybox texture virtual void replaceSkyboxTextures(const AsciiString *oldTexName[NumSkyboxTextures], const AsciiString *newTexName[NumSkyboxTextures])=0; diff --git a/Generals/Code/GameEngine/Include/GameClient/View.h b/Generals/Code/GameEngine/Include/GameClient/View.h index a6bc49708c..4da86ab1d6 100644 --- a/Generals/Code/GameEngine/Include/GameClient/View.h +++ b/Generals/Code/GameEngine/Include/GameClient/View.h @@ -144,8 +144,8 @@ class View : public Snapshot virtual void setFadeParameters(Int fadeFrames, Int direction) { }; virtual void set3DWireFrameMode(Bool enable) { }; - virtual void resetCamera(const Coord3D *location, Int frames) {}; ///< Move camera to location, and reset to default angle & zoom. - virtual void rotateCamera(Real rotations, Int frames) {}; ///< Rotate camera about current viewpoint. + virtual void resetCamera(const Coord3D *location, Int frames) {}; ///< Move camera to location, and reset to default angle & zoom. + virtual void rotateCamera(Real rotations, Int frames) {}; ///< Rotate camera about current viewpoint. virtual void rotateCameraTowardObject(ObjectID id, Int milliseconds, Int holdMilliseconds) {}; ///< Rotate camera to face an object, and hold on it virtual void rotateCameraTowardPosition(const Coord3D *pLoc, Int milliseconds) {}; ///< Rotate camera to face a location. virtual Bool isTimeFrozen(void){ return false;} ///< Freezes time during the next camera movement. diff --git a/Generals/Code/GameEngine/Include/GameLogic/AI.h b/Generals/Code/GameEngine/Include/GameLogic/AI.h index ca987196c5..3ea66d2256 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/AI.h +++ b/Generals/Code/GameEngine/Include/GameLogic/AI.h @@ -307,7 +307,8 @@ class Weapon; // TheSuperHackers @compile xezon 22/03/2025 Renames AI_PASSIVE to not conflict with macro in ws2def.h // Note - written out in save/load xfer and .map files, don't change these numbers. -enum AttitudeType { +enum AttitudeType +{ ATTITUDE_SLEEP = -2, ATTITUDE_PASSIVE=-1, ATTITUDE_NORMAL=0, diff --git a/Generals/Code/GameEngine/Include/GameLogic/Damage.h b/Generals/Code/GameEngine/Include/GameLogic/Damage.h index 55b3af48d4..f169b0a4cc 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Damage.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Damage.h @@ -36,6 +36,7 @@ #include "Common/GameType.h" #include "Common/Snapshot.h" + // FORWARD REFERENCES ///////////////////////////////////////////////////////////////////////////// class Object; class INI; @@ -215,7 +216,6 @@ static const char *TheDeathNames[] = "DETONATED", "SPLATTED", "POISONED_BETA", - "EXTRA_2", "EXTRA_3", "EXTRA_4", diff --git a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h index b242ec57fd..261f8e4866 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h +++ b/Generals/Code/GameEngine/Include/GameLogic/GameLogic.h @@ -68,6 +68,7 @@ class GhostObjectManager; class CommandButton; enum BuildableStatus; + typedef const CommandButton* ConstCommandButtonPtr; // What kind of game we're in. @@ -88,6 +89,7 @@ enum CRC_RECALC }; + /// Function pointers for use by GameLogic callback functions. typedef void (*GameLogicFuncPtr)( Object *obj, void *userData ); typedef std::hash_map, rts::equal_to > ObjectPtrHash; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h b/Generals/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h index 431786efe7..491fbddcdc 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/BehaviorModule.h @@ -209,8 +209,8 @@ class ParkingPlaceBehaviorInterface Coord3D parkingSpace; Real parkingOrientation; Coord3D runwayPrep; - Coord3D runwayStart; - Coord3D runwayEnd; + Coord3D runwayStart; + Coord3D runwayEnd; Coord3D runwayApproach; Coord3D hangarInternal; Real hangarInternalOrient; diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h b/Generals/Code/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h index 3a14a46d97..233b50efc9 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h @@ -22,7 +22,7 @@ // // //////////////////////////////////////////////////////////////////////////////// -// FILE: VeterancyCrateCollide.h ///////////////////////////////////////////////////////////////////////// +// FILE: ConvertToCarBombCrateCollide.h ///////////////////////////////////////////////////////////////////////// // Author: Kris Morness, April 2002 // Desc: A crate (actually a terrorist - mobile crate) that converts a car into a carbomb, activating // it's weapon and then activating it's AI. diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h index 656e0d9e25..c9acae7c7a 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h @@ -49,7 +49,7 @@ class EMPUpdateModuleData : public UpdateModuleData RGBColor m_startColor; RGBColor m_endColor; const ParticleSystemTemplate *m_disableFXParticleSystem; - Real m_sparksPerCubicFoot; // m_textWindows; std::set m_preorderPlayers; - Int m_additionalDisconnects; }; diff --git a/Generals/Code/GameEngine/Source/Common/Audio/GameAudio.cpp b/Generals/Code/GameEngine/Source/Common/Audio/GameAudio.cpp index e6102e5753..47209004a6 100644 --- a/Generals/Code/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/Generals/Code/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -390,6 +390,7 @@ void AudioManager::update() m_zoomVolume = 1.0f - scalar * maxBoostScalar; } } + set3DVolumeAdjustment( m_zoomVolume ); } diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index 124715e1cb..9c024c8cf1 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -457,7 +457,7 @@ GlobalData* GlobalData::m_theOriginal = NULL; { "SpecialPowerViewObject", INI::parseAsciiString, NULL, offsetof( GlobalData, m_specialPowerViewObjectName ) }, { "StandardPublicBone", INI::parseAsciiStringVectorAppend, NULL, offsetof(GlobalData, m_standardPublicBones) }, - { "ShowMetrics", INI::parseBool, NULL, offsetof( GlobalData, m_showMetrics ) }, + { "ShowMetrics", INI::parseBool, NULL, offsetof( GlobalData, m_showMetrics ) }, { "DefaultStartingCash", INI::parseUnsignedInt, NULL, offsetof( GlobalData, m_defaultStartingCash ) }, // NOTE: m_doubleClickTimeMS is still in use, but we disallow setting it from the GameData.ini file. It is now set in the constructor according to the windows parameter. @@ -1050,7 +1050,9 @@ GlobalData::~GlobalData( void ) m_weaponBonusSet->deleteInstance(); if( m_theOriginal == this ) + { m_theOriginal = NULL; + } } // end ~GlobalData @@ -1186,7 +1188,7 @@ void GlobalData::parseGameDataDefinition( INI* ini ) // override INI values with user preferences OptionPreferences optionPref; - TheWritableGlobalData->m_useAlternateMouse = optionPref.getAlternateMouseModeEnabled(); + TheWritableGlobalData->m_useAlternateMouse = optionPref.getAlternateMouseModeEnabled(); TheWritableGlobalData->m_keyboardScrollFactor = optionPref.getScrollFactor(); TheWritableGlobalData->m_defaultIP = optionPref.getLANIPAddress(); TheWritableGlobalData->m_firewallSendDelay = optionPref.getSendDelay(); diff --git a/Generals/Code/GameEngine/Source/Common/MessageStream.cpp b/Generals/Code/GameEngine/Source/Common/MessageStream.cpp index f1dcfecb07..f774afb095 100644 --- a/Generals/Code/GameEngine/Source/Common/MessageStream.cpp +++ b/Generals/Code/GameEngine/Source/Common/MessageStream.cpp @@ -625,6 +625,7 @@ AsciiString GameMessage::getCommandTypeAsAsciiString(GameMessage::Type t) CHECK_IF(MSG_DEBUG_HURT_OBJECT) CHECK_IF(MSG_DEBUG_KILL_OBJECT) #endif + CHECK_IF(MSG_END_NETWORK_MESSAGES) CHECK_IF(MSG_TIMESTAMP) CHECK_IF(MSG_OBJECT_CREATED) diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp index 79b022cd18..6a1c5ea027 100644 --- a/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/Generals/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -686,14 +686,15 @@ void Player::update() m_ai->update(); // Allow the teams this player owns to update themselves. - - for (PlayerTeamList::iterator it = m_playerTeamPrototypes.begin(); it != m_playerTeamPrototypes.end(); ++it) { - for (DLINK_ITERATOR iter = (*it)->iterate_TeamInstanceList(); !iter.done(); iter.advance()) { + for( PlayerTeamList::iterator it = m_playerTeamPrototypes.begin(); it != m_playerTeamPrototypes.end(); ++it ) + { + for( DLINK_ITERATOR iter = (*it)->iterate_TeamInstanceList(); !iter.done(); iter.advance() ) + { Team *team = iter.cur(); - if (!team) { + if( !team ) + { continue; } - team->updateGenericScripts(); } } @@ -859,14 +860,17 @@ void Player::initFromDict(const Dict* d) } Int diffInt = d->getInt(TheKey_skirmishDifficulty, &exists); GameDifficulty difficulty = TheScriptEngine->getGlobalDifficulty(); - if (exists) { + if (exists) + { difficulty = (GameDifficulty) diffInt; } - if (m_ai) { + if (m_ai) + { m_ai->setAIDifficulty(difficulty); } - if (!found) { + if (!found) + { DEBUG_CRASH(("Could not find skirmish player for side %s", mySide.str())); } else { m_playerName = qualTemplatePlayerName; @@ -3201,7 +3205,8 @@ void Player::processSelectTeamGameMessage(Int hotkeyNum, GameMessage *msg) { VecObjectPtr objectList = m_squads[hotkeyNum]->getLiveObjects(); Int numObjs = objectList.size(); - for (Int i = 0; i < numObjs; ++i) { + for (Int i = 0; i < numObjs; ++i) + { m_currentSelection->addObject(objectList[i]); } } @@ -3508,7 +3513,7 @@ void Player::crc( Xfer *xfer ) // Same cheat principle as pulling NeedScience off your Generals buttons. xfer->xferInt( &m_skillPoints ); xfer->xferInt( &m_sciencePurchasePoints ); - + } // end crc // ------------------------------------------------------------------------------------------------ @@ -3883,11 +3888,6 @@ void Player::xfer( Xfer *xfer ) // score keeper xfer->xferSnapshot( &m_scoreKeeper ); - - - - - // size of and data for kindof percent production change list UnsignedShort percentProductionChangeCount = m_kindOfPercentProductionChangeList.size(); xfer->xferUnsignedShort( &percentProductionChangeCount ); diff --git a/Generals/Code/GameEngine/Source/Common/Recorder.cpp b/Generals/Code/GameEngine/Source/Common/Recorder.cpp index e7e2c12f0c..48212c5682 100644 --- a/Generals/Code/GameEngine/Source/Common/Recorder.cpp +++ b/Generals/Code/GameEngine/Source/Common/Recorder.cpp @@ -553,7 +553,7 @@ void RecorderClass::startRecording(GameDifficulty diff, Int originalGameMode, In // // save space for stats to be filled in. // - // **** if this changes, change the LAN Playtest code above **** + // **** if this changes, change the LAN code above **** // time_t t = 0; fwrite(&t, sizeof(time_t), 1, m_file); // reserve space for start time @@ -1022,6 +1022,7 @@ void RecorderClass::handleCRCMessage(UnsignedInt newCRC, Int playerIndex, Bool f { m_crcInfo->setSawCRCMismatch(); + //Kris: Patch 1.01 November 10, 2003 (integrated changes from Matt Campbell) // Since we don't seem to have any *visible* desyncs when replaying games, but get this warning // virtually every replay, the assumption is our CRC checking is faulty. Since we're at the // tail end of patch season, let's just disable the message, and hope the users believe the diff --git a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp index f8df862b8c..d586bf7cda 100644 --- a/Generals/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/Generals/Code/GameEngine/Source/Common/StateMachine.cpp @@ -168,7 +168,7 @@ StateReturnType State::friend_checkForTransitions( StateReturnType status ) } else if (it->toStateID == EXIT_MACHINE_WITH_FAILURE) { - return STATE_FAILURE; + return STATE_FAILURE;//Lorenzen wants to know why... } // move to new state diff --git a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index 9024ae88d5..6c20a429bc 100644 --- a/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -349,10 +349,10 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe } // end if - // Need to validate that we can make this in case someone fakes their CommandSet + // Need to validate that we can make this in case someone fakes their CommandSet // A Null constructorObject is used by the script engine to cheat, so let it slide - if( constructorObject && !isPossibleToMakeUnit(constructorObject, what) ) - return NULL; + if( constructorObject && !isPossibleToMakeUnit(constructorObject, what) ) + return NULL; // clear out any objects from the building area that are "auto-clearable" when building clearRemovableForConstruction( what, pos, angle ); @@ -893,7 +893,6 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, { return LBC_OBJECTS_IN_THE_WAY; } - } // end if if (build->isKindOf(KINDOF_CANNOT_BUILD_NEAR_SUPPLIES) && TheGlobalData->m_SupplyBuildBorder > 0) @@ -924,7 +923,7 @@ LegalBuildCode BuildAssistant::isLocationLegalToBuild( const Coord3D *worldPos, } } - // if clear path is requestsed check to see if the builder object can get there + // if clear path is requested check to see if the builder object can get there if( BitIsSet( options, CLEAR_PATH ) && builderObject ) { AIUpdateInterface *ai = builderObject->getAIUpdateInterface(); diff --git a/Generals/Code/GameEngine/Source/Common/System/Debug.cpp b/Generals/Code/GameEngine/Source/Common/System/Debug.cpp index b2a41ca99b..9575a6031d 100644 --- a/Generals/Code/GameEngine/Source/Common/System/Debug.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/Debug.cpp @@ -688,7 +688,6 @@ void ReleaseCrash(const char *reason) ShowWindow(ApplicationHWnd, SW_HIDE); } } - #if defined(_DEBUG) || defined(_INTERNAL) /* static */ char buff[8192]; // not so static so we can be threadsafe _snprintf(buff, 8192, "Sorry, a serious error occurred. (%s)", reason); diff --git a/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp b/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp index 36a786a034..b4ab064b5b 100644 --- a/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/DisabledTypes.cpp @@ -40,7 +40,7 @@ const char* DisabledMaskType::s_bitNameList[] = "DISABLED_UNMANNED", "DISABLED_UNDERPOWERED", "DISABLED_FREEFALL", - + "DISABLED_SCRIPT_DISABLED", "DISABLED_SCRIPT_UNDERPOWERED", diff --git a/Generals/Code/GameEngine/Source/Common/System/FileSystem.cpp b/Generals/Code/GameEngine/Source/Common/System/FileSystem.cpp index 6d8e433b92..2e568b72c9 100644 --- a/Generals/Code/GameEngine/Source/Common/System/FileSystem.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/FileSystem.cpp @@ -196,10 +196,12 @@ File* FileSystem::openFile( const Char *filename, Int access ) Bool FileSystem::doesFileExist(const Char *filename) const { USE_PERF_TIMER(FileSystem) - if (TheLocalFileSystem->doesFileExist(filename)) { + if (TheLocalFileSystem->doesFileExist(filename)) + { return TRUE; } - if (TheArchiveFileSystem->doesFileExist(filename)) { + if (TheArchiveFileSystem->doesFileExist(filename)) + { return TRUE; } return FALSE; diff --git a/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp b/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp index c60f22e80b..e85783ad91 100644 --- a/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/GameCommon.cpp @@ -51,7 +51,7 @@ const char *TheRelationshipNames[] = Real normalizeAngle(Real angle) { DEBUG_ASSERTCRASH(!_isnan(angle), ("Angle is NAN in normalizeAngle!\n")); - + if( _isnan(angle) ) return 0;// ARGH!!!! Don't assert and then not handle it! Error bad! Fix error! diff --git a/Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp b/Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp index 33f216e4be..ae8453478a 100644 --- a/Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp @@ -902,9 +902,11 @@ void MemoryPoolSingleBlock::initBlock(Int logicalSize, MemoryPoolBlob *owningBlo #endif } #endif // MEMORYPOOL_DEBUG + #ifdef MEMORYPOOL_CHECKPOINTING m_checkpointInfo = NULL; #endif + #ifdef MEMORYPOOL_BOUNDINGWALL m_wallPattern = theBoundingWallPattern++; debugFillInWalls(); @@ -2690,8 +2692,7 @@ MemoryPool *MemoryPoolFactory::createMemoryPool(const char *poolName, Int alloca */ MemoryPool *MemoryPoolFactory::findMemoryPool(const char *poolName) { - MemoryPool *pool = m_firstPoolInFactory; - for (; pool; pool = pool->getNextPoolInList()) + for (MemoryPool *pool = m_firstPoolInFactory; pool; pool = pool->getNextPoolInList()) { if (!strcmp(poolName, pool->getPoolName())) { diff --git a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp index 0625d7e74b..27e8e988f4 100644 --- a/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/SaveGame/GameStateMap.cpp @@ -29,6 +29,7 @@ // INCLUDES /////////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" + #include "Common/file.h" #include "Common/FileSystem.h" #include "Common/GameState.h" @@ -410,16 +411,21 @@ void GameStateMap::xfer( Xfer *xfer ) xfer->xferDrawableID( &highDrawableID ); TheGameClient->setDrawableIDCounter( highDrawableID ); - if (TheGameLogic->getGameMode()==GAME_SKIRMISH) { - if (TheSkirmishGameInfo==NULL) { + if( TheGameLogic->getGameMode()==GAME_SKIRMISH ) + { + if( TheSkirmishGameInfo==NULL ) + { TheSkirmishGameInfo = NEW SkirmishGameInfo; TheSkirmishGameInfo->init(); TheSkirmishGameInfo->clearSlotList(); TheSkirmishGameInfo->reset(); } xfer->xferSnapshot(TheSkirmishGameInfo); - } else { - if (TheSkirmishGameInfo) { + } + else + { + if( TheSkirmishGameInfo ) + { delete TheSkirmishGameInfo; TheSkirmishGameInfo = NULL; } @@ -430,7 +436,8 @@ void GameStateMap::xfer( Xfer *xfer ) // things in the map file that don't don't change (terrain, triggers, teams, script // definitions) etc // - if( xfer->getXferMode() == XFER_LOAD ) { + if( xfer->getXferMode() == XFER_LOAD ) + { TheGameLogic->startNewGame( TRUE ); } diff --git a/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp b/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp index 1450537656..9c29e51879 100644 --- a/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/StackDump.cpp @@ -469,6 +469,7 @@ void WriteStackLine(void*address, void (*callback)(const char*)) callback("\n"); } + //***************************************************************************** //***************************************************************************** void DumpExceptionInfo( unsigned int u, EXCEPTION_POINTERS* e_info ) diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp index b55e78238e..1e3e57d8e5 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ModuleFactory.cpp @@ -57,8 +57,8 @@ #include "GameLogic/Module/OverchargeBehavior.h" #include "GameLogic/Module/HealContain.h" #include "GameLogic/Module/GarrisonContain.h" -#include "GameLogic/Module/TransportContain.h" #include "GameLogic/Module/RailedTransportContain.h" +#include "GameLogic/Module/TransportContain.h" #include "GameLogic/Module/MobNexusContain.h" #include "GameLogic/Module/TunnelContain.h" #include "GameLogic/Module/OverlordContain.h" @@ -67,7 +67,7 @@ #include "GameLogic/Module/POWTruckBehavior.h" #include "GameLogic/Module/PrisonBehavior.h" #include "GameLogic/Module/PropagandaCenterBehavior.h" -#endif +#endif #include "GameLogic/Module/PropagandaTowerBehavior.h" #include "GameLogic/Module/FireWeaponWhenDamagedBehavior.h" #include "GameLogic/Module/FireWeaponWhenDeadBehavior.h" @@ -214,14 +214,14 @@ #include "GameLogic/Module/FireWeaponCollide.h" #include "GameLogic/Module/SquishCollide.h" +#include "GameLogic/Module/ConvertToCarBombCrateCollide.h" +#include "GameLogic/Module/ConvertToHijackedVehicleCrateCollide.h" #include "GameLogic/Module/HealCrateCollide.h" #include "GameLogic/Module/MoneyCrateCollide.h" +#include "GameLogic/Module/SalvageCrateCollide.h" #include "GameLogic/Module/ShroudCrateCollide.h" #include "GameLogic/Module/UnitCrateCollide.h" #include "GameLogic/Module/VeterancyCrateCollide.h" -#include "GameLogic/Module/ConvertToCarBombCrateCollide.h" -#include "GameLogic/Module/ConvertToHijackedVehicleCrateCollide.h" -#include "GameLogic/Module/SalvageCrateCollide.h" // body includes #include "GameLogic/Module/InactiveBody.h" diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index 4b46cbe56d..027de71662 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -50,8 +50,8 @@ #ifdef _INTERNAL // for occasional debugging... -///#pragma optimize("", off) -///#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") +//#pragma optimize("", off) +//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") #endif enum { TEMPLATE_HASH_SIZE = 12288 }; diff --git a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 37cb205bad..dae0933f7f 100644 --- a/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/Generals/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -388,6 +388,7 @@ Bool ModuleInfo::clearModuleDataWithTag(const AsciiString& tagToClear, AsciiStri return cleared; } + //------------------------------------------------------------------------------------------------- Bool ModuleInfo::clearCopiedFromDefaultEntries(Int interfaceMask) { diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp index 1550cae3bf..16493fb6e2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -413,7 +413,6 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit m_ambientSoundEnabled = TRUE; - // // allocate any modules we need to, we should keep // this at or near the end of the drawable construction so that we have // all the valid data about the thing when we create the module diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 9209202477..bdcdd3f3d8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -369,7 +369,7 @@ void ControlBar::populatePurchaseScience( Player* player ) progress = ((player->getSkillPoints() - player->getSkillPointsLevelDown()) * 100) /(player->getSkillPointsLevelUp() - player->getSkillPointsLevelDown()); GadgetProgressBarSetProgress(win, progress); } - + win = TheWindowManager->winGetWindowFromId( m_contextParent[ CP_PURCHASE_SCIENCE ], TheNameKeyGenerator->nameToKey( "GeneralsExpPoints.wnd:StaticTextTitle" ) ); if(win) { @@ -3146,12 +3146,8 @@ void ControlBar::initSpecialPowershortcutBar( Player *player) id = TheNameKeyGenerator->nameToKey( windowName.str() ); m_specialPowerShortcutButtonParents[ i ] = TheWindowManager->winGetWindowFromId( m_specialPowerShortcutParent, id ); - - } // end for i - - } void ControlBar::populateSpecialPowerShortcut( Player *player) diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp index 06bea9b829..2446c3d7ad 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp @@ -361,7 +361,6 @@ ControlBarScheme::ControlBarScheme(void) m_minMaxButtonEnable = NULL; m_minMaxButtonHightlited = NULL; m_minMaxButtonPushed = NULL; - m_minMaxUL.x = 0; m_minMaxLR.x = 0; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp index a19ed13abd..527b708481 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp @@ -263,11 +263,10 @@ WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg, const DrawableList *drawableList = TheInGameUI->getAllSelectedLocalDrawables(); // locally-owned only - - // see if the user wants to move the tactical view - if ( drawableList->empty() - || (! TheGlobalData->m_useAlternateMouse && msg == GWM_RIGHT_DOWN) - || (TheGlobalData->m_useAlternateMouse && msg == GWM_LEFT_DOWN) ) + // see if the user wants to move the tactical view + if ( drawableList->empty() + || (! TheGlobalData->m_useAlternateMouse && msg == GWM_RIGHT_DOWN) + || (TheGlobalData->m_useAlternateMouse && msg == GWM_LEFT_DOWN) ) { TheTacticalView->lookAt( &world ); break; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp index e73f6db297..0b0f2c6d84 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -1043,7 +1043,6 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m //------------------------------------------------------------------------------------------------- case GCM_SELECTED: { - if (LANbuttonPushed) break; GameWindow *control = (GameWindow *)mData1; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index c2b854f032..98c4151a73 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -107,6 +107,7 @@ void DoCompressTest( void ); #endif // TEST_COMPRESSION #endif + // window ids ------------------------------------------------------------------------------------- static NameKeyType mainMenuID = NAMEKEY_INVALID; static NameKeyType skirmishID = NAMEKEY_INVALID; @@ -179,6 +180,7 @@ static Bool buttonPushed = FALSE; static Bool isShuttingDown = FALSE; static Bool startGame = FALSE; static Int initialGadgetDelay = 210; + enum { SHOW_NONE = 0, diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index e41ce3cbf0..b391d979a3 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -1175,15 +1175,15 @@ static void saveOptions( void ) } //Apply the sound volumes in the audio system now. - TheAudio->setVolume( sound2DVolume, (AudioAffect) (AudioAffect_Sound | AudioAffect_SystemSetting) ); + TheAudio->setVolume( sound2DVolume, (AudioAffect) (AudioAffect_Sound | AudioAffect_SystemSetting) ); TheAudio->setVolume( sound3DVolume, (AudioAffect) (AudioAffect_Sound3D | AudioAffect_SystemSetting) ); //Save the settings in the options.ini. - TheWritableGlobalData->m_SFXVolumeFactor = val; - AsciiString prefString; - prefString.format("%d", REAL_TO_INT( sound2DVolume * 100.0f ) ); - (*pref)["SFXVolume"] = prefString; - prefString.format("%d", REAL_TO_INT( sound3DVolume * 100.0f ) ); + TheWritableGlobalData->m_SFXVolumeFactor = val; + AsciiString prefString; + prefString.format("%d", REAL_TO_INT( sound2DVolume * 100.0f ) ); + (*pref)["SFXVolume"] = prefString; + prefString.format("%d", REAL_TO_INT( sound3DVolume * 100.0f ) ); (*pref)["SFX3DVolume"] = prefString; } @@ -1192,11 +1192,11 @@ static void saveOptions( void ) val = GadgetSliderGetPosition(sliderVoiceVolume); if(val != -1) { - TheWritableGlobalData->m_voiceVolumeFactor = val; - AsciiString prefString; - prefString.format("%d", val); - (*pref)["VoiceVolume"] = prefString; - TheAudio->setVolume(val / 100.0f, (AudioAffect) (AudioAffect_Speech | AudioAffect_SystemSetting)); + TheWritableGlobalData->m_voiceVolumeFactor = val; + AsciiString prefString; + prefString.format("%d", val); + (*pref)["VoiceVolume"] = prefString; + TheAudio->setVolume(val / 100.0f, (AudioAffect) (AudioAffect_Speech | AudioAffect_SystemSetting)); } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp index 13cde82e42..406ef7dc06 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp @@ -108,6 +108,7 @@ static const char *rankNames[] = { "Commander", }; + static const Image* lookupRankImage(AsciiString side, Int rank) { if (side.isEmpty()) @@ -142,6 +143,7 @@ static const Image* lookupRankImage(AsciiString side, Int rank) return img; } + static Int getTotalDisconnectsFromFile(Int playerID) { Int retval = 0; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index 7677da1ae2..46cd81a915 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -543,6 +543,7 @@ void MapSelectorTooltip(GameWindow *window, } + void positionStartSpotControls( GameWindow *win, GameWindow *mapWindow, Coord3D *pos, MapMetaData *mmd, GameWindow *buttonMapStartPositions[]) { if(!win || !mmd || !mapWindow || !buttonMapStartPositions) @@ -1230,7 +1231,7 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData ) TheSkirmishGameInfo->markPlayerAsPreorder(0); } - TheSkirmishGameInfo->setMap(prefs.getPreferredMap()); + TheSkirmishGameInfo->setMap(prefs.getPreferredMap()); const MapMetaData *md = TheMapCache->findMap(TheSkirmishGameInfo->getMap()); if (!md) { @@ -1248,8 +1249,8 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData ) std::map::iterator it = TheMapCache->find(lowerMap); if (it != TheMapCache->end()) { - GadgetStaticTextSetText(textEntryMapDisplay, it->second.m_displayName); - } + GadgetStaticTextSetText(textEntryMapDisplay, it->second.m_displayName); + } skirmishPositionStartSpots(); //updateSkirmishGameOptions(); @@ -1344,6 +1345,7 @@ void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheTransitionHandler->reverse("SkirmishGameOptionsMenuFade"); + } // void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) //------------------------------------------------------------------------------------------------- @@ -1460,13 +1462,13 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned { handleTeamSelection(i); } - else if (controlID == comboBoxPlayerID[i]) - { - handlePlayerSelection(i); - } + else if (controlID == comboBoxPlayerID[i]) + { + handlePlayerSelection(i); + } } sandboxOk = FALSE; - skirmishUpdateSlotList(); + skirmishUpdateSlotList(); }// case GCM_SELECTED: //------------------------------------------------------------------------------------------------- case GSM_SLIDER_TRACK: @@ -1523,11 +1525,10 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned else if ( controlID == buttonStartID ) { buttonPushed = TRUE; - SkirmishPreferences prefs; - prefs.write(); + SkirmishPreferences prefs; + prefs.write(); startPressed(); } - else if ( controlID == buttonResetID ) { SkirmishBattleHonors stats; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp index 1edf0dd068..7bd4aa1867 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp @@ -571,10 +571,10 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey("SkirmishGameOptionsMenu.wnd:TextEntryMapDisplay") ); if(win) { - if (md) - { - GadgetStaticTextSetText(win, md->m_displayName); - } + if (md) + { + GadgetStaticTextSetText(win, md->m_displayName); + } } //if (mapFname) //setupGameStart(mapFname); diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp index a5ad03678c..b51768602e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp @@ -1302,8 +1302,6 @@ WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedIn BuddyInfoMap *m = TheGameSpyInfo->getBuddyRequestMap(); m->erase( profileID ); - - // DONT CHECK IN UNTIL MATT HAS REVIEWED // 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)) @@ -1311,7 +1309,6 @@ WindowMsgHandledType WOLBuddyOverlayRCMenuSystem( GameWindow *window, UnsignedIn RequestBuddyAdd(profileID, nick); } updateBuddyInfo(); - } else if (!isBuddy) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index b38ca41ac0..5d26da684d 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -1020,14 +1020,14 @@ void InitWOLGameGadgets( void ) // Initialize the pointers to our gadgets parentWOLGameSetup = TheWindowManager->winGetWindowFromId( NULL, parentWOLGameSetupID ); - buttonEmote = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonEmoteID ); - buttonSelectMap = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonSelectMapID ); - buttonStart = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonStartID ); - buttonBack = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, buttonBackID); + buttonEmote = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonEmoteID ); + buttonSelectMap = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonSelectMapID ); + buttonStart = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonStartID ); + buttonBack = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, buttonBackID); listboxGameSetupChat = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, listboxGameSetupChatID ); textEntryChat = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, textEntryChatID ); textEntryMapDisplay = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, textEntryMapDisplayID ); - windowMap = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,windowMapID ); + windowMap = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,windowMapID ); DEBUG_ASSERTCRASH(windowMap, ("Could not find the parentWOLGameSetup.wnd:MapWindow" )); //Added By Sadullah Nader @@ -2617,11 +2617,11 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg }// case GBM_SELECTED: //------------------------------------------------------------------------------------------------- case GBM_SELECTED_RIGHT: - { - if (buttonPushed) - break; - - GameWindow *control = (GameWindow *)mData1; + { + if (buttonPushed) + break; + + GameWindow *control = (GameWindow *)mData1; Int controlID = control->winGetWindowId(); for (Int i = 0; i < MAX_SLOTS; i++) { diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp index ebdc81d8ab..d28124ae79 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -244,7 +244,7 @@ static void playerTooltip(GameWindow *window, return; } - UnicodeString uName = GadgetListBoxGetText(window, row, 2); + UnicodeString uName = GadgetListBoxGetText(window, row, COLUMN_PLAYERNAME); AsciiString aName; aName.translate(uName); @@ -501,7 +501,7 @@ void PopulateLobbyPlayerListbox(void) } ++numSelected; AsciiString selectedName; - uStr = GadgetListBoxGetText(listboxLobbyPlayers, selectedIndices[i], 2); + uStr = GadgetListBoxGetText(listboxLobbyPlayers, selectedIndices[i], COLUMN_PLAYERNAME); selectedName.translate(uStr); selectedNames.insert(selectedName); DEBUG_LOG(("Saving off old selection %d (%s)\n", selectedIndices[i], selectedName.str())); @@ -704,6 +704,7 @@ void WOLLobbyMenuInit( WindowLayout *layout, void *userData ) if(win) win->winHide(TRUE); DontShowMainMenu = TRUE; + } // WOLLobbyMenuInit //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp index 1794cce95d..974b1de680 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp @@ -58,37 +58,36 @@ // USER INCLUDES ////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- #include "Common/NameKeyGenerator.h" -#include "Common/MultiplayerSettings.h" +#include "Common/AudioAffect.h" +#include "Common/AudioEventRTS.h" +#include "Common/AudioHandleSpecialValues.h" +#include "Common/GameAudio.h" #include "Common/GameEngine.h" +#include "Common/GameLOD.h" #include "Common/GameState.h" -#include "Common/PlayerTemplate.h" -#include "Common/PlayerList.h" +#include "Common/MultiplayerSettings.h" #include "Common/Player.h" -#include "Common/GameLOD.h" -#include "Common/GameAudio.h" -#include "Common/AudioEventRTS.h" -#include "Common/AudioHandleSpecialValues.h" -#include "Common/AudioAffect.h" - -#include "GameClient/LoadScreen.h" -#include "GameClient/Shell.h" -#include "GameClient/GameWindowManager.h" +#include "Common/PlayerList.h" +#include "Common/PlayerTemplate.h" +#include "GameClient/CampaignManager.h" +#include "GameClient/Display.h" #include "GameClient/GadgetProgressBar.h" #include "GameClient/GadgetStaticText.h" #include "GameClient/GameText.h" -#include "GameClient/Display.h" -#include "GameClient/WindowLayout.h" +#include "GameClient/GameWindowManager.h" +#include "GameClient/GameWindowTransitions.h" +#include "GameClient/LoadScreen.h" +#include "GameClient/MapUtil.h" #include "GameClient/Mouse.h" +#include "GameClient/Shell.h" #include "GameClient/VideoPlayer.h" -#include "GameClient/MapUtil.h" +#include "GameClient/WindowLayout.h" #include "GameLogic/FPUControl.h" #include "GameLogic/GameLogic.h" -#include "GameNetwork/NetworkInterface.h" #include "GameNetwork/GameSpy/PeerDefs.h" #include "GameNetwork/GameSpy/PersistentStorageThread.h" -#include "GameClient/CampaignManager.h" +#include "GameNetwork/NetworkInterface.h" #include "GameNetwork/RankPointValue.h" -#include "GameClient/GameWindowTransitions.h" //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index 75a3bffd42..2fe3faace2 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -140,6 +140,7 @@ void GlobalLanguage::init( void ) OSVERSIONINFO osvi; osvi.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); + //GS NOTE: Must call doesFileExist in either case so that NameKeyGenerator will stay in sync AsciiString tempName; tempName.format("Data\\%s\\Language9x.ini", GetRegistryLanguage().str()); diff --git a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp index b348ab5233..f659917ba8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -786,8 +786,8 @@ const FieldParse InGameUI::s_fieldParseTable[] = { "SpySatelliteRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_SPYSATELLITE] ) }, { "NuclearMissileRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NUCLEARMISSILE] ) }, - { "EMPPulseRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_EMPPULSE] ) }, - { "ArtilleryRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ARTILLERYBARRAGE] ) }, + { "EMPPulseRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_EMPPULSE] ) }, + { "ArtilleryRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ARTILLERYBARRAGE] ) }, { "NapalmStrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NAPALMSTRIKE] ) }, { "ClusterMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLUSTERMINES] ) }, @@ -2311,7 +2311,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) str.concat(warehouseFeedback); } - if (player) + if (player) { UnicodeString tooltip; //if (TheRecorder->isMultiplayer() && player->getPlayerType() == PLAYER_HUMAN) @@ -3509,10 +3509,6 @@ void InGameUI::postDraw( void ) } } } - - - - } } } @@ -3877,9 +3873,9 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) TheInGameUI->disableTooltipsUntil(messageTimeout); // calculate where this screen position should be since the position being passed in is based off 8x6 - Coord2D multiplyer; - multiplyer.x = TheDisplay->getWidth() / 800; - multiplyer.y = TheDisplay->getHeight() / 600; + Coord2D multiplier; + multiplier.x = TheDisplay->getWidth() / 800; + multiplier.y = TheDisplay->getHeight() / 600; // lets bring out the data structure! m_militarySubtitle = NEW MilitarySubtitleData; @@ -3888,8 +3884,8 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) m_militarySubtitle->blockDrawn = TRUE; m_militarySubtitle->blockBeginFrame = currLogicFrame; m_militarySubtitle->lifetime = messageTimeout; - m_militarySubtitle->blockPos.x = m_militarySubtitle->position.x = m_militaryCaptionPosition.x * multiplyer.x; - m_militarySubtitle->blockPos.y = m_militarySubtitle->position.y = m_militaryCaptionPosition.y * multiplyer.y; + m_militarySubtitle->blockPos.x = m_militarySubtitle->position.x = m_militaryCaptionPosition.x * multiplier.x; + m_militarySubtitle->blockPos.y = m_militarySubtitle->position.y = m_militaryCaptionPosition.y * multiplier.y; m_militarySubtitle->incrementOnFrame = currLogicFrame + (Int)(((Real)LOGICFRAMES_PER_SECOND * m_militaryCaptionDelayMS)/1000.0f); m_militarySubtitle->index = 0; for (int i = 1; i < MAX_SUBTITLE_LINES; i ++) diff --git a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index e5036556e8..5bbffbaff7 100644 --- a/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -389,6 +389,7 @@ void Mouse::checkForDrag( void ) } // end checkForDrag + //------------------------------------------------------------------------------------------------- /** Check for mouse click, using allowed drag forgiveness */ //------------------------------------------------------------------------------------------------- @@ -411,6 +412,7 @@ Bool Mouse::isClick(const ICoord2D *anchor, const ICoord2D *dest, UnsignedInt pr } + /////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -675,10 +677,10 @@ void Mouse::createStreamMessages( void ) msg->appendPixelArgument( m_currMouse.pos ); msg->appendIntegerArgument( TheKeyboard->getModifierFlags() ); - Int delay = m_tooltipDelayTime; - if(m_tooltipDelay >= 0 ) - delay = m_tooltipDelay; - + Int delay = m_tooltipDelayTime; + if(m_tooltipDelay >= 0 ) + delay = m_tooltipDelay; + if( now - m_stillTime >= delay ) { if (!m_displayTooltip) diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 3858c74c00..7494f951c8 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -3318,16 +3318,16 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage const CommandButton *command = TheInGameUI->getGUICommand(); // maintain this as the set of GUI button initiated commands that require a left click action in alt mouse mode - Bool isFiringGUICommand = (command && (command->getCommandType() == GUI_COMMAND_SPECIAL_POWER - || command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_FROM_COMMAND_CENTER + Bool isFiringGUICommand = (command && (command->getCommandType() == GUI_COMMAND_SPECIAL_POWER + || command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_FROM_COMMAND_CENTER || command->getCommandType() == GUI_COMMAND_FIRE_WEAPON || command->getCommandType() == GUI_COMMAND_COMBATDROP || command->getCommandType() == GUICOMMANDMODE_HIJACK_VEHICLE || command->getCommandType() == GUICOMMANDMODE_CONVERT_TO_CARBOMB)); - - // in alternate mouse mode, this left click is only actioned here if we're firing a gui command - if ((TheGlobalData->m_useAlternateMouse) && (! isFiringGUICommand)) - break; + + // in alternate mouse mode, this left click is only actioned here if we're firing a gui command + if ((TheGlobalData->m_useAlternateMouse) && (! isFiringGUICommand)) + break; Bool controllable = TheInGameUI->areSelectedObjectsControllable() || (command && command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_FROM_COMMAND_CENTER); diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index d653093226..76beed4494 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -56,8 +56,8 @@ MetaMap *TheMetaMap = NULL; #ifdef _INTERNAL // for occasional debugging... -///#pragma optimize("", off) -///#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") +//#pragma optimize("", off) +//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") #endif diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp index 7ae460e94b..dfa556a54e 100644 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp @@ -27,19 +27,19 @@ #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "Common/BuildAssistant.h" #include "Common/GameAudio.h" #include "Common/Player.h" #include "Common/PlayerList.h" #include "Common/ThingTemplate.h" -#include "Common/BuildAssistant.h" - -#include "GameLogic/Object.h" -#include "GameLogic/GameLogic.h" #include "GameClient/CommandXlat.h" -#include "GameClient/PlaceEventTranslator.h" #include "GameClient/Drawable.h" #include "GameClient/Eva.h" +#include "GameClient/PlaceEventTranslator.h" + +#include "GameLogic/GameLogic.h" +#include "GameLogic/Object.h" //------------------------------------------------------------------------------------------------- PlaceEventTranslator::PlaceEventTranslator() : m_frameOfUpButton(-1) diff --git a/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp b/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp index 7aa24453eb..af59b9bb92 100644 --- a/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/SelectionInfo.cpp @@ -23,18 +23,18 @@ //////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" -#include "GameClient/SelectionInfo.h" -#include "Common/ActionManager.h" #include "GameLogic/Damage.h" -#include "Common/Player.h" -#include "Common/PlayerList.h" +#include "Common/ActionManager.h" #include "Common/ThingTemplate.h" +#include "Common/PlayerList.h" +#include "Common/Player.h" +#include "GameClient/SelectionInfo.h" #include "GameClient/CommandXlat.h" #include "GameClient/ControlBar.h" -#include "GameClient/Drawable.h" #include "GameClient/GameClient.h" +#include "GameClient/Drawable.h" #include "GameClient/KeyDefs.h" #ifdef _INTERNAL diff --git a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp index f58f462e71..17eb2aa590 100644 --- a/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp @@ -52,9 +52,10 @@ //----------------------------------------------------------------------------- #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "GameClient/CampaignManager.h" + #include "Common/INI.h" #include "Common/Xfer.h" -#include "GameClient/CampaignManager.h" #include "GameClient/GameClient.h" //----------------------------------------------------------------------------- // DEFINES //////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp index ac132af682..a6e58e9f26 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp @@ -818,10 +818,10 @@ void AIGuardAttackAggressorState::crc( Xfer *xfer ) //------------------------------------------------------------------------------------------------- void AIGuardAttackAggressorState::xfer( Xfer *xfer ) { - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); + // version + XferVersion currentVersion = 1; + XferVersion version = currentVersion; + xfer->xferVersion( &version, currentVersion ); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index 8e8ca896b0..cd3d8e63e7 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -2386,17 +2386,21 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye allocateZones(); DEBUG_ASSERTCRASH(xBlock==m_zoneBlockExtent.x && yBlock==m_zoneBlockExtent.y, ("Inconsistent allocation - SERIOUS ERROR. jba")); - for (xBlock=0; xBlock globalBounds.hi.x) { + if (bounds.hi.x > globalBounds.hi.x) + { bounds.hi.x = globalBounds.hi.x; } - if (bounds.hi.y > globalBounds.hi.y) { + if (bounds.hi.y > globalBounds.hi.y) + { bounds.hi.y = globalBounds.hi.y; } if (bounds.lo.x>bounds.hi.x || bounds.lo.y>bounds.hi.y) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp index c7cc019ad7..494e52ab70 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp @@ -3443,31 +3443,43 @@ void AIPlayer::getPlayerStructureBounds(Region2D *bounds, Int playerNdx ) objBounds.hi.x = objBounds.lo.x = objBounds.hi.y = objBounds.lo.x = 0; Player* pPlayer = ThePlayerList->getNthPlayer(playerNdx); - if (pPlayer == NULL) return; - for (it = pPlayer->getPlayerTeams()->begin(); it != pPlayer->getPlayerTeams()->end(); ++it) { - for (DLINK_ITERATOR iter = (*it)->iterate_TeamInstanceList(); !iter.done(); iter.advance()) { + if (pPlayer == NULL) + return; + for (it = pPlayer->getPlayerTeams()->begin(); it != pPlayer->getPlayerTeams()->end(); ++it) + { + for (DLINK_ITERATOR iter = (*it)->iterate_TeamInstanceList(); !iter.done(); iter.advance()) + { Team *team = iter.cur(); - if (!team) continue; - for (DLINK_ITERATOR iter = team->iterate_TeamMemberList(); !iter.done(); iter.advance()) { + if (!team) + continue; + for (DLINK_ITERATOR iter = team->iterate_TeamMemberList(); !iter.done(); iter.advance()) + { Object *pObj = iter.cur(); - if (!pObj) continue; - if (pObj->isKindOf(KINDOF_STRUCTURE)) { + if (!pObj) + continue; + if( pObj->isKindOf(KINDOF_STRUCTURE) ) + { Coord3D pos = *pObj->getPosition(); if (firstObject) { objBounds.lo.x = objBounds.hi.x = pos.x; objBounds.lo.y = objBounds.hi.y = pos.y; firstObject = false; - } else { + } + else + { if (objBounds.lo.x>pos.x) objBounds.lo.x = pos.x; if (objBounds.lo.y>pos.y) objBounds.lo.y = pos.y; if (objBounds.hi.xlo.x = bounds->hi.x = pos.x; bounds->lo.y = bounds->hi.y = pos.y; firstStructure = false; - } else { + } + else + { if (bounds->lo.x>pos.x) bounds->lo.x = pos.x; if (bounds->lo.y>pos.y) bounds->lo.y = pos.y; if (bounds->hi.xhi.x = pos.x; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp index c9ea9c3068..4437977c41 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp @@ -136,7 +136,7 @@ Object *Bridge::createTower( Coord3D *worldPos, if( towerTemplate == NULL || bridge == NULL ) { - DEBUG_CRASH(( "createTower: Invalid params\n" )); + DEBUG_CRASH(( "Bridge::createTower(): Invalid params\n" )); return NULL; } // end if diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp index fb13604213..aac11b6e8f 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/AutoHealBehavior.cpp @@ -265,7 +265,6 @@ UpdateSleepTime AutoHealBehavior::update( void ) } } } - } } // end for obj diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp index 05e0dd448e..00d3c6a872 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp @@ -96,9 +96,9 @@ GenerateMinefieldBehaviorModuleData::GenerateMinefieldBehaviorModuleData() { 0, 0, 0, 0 } }; - BehaviorModuleData::buildFieldParse(p); - p.add(dataFieldParse); - p.add(UpgradeMuxData::getFieldParse(), offsetof( GenerateMinefieldBehaviorModuleData, m_upgradeMuxData )); + BehaviorModuleData::buildFieldParse(p); + p.add(dataFieldParse); + p.add(UpgradeMuxData::getFieldParse(), offsetof( GenerateMinefieldBehaviorModuleData, m_upgradeMuxData )); } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp index b77d341a3c..84fd37d158 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/RebuildHoleBehavior.cpp @@ -217,10 +217,8 @@ UpdateSleepTime RebuildHoleBehavior::update( void ) // if( reconstructing == NULL ) { - newWorkerRespawnProcess( worker ); m_reconstructingID = INVALID_ID; - } // end if } // end if diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp index f02e3de162..73dd9a0397 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp @@ -135,7 +135,7 @@ ActiveBodyModuleData::ActiveBodyModuleData() //------------------------------------------------------------------------------------------------- void ActiveBodyModuleData::buildFieldParse(MultiIniFieldParse& p) { - ModuleData::buildFieldParse(p); + ModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { @@ -143,7 +143,7 @@ void ActiveBodyModuleData::buildFieldParse(MultiIniFieldParse& p) { "InitialHealth", INI::parseReal, NULL, offsetof( ActiveBodyModuleData, m_initialHealth ) }, { 0, 0, 0, 0 } }; - p.add(dataFieldParse); + p.add(dataFieldParse); } //------------------------------------------------------------------------------------------------- @@ -172,6 +172,7 @@ ActiveBody::ActiveBody( Thing *thing, const ModuleData* moduleData ) : validateArmorAndDamageFX(); // start us in the right state setCorrectDamageState(); + } //------------------------------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp index b0252e76c5..dc07cc4e7b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp @@ -70,6 +70,7 @@ void HiveStructureBody::attemptDamage( DamageInfo *damageInfo ) if( getDamageTypeFlag( data->m_damageTypesToPropagateToSlaves, damageInfo->in.m_damageType ) ) { + //We have the right type of damage types incoming to propagate to slaves. Do we have slaves? SpawnBehaviorInterface *spawnInterface = hive->getSpawnBehaviorInterface(); if( spawnInterface ) @@ -99,6 +100,7 @@ void HiveStructureBody::attemptDamage( DamageInfo *damageInfo ) { DEBUG_CRASH( ("%s has a HiveStructureBody module, which requires a SpawnBehavior module. Thus it is unable to propagate damage to slaves.", hive->getTemplate()->getName().str() ) ); } + } //Nothing to propagate (either different damage type or no slaves), diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp index 582e96d268..67285d293e 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp @@ -155,6 +155,7 @@ Bool SalvageCrateCollide::testWeaponChance() return FALSE; } +// ------------------------------------------------------------------------------------------------ Bool SalvageCrateCollide::testLevelChance() { const SalvageCrateCollideModuleData *md = getSalvageCrateCollideModuleData(); @@ -168,6 +169,7 @@ Bool SalvageCrateCollide::testLevelChance() return FALSE; } +// ------------------------------------------------------------------------------------------------ void SalvageCrateCollide::doWeaponSet( Object *other ) { if( other->testWeaponSetFlag( WEAPONSET_CRATEUPGRADE_ONE ) ) @@ -181,11 +183,13 @@ void SalvageCrateCollide::doWeaponSet( Object *other ) } } +// ------------------------------------------------------------------------------------------------ void SalvageCrateCollide::doLevelGain( Object *other ) { other->getExperienceTracker()->gainExpForLevel( 1 ); } +// ------------------------------------------------------------------------------------------------ void SalvageCrateCollide::doMoney( Object *other ) { const SalvageCrateCollideModuleData *md = getSalvageCrateCollideModuleData(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index 626230a42f..c286d86bdd 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -923,6 +923,7 @@ void GarrisonContain::healObjects( void ) } } + //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- void GarrisonContain::healSingleObject( Object *obj, Real framesForFullHeal) @@ -1254,6 +1255,7 @@ void GarrisonContain::exitObjectViaDoor( Object *exitObj, ExitDoorType exitDoor Coord3D endPosition; Real exitAngle = getObject()->getOrientation(); + // Garrison doesn't have reserveDoor or exitDelay, so if we do nothing, everyone will appear on top // of each other and get stuck inside each others' extent (except for the first guy). So we'll // scatter the start point around a little to make it better. @@ -1293,6 +1295,7 @@ void GarrisonContain::exitObjectViaDoor( Object *exitObj, ExitDoorType exitDoor TheAI->pathfinder()->updateGoal(exitObj, &endPosition, TheTerrainLogic->getLayerForDestination(&endPosition)); } + recalcApparentControllingPlayer(); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp index f093146131..774102a439 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp @@ -53,13 +53,13 @@ OverlordContainModuleData::OverlordContainModuleData() // ------------------------------------------------------------------------------------------------ void OverlordContainModuleData::buildFieldParse(MultiIniFieldParse& p) { - TransportContainModuleData::buildFieldParse(p); + TransportContainModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { { 0, 0, 0, 0 } }; - p.add(dataFieldParse); + p.add(dataFieldParse); } // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp index 004f8f4971..cca76f8225 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp @@ -329,7 +329,7 @@ UpdateSleepTime ParachuteContain::update( void ) // When a parachute opens, it should look for a good place to land. This could be explicitly set // by a DeliverPayload, otherwise any place clear is good. - if( parachuteAI ) + if( parachuteAI ) { Coord3D target = *parachute->getPosition(); if( m_isLandingOverrideSet ) @@ -505,9 +505,13 @@ void ParachuteContain::onRemoving( Object *rider ) { Player* controller = rider->getControllingPlayer(); if (controller && controller->isSkirmishAIPlayer()) + { riderAI->aiHunt(CMD_FROM_AI); // hunt, as per Dustin's request. + } else - riderAI->aiIdle(CMD_FROM_AI); // become idle. + { + riderAI->aiIdle(CMD_FROM_AI); // become idle. + } } // if we land in the water, we die. alas. diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp index 071ac662f2..55409ed73a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp @@ -111,7 +111,7 @@ void TransportContainModuleData::buildFieldParse(MultiIniFieldParse& p) { "ExitDelay", INI::parseDurationUnsignedInt, NULL, offsetof( TransportContainModuleData, m_exitDelay ) }, { 0, 0, 0, 0 } }; - p.add(dataFieldParse); + p.add(dataFieldParse); } @@ -409,7 +409,6 @@ UpdateSleepTime TransportContain::update() } } } - return OpenContain::update(); //extend } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp index 04e1f54f1e..87b70ce3ec 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp @@ -2553,6 +2553,12 @@ void Locomotor::maintainCurrentPositionHover(Object* obj, PhysicsBehavior *physi force.y = accelForce * dir->y; force.z = 0.0f; + // Apply a random kick (if applicable) to dirty-up visually. + // The idea is that chopper pilots have to do course corrections all the time + // Because of changes in wind, pressure, etc. + // Those changes are added here, then the + + // apply forces to object physics->applyMotiveForce( &force ); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 93bfeb712c..293bd93e73 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -3403,7 +3403,7 @@ void Object::crc( Xfer *xfer ) CRCDEBUG_LOG(("CRC of Object %d (%s), owned by player %d, ", m_id, getTemplate()->getName().str(), getControllingPlayer()->getPlayerIndex())); DUMPMATRIX3D(mtx); } -#endif //DEBUG_CRC +#endif // DEBUG_CRC xfer->xferUser(&m_id, sizeof(m_id)); @@ -4861,12 +4861,12 @@ void Object::doCommandButtonAtObject( const CommandButton *commandButton, Object break; case GUICOMMANDMODE_HIJACK_VEHICLE: - if ( ai ) + if( ai ) { - ai->aiEnter(obj, cmdSource); + ai->aiEnter( obj, cmdSource ); } break; - + //Feel free to implement object based command buttons. case GUI_COMMAND_DOZER_CONSTRUCT: case GUI_COMMAND_DOZER_CONSTRUCT_CANCEL: @@ -4977,7 +4977,6 @@ void Object::doCommandButtonAtPosition( const CommandButton *commandButton, cons } } - // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ void Object::clearLeechRangeModeForAllWeapons() diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 3b45f20885..c5d0f811b1 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -124,7 +124,7 @@ class FireWeaponNugget : public ObjectCreationNugget public: FireWeaponNugget() : - m_weapon(NULL) + m_weapon(NULL) { } @@ -133,14 +133,14 @@ class FireWeaponNugget : public ObjectCreationNugget if (!primaryObj || !primary || !secondary) { DEBUG_CRASH(("You must have a primary and secondary source for this effect")); - return; - } + return; + } - if (m_weapon) - { - TheWeaponStore->createAndFireTempWeapon( m_weapon, primaryObj, secondary ); - } - } + if (m_weapon) + { + TheWeaponStore->createAndFireTempWeapon( m_weapon, primaryObj, secondary ); + } + } static void parse(INI *ini, void *instance, void* /*store*/, const void* /*userData*/) { @@ -168,7 +168,7 @@ class AttackNugget : public ObjectCreationNugget public: AttackNugget() : - m_numberOfShots(1), + m_numberOfShots(1), m_weaponSlot(PRIMARY_WEAPON), m_deliveryDecalRadius(0) { @@ -179,8 +179,8 @@ class AttackNugget : public ObjectCreationNugget if (!primaryObj || !primary || !secondary) { DEBUG_CRASH(("You must have a primary and secondary source for this effect")); - return; - } + return; + } // Star trekkin, across the universe. // Boldly goin forward now, cause we can't find reverse! @@ -271,8 +271,8 @@ class DeliverPayloadNugget : public ObjectCreationNugget if (!primaryObj || !primary || !secondary) { DEBUG_CRASH(("You must have a primary and secondary source for this effect")); - return; - } + return; + } Team* owner = primaryObj ? primaryObj->getControllingPlayer()->getDefaultTeam() : NULL; @@ -613,23 +613,23 @@ class ApplyRandomForceNugget : public ObjectCreationNugget { /// @todo srj -- ack. const_cast is evil. PhysicsBehavior* p = const_cast(primary)->getPhysics(); - if (p) - { + if (p) + { Coord3D force; calcRandomForce(m_minMag, m_maxMag, m_minPitch, m_maxPitch, &force); p->applyForce(&force); - Real yaw = GameLogicRandomValueReal( -m_spinRate, m_spinRate ); - Real roll = GameLogicRandomValueReal( -m_spinRate, m_spinRate ); - Real pitch = GameLogicRandomValueReal( -m_spinRate, m_spinRate ); - p->setYawRate(yaw); - p->setRollRate(roll); - p->setPitchRate(pitch); - } - else - { - DEBUG_CRASH(("You must have a Physics module source for this effect")); - } + Real yaw = GameLogicRandomValueReal( -m_spinRate, m_spinRate ); + Real roll = GameLogicRandomValueReal( -m_spinRate, m_spinRate ); + Real pitch = GameLogicRandomValueReal( -m_spinRate, m_spinRate ); + p->setYawRate(yaw); + p->setRollRate(roll); + p->setPitchRate(pitch); + } + else + { + DEBUG_CRASH(("You must have a Physics module source for this effect")); + } } else { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp index 59f23bd3a7..1599fa53cb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/BaikonurLaunchPower.cpp @@ -22,7 +22,7 @@ // // //////////////////////////////////////////////////////////////////////////////// -// FILE: BaikonurLaunchPower.h ///////////////////////////////////////////////// +// FILE: BaikonurLaunchPower.cpp//////////////////////////////////////////////// //----------------------------------------------------------------------------- // // Electronic Arts Pacific. @@ -34,7 +34,7 @@ // // Created: November 2002 // -// Filename: BaikonurLaunchPower.h +// Filename: BaikonurLaunchPower.cpp // // Author: Kris Morness // diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index 32b81cd5f2..d1468edddb 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -78,10 +78,10 @@ SpecialPowerModuleData::SpecialPowerModuleData() static const FieldParse dataFieldParse[] = { - { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( SpecialPowerModuleData, m_specialPowerTemplate ) }, - { "UpdateModuleStartsAttack", INI::parseBool, NULL, offsetof( SpecialPowerModuleData, m_updateModuleStartsAttack ) }, - { "StartsPaused", INI::parseBool, NULL, offsetof( SpecialPowerModuleData, m_startsPaused ) }, - { "InitiateSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialPowerModuleData, m_initiateSound ) }, + { "SpecialPowerTemplate", INI::parseSpecialPowerTemplate, NULL, offsetof( SpecialPowerModuleData, m_specialPowerTemplate ) }, + { "UpdateModuleStartsAttack", INI::parseBool, NULL, offsetof( SpecialPowerModuleData, m_updateModuleStartsAttack ) }, + { "StartsPaused", INI::parseBool, NULL, offsetof( SpecialPowerModuleData, m_startsPaused ) }, + { "InitiateSound", INI::parseAudioEventRTS, NULL, offsetof( SpecialPowerModuleData, m_initiateSound ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 8634003c69..d0bfae3fa9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -130,16 +130,16 @@ const LocomotorTemplateVector* AIUpdateModuleData::findLocomotorTemplateVector(L static const FieldParse dataFieldParse[] = { - { "Turret", AIUpdateModuleData::parseTurret, NULL, offsetof(AIUpdateModuleData, m_turretData[0]) }, - { "AltTurret", AIUpdateModuleData::parseTurret, NULL, offsetof(AIUpdateModuleData, m_turretData[1]) }, + { "Turret", AIUpdateModuleData::parseTurret, NULL, offsetof(AIUpdateModuleData, m_turretData[0]) }, + { "AltTurret", AIUpdateModuleData::parseTurret, NULL, offsetof(AIUpdateModuleData, m_turretData[1]) }, { "AutoAcquireEnemiesWhenIdle", INI::parseBitString32, TheAutoAcquireEnemiesNames, offsetof(AIUpdateModuleData, m_autoAcquireEnemiesWhenIdle) }, - { "MoodAttackCheckRate", INI::parseDurationUnsignedInt, NULL, offsetof(AIUpdateModuleData, m_moodAttackCheckRate) }, + { "MoodAttackCheckRate", INI::parseDurationUnsignedInt, NULL, offsetof(AIUpdateModuleData, m_moodAttackCheckRate) }, #ifdef ALLOW_SURRENDER - { "SurrenderDuration", INI::parseDurationUnsignedInt, NULL, offsetof(AIUpdateModuleData, m_surrenderDuration) }, + { "SurrenderDuration", INI::parseDurationUnsignedInt, NULL, offsetof(AIUpdateModuleData, m_surrenderDuration) }, #endif { 0, 0, 0, 0 } }; - p.add(dataFieldParse); + p.add(dataFieldParse); } //------------------------------------------------------------------------------------------------- @@ -2764,7 +2764,7 @@ void AIUpdateInterface::aiDoCommand(const AICommandParms* parms) */ void AIUpdateInterface::privateMoveToPosition( const Coord3D *pos, CommandSourceType cmdSource ) { - if (getObject()->isMobile() == FALSE) + if (getObject()->isMobile() == FALSE) return; //Resetting the locomotor here was initially added for scripting purposes. It has been moved diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index ef3a9b44e2..b76a9e94b8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -961,7 +961,7 @@ Bool ChinookAIUpdate::isAvailableForSupplying() const //------------------------------------------------------------------------------------------------- Bool ChinookAIUpdate::isAllowedToAdjustDestination() const { - if (m_flightStatus == CHINOOK_LANDED) + if (m_flightStatus == CHINOOK_LANDED) return false; return SupplyTruckAIUpdate::isAllowedToAdjustDestination(); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp index 65a5933674..b49156a438 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -38,12 +38,12 @@ #include "GameClient/FXList.h" #include "GameClient/InGameUI.h" #include "GameLogic/Locomotor.h" -#include "GameLogic/Module/BodyModule.h" -#include "GameLogic/Module/ContainModule.h" -#include "GameLogic/Module/DeliverPayloadAIUpdate.h" #include "GameLogic/Module/GenerateMinefieldBehavior.h" -#include "GameLogic/Module/PhysicsUpdate.h" +#include "GameLogic/Module/DeliverPayloadAIUpdate.h" #include "GameLogic/Module/ParachuteContain.h" +#include "GameLogic/Module/ContainModule.h" +#include "GameLogic/Module/PhysicsUpdate.h" +#include "GameLogic/Module/BodyModule.h" #include "GameLogic/Object.h" #include "GameLogic/PartitionManager.h" #include "GameLogic/Weapon.h" @@ -416,7 +416,8 @@ void DeliverPayloadAIUpdate::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version +*/ // ------------------------------------------------------------------------------------------------ void DeliverPayloadAIUpdate::xfer( Xfer *xfer ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp index 749d288212..62bf490ec9 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp @@ -413,12 +413,14 @@ void MissileAIUpdate::doPrelaunchState() //------------------------------------------------------------------------------------------------- void MissileAIUpdate::doKillSelfState() { - if (m_stateTimestamp > TheGameLogic->getFrame()-3) { + if (m_stateTimestamp > TheGameLogic->getFrame()-3) + { // Hold in this state 2 frames to let the contrail catch up. jba. return; } Object* obj = getObject(); - if (m_detonationWeaponTmpl) { + if (m_detonationWeaponTmpl) + { TheGameLogic->destroyObject( obj ); } switchToState(DEAD); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp index 2838c0a558..5a0f6d6001 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp @@ -313,12 +313,12 @@ void RailroadBehavior::onCollide( Object *other, const Coord3D *loc, const Coord //--------------------------- // if we made it this far, it is something we dont want to share space with + Coord3D dlt; dlt.x = theirLoc->x - myLoc->x; dlt.y = theirLoc->y - myLoc->y; dlt.z = theirLoc->z - myLoc->z; - //Alert all the players of recent disaster if ( ! m_whistleSound.isCurrentlyPlaying()) m_whistleSound.setPlayingHandle(TheAudio->addAudioEvent( &m_whistleSound )); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp index 956224c556..ef3776914b 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp @@ -54,7 +54,7 @@ FireWeaponUpdateModuleData::FireWeaponUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "Weapon", INI::parseWeaponTemplate, NULL, offsetof( FireWeaponUpdateModuleData, m_weaponTemplate ) }, + { "Weapon", INI::parseWeaponTemplate, NULL, offsetof( FireWeaponUpdateModuleData, m_weaponTemplate ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp index 5043c8d598..a92ad95556 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp @@ -120,8 +120,8 @@ const Int DEFAULT_UPDATE_RATE = LOGICFRAMES_PER_SECOND; //------------------------------------------------------------------------------------------------- HordeUpdateModuleData::HordeUpdateModuleData() : m_updateRate(DEFAULT_UPDATE_RATE), - m_minCount(0), - m_minDist(0.0f), + m_minCount(0), + m_minDist(0.0f), m_rubOffRadius(20.0f), m_alliesOnly(true), m_exactMatch(false), diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp index b1ae089b6a..0664f461f8 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp @@ -292,9 +292,9 @@ void ParticleUplinkCannonUpdate::initiateIntentToDoSpecialPower(const SpecialPow { //All computer controlled players have automatic control -- the "S" curve. UnsignedInt now = TheGameLogic->getFrame(); - m_initialTargetPosition.set( targetPos ); - m_startAttackFrame = max( now, (UnsignedInt)1 ); - m_laserStatus = LASERSTATUS_NONE; + m_initialTargetPosition.set( targetPos ); + m_startAttackFrame = max( now, (UnsignedInt)1 ); + m_laserStatus = LASERSTATUS_NONE; setLogicalStatus( STATUS_READY_TO_FIRE ); m_specialPowerModule->setReadyFrame( now ); } diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp index 7d953dce32..408fde5482 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp @@ -282,9 +282,9 @@ Bool ProductionUpdate::queueUpgrade( const UpgradeTemplate *upgrade ) if( isUpgradeInQueue( upgrade ) == TRUE ) return FALSE; - // STOP cheaters by making sure they can actually build this - if( !getObject()->canProduceUpgrade(upgrade) ) - return FALSE; + // STOP cheaters by making sure they can actually build this + if( !getObject()->canProduceUpgrade(upgrade) ) + return FALSE; // // you cannot queue a player upgrade production if you are producing one already somewhere else @@ -1137,27 +1137,26 @@ void ProductionUpdate::onDie( const DamageInfo *damageInfo ) // ------------------------------------------------------------------------------------------------ void ProductionUpdate::cancelAndRefundAllProduction( void ) { - // Empirically, in release the code can loop forever. So we limit to 100 passes. jba. [8/31/2003] - const Int productionLimit = 100;// With luck, we never queue up 100 units. [8/31/2003] - Int i; - for (i=0; igetProductionType() == PRODUCTION_UNIT ) - cancelUnitCreate( m_productionQueue->getProductionID() ); - else if( m_productionQueue->getProductionType() == PRODUCTION_UPGRADE ) - cancelUpgrade( m_productionQueue->getProductionUpgrade() ); - else - { - // unknown production type - DEBUG_CRASH(( "ProductionUpdate::cancelAndRefundAllProduction - Unknown production type '%d'\n", - m_productionQueue->getProductionType() )); - return; - } // end else - } // end if - } + // Empirically, in release the code can loop forever. So we limit to 100 passes. jba. [8/31/2003] + const Int productionLimit = 100;// With luck, we never queue up 100 units. [8/31/2003] + Int i; + for (i=0; igetProductionType() == PRODUCTION_UNIT ) + cancelUnitCreate( m_productionQueue->getProductionID() ); + else if( m_productionQueue->getProductionType() == PRODUCTION_UPGRADE ) + cancelUpgrade( m_productionQueue->getProductionUpgrade() ); + else + { + // unknown production type + DEBUG_CRASH(( "ProductionUpdate::cancelAndRefundAllProduction - Unknown production type '%d'\n", m_productionQueue->getProductionType() )); + return; + } // end else + } // end if + } } // end cancelAndRefundAllProduction // ------------------------------------------------------------------------------------------------ diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp index 94a5a9d2ba..9edff9f970 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/ProjectileStreamUpdate.cpp @@ -186,7 +186,8 @@ void ProjectileStreamUpdate::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version +*/ // ------------------------------------------------------------------------------------------------ void ProjectileStreamUpdate::xfer( Xfer *xfer ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp index f15bb6c1f6..700d592dcf 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp @@ -17,9 +17,9 @@ */ //////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // +// // +// (c) 2001-2003 Electronic Arts Inc. // +// // //////////////////////////////////////////////////////////////////////////////// // FILE: SpecialAbilityUpdate.cpp ///////////////////////////////////////////////////////////////////////// @@ -27,7 +27,7 @@ // Desc: Handles processing of unit special abilities. /////////////////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine #include "Common/GameAudio.h" #include "Common/GlobalData.h" @@ -79,8 +79,8 @@ SpecialAbilityUpdate::SpecialAbilityUpdate( Thing *thing, const ModuleData* modu // m_active = false; m_prepFrames = 0; - m_animFrames = 0; - m_targetID = INVALID_ID; + m_animFrames = 0; + m_targetID = INVALID_ID; m_targetPos.zero(); m_locationCount = 0; m_specialObjectEntries = 0; @@ -135,7 +135,7 @@ that has every option will do the following in order: StartAbilityRange -- Specify how far you want your unit to be from the target before start your special ability. AbilityAbortRange -- After starting an attack, it'll allow preparation unless the target goes - beyond this range. If this happens, the ability is aborted outright. + beyond this range. If this happens, the ability is aborted outright. PreparationTime -- How long it takes to prepare your special once in position and unpacked. PersistentPrepTime -- This value defines whether or not you are using a persistent special. Once the special ability is triggered, it'll wait until this specified @@ -149,7 +149,7 @@ that has every option will do the following in order: of xTime +/- 20%. This is important because it represents averages. UnpackTime -- Same as PackTime, except used once entering range of target. SkipPackingWithNoTarget -- This option is used by the No Target Special variation, and only uses - packing/unpacking when you have a specific target. In the case of Colonel + packing/unpacking when you have a specific target. In the case of Colonel Burton, this value is set to true. When he plants a C4 charge, he has a target, therefore he requires unpacking (laying the charge). When he runs away and decides to detonate the charge, he calls the same special @@ -167,7 +167,7 @@ that has every option will do the following in order: the building (hacker), this value will dictate how long the building will be disabled should the hacker die or stop the attack. UniqueSpecialObjectTargets -- Prevents the owner from placing multiple special objects on the - same target. C4 charges once again. + same target. C4 charges once again. SpecialObjectsPersistWhenOwnerDies -- If the owner dies, the special objects will remain in the world. Timed C4 charges is a good example, but remote C4 charges is a bad example -- because it requires the owner to detonate them. @@ -193,7 +193,7 @@ UpdateSleepTime SpecialAbilityUpdate::update( void ) /// @todo srj -- this could probably sleep more between stages. maybe someday. // Note: This will be complicated because one difficult example is handling Burton when he dies while - // bombs are in the world. + // bombs are in the world. //Validation of special objects makes sure that they still exist. Sometimes special //objects can be destroyed or removed, or detonate, etc! When they go missing, @@ -212,7 +212,7 @@ UpdateSleepTime SpecialAbilityUpdate::update( void ) return calcSleepTime(); } - if( !m_active ) // Not active. + if( !m_active ) // Not active. return calcSleepTime(); AIUpdateInterface *ai = getObject()->getAIUpdateInterface(); @@ -249,7 +249,7 @@ UpdateSleepTime SpecialAbilityUpdate::update( void ) shouldAbort = TRUE; else switch (data->m_specialPowerTemplate->getSpecialPowerType()) { - case SPECIAL_INFANTRY_CAPTURE_BUILDING: + case SPECIAL_INFANTRY_CAPTURE_BUILDING: case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: case SPECIAL_HACKER_DISABLE_BUILDING: if (target->getTeam() == getObject()->getTeam()) @@ -766,7 +766,7 @@ Bool SpecialAbilityUpdate::isWithinStartAbilityRange() const { return true; } - } + } return false; } @@ -840,7 +840,7 @@ Bool SpecialAbilityUpdate::isWithinAbilityAbortRange() const { return true; } - } + } return false; } @@ -905,7 +905,7 @@ void SpecialAbilityUpdate::startPreparation() } break; } - case SPECIAL_INFANTRY_CAPTURE_BUILDING: + case SPECIAL_INFANTRY_CAPTURE_BUILDING: { Object *target = TheGameLogic->findObjectByID( m_targetID ); if (target) @@ -1173,7 +1173,6 @@ void SpecialAbilityUpdate::triggerAbilityEffect() } } - AudioEventRTS sound = data->m_triggerSound; sound.setObjectID( object->getID() ); TheAudio->addAudioEvent( &sound ); @@ -1286,7 +1285,7 @@ void SpecialAbilityUpdate::triggerAbilityEffect() break; } - case SPECIAL_INFANTRY_CAPTURE_BUILDING: + case SPECIAL_INFANTRY_CAPTURE_BUILDING: case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: { Object *target = TheGameLogic->findObjectByID( m_targetID ); @@ -1304,7 +1303,7 @@ void SpecialAbilityUpdate::triggerAbilityEffect() } // Just in case we are capturing a building which is already garrisoned by other - ContainModuleInterface * contain = target->getContain(); + ContainModuleInterface * contain = target->getContain(); if ( contain && contain->isGarrisonable() ) { contain->removeAllContained( TRUE ); diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp index eec1ecc046..e4e7ace2ae 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp @@ -30,12 +30,13 @@ // USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine +#include "GameLogic/Module/StickyBombUpdate.h" + #include "Common/ThingTemplate.h" #include "Common/Xfer.h" #include "GameClient/Drawable.h" #include "GameClient/InGameUI.h" #include "GameLogic/Object.h" -#include "GameLogic/Module/StickyBombUpdate.h" #include "GameLogic/Module/LifetimeUpdate.h" #include "GameLogic/Module/AIUpdate.h" #include "GameLogic/Module/BodyModule.h" diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index 55fe5b9ed1..3cf708ee88 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -459,18 +459,18 @@ CanAttackResult WeaponSet::getAbleToAttackSpecificObject( AbleToAttackType attac if (victim->testStatus(OBJECT_STATUS_NO_ATTACK_FROM_AI) && commandSource == CMD_FROM_AI) return ATTACKRESULT_NOT_POSSIBLE; - Bool allowStealthToPreventAttacks = TRUE; + Bool allowStealthToPreventAttacks = TRUE; if (source->testStatus(OBJECT_STATUS_IGNORING_STEALTH) || sameOwnerForceAttack) allowStealthToPreventAttacks = FALSE; - if( isForcedAttack( attackType ) && victim->isKindOf( KINDOF_DISGUISER ) ) - { - // force-attack allows you to attack disguised things, which also happen to be stealthed. - // since we normally disallow attacking stealthed things (even via force-fire), we check - // for disguised and explicitly ignore stealth in that case - StealthUpdate *update = (StealthUpdate*)victim->findUpdateModule( key_StealthUpdate ); - if (update && update->isDisguised()) - allowStealthToPreventAttacks = FALSE; - } + if( isForcedAttack( attackType ) && victim->isKindOf( KINDOF_DISGUISER ) ) + { + // force-attack allows you to attack disguised things, which also happen to be stealthed. + // since we normally disallow attacking stealthed things (even via force-fire), we check + // for disguised and explicitly ignore stealth in that case + StealthUpdate *update = (StealthUpdate*)victim->findUpdateModule( key_StealthUpdate ); + if (update && update->isDisguised()) + allowStealthToPreventAttacks = FALSE; + } // If an object is stealthed and hasn't been detected yet, then it is not a valid target to fire // on. diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index d51a7bc25e..4df2f4200d 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -4831,22 +4831,26 @@ void ScriptActions::doSetToppleDirection( const AsciiString& unitName, const Coo void ScriptActions::doMoveUnitTowardsNearest( const AsciiString& unitName, const AsciiString& objectType, AsciiString triggerName) { Object *obj = TheScriptEngine->getUnitNamed(unitName); - if (!obj) { + if (!obj) + { return; } AIUpdateInterface *ai = obj->getAIUpdateInterface(); - if (!ai) { + if (!ai) + { return; } const ThingTemplate *templ = TheThingFactory->findTemplate(objectType); - if (!templ) { + if (!templ) + { return; } PolygonTrigger *trig = TheScriptEngine->getQualifiedTriggerAreaByName(triggerName); - if (!trig) { + if (!trig) + { return; } @@ -4857,7 +4861,8 @@ void ScriptActions::doMoveUnitTowardsNearest( const AsciiString& unitName, const PartitionFilter *filters[] = { &thingsToAccept, &acceptWithin, &filterMapStatus, NULL }; Object *dest = ThePartitionManager->getClosestObject(obj->getPosition(), REALLY_FAR, FROM_CENTER_2D, filters); - if (!dest) { + if (!dest) + { return; } @@ -4871,28 +4876,33 @@ void ScriptActions::doMoveUnitTowardsNearest( const AsciiString& unitName, const void ScriptActions::doMoveTeamTowardsNearest( const AsciiString& teamName, const AsciiString& objectType, AsciiString triggerName) { Team *team = TheScriptEngine->getTeamNamed(teamName); - if (!team) { + if (!team) + { return; } const ThingTemplate *templ = TheThingFactory->findTemplate(objectType); - if (!templ) { + if (!templ) + { return; } PolygonTrigger *trig = TheScriptEngine->getQualifiedTriggerAreaByName(triggerName); - if (!trig) { + if (!trig) + { return; } for (DLINK_ITERATOR iter = team->iterate_TeamMemberList(); !iter.done(); iter.advance()) { Object *obj = iter.cur(); - if (!obj) { + if (!obj) + { continue; } AIUpdateInterface *ai = obj->getAIUpdateInterface(); - if (!ai) { + if (!ai) + { continue; } @@ -4906,9 +4916,8 @@ void ScriptActions::doMoveTeamTowardsNearest( const AsciiString& teamName, const if (!dest) { return; } - ai->chooseLocomotorSet( LOCOMOTORSET_NORMAL ); - ai->aiMoveToObject(dest, CMD_FROM_SCRIPT); + ai->aiMoveToObject( dest, CMD_FROM_SCRIPT ); } } diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp index 74f761df89..392ed2766c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptConditions.cpp @@ -1710,17 +1710,26 @@ Bool ScriptConditions::evaluateMultiplayerPlayerDefeat(void) //------------------------------------------------------------------------------------------------- Bool ScriptConditions::evaluatePlayerUnitCondition(Condition *pCondition, Parameter *pPlayerParm, Parameter *pComparisonParm, Parameter *pCountParm, Parameter *pUnitTypeParm) { - if (pCondition->getCustomData()!=0) { + if (pCondition->getCustomData()!=0) + { // We have a cached value. - if (TheScriptEngine->getFrameObjectCountChanged()+1 < TheGameLogic->getFrame()) { + if( TheScriptEngine->getFrameObjectCountChanged()+1 < TheGameLogic->getFrame() ) + { // object count hasn't changed recently. Use cached value. - if (pCondition->getCustomData()==1) return true; - if (pCondition->getCustomData()==-1) return false; + if( pCondition->getCustomData() == 1 ) + { + return true; + } + if( pCondition->getCustomData() == -1 ) + { + return false; + } } } Player* pPlayer = playerFromParam(pPlayerParm); - if (!pPlayer) { + if (!pPlayer) + { return false; } @@ -1733,7 +1742,8 @@ Bool ScriptConditions::evaluatePlayerUnitCondition(Condition *pCondition, Parame Int numObjs = types.m_types->prepForPlayerCounting(templates, counts); Int count = 0; - if (numObjs > 0) { + if (numObjs > 0) + { pPlayer->countObjectsByThingTemplate(numObjs, &(*templates.begin()), false, &(*counts.begin())); count = rts::sum(counts); } @@ -1741,18 +1751,31 @@ Bool ScriptConditions::evaluatePlayerUnitCondition(Condition *pCondition, Parame Bool comparison = false; switch (pComparisonParm->getInt()) { - case Parameter::LESS_THAN : comparison = (count < pCountParm->getInt()); break; - case Parameter::LESS_EQUAL : comparison = (count <= pCountParm->getInt()); break; - case Parameter::EQUAL : comparison = (count == pCountParm->getInt()); break; - case Parameter::GREATER_EQUAL : comparison = (count >= pCountParm->getInt()); break; - case Parameter::GREATER : comparison = (count > pCountParm->getInt()); break; - case Parameter::NOT_EQUAL : comparison = (count != pCountParm->getInt()); break; + case Parameter::LESS_THAN : + comparison = (count < pCountParm->getInt()); + break; + case Parameter::LESS_EQUAL : + comparison = (count <= pCountParm->getInt()); + break; + case Parameter::EQUAL : + comparison = (count == pCountParm->getInt()); + break; + case Parameter::GREATER_EQUAL : + comparison = (count >= pCountParm->getInt()); + break; + case Parameter::GREATER : + comparison = (count > pCountParm->getInt()); + break; + case Parameter::NOT_EQUAL : + comparison = (count != pCountParm->getInt()); + break; default: DEBUG_CRASH(("ScriptConditions::evaluatePlayerUnitCondition: Invalid comparison type. (jkmcd)")); break; } pCondition->setCustomData(-1); // false. - if (comparison) { + if (comparison) + { pCondition->setCustomData(1); // true. } return comparison; @@ -2166,7 +2189,7 @@ Bool ScriptConditions::evaluateSkirmishPlayerTechBuildingWithinDistancePerimeter if (!player) { return false; } - + // If we have a chached value, return it. [8/8/2003] if (pCondition->getCustomData()==1) return true; if (pCondition->getCustomData()==-1) return false; @@ -2402,12 +2425,14 @@ Bool ScriptConditions::evaluateSkirmishNamedAreaExists(Parameter *, Parameter *p Bool ScriptConditions::evaluateSkirmishPlayerHasUnitsInArea(Condition *pCondition, Parameter *pSkirmishPlayerParm, Parameter *pTriggerParm ) { Player *player = playerFromParam(pSkirmishPlayerParm); - if (!player) { + if (!player) + { return FALSE; } PolygonTrigger *pTrig = TheScriptEngine->getQualifiedTriggerAreaByName(pTriggerParm->getString()); - if (!pTrig) { + if (!pTrig) + { return FALSE; } diff --git a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index 800721b112..b04df6752a 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -683,7 +683,8 @@ void ScriptGroup::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version +*/ // ------------------------------------------------------------------------------------------------ void ScriptGroup::xfer( Xfer *xfer ) { @@ -1645,7 +1646,7 @@ AsciiString Condition::getUiText(void) */ void Condition::WriteConditionDataChunk(DataChunkOutput &chunkWriter, Condition *pCondition) { - /**********ACTION DATA ***********************/ + /**********Condition DATA ***********************/ while (pCondition) { chunkWriter.openDataChunk("Condition", K_SCRIPT_CONDITION_VERSION_3); chunkWriter.writeInt(pCondition->m_conditionType); @@ -1924,7 +1925,7 @@ AsciiString Parameter::getUiText(void) const default : DEBUG_CRASH(("Unknown Radar event type.")); } break; - + case DIALOG: uiText.format("'%s'", uiString.str()); diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/Damage.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/Damage.cpp index 3e38062891..1a8f06b26c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/Damage.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/Damage.cpp @@ -60,7 +60,8 @@ void DamageInfo::xfer( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version +*/ // ------------------------------------------------------------------------------------------------ void DamageInfoInput::xfer( Xfer *xfer ) { diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 3db88139b8..4d85d212c2 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -2298,18 +2298,22 @@ Bool GameLogic::isIntroMoviePlaying() // ------------------------------------------------------------------------------------------------ void GameLogic::selectObject(Object *obj, Bool createNewSelection, PlayerMaskType playerMask, Bool affectClient) { - if (!obj) { + if (!obj) + { return; } - if (!obj->isMassSelectable() && !createNewSelection) { + if (!obj->isMassSelectable() && !createNewSelection) + { DEBUG_LOG(("GameLogic::selectObject() - Object attempted to be added to selection, but isn't mass-selectable.\n")); return; } - while (playerMask) { + while( playerMask ) + { Player *player = ThePlayerList->getEachPlayerFromMask(playerMask); - if (!player) { + if( !player ) + { return; } @@ -2319,17 +2323,22 @@ void GameLogic::selectObject(Object *obj, Bool createNewSelection, PlayerMaskTyp group->add(obj); // add all selected agents to the AI group - if (createNewSelection) { + if (createNewSelection) + { player->setCurrentlySelectedAIGroup(group); - } else { + } + else + { player->addAIGroupToCurrentSelection(group); } TheAI->destroyGroup(group); - if (affectClient) { + if( affectClient ) + { Drawable *draw = obj->getDrawable(); - if (draw) { + if( draw ) + { TheInGameUI->selectDrawable(draw); } } @@ -2717,6 +2726,7 @@ void GameLogic::friend_awakenUpdateModule(Object* obj, UpdateModulePtr u, Unsign } } + // ------------------------------------------------------------------------------------------------ #ifdef DO_UNIT_TIMINGS enum {TIME_FRAMES=100}; @@ -2779,8 +2789,7 @@ static void unitTimings(void) QueryPerformanceCounter((LARGE_INTEGER *)&endTime64); double timeToUpdate = ((double)(endTime64-startTime64) / (double)(freq64)); timeToUpdate *= FACTOR; - - + if (mode == LOGIC) { timeLogic = timeToUpdate; @@ -2926,13 +2935,16 @@ static void unitTimings(void) if (unitTypes==END) { side++; unitTypes = INFANTRY; - if (sides[side].isEmpty()) { + if (sides[side].isEmpty() ) // end of sides list + { g_UT_startTiming = false; - if (g_UT_timingLog) { + if (g_UT_timingLog) + { fclose(g_UT_timingLog); g_UT_timingLog = NULL; } - if (g_UT_commaLog) { + if (g_UT_commaLog) + { fclose(g_UT_commaLog); g_UT_commaLog = NULL; } @@ -3539,7 +3551,7 @@ UnsignedInt GameLogic::getCRC( Int mode, AsciiString deepCRCFileName ) CRCGEN_LOG(("CRC after module factory for frame %d is 0x%8.8X\n", m_frame, xferCRC->getCRC())); } } -#endif //DEBUG_CRC +#endif // DEBUG_CRC marker = "MARKER:ThePlayerList"; xferCRC->xferAsciiString(&marker); diff --git a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 31c36e00a1..e3c1ac91bd 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -936,6 +936,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } #endif + #ifdef ALLOW_SURRENDER //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_SURRENDER: diff --git a/Generals/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp b/Generals/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp index b34d115042..16b723fece 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp @@ -456,7 +456,7 @@ UnsignedShort FirewallHelperClass::getManglerResponse(UnsignedShort packetID, In } Int retval = m_spareSockets[i].udp->Read((unsigned char *)message, sizeof(ManglerData), &addr); if (retval > 0) { - + CRC crc; crc.computeCRC((unsigned char *)(&(message->data.magic)), sizeof(ManglerData) - sizeof(unsigned int)); if (crc.get() != htonl(message->data.CRC)) { diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp index d1a7ecc847..2cd7630de0 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameInfo.cpp @@ -1101,7 +1101,7 @@ Bool ParseAsciiStringToGameInfo(GameInfo *game, AsciiString options) break; } UnicodeString name; - name.set(MultiByteToWideCharSingleLine(slotValue.str() +1).c_str()); + name.set(MultiByteToWideCharSingleLine(slotValue.str() +1).c_str()); //DEBUG_LOG(("ParseAsciiStringToGameInfo - name is %s\n", slotValue.str()+1)); diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/GSConfig.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/GSConfig.cpp index 60be316d5e..3e30309fcc 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/GSConfig.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/GSConfig.cpp @@ -348,7 +348,7 @@ m_qmChannel(0) if (md) { m_qmMaps.push_back(mapName); - } + } #endif } else if (inQMBot) diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp index 72071c2a90..1e29bc0160 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp @@ -69,6 +69,7 @@ #endif // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// +// Note: if you add more columns, you must modify the .wnd files and change the listbox properties (yuck!) static enum { COLUMN_NAME = 0, COLUMN_MAP, diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp index be20575ee4..7a9965a4d0 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp @@ -669,7 +669,7 @@ AsciiString GameSpyStagingRoom::generateGameSpyGameResultsPacket( void ) Int gsPlayerID = slot->getProfileID(); Bool disconnected = slot->disconnected(); - AsciiString result = "loss", side = "USA"; + AsciiString result = "loss"; if (disconnected) result = "discon"; else if (TheNetwork->sawCRCMismatch()) @@ -677,9 +677,9 @@ AsciiString GameSpyStagingRoom::generateGameSpyGameResultsPacket( void ) else if (TheVictoryConditions->hasAchievedVictory(p)) result = "win"; - side = p->getPlayerTemplate()->getSide(); + AsciiString side = p->getPlayerTemplate()->getSide(); if (side == "America") - side = "USA"; + side = "USA"; //conform to GameSpy AsciiString playerStr; playerStr.format("\\player_%d\\%s\\pid_%d\\%d\\team_%d\\%d\\result_%d\\%s\\side_%d\\%s", diff --git a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp index 1802928f37..3e5c83f48f 100644 --- a/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp +++ b/Generals/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PersistentStorageThread.cpp @@ -1359,7 +1359,7 @@ std::string GameSpyPSMessageQueueInterface::formatPlayerKVPairs( PSPlayerStats s ITERATE_OVER(buildingsBuilt); ITERATE_OVER(earnings); ITERATE_OVER(techCaptured); - + //GS Report all disconnects, even if zero, because might have been //previously reported as 1 by updateAdditionalGameSpyDisconnections // ITERATE_OVER(discons); diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h index 0f7745bd81..b60b0967e1 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/Common/W3DRadar.h @@ -76,12 +76,12 @@ class W3DRadar : public Radar void initializeTextureFormats( void ); ///< find format to use for the radar texture void deleteResources( void ); ///< delete resources used void drawEvents( Int pixelX, Int pixelY, Int width, Int height); ///< draw all of the radar events - void drawHeroIcon( Int pixelX, Int pixelY, Int width, Int height, const Coord3D *pos ); //< draw a hero icon + void drawHeroIcon( Int pixelX, Int pixelY, Int width, Int height, const Coord3D *pos ); //< draw a hero icon void drawViewBox( Int pixelX, Int pixelY, Int width, Int height ); ///< draw view box void buildTerrainTexture( TerrainLogic *terrain ); ///< create the terrain texture of the radar void drawIcons( Int pixelX, Int pixelY, Int width, Int height ); ///< draw all of the radar icons void renderObjectList( const RadarObject *listHead, TextureClass *texture, Bool calcHero = FALSE ); ///< render an object list to the texture - void interpolateColorForHeight( RGBColor *color, + void interpolateColorForHeight( RGBColor *color, Real height, Real hiZ, Real midZ, @@ -118,7 +118,7 @@ class W3DRadar : public Radar Real m_viewZoom; ///< camera zoom used for the view box we have ICoord2D m_viewBox[ 4 ]; ///< radar cell points for the 4 corners of view box - std::list m_cachedHeroPosList; //< cache of hero positions for drawing icons in radar overlay + std::list m_cachedHeroPosList; //< cache of hero positions for drawing icons in radar overlay }; diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h index 88c863ea4e..3550e8b3b3 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManager.h @@ -66,11 +66,13 @@ class W3DAssetManager: public WW3DAssetManager // unique to W3DAssetManager virtual HAnimClass * Get_HAnim(const char * name); virtual bool Load_3D_Assets( const char * filename ); // This CANNOT be Bool, as it will not inherit properly if you make Bool == Int - virtual TextureClass * Get_Texture( + virtual TextureClass * Get_Texture + ( const char * filename, MipCountType mip_level_count=MIP_LEVELS_ALL, WW3DFormat texture_format=WW3D_FORMAT_UNKNOWN, - bool allow_compression=true); + bool allow_compression=true + ); //'Generals' customizations void Report_Used_Assets(void); diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBridgeBuffer.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBridgeBuffer.h index 1b0b9e73c4..6b885b5da8 100644 --- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBridgeBuffer.h +++ b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DBridgeBuffer.h @@ -164,8 +164,8 @@ friend class HeightMapRenderObjClass; void loadBridges(W3DTerrainLogic *pTerrainLogic, Bool saveGame); ///< Loads the bridges from the map objects list. void worldBuilderUpdateBridgeTowers( W3DAssetManager *assetManager, SimpleSceneClass *scene ); ///< for the editor and showing visual bridge towers void updateCenter(CameraClass *camera, RefRenderObjListIterator *pLightsIterator); - enum { MAX_BRIDGE_VERTEX=8000, - MAX_BRIDGE_INDEX=2*8000, + enum { MAX_BRIDGE_VERTEX=8000, //make sure it stays under 65535 + MAX_BRIDGE_INDEX=2*MAX_BRIDGE_VERTEX, //make sure it stays under 65535 MAX_BRIDGES=200}; protected: DX8VertexBufferClass *m_vertexBridge; ///m_pendingEvent->getAudioEventInfo()->m_type != AT_SoundEffect) { + if (req->m_pendingEvent->getAudioEventInfo()->m_type != AT_SoundEffect) + { return true; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 284379cd1b..eb55516df1 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -60,6 +60,7 @@ //#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") #endif + // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// enum { OVERLAY_REFRESH_RATE = 6 }; ///< over updates once this many frames @@ -277,8 +278,6 @@ void W3DRadar::drawHeroIcon( Int pixelX, Int pixelY, Int width, Int height, cons } } - - //------------------------------------------------------------------------------------------------- /** Draw a "box" into the texture passed in that represents the viewable area for * the tactical display into the game world */ @@ -616,7 +615,6 @@ void W3DRadar::drawIcons( Int pixelX, Int pixelY, Int width, Int height ) } } - //------------------------------------------------------------------------------------------------- /** Render an object list into the texture passed in */ //------------------------------------------------------------------------------------------------- @@ -704,7 +702,7 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text continue; if ( ThePlayerList->getLocalPlayer()->getRelationship(obj->getTeam()) == ENEMIES ) - if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !stealth->isDisguised() ) + if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !stealth->isDisguised() ) skip = TRUE; UnsignedByte r, g, b, a; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index d50ecb3519..185ae3fd7f 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -2661,7 +2661,7 @@ Bool W3DModelDraw::updateBonesForClientParticleSystems() sys->rotateLocalTransformZ(rotation); } - } + }// next praticle system }// end if Drawable diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp index bbfb6d9eb9..0e8c393882 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DTruckDraw.cpp @@ -265,7 +265,8 @@ void W3DTruckDraw::enableEmitters( Bool enable ) } } //------------------------------------------------------------------------------------------------- -void W3DTruckDraw::updateBones( void ) { +void W3DTruckDraw::updateBones( void ) +{ if( getW3DTruckDrawModuleData() ) { //Front tires diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index 54b5af3f15..8c07bf9779 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -968,8 +968,8 @@ void W3DDisplay::gatherDebugStats( void ) else unibuffer.format( L"%.2f FPS, ", fps); - unibuffer2.format( L"%.2fms [cumuFPS=%.2f] draws: %d skins: %d sortP: %d skinP: %d", ms, cumuFPS, (Int)drawsPerFrame,(Int)skinDrawsPerFrame,(Int)sortPolysPerFrame, (Int)skinPolysPerFrame); - unibuffer.concat(unibuffer2); + unibuffer2.format( L"%.2fms [cumuFPS=%.2f] draws: %d skins: %d sortP: %d skinP: %d", ms, cumuFPS, (Int)drawsPerFrame,(Int)skinDrawsPerFrame,(Int)sortPolysPerFrame, (Int)skinPolysPerFrame); + unibuffer.concat(unibuffer2); #else //Int LOD = TheGlobalData->m_terrainLOD; //unibuffer.format( L"FPS: %.2f, %.2fms mapLOD=%d draws: %.2f sort %.2f", fps, ms, LOD, drawsPerFrame,sortPolysPerFrame); diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp index cd56ba06f0..1e494296fb 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp @@ -44,7 +44,7 @@ //------------------------------------------------------------------------------------------------- W3DDisplayStringManager::W3DDisplayStringManager( void ) { - for (Int i = 0; i < 10; ++i) + for (Int i = 0; i < MAX_GROUPS; ++i) { m_groupNumeralStrings[i] = NULL; } @@ -56,7 +56,7 @@ W3DDisplayStringManager::W3DDisplayStringManager( void ) //------------------------------------------------------------------------------------------------- W3DDisplayStringManager::~W3DDisplayStringManager( void ) { - for (Int i = 0; i < 10; ++i) + for (Int i = 0; i < MAX_GROUPS; ++i) { if (m_groupNumeralStrings[i]) freeDisplayString(m_groupNumeralStrings[i]); @@ -79,14 +79,20 @@ void W3DDisplayStringManager::postProcessLoad( void ) TheDrawGroupInfo->m_fontSize, TheDrawGroupInfo->m_fontIsBold ); - for (Int i = 0; i < 10; ++i) + for (Int i = 0; i < MAX_GROUPS; ++i) { m_groupNumeralStrings[i] = newDisplayString(); m_groupNumeralStrings[i]->setFont(font); +#ifdef KRIS_BRUTAL_HACK_FOR_AIRCRAFT_CARRIER_DEBUGGING + UnicodeString displayNumber; + displayNumber.format( L"%d", i); + m_groupNumeralStrings[i]->setText( displayNumber ); +#else AsciiString displayNumber; displayNumber.format("NUMBER:%d", i); m_groupNumeralStrings[i]->setText(TheGameText->fetch(displayNumber)); +#endif } m_formationLetterDisplayString = newDisplayString(); @@ -225,7 +231,8 @@ void W3DDisplayStringManager::update( void ) //------------------------------------------------------------------------------------------------- DisplayString *W3DDisplayStringManager::getGroupNumeralString( Int numeral ) { - if (numeral < 0 || numeral > 9) { + if (numeral < 0 || numeral > MAX_GROUPS - 1 ) + { DEBUG_CRASH(("Numeral '%d' out of range.\n", numeral)); return m_groupNumeralStrings[0]; } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index 07b49e6bfa..2b02a71938 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -687,14 +687,15 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I // THIS WILL EXPLICITLY SKIP THE FIRST PASS SO THAT HEATVISION ONLY WILL RENDER rinfo.Push_Override_Flags(RenderInfoClass::RINFO_OVERRIDE_ADDITIONAL_PASSES_ONLY); rinfo.Push_Material_Pass(m_heatVisionOnlyPass); - doExtraFlagsPop=TRUE; + doExtraFlagsPop = TRUE; } else { //THIS CALLS FOR THE HEATVISION TO RENDER rinfo.Push_Material_Pass(m_heatVisionMaterialPass); } - doExtraMaterialPop=TRUE; + + doExtraMaterialPop = TRUE; } } else diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp index a19d2f041c..f2f63d8560 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp @@ -618,7 +618,8 @@ void W3DTerrainVisual::addFactionBibDrawable(Drawable *factionBuilding, Bool hig // ------------------------------------------------------------------------------------------------ void W3DTerrainVisual::addFactionBib(Object *factionBuilding, Bool highlight, Real extra) { - if (m_terrainHeightMap) { + if (m_terrainHeightMap) + { const Matrix3D * mtx = factionBuilding->getTransformMatrix(); Vector3 corners[4]; Coord3D pos; diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp index c9e781fd43..d24f659695 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp @@ -417,8 +417,7 @@ void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) m_line->Set_Points( numPoints, points ); m_line->Render( localRinfo ); - } - + }// end if exit interface } } diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp index 1374e383a6..9d50fea3ab 100644 --- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp +++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp @@ -929,9 +929,9 @@ void WaterRenderObjClass::ReAcquireResources(void) } shader = "ps.1.1\n \ - tex t0 \n\ - tex t1 \n\ - tex t2 \n\ + tex t0 ;get water texture\n\ + tex t1 ;get white highlights on black background\n\ + tex t2 ;get white highlights with more tiling\n\ tex t3 ; get black shroud \n\ mul r0,v0,t0 ; blend vertex color and alpha into base texture. \n\ mad r0.rgb, t1, t2, r0 ; blend sparkles and noise \n\ diff --git a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp index 57348d4866..e54926f500 100644 --- a/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp +++ b/Generals/Code/Libraries/Source/WWVegas/WW3D2/meshmatdesc.cpp @@ -62,29 +62,29 @@ MatBufferClass::MatBufferClass(const MatBufferClass & that) : } } -MatBufferClass::~MatBufferClass(void) -{ - for (int i=0; iAdd_Ref(); - } - return Array[index]; +{ + if (Array[index]) { + Array[index]->Add_Ref(); + } + return Array[index]; } VertexMaterialClass * MatBufferClass::Peek_Element(int index) -{ - return Array[index]; +{ + return Array[index]; } @@ -95,7 +95,7 @@ VertexMaterialClass * MatBufferClass::Peek_Element(int index) ** ** **************************************************************************************************/ -TexBufferClass::TexBufferClass(const TexBufferClass & that) : +TexBufferClass::TexBufferClass(const TexBufferClass & that) : ShareBufferClass(that) { // add a reference for each pointer that was copied... @@ -107,28 +107,28 @@ TexBufferClass::TexBufferClass(const TexBufferClass & that) : } TexBufferClass::~TexBufferClass(void) -{ - for (int i=0;iAdd_Ref(); - } - return Array[index]; +{ + if (Array[index]) { + Array[index]->Add_Ref(); + } + return Array[index]; } TextureClass * TexBufferClass::Peek_Element(int index) -{ - return Array[index]; +{ + return Array[index]; } @@ -204,7 +204,7 @@ MeshMatDescClass::MeshMatDescClass(void) : } } -MeshMatDescClass::MeshMatDescClass(const MeshMatDescClass & that) : +MeshMatDescClass::MeshMatDescClass(const MeshMatDescClass & that) : PassCount(1), VertexCount(0), PolyCount(0) @@ -244,7 +244,7 @@ MeshMatDescClass & MeshMatDescClass::operator = (const MeshMatDescClass & that) { if (this != &that) { - + PassCount = that.PassCount; VertexCount = that.VertexCount; PolyCount = that.PolyCount; @@ -261,7 +261,7 @@ MeshMatDescClass::operator = (const MeshMatDescClass & that) for (int stage=0; stage < MAX_TEX_STAGES; stage++) { UVSource[pass][stage] = that.UVSource[pass][stage]; REF_PTR_SET(Texture[pass][stage],that.Texture[pass][stage]); - + // make our own array of texture pointers. REF_PTR_RELEASE(TextureArray[pass][stage]); if (that.TextureArray[pass][stage]) { @@ -289,7 +289,7 @@ MeshMatDescClass::operator = (const MeshMatDescClass & that) if (that.ShaderArray[pass]) { ShaderArray[pass] = NEW_REF(ShareBufferClass,(*that.ShaderArray[pass])); } - } + } } return *this; } @@ -327,16 +327,16 @@ void MeshMatDescClass::Reset(int polycount,int vertcount,int passcount) REF_PTR_RELEASE(Texture[pass][stage]); REF_PTR_RELEASE(TextureArray[pass][stage]); } - + // REF_PTR_RELEASE(UVIndex[pass]); DCGSource[pass] = VertexMaterialClass::MATERIAL; DIGSource[pass] = VertexMaterialClass::MATERIAL; Shader[pass] = 0; REF_PTR_RELEASE(ShaderArray[pass]); - + REF_PTR_RELEASE(Material[pass]); REF_PTR_RELEASE(MaterialArray[pass]); - + } } @@ -371,7 +371,7 @@ void MeshMatDescClass::Init_Alternate(MeshMatDescClass & default_materials,MeshM // and set its index into our UVSource array. if (alternate_materials.UVSource[pass][stage] == -1) { if (default_materials.UVSource[pass][stage] != -1) { - + // Look up the uv array in default_materials that we need to bring over. int default_uv_source = default_materials.UVSource[pass][stage]; UVBufferClass * uvarray = default_materials.UV[default_uv_source]; @@ -391,10 +391,10 @@ void MeshMatDescClass::Init_Alternate(MeshMatDescClass & default_materials,MeshM UVSource[pass][stage] = found_index; } else { int new_index = Get_UV_Array_Count(); - REF_PTR_SET(UV[new_index],default_materials.UV[default_uv_source]); + REF_PTR_SET(UV[new_index],default_materials.UV[default_uv_source]); UVSource[pass][stage] = new_index; } - } + } } else { UVSource[pass][stage] = alternate_materials.UVSource[pass][stage]; } @@ -423,7 +423,7 @@ void MeshMatDescClass::Init_Alternate(MeshMatDescClass & default_materials,MeshM } else { DCGSource[pass] = alternate_materials.DCGSource[pass]; } - + // Shaders, currently I can't tell if the alternate data has a shader... Can't override the shader for now. Shader[pass] = default_materials.Shader[pass]; REF_PTR_SET(ShaderArray[pass],default_materials.ShaderArray[pass]); @@ -438,7 +438,7 @@ void MeshMatDescClass::Init_Alternate(MeshMatDescClass & default_materials,MeshM Material[pass] = NEW_REF(VertexMaterialClass,(*(default_materials.Material[pass]))); } else { if (default_materials.MaterialArray[pass]) { - WWDEBUG_SAY(("Unimplemented case: mesh has more than one default vertex material but no alternate vertex materials have been defined.\r\n")); + WWDEBUG_SAY(("Unimplemented case: mesh has more than one default vertex material but no alternate vertex materials have been defined.\r\n")); } Material[pass] = NULL; } @@ -467,7 +467,7 @@ bool MeshMatDescClass::Is_Empty(void) if (MaterialArray[pass] != NULL) return false; } - + return true; } @@ -514,7 +514,7 @@ VertexMaterialClass * MeshMatDescClass::Get_Material(int vidx,int pass) const Material[pass]->Add_Ref(); return Material[pass]; - + } return NULL; } @@ -523,7 +523,7 @@ ShaderClass MeshMatDescClass::Get_Shader(int pidx,int pass) const { if (ShaderArray[pass]) { return ShaderArray[pass]->Get_Element(pidx); - } + } return Shader[pass]; } @@ -532,13 +532,13 @@ TextureClass * MeshMatDescClass::Get_Texture(int pidx,int pass,int stage) const if (TextureArray[pass][stage]) { return TextureArray[pass][stage]->Get_Element(pidx); - + } else if (Texture[pass][stage] != NULL) { Texture[pass][stage]->Add_Ref(); return Texture[pass][stage]; - - } + + } return NULL; } @@ -546,7 +546,7 @@ VertexMaterialClass * MeshMatDescClass::Peek_Material(int vidx,int pass) const { if (MaterialArray[pass]) { return MaterialArray[pass]->Peek_Element(vidx); - } + } return Material[pass]; } @@ -645,7 +645,7 @@ void MeshMatDescClass::Install_UV_Array(int pass,int stage,Vector2 * uvs,int cou memcpy(UV[new_index]->Get_Array(),uvs,count * sizeof(Vector2)); UV[new_index]->Update_CRC(); // update the crc for future comparision Set_UV_Source(pass,stage,new_index); - } + } } } @@ -659,7 +659,7 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled) for (int pass=0; passSet_Lighting(false); } - } } @@ -893,10 +892,9 @@ void MeshMatDescClass::Post_Load_Process(bool lighting_enabled) Vector3 mtl_emissive; VertexMaterialClass * prev_mtl = NULL; - VertexMaterialClass * mtl = Peek_Material(0,pass); + VertexMaterialClass * mtl = Peek_Material(0, pass); for (int vidx=0; vidxSet_Lighting(lighting_enabled); - for (int stage=0; stage. */ + + #include "Common/AsciiString.h" class TeamsInfo; class SidesList; diff --git a/Generals/Code/Tools/WorldBuilder/include/DrawObject.h b/Generals/Code/Tools/WorldBuilder/include/DrawObject.h index 90432b7527..1adbe7d3ae 100644 --- a/Generals/Code/Tools/WorldBuilder/include/DrawObject.h +++ b/Generals/Code/Tools/WorldBuilder/include/DrawObject.h @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ + #ifndef __DRAW_OBJECT_H_ #define __DRAW_OBJECT_H_ @@ -84,6 +85,7 @@ class DrawObject : public RenderObjClass static void setDoMeshFeedback(Bool val) { m_meshFeedback = val; } static void setDoRampFeedback(Bool val) { m_rampFeedback = val; } static void setDoBoundaryFeedback(Bool val) { m_boundaryFeedback = val; } + static void setDoAmbientSoundFeedback(Bool val) { m_ambientSoundFeedback = val; } static void setBrushFeedbackParms(Bool square, Int width, Int featherWidth) diff --git a/Generals/Code/Tools/WorldBuilder/include/ImpassableOptions.h b/Generals/Code/Tools/WorldBuilder/include/ImpassableOptions.h index 4c5e998fc3..47afcdd7ce 100644 --- a/Generals/Code/Tools/WorldBuilder/include/ImpassableOptions.h +++ b/Generals/Code/Tools/WorldBuilder/include/ImpassableOptions.h @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ + #pragma once #ifndef __IMPASSABLEOPTIONS_H__ diff --git a/Generals/Code/Tools/WorldBuilder/include/LayersList.h b/Generals/Code/Tools/WorldBuilder/include/LayersList.h index 2cc559500d..35d4575552 100644 --- a/Generals/Code/Tools/WorldBuilder/include/LayersList.h +++ b/Generals/Code/Tools/WorldBuilder/include/LayersList.h @@ -152,7 +152,6 @@ class LayersList : public CDialog afx_msg void OnMergeObject(UINT commandID); afx_msg void OnMergeViewSelection(UINT commandID); - afx_msg void OnNewLayer(); afx_msg void OnDeleteLayer(); afx_msg void OnHideShowLayer(); diff --git a/Generals/Code/Tools/WorldBuilder/include/MainFrm.h b/Generals/Code/Tools/WorldBuilder/include/MainFrm.h index 7fdd512245..eab60fbded 100644 --- a/Generals/Code/Tools/WorldBuilder/include/MainFrm.h +++ b/Generals/Code/Tools/WorldBuilder/include/MainFrm.h @@ -119,7 +119,6 @@ class CMainFrame : public CFrameWnd CameraOptions m_cameraOptions; LayersList* m_layersList; - CWnd *m_curOptions; Int m_curOptionsX; Int m_curOptionsY; diff --git a/Generals/Code/Tools/WorldBuilder/include/SplashScreen.h b/Generals/Code/Tools/WorldBuilder/include/SplashScreen.h index 4eac25f595..3db89035bb 100644 --- a/Generals/Code/Tools/WorldBuilder/include/SplashScreen.h +++ b/Generals/Code/Tools/WorldBuilder/include/SplashScreen.h @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ + #pragma once #ifndef __SPLASHSCREEN_H__ diff --git a/Generals/Code/Tools/WorldBuilder/include/TeamGeneric.h b/Generals/Code/Tools/WorldBuilder/include/TeamGeneric.h index 45b9153fd7..a33253e591 100644 --- a/Generals/Code/Tools/WorldBuilder/include/TeamGeneric.h +++ b/Generals/Code/Tools/WorldBuilder/include/TeamGeneric.h @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ + #pragma once #ifndef __TEAMGENERIC_H__ diff --git a/Generals/Code/Tools/WorldBuilder/include/WBHeightMap.h b/Generals/Code/Tools/WorldBuilder/include/WBHeightMap.h index adf43afd21..fcc1c9481c 100644 --- a/Generals/Code/Tools/WorldBuilder/include/WBHeightMap.h +++ b/Generals/Code/Tools/WorldBuilder/include/WBHeightMap.h @@ -16,11 +16,12 @@ ** along with this program. If not, see . */ + #ifndef __WBHEIGHTMAP_H_ #define __WBHEIGHTMAP_H_ #include "W3DDevice/GameClient/HeightMap.h" - + class WBHeightMap : public HeightMapRenderObjClass { diff --git a/Generals/Code/Tools/WorldBuilder/include/wbview3d.h b/Generals/Code/Tools/WorldBuilder/include/wbview3d.h index 6b6eaa9652..eaacdfc9e4 100644 --- a/Generals/Code/Tools/WorldBuilder/include/wbview3d.h +++ b/Generals/Code/Tools/WorldBuilder/include/wbview3d.h @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ + // WbView3d.h // Class to encapsulate height map. // Author: Steven Johnson, Aug 2001 diff --git a/Generals/Code/Tools/WorldBuilder/src/BorderTool.cpp b/Generals/Code/Tools/WorldBuilder/src/BorderTool.cpp index a4f23b7f30..471a6ace5e 100644 --- a/Generals/Code/Tools/WorldBuilder/src/BorderTool.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/BorderTool.cpp @@ -138,10 +138,13 @@ void BorderTool::mouseDown(TTrackingMode m, CPoint viewPt, WbView* pView, CWorld Int motion; pDoc->findBoundaryNear(&groundPt, BOUNDARY_PICK_DISTANCE, &m_modifyBorderNdx, &motion); - if (motion == 0) { + if (motion == 0) + { // modifying the bottom left is not allowed. m_modifyBorderNdx = -1; - } else { + } + else + { m_modificationType = (ModificationType) motion; } } diff --git a/Generals/Code/Tools/WorldBuilder/src/CameraOptions.cpp b/Generals/Code/Tools/WorldBuilder/src/CameraOptions.cpp index 9b2c0d17f8..e91a81883a 100644 --- a/Generals/Code/Tools/WorldBuilder/src/CameraOptions.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/CameraOptions.cpp @@ -58,6 +58,7 @@ BEGIN_MESSAGE_MAP(CameraOptions, CDialog) //}}AFX_MSG_MAP END_MESSAGE_MAP() + ///////////////////////////////////////////////////////////////////////////// // CameraOptions message handlers diff --git a/Generals/Code/Tools/WorldBuilder/src/SplashScreen.cpp b/Generals/Code/Tools/WorldBuilder/src/SplashScreen.cpp index e99e33524b..78911a6ba6 100644 --- a/Generals/Code/Tools/WorldBuilder/src/SplashScreen.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/SplashScreen.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ + #include "StdAfx.h" #include "SplashScreen.h" diff --git a/Generals/Code/Tools/WorldBuilder/src/TeamGeneric.cpp b/Generals/Code/Tools/WorldBuilder/src/TeamGeneric.cpp index 1fb3c6ee91..c0e68bb50e 100644 --- a/Generals/Code/Tools/WorldBuilder/src/TeamGeneric.cpp +++ b/Generals/Code/Tools/WorldBuilder/src/TeamGeneric.cpp @@ -16,6 +16,7 @@ ** along with this program. If not, see . */ + #include "StdAfx.h" #include "resource.h" diff --git a/GeneralsMD/Code/GameEngine/Include/Common/BattleHonors.h b/GeneralsMD/Code/GameEngine/Include/Common/BattleHonors.h index 55e4437891..56240f0e5c 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/BattleHonors.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/BattleHonors.h @@ -65,7 +65,7 @@ //----------------------------------------------------------------------------- enum { - BATTLE_HONOR_LADDER_CHAMP = 0x00000001, + BATTLE_HONOR_LADDER_CHAMP = 0x00000001, BATTLE_HONOR_STREAK = 0x00000002, // BATTLE_HONOR_STREAK_5 = 0x00000004, // NOT TO BE REUSED // BATTLE_HONOR_STREAK_10 = 0x00000008, // NOT TO BE REUSED @@ -91,7 +91,7 @@ enum BATTLE_HONOR_DOMINATION_ONLINE = 0x00800000, BATTLE_HONOR_STREAK_ONLINE = 0x01000000, BATTLE_HONOR_CHALLENGE = 0x02000000, // not set in battle honors field in persistent storage -//BATTLE_HONOR_FREE = 0x04000000, + //BATTLE_HONOR_FREE = 0x04000000, BATTLE_HONOR_NOT_GAINED = 0x08000000 // This is set in tooltip item data to indicate that the honor isn't actually gained. }; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h index 8dd24109ca..106f26645b 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h @@ -426,7 +426,7 @@ class GlobalData : public SubsystemInterface UnsignedInt m_unlookPersistDuration; ///< How long after unlook until the sighting info executes the undo Bool m_shouldUpdateTGAToDDS; ///< Should we attempt to update old TGAs to DDS stuff on loadup? - + UnsignedInt m_doubleClickTimeMS; ///< What is the maximum amount of time that can seperate two clicks in order ///< for us to generate a double click message? @@ -516,7 +516,7 @@ class GlobalData : public SubsystemInterface // the trailing '\' is included! - const AsciiString &getPath_UserData() const { return m_userDataDir; } + const AsciiString &getPath_UserData() const { return m_userDataDir; } private: diff --git a/GeneralsMD/Code/GameEngine/Include/Common/INI.h b/GeneralsMD/Code/GameEngine/Include/Common/INI.h index 8ac4254796..29d977e849 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/INI.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/INI.h @@ -404,7 +404,7 @@ class INI AsciiString m_filename; ///< filename of file currently loading INILoadType m_loadType; ///< load time for current file UnsignedInt m_lineNum; ///< current line number that's been read - char m_buffer[ INI_MAX_CHARS_PER_LINE+1 ];///< buffer to read file contents into + char m_buffer[ INI_MAX_CHARS_PER_LINE+1 ]; ///< buffer to read file contents into const char *m_seps; ///< for strtok parsing const char *m_sepsPercent; ///< m_seps with percent delimiter as well const char *m_sepsColon; ///< m_seps with colon delimiter as well diff --git a/GeneralsMD/Code/GameEngine/Include/Common/KindOf.h b/GeneralsMD/Code/GameEngine/Include/Common/KindOf.h index 42e60a328f..9877f379a7 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/KindOf.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/KindOf.h @@ -172,8 +172,7 @@ enum KindOfType KINDOF_IGNORE_DOCKING_BONES, ///< Structure will not look up docking bones. Patch 1.03 hack. KINDOF_COUNT // total number of kindofs - -}; +}; typedef BitFlags KindOfMaskType; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/MiscAudio.h b/GeneralsMD/Code/GameEngine/Include/Common/MiscAudio.h index 5c032f736d..fb9e8f2a50 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/MiscAudio.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/MiscAudio.h @@ -76,4 +76,3 @@ struct MiscAudio #endif /* _MISCAUDIO_H_ */ - diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h b/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h index 8579d2dcf7..5e08851327 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ModelState.h @@ -118,7 +118,7 @@ enum ModelConditionFlagType MODELCONDITION_WEAPONSET_CRATEUPGRADE_ONE, MODELCONDITION_WEAPONSET_CRATEUPGRADE_TWO, MODELCONDITION_WEAPONSET_PLAYER_UPGRADE, - MODELCONDITION_DOOR_1_OPENING, + MODELCONDITION_DOOR_1_OPENING, MODELCONDITION_DOOR_1_CLOSING, MODELCONDITION_DOOR_1_WAITING_OPEN, MODELCONDITION_DOOR_1_WAITING_TO_CLOSE, diff --git a/GeneralsMD/Code/GameEngine/Include/Common/SpecialPowerType.h b/GeneralsMD/Code/GameEngine/Include/Common/SpecialPowerType.h index 44b3b3aa9a..bc322fc221 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/SpecialPowerType.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/SpecialPowerType.h @@ -72,7 +72,7 @@ enum SpecialPowerType //Special abilities SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES, SPECIAL_REMOTE_CHARGES, - SPECIAL_TIMED_CHARGES, + SPECIAL_TIMED_CHARGES, SPECIAL_HELIX_NAPALM_BOMB, SPECIAL_HACKER_DISABLE_BUILDING, SPECIAL_TANKHUNTER_TNT_ATTACK, diff --git a/GeneralsMD/Code/GameEngine/Include/Common/StackDump.h b/GeneralsMD/Code/GameEngine/Include/Common/StackDump.h index 3644e524cc..4085b0e66c 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/StackDump.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/StackDump.h @@ -69,4 +69,5 @@ __inline void DumpExceptionInfo( unsigned int u, EXCEPTION_POINTERS* e_info ) {} #endif extern AsciiString g_LastErrorDump; + #endif // __STACKDUMP_H_ diff --git a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h b/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h index f5a109a960..d8804985e8 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/SubsystemInterface.h @@ -157,7 +157,7 @@ class SubsystemInterfaceList void resetAll(); void shutdownAll(); #ifdef DUMP_PERF_STATS - AsciiString dumpTimesForAll(); + AsciiString dumpTimesForAll(); #endif private: diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h index ffa2e08beb..f3c1dad943 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h @@ -507,9 +507,9 @@ class ThingTemplate : public Overridable const AudioEventRTS *getSoundPromotedHero() const { return getAudio(TTAUDIO_soundPromotedHero); } const AudioEventRTS *getSoundFalling() const { return getAudio(TTAUDIO_soundFalling); } - Bool hasSoundAmbient() const { return hasAudio(TTAUDIO_soundAmbient); } + Bool hasSoundAmbient() const { return hasAudio(TTAUDIO_soundAmbient); } - const AudioEventRTS *getPerUnitSound(const AsciiString& soundName) const; + const AudioEventRTS *getPerUnitSound(const AsciiString& soundName) const; const FXList* getPerUnitFX(const AsciiString& fxName) const; UnsignedInt getThreatValue() const { return m_threatValue; } @@ -747,13 +747,13 @@ class ThingTemplate : public Overridable UnsignedShort m_maxSimultaneousOfType; ///< max simultaneous of this unit we can have (per player) at one time. (0 == unlimited) // ---- Bool-sized things - Bool m_maxSimultaneousDeterminedBySuperweaponRestriction; ///< If true, override value in m_maxSimultaneousOfType with value from GameInfo::getSuperweaponRestriction() + Bool m_maxSimultaneousDeterminedBySuperweaponRestriction; ///< If true, override value in m_maxSimultaneousOfType with value from GameInfo::getSuperweaponRestriction() Bool m_isPrerequisite; ///< Is this thing considered in a prerequisite for any other thing? Bool m_isBridge; ///< True if this model is a bridge. Bool m_isBuildFacility; ///< is this the build facility for something? (calculated based on other template's prereqs) Bool m_isTrainable; ///< Whether or not I can even gain experience - Bool m_enterGuard; ///< Whether or not I can enter objects when guarding - Bool m_hijackGuard; ///< Whether or not I can hijack objects when guarding + Bool m_enterGuard; ///< Whether or not I can enter objects when guarding + Bool m_hijackGuard; ///< Whether or not I can hijack objects when guarding Bool m_isForbidden; ///< useful when overriding in .ini Bool m_armorCopiedFromDefault; Bool m_weaponsCopiedFromDefault; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h index a495a5d42a..c9299d2868 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h @@ -143,10 +143,10 @@ class LANPreferences : public UserPreferences Int getNumRemoteIPs(void); // convenience function UnicodeString getRemoteIPEntry(Int i); // convenience function - Bool getSuperweaponRestricted(void) const; - Money getStartingCash(void) const; - void setSuperweaponRestricted( Bool superweaponRestricted); - void setStartingCash( const Money & startingCash ); + Bool getSuperweaponRestricted(void) const; + Money getStartingCash(void) const; + void setSuperweaponRestricted( Bool superweaponRestricted); + void setStartingCash( const Money & startingCash ); }; #endif // __USERPREFERENCES_H__ diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h index ca38307b7d..dcf560fdbc 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Drawable.h @@ -151,8 +151,8 @@ class DrawableLocoInfo : public MemoryPoolObject Real m_overlapZVel; ///< fake Z velocity Real m_overlapZ; ///< current height (additional) Real m_wobble; ///< for wobbling - Real m_yawModulator; ///< for the swimmy soft hover of a helicopter - Real m_pitchModulator; ///< for the swimmy soft hover of a helicopter + Real m_yawModulator; ///< for the swimmy soft hover of a helicopter + Real m_pitchModulator; ///< for the swimmy soft hover of a helicopter TWheelInfo m_wheelInfo; ///< Wheel offset & angle info for a wheeled type locomotor. DrawableLocoInfo(); @@ -294,7 +294,7 @@ class Drawable : public Thing, Drawable( const ThingTemplate *thing, DrawableStatus statusBits = DRAWABLE_STATUS_NONE ); void onDestroy( void ); ///< run from GameClient::destroyDrawable - void onLevelStart(); ///< run from GameLogic::startNewGame + void onLevelStart(); ///< run from GameLogic::startNewGame Drawable *getNextDrawable( void ) const { return m_nextDrawable; } ///< return the next drawable in the global list Drawable *getPrevDrawable( void ) const { return m_prevDrawable; } ///< return the prev drawable in the global list @@ -309,8 +309,7 @@ class Drawable : public Thing, TintEnvelope *getColorTintEnvelope( void ) { return m_colorTintEnvelope; } void setColorTintEnvelope( TintEnvelope &source ) { if (m_colorTintEnvelope) *m_colorTintEnvelope = source; } - - void imitateStealthLook( Drawable& otherDraw ); + void imitateStealthLook( Drawable& otherDraw ); void setTerrainDecal(TerrainDecalType type); ///m_wheelInfo : NULL; } - + const DrawableLocoInfo *getLocoInfo() const { return m_locoInfo; } // this method must ONLY be called from the client, NEVER From the logic, not even indirectly. @@ -497,7 +496,7 @@ class Drawable : public Thing, "inbetween", it is included in the completion time. */ void setAnimationCompletionTime(UnsignedInt numFrames); - + //Kris: Manually set a drawable's current animation to specific frame. virtual void setAnimationFrame( int frame ); @@ -563,26 +562,26 @@ class Drawable : public Thing, void killIcon(DrawableIconType t) { if (m_iconInfo) m_iconInfo->killIcon(t); } Bool hasIconInfo() const { return m_iconInfo != NULL; } - - Bool getReceivesDynamicLights( void ) { return m_receivesDynamicLights; }; - void setReceivesDynamicLights( Bool set ) { m_receivesDynamicLights = set; }; - - //--------------------------------------------------------------------------------- - // Stuff for overriding ambient sound - const AudioEventInfo * getBaseSoundAmbientInfo() const; //< Possible starting point if only some parameters are customized - void enableAmbientSoundFromScript( Bool enable ); - const AudioEventRTS * getAmbientSound() const { return m_ambientSound == NULL ? NULL : &m_ambientSound->m_event; } - void setCustomSoundAmbientOff(); //< Kill the ambient sound - void setCustomSoundAmbientInfo( DynamicAudioEventInfo * customAmbientInfo ); //< Set ambient sound. - void clearCustomSoundAmbient( ) { clearCustomSoundAmbient( true ); } //< Return to using defaults - Bool getAmbientSoundEnabled( void ) const { return m_ambientSoundEnabled; } - void mangleCustomAudioName( DynamicAudioEventInfo * audioToMangle ) const; - - - Real friend_getStealthOpacity( void ) { return m_stealthOpacity; } - Real friend_getExplicitOpacity( void ) { return m_explicitOpacity; } - Real friend_getEffectiveStealthOpacity( void ) { return m_effectiveStealthOpacity; } - + + Bool getReceivesDynamicLights( void ) { return m_receivesDynamicLights; }; + void setReceivesDynamicLights( Bool set ) { m_receivesDynamicLights = set; }; + + //--------------------------------------------------------------------------------- + // Stuff for overriding ambient sound + const AudioEventInfo * getBaseSoundAmbientInfo() const; //< Possible starting point if only some parameters are customized + void enableAmbientSoundFromScript( Bool enable ); + const AudioEventRTS * getAmbientSound() const { return m_ambientSound == NULL ? NULL : &m_ambientSound->m_event; } + void setCustomSoundAmbientOff(); //< Kill the ambient sound + void setCustomSoundAmbientInfo( DynamicAudioEventInfo * customAmbientInfo ); //< Set ambient sound. + void clearCustomSoundAmbient( ) { clearCustomSoundAmbient( true ); } //< Return to using defaults + Bool getAmbientSoundEnabled( void ) const { return m_ambientSoundEnabled; } + void mangleCustomAudioName( DynamicAudioEventInfo * audioToMangle ) const; + + + Real friend_getStealthOpacity( void ) { return m_stealthOpacity; } + Real friend_getExplicitOpacity( void ) { return m_explicitOpacity; } + Real friend_getEffectiveStealthOpacity( void ) { return m_effectiveStealthOpacity; } + protected: // snapshot methods @@ -629,7 +628,7 @@ class Drawable : public Thing, const AudioEventRTS& getAmbientSoundByDamage(BodyDamageType dt); - void clearCustomSoundAmbient( bool restartSound ); //< Return to using defaults + void clearCustomSoundAmbient( bool restartSound ); //< Return to using defaults #ifdef _DEBUG void validatePos() const; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Eva.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Eva.h index 61186c257c..d93ea4fbb4 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Eva.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Eva.h @@ -40,48 +40,48 @@ class INI; // Keep in sync with TheEvaMessageNames AND Eva::s_shouldPlayFuncs enum EvaMessage { - EVA_Invalid = -1, - + EVA_Invalid = -1, + EVA_FIRST = 0, EVA_LowPower = EVA_FIRST, EVA_InsufficientFunds, EVA_SuperweaponDetected_Own_ParticleCannon, EVA_SuperweaponDetected_Own_Nuke, EVA_SuperweaponDetected_Own_ScudStorm, - EVA_SuperweaponDetected_Ally_ParticleCannon, - EVA_SuperweaponDetected_Ally_Nuke, - EVA_SuperweaponDetected_Ally_ScudStorm, - EVA_SuperweaponDetected_Enemy_ParticleCannon, - EVA_SuperweaponDetected_Enemy_Nuke, - EVA_SuperweaponDetected_Enemy_ScudStorm, + EVA_SuperweaponDetected_Ally_ParticleCannon, + EVA_SuperweaponDetected_Ally_Nuke, + EVA_SuperweaponDetected_Ally_ScudStorm, + EVA_SuperweaponDetected_Enemy_ParticleCannon, + EVA_SuperweaponDetected_Enemy_Nuke, + EVA_SuperweaponDetected_Enemy_ScudStorm, EVA_SuperweaponLaunched_Own_ParticleCannon, EVA_SuperweaponLaunched_Own_Nuke, EVA_SuperweaponLaunched_Own_ScudStorm, - EVA_SuperweaponLaunched_Ally_ParticleCannon, - EVA_SuperweaponLaunched_Ally_Nuke, - EVA_SuperweaponLaunched_Ally_ScudStorm, - EVA_SuperweaponLaunched_Enemy_ParticleCannon, - EVA_SuperweaponLaunched_Enemy_Nuke, - EVA_SuperweaponLaunched_Enemy_ScudStorm, - EVA_SuperweaponReady_Own_ParticleCannon, - EVA_SuperweaponReady_Own_Nuke, - EVA_SuperweaponReady_Own_ScudStorm, - EVA_SuperweaponReady_Ally_ParticleCannon, - EVA_SuperweaponReady_Ally_Nuke, - EVA_SuperweaponReady_Ally_ScudStorm, - EVA_SuperweaponReady_Enemy_ParticleCannon, - EVA_SuperweaponReady_Enemy_Nuke, - EVA_SuperweaponReady_Enemy_ScudStorm, + EVA_SuperweaponLaunched_Ally_ParticleCannon, + EVA_SuperweaponLaunched_Ally_Nuke, + EVA_SuperweaponLaunched_Ally_ScudStorm, + EVA_SuperweaponLaunched_Enemy_ParticleCannon, + EVA_SuperweaponLaunched_Enemy_Nuke, + EVA_SuperweaponLaunched_Enemy_ScudStorm, + EVA_SuperweaponReady_Own_ParticleCannon, + EVA_SuperweaponReady_Own_Nuke, + EVA_SuperweaponReady_Own_ScudStorm, + EVA_SuperweaponReady_Ally_ParticleCannon, + EVA_SuperweaponReady_Ally_Nuke, + EVA_SuperweaponReady_Ally_ScudStorm, + EVA_SuperweaponReady_Enemy_ParticleCannon, + EVA_SuperweaponReady_Enemy_Nuke, + EVA_SuperweaponReady_Enemy_ScudStorm, EVA_BuldingLost, EVA_BaseUnderAttack, EVA_AllyUnderAttack, EVA_BeaconDetected, - EVA_EnemyBlackLotusDetected, - EVA_EnemyJarmenKellDetected, - EVA_EnemyColonelBurtonDetected, - EVA_OwnBlackLotusDetected, - EVA_OwnJarmenKellDetected, - EVA_OwnColonelBurtonDetected, + EVA_EnemyBlackLotusDetected, + EVA_EnemyJarmenKellDetected, + EVA_EnemyColonelBurtonDetected, + EVA_OwnBlackLotusDetected, + EVA_OwnJarmenKellDetected, + EVA_OwnColonelBurtonDetected, EVA_UnitLost, EVA_GeneralLevelUp, EVA_VehicleStolen, @@ -91,11 +91,11 @@ enum EvaMessage EVA_BuildingBeingStolen, EVA_BuildingSabotaged, EVA_SuperweaponLaunched_Own_GPS_Scrambler, - EVA_SuperweaponLaunched_Ally_GPS_Scrambler, - EVA_SuperweaponLaunched_Enemy_GPS_Scrambler, + EVA_SuperweaponLaunched_Ally_GPS_Scrambler, + EVA_SuperweaponLaunched_Enemy_GPS_Scrambler, EVA_SuperweaponLaunched_Own_Sneak_Attack, - EVA_SuperweaponLaunched_Ally_Sneak_Attack, - EVA_SuperweaponLaunched_Enemy_Sneak_Attack, + EVA_SuperweaponLaunched_Ally_Sneak_Attack, + EVA_SuperweaponLaunched_Enemy_Sneak_Attack, EVA_COUNT, }; @@ -197,8 +197,8 @@ class Eva : public SubsystemInterface void setEvaEnabled(Bool enabled); - // Parse EvaMessage enum name in INI - static void parseEvaMessageFromIni( INI * ini, void *instance, void *store, const void* userData ); + // Parse EvaMessage enum name in INI + static void parseEvaMessageFromIni( INI * ini, void *instance, void *store, const void* userData ); protected: // Note: These are all protected. They should *NEVER* be made public. They are for internal use only Bool isTimeForCheck(EvaMessage messageToTest, UnsignedInt currentFrame) const; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h index 78edbf64dd..18ecdd2c17 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h @@ -153,7 +153,6 @@ class GameClient : public SubsystemInterface, void incrementRenderedObjectCount() { m_renderedObjectCount++; } virtual void notifyTerrainObjectMoved(Object *obj) = 0; - protected: // snapshot methods diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h index fb212c0aad..10e5f04054 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindow.h @@ -250,7 +250,7 @@ friend class GameWindowManager; Int winBringToTop( void ); ///< bring this window to the top of the win list Int winEnable( Bool enable ); /**< enable/disable a window, a disbled window can be seen but accepts no input */ - Bool winGetEnabled( void ); ///< Is window enabled? + Bool winGetEnabled( void ); ///< Is window enabled? Int winHide( Bool hide ); ///< hide/unhide a window Bool winIsHidden( void ); ///< is this window hidden/ UnsignedInt winSetStatus( UnsignedInt status ); ///< set status bits diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h index fa0f6a9d77..074a2e4400 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Image.h @@ -146,7 +146,7 @@ class ImageCollection : public SubsystemInterface } protected: - std::map m_imageMap; ///< maps named keys to images + std::map m_imageMap; ///< maps named keys to images }; // end ImageCollection // INLINING /////////////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h index c96fd88656..0256e2caef 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h @@ -125,7 +125,7 @@ static const char *TheRadiusCursorNames[] = "CARPETBOMB", "DAISYCUTTER", "PARADROP", - "SPYSATELLITE", + "SPYSATELLITE", "SPECTREGUNSHIP", "HELIX_NAPALM_BOMB", @@ -188,7 +188,7 @@ class SuperweaponInfo : public MemoryPoolObject Bool hiddenByScript, Bool hiddenByScience, Bool ready, - Bool evaReadyPlayed, + Bool evaReadyPlayed, const AsciiString& superweaponNormalFont, Int superweaponNormalPointSize, Bool superweaponNormalBold, @@ -210,7 +210,7 @@ class SuperweaponInfo : public MemoryPoolObject Bool m_hiddenByScript; Bool m_hiddenByScience; Bool m_ready; ///< Stores if we were ready last draw, since readyness can change without time changing - Bool m_evaReadyPlayed; ///< Stores if Eva announced superweapon is ready + Bool m_evaReadyPlayed; ///< Stores if Eva announced superweapon is ready // not saved, but public Bool m_forceUpdateText; @@ -582,8 +582,7 @@ friend class Drawable; // for selection/deselection transactions void registerWindowLayout(WindowLayout *layout); // register a layout for updates void unregisterWindowLayout(WindowLayout *layout); // stop updates for this layout - void triggerDoubleClickAttackMoveGuardHint( void ); - + void triggerDoubleClickAttackMoveGuardHint( void ); public: // World 2D animation methods @@ -730,9 +729,9 @@ friend class Drawable; // for selection/deselection transactions Int m_maxSelectCount; ///< Max number of objects to select UnsignedInt m_frameSelectionChanged; ///< Frame when the selection last changed. - Int m_duringDoubleClickAttackMoveGuardHintTimer; ///< Frames left to draw the doubleClickFeedbackTimer - Coord3D m_duringDoubleClickAttackMoveGuardHintStashedPosition; - + Int m_duringDoubleClickAttackMoveGuardHintTimer; ///< Frames left to draw the doubleClickFeedbackTimer + Coord3D m_duringDoubleClickAttackMoveGuardHintStashedPosition; + // Video playback data VideoBuffer* m_videoBuffer; ///< video playback buffer VideoStreamInterface* m_videoStream; ///< Video stream; diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h index d11ac28792..29b15e0e3a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/Mouse.h @@ -282,7 +282,6 @@ class Mouse : public SubsystemInterface Bool isClick(const ICoord2D *anchor, const ICoord2D *dest, UnsignedInt previousMouseClick, UnsignedInt currentMouseClick); - AsciiString m_tooltipFontName; ///< tooltip font Int m_tooltipFontSize; ///< tooltip font Bool m_tooltipFontIsBold; ///< tooltip font diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h index e96e4c665a..ae6dbff737 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h +++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h @@ -544,7 +544,7 @@ class ParticleSystem : public MemoryPoolObject, void rotateLocalTransformX( Real x ); ///< rotate local transform matrix void rotateLocalTransformY( Real y ); ///< rotate local transform matrix void rotateLocalTransformZ( Real z ); ///< rotate local transform matrix - void setSkipParentXfrm(Bool enable) { m_skipParentXfrm = enable; } ///getFrame() ;} ///< Returns true if the zones need to be recalculated. - void markZonesDirty( Bool insert ) ; ///< Called when the zones need to be recalculated. - void updateZonesForModify( PathfindCell **map, PathfindLayer layers[], const IRegion2D &structureBounds, const IRegion2D &globalBounds ) ; ///< Called to recalculate an area when a structure has been removed. + void markZonesDirty( Bool insert ) ; ///< Called when the zones need to be recalculated. + void updateZonesForModify( PathfindCell **map, PathfindLayer layers[], const IRegion2D &structureBounds, const IRegion2D &globalBounds ) ; ///< Called to recalculate an area when a structure has been removed. void calculateZones( PathfindCell **map, PathfindLayer layers[], const IRegion2D &bounds); ///< Does zone calculations. zoneStorageType getEffectiveZone(LocomotorSurfaceTypeMask acceptableSurfaces, Bool crusher, zoneStorageType zone) const; zoneStorageType getEffectiveTerrainZone(zoneStorageType zone) const; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/FiringTracker.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/FiringTracker.h index f994baee50..75577914eb 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/FiringTracker.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/FiringTracker.h @@ -86,7 +86,7 @@ class FiringTracker : public UpdateModule Int m_consecutiveShots; ///< How many times I have shot at the same thing ObjectID m_victimID; ///< The thing I have shot so many times UnsignedInt m_frameToStartCooldown; ///< This is the frame I should cool down at, and is pushed back every time a shot is fired - UnsignedInt m_frameToForceReload; ///< Even more than AutoReload, this means it will pre-emptively reload instead of event triggering a delay after the last shot + UnsignedInt m_frameToForceReload; ///< Even more than AutoReload, this means it will pre-emptively reload instead of event triggering a delay after the last shot UnsignedInt m_frameToStopLoopingSound; ///< if sound is looping, frame to stop looping it (or zero if not looping) AudioHandle m_audioHandle; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h index 95556225a8..873fe830b7 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h @@ -195,15 +195,14 @@ class AIUpdateModuleData : public UpdateModuleData LocomotorTemplateMap m_locomotorTemplates; ///< locomotors for object const TurretAIData* m_turretData[MAX_TURRETS]; UnsignedInt m_moodAttackCheckRate; ///< how frequently we should recheck for enemies due to moods, when idle - Bool m_forbidPlayerCommands; ///< Should isAllowedToRespondToAiCommands() filter out commands from the player, thus making it ai-controllable only? - Bool m_turretsLinked; ///< Turrets are linked together and attack together. + Bool m_forbidPlayerCommands; ///< Should isAllowedToRespondToAiCommands() filter out commands from the player, thus making it ai-controllable only? + Bool m_turretsLinked; ///< Turrets are linked together and attack together. UnsignedInt m_autoAcquireEnemiesWhenIdle; #ifdef ALLOW_SURRENDER UnsignedInt m_surrenderDuration; ///< when we surrender, how long we stay surrendered. #endif - - AIUpdateModuleData(); + AIUpdateModuleData(); virtual ~AIUpdateModuleData(); virtual Bool isAiModuleData() const { return true; } @@ -215,7 +214,6 @@ class AIUpdateModuleData : public UpdateModuleData private: static void parseTurret( INI* ini, void *instance, void *store, const void* /*userData*/ ); - }; //------------------------------------------------------------------------------------------------- @@ -587,9 +585,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface void friend_setLastCommandSource( CommandSourceType source ) {m_lastCommandSource = source;} Bool canAutoAcquire() const { return getAIUpdateModuleData()->m_autoAcquireEnemiesWhenIdle; } - - Bool canAutoAcquireWhileStealthed() const ; - + Bool canAutoAcquireWhileStealthed() const ; protected: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AssistedTargetingUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AssistedTargetingUpdate.h index bb29cee397..ac3c81cb4f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AssistedTargetingUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AssistedTargetingUpdate.h @@ -41,16 +41,15 @@ class AssistedTargetingUpdateModuleData : public UpdateModuleData public: Int m_clipSize; WeaponSlotType m_weaponSlot; - - AsciiString m_laserFromAssistedName; - AsciiString m_laserToTargetName; + AsciiString m_laserFromAssistedName; + AsciiString m_laserToTargetName; AssistedTargetingUpdateModuleData() { m_clipSize = 1; m_weaponSlot = PRIMARY_WEAPON; - m_laserFromAssistedName.clear(); - m_laserToTargetName.clear(); + m_laserFromAssistedName.clear(); + m_laserToTargetName.clear(); } static void buildFieldParse(MultiIniFieldParse& p); @@ -76,11 +75,8 @@ class AssistedTargetingUpdate : public UpdateModule private: void makeFeedbackLaser( const ThingTemplate *laserTemplate, const Object *from, const Object *to ); - const ThingTemplate *m_laserFromAssisted; const ThingTemplate *m_laserToTarget; - - }; #endif diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h index e285907a9b..e4167e514c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AutoDepositUpdate.h @@ -65,7 +65,7 @@ void parseUpgradePair( INI *ini, void *instance, void *store, const void *userDa struct upgradePair { std::string type; - Int amount; + Int amount; }; //----------------------------------------------------------------------------- @@ -74,7 +74,6 @@ struct upgradePair class AutoDepositUpdateModuleData : public UpdateModuleData { public: - UnsignedInt m_depositFrame; Int m_depositAmount; Int m_initialCaptureBonus; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ChinookAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ChinookAIUpdate.h index cdd11e8e57..88e8bbfc6b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ChinookAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ChinookAIUpdate.h @@ -46,8 +46,8 @@ class ChinookAIUpdateModuleData : public SupplyTruckAIUpdateModuleData { public: AsciiString m_ropeName; - AsciiString m_rotorWashParticleSystem; - Real m_rappelSpeed; + AsciiString m_rotorWashParticleSystem; + Real m_rappelSpeed; Real m_ropeDropSpeed; Real m_ropeWidth; Real m_ropeFinalHeight; @@ -124,10 +124,9 @@ class ChinookAIUpdate : public SupplyTruckAIUpdate virtual void privateAttackPosition( const Coord3D *pos, Int maxShotsToFire, CommandSourceType cmdSource );///< Extension. Also tell occupants to attackPosition virtual void privateForceAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource );///< Extension. Also tell occupants to forceAttackObject - virtual void privateIdle(CommandSourceType cmdSource); - - void private___TellPortableStructureToAttackWithMe( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ); + virtual void privateIdle(CommandSourceType cmdSource); + void private___TellPortableStructureToAttackWithMe( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ); private: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ContainModule.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ContainModule.h index 02f2b75bd9..9bdd7da706 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ContainModule.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ContainModule.h @@ -55,10 +55,10 @@ enum ObjectEnterExitType enum EvacDisposition { - EVAC_INVALID = 0, - EVAC_TO_LEFT, - EVAC_TO_RIGHT, - EVAC_BURST_FROM_CENTER, + EVAC_INVALID = 0, + EVAC_TO_LEFT, + EVAC_TO_RIGHT, + EVAC_BURST_FROM_CENTER, }; @@ -102,8 +102,8 @@ class ContainModuleInterface virtual Bool isTunnelContain() const = 0; virtual Bool isRiderChangeContain() const = 0; virtual Bool isImmuneToClearBuildingAttacks() const = 0; - virtual Bool isSpecialOverlordStyleContainer() const = 0; - virtual Bool isAnyRiderAttacking() const = 0; + virtual Bool isSpecialOverlordStyleContainer() const = 0; + virtual Bool isAnyRiderAttacking() const = 0; ///< if my object gets selected, then my visible passengers should, too ///< this gets called from @@ -129,7 +129,7 @@ class ContainModuleInterface virtual const Player* getApparentControllingPlayer(const Player* observingPlayer) const = 0; virtual void recalcApparentControllingPlayer() = 0; - + // // you will want to override onContaining() and onRemoving() if you need to // do special actions at those event times for your module @@ -147,7 +147,7 @@ class ContainModuleInterface virtual void orderAllPassengersToIdle( CommandSourceType ) = 0; ///< Just like it sounds virtual void orderAllPassengersToHackInternet( CommandSourceType ) = 0; ///< Just like it sounds virtual void markAllPassengersDetected() = 0; ///< Cool game stuff got added to the system calls since this layer didn't exist, so this regains that functionality - + // // interface for containing objects inside of objects. Objects that are // contained remove their drawable representations entirely from the client @@ -187,11 +187,11 @@ class ContainModuleInterface virtual PlayerMaskType getPlayerWhoEntered(void) const = 0; virtual void processDamageToContained(Real percentDamage) = 0; ///< Do our % damage to units now. - virtual Object* getClosestRider ( const Coord3D *pos ) = 0; + virtual Object* getClosestRider ( const Coord3D *pos ) = 0; virtual void enableLoadSounds( Bool enable ) = 0; - virtual void setEvacDisposition( EvacDisposition disp ) = 0; + virtual void setEvacDisposition( EvacDisposition disp ) = 0; virtual Bool isWeaponBonusPassedToPassengers() const = 0; virtual WeaponBonusConditionFlags getWeaponBonusPassedToPassengers() const = 0; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CrateCollide.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CrateCollide.h index 0155c93ebb..d2a7a39907 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CrateCollide.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CrateCollide.h @@ -98,8 +98,8 @@ enum SabotageVictimType virtual Bool isHijackedVehicleCrateCollide() const { return FALSE; } virtual Bool isSabotageBuildingCrateCollide() const { return FALSE; } - void doSabotageFeedbackFX( const Object *other, SabotageVictimType type = SAB_VICTIM_GENERIC ); - + void doSabotageFeedbackFX( const Object *other, SabotageVictimType type = SAB_VICTIM_GENERIC ); + protected: /// This is the game logic execution function that all real CrateCollides will implement diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeliverPayloadAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeliverPayloadAIUpdate.h index c545699965..87e64104c6 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeliverPayloadAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DeliverPayloadAIUpdate.h @@ -142,7 +142,7 @@ class HeadOffMapState : public State MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(HeadOffMapState, "HeadOffMapState") //I'm outta here public: - HeadOffMapState( StateMachine *machine ) :State( machine, "HeadOffMapState" ) { facingDirectionUponDelivery.zero(); } + HeadOffMapState( StateMachine *machine ) :State( machine, "HeadOffMapState" ) { facingDirectionUponDelivery.zero(); } virtual StateReturnType update(); virtual StateReturnType onEnter(); protected: @@ -150,8 +150,8 @@ class HeadOffMapState : public State virtual void crc( Xfer *xfer ){}; virtual void xfer( Xfer *xfer ){XferVersion cv = 1; XferVersion v = cv; xfer->xferVersion( &v, cv );} virtual void loadPostProcess(){}; - - Coord3D facingDirectionUponDelivery; + + Coord3D facingDirectionUponDelivery; }; EMPTY_DTOR(HeadOffMapState) diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DumbProjectileBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DumbProjectileBehavior.h index 693a699b2a..e7ebeaeedd 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DumbProjectileBehavior.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/DumbProjectileBehavior.h @@ -116,8 +116,8 @@ class DumbProjectileBehavior : public UpdateModule, public ProjectileUpdateInter Int m_flightPathSegments; ///< number of segments in the flightpath (in case we must regen it) Int m_currentFlightPathStep; ///< Our current index in the flight path vector. Quicker than popping off. WeaponBonusConditionFlags m_extraBonusFlags; - - Bool m_hasDetonated; ///< + + Bool m_hasDetonated; ///< Bool calcFlightPath(Bool recalcNumSegments); #if defined(_DEBUG) || defined(_INTERNAL) diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h index 4d8435c57b..28c8a40340 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/EMPUpdate.h @@ -52,13 +52,13 @@ class EMPUpdateModuleData : public UpdateModuleData RGBColor m_startColor; RGBColor m_endColor; const ParticleSystemTemplate *m_disableFXParticleSystem; - Real m_sparksPerCubicFoot; //m_isEnclosingContainer; } - virtual Bool isSpecialOverlordStyleContainer() const {return FALSE;} + virtual Bool isEnclosingContainerFor( const Object *obj ) const { return getGarrisonContainModuleData()->m_isEnclosingContainer; } + virtual Bool isSpecialOverlordStyleContainer() const {return FALSE;} virtual void removeAllContained( Bool exposeStealthUnits ); ///< remove all contents of this open container @@ -126,9 +124,8 @@ class GarrisonContain : public OpenContain virtual void exitObjectByBudding( Object *newObj, Object *budHost ) { return; }; virtual void onContaining( Object *obj, Bool wasSelected ); ///< object now contains 'obj' virtual void onRemoving( Object *obj ); ///< object no longer contains 'obj' - virtual void onSelling( void ); + virtual void onSelling( void ); - // A Garrison Contain must eject all passengers when it crosses the ReallyDamaged threshold. virtual void onBodyDamageStateChange( const DamageInfo* damageInfo, BodyDamageType oldState, @@ -142,9 +139,9 @@ class GarrisonContain : public OpenContain virtual void recalcApparentControllingPlayer( void ); virtual Bool isDisplayedOnControlBar() const {return TRUE;}///< Does this container display its contents on the ControlBar? - virtual void onDamage( DamageInfo *info ); + virtual void onDamage( DamageInfo *info ); - virtual void setEvacDisposition( EvacDisposition disp ) { m_evacDisposition = disp; }; + virtual void setEvacDisposition( EvacDisposition disp ) { m_evacDisposition = disp; }; protected: @@ -167,11 +164,11 @@ class GarrisonContain : public OpenContain void removeInvalidObjectsFromGarrisonPoints( void ); ///< remove objects with invalid targets from valid points void trackTargets( void ); ///< keep attackers at the closest garrison point to their active target - void matchObjectsToGarrisonPoints( void ); ///< Every frame, and whenever anyone enters or leaves - void positionObjectsAtStationGarrisonPoints( void ); ///< enforce that everybody stays at their pre-assigned space - void loadStationGarrisonPoints( void ); - Bool pickAStationForMe( const Object *pbj ); - void removeObjectFromStationPoint( const Object *obj ); + void matchObjectsToGarrisonPoints( void ); ///< Every frame, and whenever anyone enters or leaves + void positionObjectsAtStationGarrisonPoints( void ); ///< enforce that everybody stays at their pre-assigned space + void loadStationGarrisonPoints( void ); + Bool pickAStationForMe( const Object *pbj ); + void removeObjectFromStationPoint( const Object *obj ); enum { GARRISON_INDEX_INVALID = -1 }; Int findConditionIndex( void ); ///< find the condition index to use given the current object body state @@ -187,7 +184,6 @@ class GarrisonContain : public OpenContain enum { MAX_GARRISON_POINTS = 40 }; - // // The max units inside any garrisoned structure is 10. Since the units will "move around" // the inside of the structure to be close to their targets, we need a max of 10 garrison points @@ -212,11 +208,11 @@ class GarrisonContain : public OpenContain }; - struct StationPointData - { - ObjectID occupantID; - Coord3D position; - }; + struct StationPointData + { + ObjectID occupantID; + Coord3D position; + }; // ---------------------------------------------------------------------------------------------- enum @@ -234,14 +230,14 @@ class GarrisonContain : public OpenContain Coord3D m_garrisonPoint[ MAX_GARRISON_POINT_CONDITIONS ][ MAX_GARRISON_POINTS ]; ///< the garrison point positions (in world coords) for pristine, damaged, and really damaged Coord3D m_exitRallyPoint; ///< Point to rally at when exiting structure (if possible) - std::vector m_stationPointList; + std::vector m_stationPointList; Bool m_stationGarrisonPointsInitialized; ///< DO NOT XFER THIS!!! TRUE once we have loaded the pre-assigned garrison point positions from the art Bool m_garrisonPointsInitialized; ///< TRUE once we have loaded the garrison point positions from the art Bool m_hideGarrisonedStateFromNonallies; ///< if T, don't appear to be garrisoned (all stealthy) Bool m_rallyValid; ///< TRUE when m_exitRallyPoint is valid - EvacDisposition m_evacDisposition; + EvacDisposition m_evacDisposition; }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MissileAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MissileAIUpdate.h index 8b753cfc55..79b9243ef8 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MissileAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/MissileAIUpdate.h @@ -63,7 +63,8 @@ class MissileAIUpdateModuleData : public AIUpdateModuleData Real m_lockDistance; ///< If I get this close to my target, guaranteed hit. Bool m_detonateCallsKill; ///< if true, kill() will be called, instead of KILL_SELF state, which calls destroy. - Int m_killSelfDelay; ///< If I have detonated and entered the KILL-SELF state, how ling do I wait before I Kill/destroy self? + Int m_killSelfDelay; ///< If I have detonated and entered the KILL-SELF state, how ling do I wait before I Kill/destroy self? + MissileAIUpdateModuleData(); static void buildFieldParse(MultiIniFieldParse& p); @@ -105,7 +106,6 @@ class MissileAIUpdate : public AIUpdateInterface, public ProjectileUpdateInterfa virtual UpdateSleepTime update(); virtual void onDelete( void ); - protected: void detonate(); @@ -131,7 +131,7 @@ class MissileAIUpdate : public AIUpdateInterface, public ProjectileUpdateInterfa Bool m_isArmed; ///< if true, missile will explode on contact Bool m_noDamage; ///< if true, missile will not cause damage when it detonates. (Used for flares). Bool m_isJammed; ///< No target, just shooting at a scattered position - + void doPrelaunchState(); void doLaunchState(); void doIgnitionState(); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h index 3e3ba8dbd1..63f2d47021 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OpenContain.h @@ -127,7 +127,7 @@ class OpenContain : public UpdateModule, virtual void onBodyDamageStateChange( const DamageInfo* damageInfo, BodyDamageType oldState, BodyDamageType newState){}; ///< state change callback - + // our object changed position... react as appropriate. virtual void containReactToTransformChange(); @@ -139,14 +139,14 @@ class OpenContain : public UpdateModule, ///< if my object gets selected, then my visible passengers should, too ///< this gets called from virtual void clientVisibleContainedFlashAsSelected() {}; - + virtual const Player* getApparentControllingPlayer(const Player* observingPlayer) const { return NULL; } virtual void recalcApparentControllingPlayer() { } virtual void onContaining( Object *obj, Bool wasSelected ); ///< object now contains 'obj' virtual void onRemoving( Object *obj ); ///< object no longer contains 'obj' virtual void onSelling();///< Container is being sold. Open responds by kicking people out - + virtual void orderAllPassengersToExit( CommandSourceType commandSource, Bool instantly ); ///< All of the smarts of exiting are in the passenger's AIExit. removeAllFrommContain is a last ditch system call, this is the game Evacuate virtual void orderAllPassengersToIdle( CommandSourceType commandSource ); ///< Just like it sounds virtual void orderAllPassengersToHackInternet( CommandSourceType ); ///< Just like it sounds @@ -163,9 +163,9 @@ class OpenContain : public UpdateModule, virtual Bool isEnclosingContainerFor( const Object *obj ) const; ///< Does this type of Contain Visibly enclose its contents? virtual Bool isPassengerAllowedToFire( ObjectID id = INVALID_ID ) const; ///< Hey, can I shoot out of this container? - virtual void setPassengerAllowedToFire( Bool permission = TRUE ) { m_passengerAllowedToFire = permission; } ///< Hey, can I shoot out of this container? + virtual void setPassengerAllowedToFire( Bool permission = TRUE ) { m_passengerAllowedToFire = permission; } ///< Hey, can I shoot out of this container? - virtual void setOverrideDestination( const Coord3D * ){} ///< Instead of falling peacefully towards a clear spot, I will now aim here + virtual void setOverrideDestination( const Coord3D * ){} ///< Instead of falling peacefully towards a clear spot, I will now aim here virtual Bool isDisplayedOnControlBar() const {return FALSE;}///< Does this container display its contents on the ControlBar? virtual Int getExtraSlotsInUse( void ) { return 0; } virtual Bool isKickOutOnCapture(){ return TRUE; }///< By default, yes, all contain modules kick passengers out on capture @@ -206,8 +206,8 @@ class OpenContain : public UpdateModule, virtual Bool isRiderChangeContain() const { return FALSE; } virtual Bool isSpecialZeroSlotContainer() const { return false; } virtual Bool isImmuneToClearBuildingAttacks() const { return true; } - virtual Bool isSpecialOverlordStyleContainer() const { return false; } - virtual Bool isAnyRiderAttacking( void ) const; + virtual Bool isSpecialOverlordStyleContainer() const { return false; } + virtual Bool isAnyRiderAttacking( void ) const; /** this is used for containers that must do something to allow people to enter or exit... @@ -227,10 +227,10 @@ class OpenContain : public UpdateModule, virtual void enableLoadSounds( Bool enable ) { m_loadSoundsEnabled = enable; } - Real getDamagePercentageToUnits( void ); - virtual Object* getClosestRider ( const Coord3D *pos ); + Real getDamagePercentageToUnits( void ); + virtual Object* getClosestRider ( const Coord3D *pos ); - virtual void setEvacDisposition( EvacDisposition disp ) {}; + virtual void setEvacDisposition( EvacDisposition disp ) {}; protected: virtual void monitorConditionChanges( void ); ///< check to see if we need to update our occupant postions from a model change or anything else @@ -282,7 +282,7 @@ class OpenContain : public UpdateModule, Coord3D m_rallyPoint; ///< Where units should move to after they have reached the "natural" rally point Bool m_rallyPointExists; ///< Only move to the rally point if this is true Bool m_loadSoundsEnabled; ///< Don't serialize -- used for disabling sounds during payload creation. - Bool m_passengerAllowedToFire; ///< Newly promoted from the template data to the module for upgrade overriding access + Bool m_passengerAllowedToFire; ///< Newly promoted from the template data to the module for upgrade overriding access }; #endif // end __OPENCONTAIN_H_ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h index 4e52e26422..a521e3b91d 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/OverlordContain.h @@ -122,7 +122,7 @@ class OverlordContain : public TransportContain ContainModuleInterface *getRedirectedContain() const; ///< And this gets what are redirecting to. void activateRedirectedContain();///< I need to shut this off since I can talk directly to my bunker, but he can never directly see me void deactivateRedirectedContain(); - void parseInitialPayload( INI* ini, void *instance, void *store, const void* /*userData*/ ); + void parseInitialPayload( INI* ini, void *instance, void *store, const void* /*userData*/ ); Bool m_redirectionActivated; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h index f32d771028..c39fd4b92b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PhysicsUpdate.h @@ -66,7 +66,7 @@ class PhysicsBehaviorModuleData : public UpdateModuleData Real m_minFallSpeedForDamage; Real m_fallHeightDamageFactor; Real m_pitchRollYawFactor; - + const WeaponTemplate* m_vehicleCrashesIntoBuildingWeaponTemplate; const WeaponTemplate* m_vehicleCrashesIntoNonBuildingWeaponTemplate; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProjectileStreamUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProjectileStreamUpdate.h index 599541298d..39d77de041 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProjectileStreamUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/ProjectileStreamUpdate.h @@ -73,7 +73,7 @@ class ProjectileStreamUpdate : public UpdateModule Int m_nextFreeIndex; Int m_firstValidIndex; ObjectID m_owningObject; - + ObjectID m_targetObject;///< Need to insert a hole if target changes, so track target ID and target position Coord3D m_targetPosition; }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h index 21df65f4ec..6397ea7ae4 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/RailroadGuideAIUpdate.h @@ -226,7 +226,6 @@ class RailroadBehavior : public PhysicsBehavior virtual Bool isRailroad() const ; virtual UpdateSleepTime update( void ); - // TRAINY METHODS void getPulled( PullInfo *info ); void destroyTheWholeTrainNow( void ); @@ -235,9 +234,9 @@ class RailroadBehavior : public PhysicsBehavior void disembark( void ); Bool hasEverBeenHitched( void ) { return m_hasEverBeenHitched; }; - void setHeld( Bool held ) {m_held = held;}; + void setHeld( Bool held ) {m_held = held;}; - void makeAWallOutOfThisTrain( Bool on ); + void makeAWallOutOfThisTrain( Bool on ); protected: @@ -294,7 +293,7 @@ class RailroadBehavior : public PhysicsBehavior // i.e. do I provide the movement and scheduling AI for m_trailerID // And therefore for his and his and his.......... - Bool m_held; ///< This will prevent a loco from departing a station + Bool m_held; ///< This will prevent a loco from departing a station ConductorState m_conductorState; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h index ebc3da4072..8cdb592f8a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SpecialAbilityUpdate.h @@ -77,8 +77,8 @@ class SpecialAbilityUpdateModuleData : public UpdateModuleData Bool m_doCaptureFX; ///< the house color flashing while a building is getting captured Bool m_loseStealthOnTrigger; Bool m_approachRequiresLOS; - Bool m_needToFaceTarget; - Bool m_persistenceRequiresRecharge; + Bool m_needToFaceTarget; + Bool m_persistenceRequiresRecharge; const ParticleSystemTemplate *m_disableFXParticleSystem; AudioEventRTS m_packSound; @@ -114,8 +114,8 @@ class SpecialAbilityUpdateModuleData : public UpdateModuleData m_skillPointsForTriggering = -1; m_approachRequiresLOS = TRUE; m_preTriggerUnstealthFrames = 0; - m_needToFaceTarget = TRUE; - m_persistenceRequiresRecharge = FALSE; + m_needToFaceTarget = TRUE; + m_persistenceRequiresRecharge = FALSE; } static void buildFieldParse(MultiIniFieldParse& p) @@ -160,8 +160,8 @@ class SpecialAbilityUpdateModuleData : public UpdateModuleData { "SkillPointsForTriggering", INI::parseInt, NULL, offsetof( SpecialAbilityUpdateModuleData, m_skillPointsForTriggering ) }, { "ApproachRequiresLOS", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_approachRequiresLOS ) }, { "ApproachRequiresLOS", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_approachRequiresLOS ) }, - { "NeedToFaceTarget", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_needToFaceTarget ) }, - { "PersistenceRequiresRecharge",INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_persistenceRequiresRecharge ) }, + { "NeedToFaceTarget", INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_needToFaceTarget ) }, + { "PersistenceRequiresRecharge",INI::parseBool, NULL, offsetof( SpecialAbilityUpdateModuleData, m_persistenceRequiresRecharge ) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -244,9 +244,9 @@ class SpecialAbilityUpdate : public SpecialPowerUpdateModule Bool needToFace() const; void startFacing(); - // Lorenzen added this additional flag to support the NapalmBombDrop - // It causes this update to force a recharge of the SPM between drops - Bool getDoesPersistenceRequireRecharge() const { return getSpecialAbilityUpdateModuleData()->m_persistenceRequiresRecharge; } + // Lorenzen added this additional flag to support the NapalmBombDrop + // It causes this update to force a recharge of the SPM between drops + Bool getDoesPersistenceRequireRecharge() const { return getSpecialAbilityUpdateModuleData()->m_persistenceRequiresRecharge; } // void setBusy ( Bool is ) { m_isBusy = is; } // Bool m_isBusy; ///< whether I am between trigger and completion diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h index 20194d5a29..dc4dad069e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/StealthUpdate.h @@ -52,7 +52,7 @@ enum STEALTH_ONLY_WITH_BLACK_MARKET = 0x00000040, STEALTH_NOT_WHILE_TAKING_DAMAGE = 0x00000080, STEALTH_NOT_WHILE_FIRING_WEAPON = (STEALTH_NOT_WHILE_FIRING_PRIMARY | STEALTH_NOT_WHILE_FIRING_SECONDARY | STEALTH_NOT_WHILE_FIRING_TERTIARY), - STEALTH_NOT_WHILE_RIDERS_ATTACKING = 0x00000100, + STEALTH_NOT_WHILE_RIDERS_ATTACKING = 0x00000100, }; #ifdef DEFINE_STEALTHLEVEL_NAMES @@ -66,7 +66,7 @@ static const char *TheStealthLevelNames[] = "FIRING_TERTIARY", "NO_BLACK_MARKET", "TAKING_DAMAGE", - "RIDERS_ATTACKING", + "RIDERS_ATTACKING", NULL }; #endif @@ -77,11 +77,11 @@ static const char *TheStealthLevelNames[] = class StealthUpdateModuleData : public UpdateModuleData { public: - ObjectStatusMaskType m_hintDetectableStates; - ObjectStatusMaskType m_requiredStatus; - ObjectStatusMaskType m_forbiddenStatus; - FXList *m_disguiseRevealFX; - FXList *m_disguiseFX; + ObjectStatusMaskType m_hintDetectableStates; + ObjectStatusMaskType m_requiredStatus; + ObjectStatusMaskType m_forbiddenStatus; + FXList *m_disguiseRevealFX; + FXList *m_disguiseFX; Real m_stealthSpeed; Real m_friendlyOpacityMin; Real m_friendlyOpacityMax; @@ -92,13 +92,13 @@ class StealthUpdateModuleData : public UpdateModuleData UnsignedInt m_stealthDelay; UnsignedInt m_stealthLevel; UnsignedInt m_blackMarketCheckFrames; - EvaMessage m_enemyDetectionEvaEvent; - EvaMessage m_ownDetectionEvaEvent; - Bool m_innateStealth; + EvaMessage m_enemyDetectionEvaEvent; + EvaMessage m_ownDetectionEvaEvent; + Bool m_innateStealth; Bool m_orderIdleEnemiesToAttackMeUponReveal; Bool m_teamDisguised; Bool m_useRiderStealth; - Bool m_grantedBySpecialPower; + Bool m_grantedBySpecialPower; StealthUpdateModuleData(); static void buildFieldParse(MultiIniFieldParse& p); @@ -117,9 +117,7 @@ class StealthUpdate : public UpdateModule StealthUpdate( Thing *thing, const ModuleData* moduleData ); // virtual destructor prototype provided by memory pool declaration - - virtual StealthUpdate* getStealth() { return this; } - + virtual StealthUpdate* getStealth() { return this; } virtual UpdateSleepTime update(); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyCenterDockUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyCenterDockUpdate.h index 4f39179b13..7e6df1763c 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyCenterDockUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyCenterDockUpdate.h @@ -42,7 +42,7 @@ class SupplyCenterDockUpdateModuleData : public DockUpdateModuleData { public: - SupplyCenterDockUpdateModuleData( void ); + SupplyCenterDockUpdateModuleData( void ); static void buildFieldParse(MultiIniFieldParse& p); UnsignedInt m_grantTemporaryStealthFrames; diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyTruckAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyTruckAIUpdate.h index 7e088a049f..7f93d6960b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyTruckAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SupplyTruckAIUpdate.h @@ -218,7 +218,7 @@ class SupplyTruckAIUpdate : public AIUpdateInterface, public SupplyTruckAIInterf virtual ObjectID getPreferredDockID() const { return m_preferredDock; } virtual UnsignedInt getActionDelayForDock( Object *dock ); virtual Int getUpgradedSupplyBoost() const { return 0; } - + virtual UpdateSleepTime update(); protected: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/TransportContain.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/TransportContain.h index 0c6f045188..ad62287849 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/TransportContain.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/TransportContain.h @@ -87,8 +87,8 @@ class TransportContain : public OpenContain virtual UpdateSleepTime update(); ///< called once per frame virtual Bool isRiderChangeContain() const { return FALSE; } - virtual Bool isSpecialOverlordStyleContainer() const {return FALSE;} - + virtual Bool isSpecialOverlordStyleContainer() const {return FALSE;} + virtual Int getContainMax( void ) const; virtual Int getExtraSlotsInUse( void ) { return m_extraSlotsInUse; }///< Transports have the ability to carry guys how take up more than spot. diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h index cd316da377..4b68e36a0e 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/WorkerAIUpdate.h @@ -105,7 +105,7 @@ class WorkerAIUpdateModuleData : public AIUpdateModuleData { "SupplyWarehouseActionDelay", INI::parseDurationUnsignedInt, NULL, offsetof( WorkerAIUpdateModuleData, m_warehouseDelay ) }, { "SupplyWarehouseScanDistance", INI::parseReal, NULL, offsetof( WorkerAIUpdateModuleData, m_warehouseScanDistance ) }, { "SuppliesDepletedVoice", INI::parseAudioEventRTS, NULL, offsetof( WorkerAIUpdateModuleData, m_suppliesDepletedVoice) }, - { "UpgradedSupplyBoost", INI::parseInt, NULL, offsetof( WorkerAIUpdateModuleData, m_upgradedSupplyBoost) }, + { "UpgradedSupplyBoost", INI::parseInt, NULL, offsetof( WorkerAIUpdateModuleData, m_upgradedSupplyBoost) }, { 0, 0, 0, 0 } }; p.add(dataFieldParse); diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h index 896e845ce5..835789ec7f 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Object.h @@ -497,9 +497,9 @@ class Object : public Thing, public Snapshot Weapon* findWaypointFollowingCapableWeapon(); Bool getAmmoPipShowingInfo(Int& numTotal, Int& numFull) const; - void notifyFiringTrackerShotFired( const Weapon* weaponFired, ObjectID victimID ) ; + void notifyFiringTrackerShotFired( const Weapon* weaponFired, ObjectID victimID ) ; - /** + /** Determines if the unit has any weapon that could conceivably harm the victim. this does not take range, ammo, etc. into account, but immutable weapon properties, such as "can you diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h index 0af9cec891..db4a72fd70 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScriptActions.h @@ -150,7 +150,7 @@ class ScriptActions : public ScriptActionsInterface void doTeamEnterNamed(const AsciiString& teamName, const AsciiString& unitDestName); void doNamedExitAll(const AsciiString& unitName); void doTeamExitAll(const AsciiString& teamName); - void doNamedSetGarrisonEvacDisposition(const AsciiString& unitName, UnsignedInt disp ); + void doNamedSetGarrisonEvacDisposition(const AsciiString& unitName, UnsignedInt disp ); void doNamedFollowWaypoints(const AsciiString& unitName, const AsciiString& waypointName); void doTeamFollowWaypoints(const AsciiString& teamName, const AsciiString& waypointName, Bool asTeam); void doTeamFollowWaypointsExact(const AsciiString& teamName, const AsciiString& waypointName, Bool asTeam); @@ -388,7 +388,7 @@ class ScriptActions : public ScriptActionsInterface void doResizeViewGuardband(const Real gbx, const Real gby ); void deleteAllUnmanned(); void doNamedSetTrainHeld( const AsciiString &locoName, const Bool set ); - void doEnableObjectSound(const AsciiString& objectName, Bool enable); + void doEnableObjectSound(const AsciiString& objectName, Bool enable); }; // end class ScriptActions diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/TerrainLogic.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/TerrainLogic.h index 98150831ab..faa8bc4161 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/TerrainLogic.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/TerrainLogic.h @@ -314,8 +314,8 @@ class TerrainLogic : public Snapshot, Int getActiveBoundary(void) { return m_activeBoundary; } void setActiveBoundary(Int newActiveBoundary); - void flattenTerrain(Object *obj); ///< Flatten the terrain under a building. - void createCraterInTerrain(Object *obj); ///< Flatten the terrain under a building. + void flattenTerrain(Object *obj); ///< Flatten the terrain under a building. + void createCraterInTerrain(Object *obj); ///< Flatten the terrain under a building. protected: diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h index 20b2d829c1..710a31f9af 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Weapon.h @@ -439,7 +439,7 @@ class WeaponTemplate : public MemoryPoolObject inline Int getContinuousFireOneShotsNeeded() const { return m_continuousFireOneShotsNeeded; } inline Int getContinuousFireTwoShotsNeeded() const { return m_continuousFireTwoShotsNeeded; } inline UnsignedInt getContinuousFireCoastFrames() const { return m_continuousFireCoastFrames; } - inline UnsignedInt getAutoReloadWhenIdleFrames() const { return m_autoReloadWhenIdleFrames; } + inline UnsignedInt getAutoReloadWhenIdleFrames() const { return m_autoReloadWhenIdleFrames; } inline UnsignedInt getSuspendFXDelay() const { return m_suspendFXDelay; } inline const FXList* getFireFX(VeterancyLevel v) const { return m_fireFXs[v]; } @@ -533,7 +533,7 @@ class WeaponTemplate : public MemoryPoolObject Int m_continuousFireOneShotsNeeded; ///< How many consecutive shots will give my owner the ContinuousFire Property Int m_continuousFireTwoShotsNeeded; ///< How many consecutive shots will give my owner the ContinuousFireTwo Property UnsignedInt m_continuousFireCoastFrames;///< How long after we should have shot should we start to wind down from Continuous fire mode - UnsignedInt m_autoReloadWhenIdleFrames; ///< How long we have to wait after our last shot to force a reload + UnsignedInt m_autoReloadWhenIdleFrames; ///< How long we have to wait after our last shot to force a reload Int m_shotsPerBarrel; ///< If non zero, don't cycle through your launch points every shot, mod the shot by this to get even chucks of firing Int m_antiMask; ///< what we can target Int m_affectsMask; ///< what we can affect @@ -617,7 +617,7 @@ class Weapon : public MemoryPoolObject, { return estimateWeaponDamage(source, NULL, pos); } - + void onWeaponBonusChange(const Object *source);///< Our Object's weapon bonus changed, so we need to update to reflect that instead of waiting /** return true if the target is within attack range, false otherwise. @@ -698,7 +698,7 @@ class Weapon : public MemoryPoolObject, inline Int getContinuousFireOneShotsNeeded() const { return m_template->getContinuousFireOneShotsNeeded(); } inline Int getContinuousFireTwoShotsNeeded() const { return m_template->getContinuousFireTwoShotsNeeded(); } inline UnsignedInt getContinuousFireCoastFrames() const { return m_template->getContinuousFireCoastFrames(); } - inline UnsignedInt getAutoReloadWhenIdleFrames() const { return m_template->getAutoReloadWhenIdleFrames(); } + inline UnsignedInt getAutoReloadWhenIdleFrames() const { return m_template->getAutoReloadWhenIdleFrames(); } inline const AudioEventRTS& getFireSound() const { return m_template->getFireSound(); } inline UnsignedInt getFireSoundLoopTime() const { return m_template->getFireSoundLoopTime(); } inline DamageType getDamageType() const { return m_template->getDamageType(); } diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameInfo.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameInfo.h index 7568a31217..b3d7af89ae 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameInfo.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameInfo.h @@ -197,10 +197,10 @@ class GameInfo inline Int getUseStats( void ) const; ///< Does this game count towards gamespy stats? inline void setUseStats( Int useStats ); - inline UnsignedShort getSuperweaponRestriction( void ) const; ///< Get any optional limits on superweapons - void setSuperweaponRestriction( UnsignedShort restriction ); ///< Set the optional limits on superweapons - inline const Money & getStartingCash(void) const; - void setStartingCash( const Money & startingCash ); + inline UnsignedShort getSuperweaponRestriction( void ) const; ///< Get any optional limits on superweapons + void setSuperweaponRestriction( UnsignedShort restriction ); ///< Set the optional limits on superweapons + inline const Money & getStartingCash(void) const; + void setStartingCash( const Money & startingCash ); void setSlotPointer( Int index, GameSlot *slot ); ///< Set the slot info pointer @@ -230,8 +230,8 @@ class GameInfo Bool isPlayerPreorder(Int index); void markPlayerAsPreorder(Int index); - inline Bool oldFactionsOnly(void) const; - inline void setOldFactionsOnly( Bool oldFactionsOnly ); + inline Bool oldFactionsOnly(void) const; + inline void setOldFactionsOnly( Bool oldFactionsOnly ); protected: Int m_preorderMask; @@ -251,9 +251,9 @@ class GameInfo Int m_mapMask; Int m_seed; Int m_useStats; - Money m_startingCash; - UnsignedShort m_superweaponRestriction; - Bool m_oldFactionsOnly; // Only USA, China, GLA -- not USA Air Force General, GLA Toxic General, et al + Money m_startingCash; + UnsignedShort m_superweaponRestriction; + Bool m_oldFactionsOnly; // Only USA, China, GLA -- not USA Air Force General, GLA Toxic General, et al }; extern GameInfo *TheGameInfo; diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/GSConfig.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/GSConfig.h index fb03080e9e..723911c02b 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/GSConfig.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/GSConfig.h @@ -65,6 +65,7 @@ class GameSpyConfigInterface // Custom match virtual Bool restrictGamesToLobby() = 0; + static GameSpyConfigInterface* create(AsciiString config); }; diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h index ee45b41f44..5ed7f04b68 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/PeerThread.h @@ -119,7 +119,7 @@ class PeerRequest UnsignedInt iniCRC; UnsignedInt gameVersion; Bool allowObservers; - Bool useStats; + Bool useStats; UnsignedShort ladPort; UnsignedInt ladPassCRC; Bool restrictGameList; @@ -333,7 +333,7 @@ class PeerResponse Bool isStaging; Bool requiresPassword; Bool allowObservers; - Bool useStats; + Bool useStats; UnsignedInt version; UnsignedInt exeCRC; UnsignedInt iniCRC; diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/StagingRoomGameInfo.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/StagingRoomGameInfo.h index e7cd2bd4e4..906e7e413a 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/StagingRoomGameInfo.h +++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameSpy/StagingRoomGameInfo.h @@ -153,7 +153,7 @@ class GameSpyStagingRoom : public GameInfo inline void setGameName( UnicodeString name ) { m_gameName = name; } inline UnicodeString getGameName( void ) const { return m_gameName; } - inline void setLocalName( AsciiString name ) { m_localName = name; } + inline void setLocalName( AsciiString name ) { m_localName = name; } }; extern GameSpyStagingRoom *TheGameSpyGame; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp index b1858359ef..16f72bed48 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp @@ -781,8 +781,8 @@ void AudioManager::set3DVolumeAdjustment( Real volumeAdjustment ) if (m_sound3DVolume > 1.0f) m_sound3DVolume = 1.0f; - if ( ! has3DSensitiveStreamsPlaying() ) - m_volumeHasChanged = TRUE; + if ( ! has3DSensitiveStreamsPlaying() ) + m_volumeHasChanged = TRUE; } //------------------------------------------------------------------------------------------------- @@ -856,17 +856,17 @@ AudioEventInfo *AudioManager::newAudioEventInfo( AsciiString audioName ) // Add an AudioEventInfo structure allocated elsewhere to the audio event list void AudioManager::addAudioEventInfo( AudioEventInfo * newEvent ) { - // Warning: Don't try to copy the structure. It may be a derived class - AudioEventInfo *eventInfo = findAudioEventInfo( newEvent->m_audioName ); - if (eventInfo) - { - DEBUG_CRASH(("Requested add of '%s' multiple times. Is this intentional? - jkmcd\n", newEvent->m_audioName.str())); - *eventInfo = *newEvent; - } - else - { - m_allAudioEventInfo[newEvent->m_audioName] = newEvent; - } + // Warning: Don't try to copy the structure. It may be a derived class + AudioEventInfo *eventInfo = findAudioEventInfo( newEvent->m_audioName ); + if (eventInfo) + { + DEBUG_CRASH(("Requested add of '%s' multiple times. Is this intentional? - jkmcd\n", newEvent->m_audioName.str())); + *eventInfo = *newEvent; + } + else + { + m_allAudioEventInfo[newEvent->m_audioName] = newEvent; + } } //------------------------------------------------------------------------------------------------- @@ -885,22 +885,21 @@ AudioEventInfo *AudioManager::findAudioEventInfo( AsciiString eventName ) const // Remove all AudioEventInfo's with the m_isLevelSpecific flag void AudioManager::removeLevelSpecificAudioEventInfos(void) { - AudioEventInfoHash::iterator it = m_allAudioEventInfo.begin(); - - while ( it != m_allAudioEventInfo.end() ) - { - AudioEventInfoHash::iterator next = it; // Make sure erase doesn't cause problems - next++; - - if ( it->second->isLevelSpecific() ) - { - it->second->deleteInstance(); - m_allAudioEventInfo.erase( it ); - } - - it = next; - } - + AudioEventInfoHash::iterator it = m_allAudioEventInfo.begin(); + + while ( it != m_allAudioEventInfo.end() ) + { + AudioEventInfoHash::iterator next = it; // Make sure erase doesn't cause problems + next++; + + if ( it->second->isLevelSpecific() ) + { + it->second->deleteInstance(); + m_allAudioEventInfo.erase( it ); + } + + it = next; + } } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/Common/BitFlags.cpp b/GeneralsMD/Code/GameEngine/Source/Common/BitFlags.cpp index fad98759a8..be4132bf3c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/BitFlags.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/BitFlags.cpp @@ -39,7 +39,7 @@ const char* ModelConditionFlags::s_bitNameList[] = { - "TOPPLED", + "TOPPLED", "FRONTCRUSHED", "BACKCRUSHED", "DAMAGED", diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp index 33e862239e..76dc1ca59d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp @@ -1233,10 +1233,10 @@ static CommandLineParam params[] = { "-munkee", parseMunkee }, { "-displayDebug", parseDisplayDebug }, { "-file", parseFile }, - + // { "-preload", parsePreload }, - { "-preloadEverything", parsePreloadEverything }, + { "-preloadEverything", parsePreloadEverything }, { "-logAssets", parseLogAssets }, { "-netMinPlayers", parseNetMinPlayers }, { "-DemoLoadScreen", parseDemoLoadScreen }, diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp index f31ea220cd..1d8c60162b 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp @@ -670,7 +670,7 @@ void GameEngine::init( int argc, char *argv[] ) TheWritableGlobalData->m_afterIntro = TRUE; //initDisabledMasks(); - + } catch (ErrorCode ec) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index b641acf4e7..9811f34370 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -457,8 +457,8 @@ GlobalData* GlobalData::m_theOriginal = NULL; { "SpecialPowerViewObject", INI::parseAsciiString, NULL, offsetof( GlobalData, m_specialPowerViewObjectName ) }, { "StandardPublicBone", INI::parseAsciiStringVectorAppend, NULL, offsetof(GlobalData, m_standardPublicBones) }, - { "ShowMetrics", INI::parseBool, NULL, offsetof( GlobalData, m_showMetrics ) }, - { "DefaultStartingCash", Money::parseMoneyAmount, NULL, offsetof( GlobalData, m_defaultStartingCash ) }, + { "ShowMetrics", INI::parseBool, NULL, offsetof( GlobalData, m_showMetrics ) }, + { "DefaultStartingCash", Money::parseMoneyAmount, NULL, offsetof( GlobalData, m_defaultStartingCash ) }, // NOTE: m_doubleClickTimeMS is still in use, but we disallow setting it from the GameData.ini file. It is now set in the constructor according to the windows parameter. // { "DoubleClickTimeMS", INI::parseUnsignedInt, NULL, offsetof( GlobalData, m_doubleClickTimeMS ) }, @@ -500,7 +500,7 @@ GlobalData* GlobalData::m_theOriginal = NULL; { "ShroudOn", INI::parseBool, NULL, offsetof( GlobalData, m_shroudOn ) }, { "FogOfWarOn", INI::parseBool, NULL, offsetof( GlobalData, m_fogOfWarOn ) }, { "ShowCollisionExtents", INI::parseBool, NULL, offsetof( GlobalData, m_showCollisionExtents ) }, - { "ShowAudioLocations", INI::parseBool, NULL, offsetof( GlobalData, m_showAudioLocations ) }, + { "ShowAudioLocations", INI::parseBool, NULL, offsetof( GlobalData, m_showAudioLocations ) }, { "DebugProjectileTileWidth", INI::parseReal, NULL, offsetof( GlobalData, m_debugProjectileTileWidth) }, { "DebugProjectileTileDuration",INI::parseInt, NULL, offsetof( GlobalData, m_debugProjectileTileDuration) }, { "DebugProjectileTileColor", INI::parseRGBColor, NULL, offsetof( GlobalData, m_debugProjectileTileColor) }, @@ -892,8 +892,8 @@ GlobalData::GlobalData() m_hotKeyTextColor = GameMakeColor(255,255,0,255); - // THis is put ON ice until later - // m_cheaterHasBeenSpiedIfMyLowestBitIsTrue = GameMakeColor(255,128,0,0);// orange, to the hacker's eye + // THis is put ON ice until later + // m_cheaterHasBeenSpiedIfMyLowestBitIsTrue = GameMakeColor(255,128,0,0);// orange, to the hacker's eye m_shroudColor.setFromInt( 0x00FFFFFF ) ; m_clearAlpha = 255; @@ -1043,41 +1043,41 @@ GlobalData::GlobalData() #ifdef DUMP_PERF_STATS m_dumpPerformanceStatistics = FALSE; - m_dumpStatsAtInterval = FALSE; - m_statsInterval = 30; + m_dumpStatsAtInterval = FALSE; + m_statsInterval = 30; #endif m_forceBenchmark = FALSE; ///deleteInstance(); - if( m_theOriginal == this ) { + if( m_theOriginal == this ) + { m_theOriginal = NULL; TheWritableGlobalData = NULL; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp index 94a4128d96..a4e88b08d7 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp @@ -115,7 +115,7 @@ static const BlockParse theTypeTable[] = { "Mouse", INI::parseMouseDefinition }, { "MouseCursor", INI::parseMouseCursorDefinition }, { "MultiplayerColor", INI::parseMultiplayerColorDefinition }, - { "MultiplayerStartingMoneyChoice", INI::parseMultiplayerStartingMoneyChoiceDefinition }, + { "MultiplayerStartingMoneyChoice", INI::parseMultiplayerStartingMoneyChoiceDefinition }, { "OnlineChatColors", INI::parseOnlineChatColorDefinition }, { "MultiplayerSettings",INI::parseMultiplayerSettingsDefinition }, { "MusicTrack", INI::parseMusicTrackDefinition }, @@ -185,7 +185,7 @@ INI::INI( void ) { m_file = NULL; - m_readBufferNext=m_readBufferUsed=0; + m_readBufferNext=m_readBufferUsed=0; m_filename = "None"; m_loadType = INI_LOAD_INVALID; m_lineNum = 0; @@ -299,7 +299,7 @@ void INI::unPrepFile() // close the file m_file->close(); m_file = NULL; - m_readBufferUsed=m_readBufferNext=0; + m_readBufferUsed=m_readBufferNext=0; m_filename = "None"; m_loadType = INI_LOAD_INVALID; m_lineNum = 0; @@ -424,61 +424,61 @@ void INI::readLine( void ) // sanity DEBUG_ASSERTCRASH( m_file, ("readLine(), file pointer is NULL\n") ); - if (m_endOfFile) - *m_buffer=0; - else - { - char *p=m_buffer; - while (p!=m_buffer+INI_MAX_CHARS_PER_LINE) - { - // get next character - if (m_readBufferNext==m_readBufferUsed) - { - // refill buffer - m_readBufferNext=0; - m_readBufferUsed=m_file->read(m_readBuffer,INI_READ_BUFFER); - - // EOF? - if (!m_readBufferUsed) - { - m_endOfFile=true; - *p=0; - break; - } - } - *p=m_readBuffer[m_readBufferNext++]; - - // CR? - if (*p=='\n') - { - *p=0; - break; - } - - DEBUG_ASSERTCRASH(*p != '\t', ("tab characters are not allowed in INI files (%s). please check your editor settings. Line Number %d\n",m_filename.str(), getLineNum())); - - // comment? - if (*p==';') - *p=0; - // whitespace? - else if (*p>0&&*p<32) - *p=' '; - p++; - } - *p=0; + if( m_endOfFile ) + *m_buffer=0; + else + { + char *p=m_buffer; + while (p!=m_buffer+INI_MAX_CHARS_PER_LINE) + { + // get next character + if (m_readBufferNext==m_readBufferUsed) + { + // refill buffer + m_readBufferNext=0; + m_readBufferUsed=m_file->read(m_readBuffer,INI_READ_BUFFER); + + // EOF? + if (!m_readBufferUsed) + { + m_endOfFile=true; + *p=0; + break; + } + } + *p=m_readBuffer[m_readBufferNext++]; + + // CR? + if (*p=='\n') + { + *p=0; + break; + } + + DEBUG_ASSERTCRASH(*p != '\t', ("tab characters are not allowed in INI files (%s). please check your editor settings. Line Number %d\n",m_filename.str(), getLineNum())); + + // comment? + if (*p==';') + *p=0; + // whitespace? + else if (*p>0&&*p<32) + *p=' '; + p++; + } + *p=0; // increase our line count m_lineNum++; // check for at the max - if ( p == m_buffer+INI_MAX_CHARS_PER_LINE ) + if( p == m_buffer+INI_MAX_CHARS_PER_LINE ) { DEBUG_ASSERTCRASH( 0, ("Buffer too small (%d) and was truncated, increase INI_MAX_CHARS_PER_LINE\n", INI_MAX_CHARS_PER_LINE) ); } // end if - } + } if (s_xfer) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp index 3035213cf0..9fa1994d5c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp @@ -73,7 +73,6 @@ void ControlBar::parseCommandButtonDefinition( INI *ini ) // parse the ini definition ini->initFromINI( button, button->getFieldParse() ); - //Make sure buttons with special power templates also have the appropriate option set. const SpecialPowerTemplate *spTemplate = button->getSpecialPowerTemplate(); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp index 0510a1f208..54fbd71d66 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMappedImage.cpp @@ -66,7 +66,7 @@ void INI::parseMappedImageDefinition( INI* ini ) { // image not found, create a new one - image = newInstance(Image); + image = newInstance(Image); image->setName( name ); TheMappedImageCollection->addImage(image); DEBUG_ASSERTCRASH( image, ("parseMappedImage: unable to allocate image for '%s'\n", diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMiscAudio.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMiscAudio.cpp index a5b2261de5..d6acfc1b35 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMiscAudio.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMiscAudio.cpp @@ -65,7 +65,7 @@ const FieldParse MiscAudio::m_fieldParseTable[] = { "RepairSparks", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_repairSparks ) }, { "SabotageShutDownBuilding", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_sabotageShutDownBuilding ) }, { "SabotageResetTimeBuilding", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_sabotageResetTimerBuilding ) }, - { "AircraftWheelScreech", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_aircraftWheelScreech ) }, + { "AircraftWheelScreech", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_aircraftWheelScreech ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp index 630523f4d1..0e8aaa4f8d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIMultiplayer.cpp @@ -80,30 +80,30 @@ void INI::parseMultiplayerColorDefinition( INI* ini ) namespace { - struct MultiplayerStartingMoneySettings - { - Money money; - Bool isDefault; - }; - - const FieldParse startingMoneyFieldParseTable[] = - { - { "Value", Money::parseMoneyAmount, NULL, offsetof( MultiplayerStartingMoneySettings, money ) }, - { "Default", INI::parseBool, NULL, offsetof( MultiplayerStartingMoneySettings, isDefault ) }, - { NULL, NULL, NULL, 0 } // keep this last - }; + struct MultiplayerStartingMoneySettings + { + Money money; + Bool isDefault; + }; + + const FieldParse startingMoneyFieldParseTable[] = + { + { "Value", Money::parseMoneyAmount, NULL, offsetof( MultiplayerStartingMoneySettings, money ) }, + { "Default", INI::parseBool, NULL, offsetof( MultiplayerStartingMoneySettings, isDefault ) }, + { NULL, NULL, NULL, 0 } // keep this last + }; } void INI::parseMultiplayerStartingMoneyChoiceDefinition( INI* ini ) { - DEBUG_ASSERTCRASH( ini->getLoadType() != INI_LOAD_CREATE_OVERRIDES, ("Overrides not supported for MultiplayerStartingMoneyChoice") ); - - // Temporary data store - MultiplayerStartingMoneySettings settings; - settings.isDefault = false; - - ini->initFromINI( &settings, startingMoneyFieldParseTable ); - - TheMultiplayerSettings->addStartingMoneyChoice( settings.money, settings.isDefault ); + DEBUG_ASSERTCRASH( ini->getLoadType() != INI_LOAD_CREATE_OVERRIDES, ("Overrides not supported for MultiplayerStartingMoneyChoice") ); + + // Temporary data store + MultiplayerStartingMoneySettings settings; + settings.isDefault = false; + + ini->initFromINI( &settings, startingMoneyFieldParseTable ); + + TheMultiplayerSettings->addStartingMoneyChoice( settings.money, settings.isDefault ); } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp index fc2c79dc6c..7aee2659d2 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp @@ -377,9 +377,8 @@ AsciiString GameMessage::getCommandTypeAsAsciiString(GameMessage::Type t) CHECK_IF(MSG_META_TOGGLE_CAMERA_TRACKING_DRAWABLE) CHECK_IF(MSG_META_DEMO_INSTANT_QUIT) - #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)//may be defined in GameCommon.h - CHECK_IF(MSG_CHEAT_RUNSCRIPT1) + CHECK_IF(MSG_CHEAT_RUNSCRIPT1) CHECK_IF(MSG_CHEAT_RUNSCRIPT2) CHECK_IF(MSG_CHEAT_RUNSCRIPT3) CHECK_IF(MSG_CHEAT_RUNSCRIPT4) @@ -397,14 +396,12 @@ AsciiString GameMessage::getCommandTypeAsAsciiString(GameMessage::Type t) CHECK_IF(MSG_CHEAT_ADD_CASH) CHECK_IF(MSG_CHEAT_GIVE_ALL_SCIENCES) CHECK_IF(MSG_CHEAT_GIVE_SCIENCEPURCHASEPOINTS) - CHECK_IF(MSG_CHEAT_SHOW_HEALTH) - CHECK_IF(MSG_CHEAT_TOGGLE_MESSAGE_TEXT) + CHECK_IF(MSG_CHEAT_SHOW_HEALTH) + CHECK_IF(MSG_CHEAT_TOGGLE_MESSAGE_TEXT) +#endif + CHECK_IF(MSG_META_TOGGLE_FAST_FORWARD_REPLAY) -#endif - CHECK_IF(MSG_META_TOGGLE_FAST_FORWARD_REPLAY) - - #if defined(_DEBUG) || defined(_INTERNAL) CHECK_IF(MSG_META_DEMO_TOGGLE_BEHIND_BUILDINGS) CHECK_IF(MSG_META_DEMO_TOGGLE_LETTERBOX) @@ -460,7 +457,7 @@ AsciiString GameMessage::getCommandTypeAsAsciiString(GameMessage::Type t) CHECK_IF(MSG_META_DEMO_ENSHROUD) CHECK_IF(MSG_META_DEMO_DESHROUD) CHECK_IF(MSG_META_DEBUG_SHOW_EXTENTS) - CHECK_IF(MSG_META_DEBUG_SHOW_AUDIO_LOCATIONS) + CHECK_IF(MSG_META_DEBUG_SHOW_AUDIO_LOCATIONS) CHECK_IF(MSG_META_DEBUG_SHOW_HEALTH) CHECK_IF(MSG_META_DEBUG_GIVE_VETERANCY) CHECK_IF(MSG_META_DEBUG_TAKE_VETERANCY) @@ -666,7 +663,7 @@ AsciiString GameMessage::getCommandTypeAsAsciiString(GameMessage::Type t) CHECK_IF(MSG_SELF_DESTRUCT) CHECK_IF(MSG_CREATE_FORMATION) CHECK_IF(MSG_LOGIC_CRC) -#if defined(_DEBUG) || defined(_INTERNAL) +#if defined(_DEBUG) || defined(_INTERNAL) CHECK_IF(MSG_DEBUG_KILL_SELECTION) CHECK_IF(MSG_DEBUG_HURT_OBJECT) CHECK_IF(MSG_DEBUG_KILL_OBJECT) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp index 3d3c9ddd16..823087fe0e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp @@ -84,7 +84,7 @@ MultiplayerSettings::MultiplayerSettings() m_observerColor; m_randomColor; - m_gotDefaultStartingMoney = false; + m_gotDefaultStartingMoney = false; } // end MultiplayerSettings MultiplayerColorDefinition::MultiplayerColorDefinition() @@ -142,13 +142,13 @@ MultiplayerColorDefinition * MultiplayerSettings::newMultiplayerColorDefinition( void MultiplayerSettings::addStartingMoneyChoice( const Money & money, Bool isDefault ) { - m_startingMoneyList.push_back( money ); - if ( isDefault ) - { - DEBUG_ASSERTCRASH( !m_gotDefaultStartingMoney, ("Cannot have more than one default MultiplayerStartingMoneyChoice") ); - m_defaultStartingMoney = money; - m_gotDefaultStartingMoney = true; - } + m_startingMoneyList.push_back( money ); + if ( isDefault ) + { + DEBUG_ASSERTCRASH( !m_gotDefaultStartingMoney, ("Cannot have more than one default MultiplayerStartingMoneyChoice") ); + m_defaultStartingMoney = money; + m_gotDefaultStartingMoney = true; + } } MultiplayerColorDefinition * MultiplayerColorDefinition::operator =(const MultiplayerColorDefinition& other) @@ -171,4 +171,3 @@ void MultiplayerColorDefinition::setNightColor( RGBColor rgb ) { m_colorNight = rgb.getAsInt() | 0xFF << 24; } - diff --git a/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp b/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp index 9488b5bf0d..475f7b677e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/NameKeyGenerator.cpp @@ -223,7 +223,7 @@ NameKeyType NameKeyGenerator::nameToLowercaseKey(const char* nameString) //------------------------------------------------------------------------------------------------- void NameKeyGenerator::parseStringAsNameKeyType( INI *ini, void *instance, void *store, const void* userData ) { - *(NameKeyType *)store = TheNameKeyGenerator->nameToKey( ini->getNextToken() ); + *(NameKeyType *)store = TheNameKeyGenerator->nameToKey( ini->getNextToken() ); } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/PerfTimer.cpp b/GeneralsMD/Code/GameEngine/Source/Common/PerfTimer.cpp index 0d4fcec12f..7c88015f68 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/PerfTimer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/PerfTimer.cpp @@ -71,63 +71,63 @@ void InitPrecisionTimer() { #ifdef HOFFESOMMER_REPLACEMENT_CODE - // measure clock cycles 3 times for 20 msec each - // then take the 2 counts that are closest, average - _int64 n[ 3 ]; - for( int k = 0; k < 3; k++ ) - { - // wait for end of current tick - unsigned timeEnd = timeGetTime() + 2; - while( timeGetTime() < timeEnd ); //do nothing + // measure clock cycles 3 times for 20 msec each + // then take the 2 counts that are closest, average + _int64 n[ 3 ]; + for( int k = 0; k < 3; k++ ) + { + // wait for end of current tick + unsigned timeEnd = timeGetTime() + 2; + while( timeGetTime() < timeEnd ); //do nothing - // get cycles - _int64 start, startQPC, endQPC; - QueryPerformanceCounter( (LARGE_INTEGER *)&startQPC ); - ProfileGetTime( start ); - timeEnd += 20; - while( timeGetTime() < timeEnd ); //do nothing - ProfileGetTime( n[ k ] ); - n[ k ] -= start; + // get cycles + _int64 start, startQPC, endQPC; + QueryPerformanceCounter( (LARGE_INTEGER *)&startQPC ); + ProfileGetTime( start ); + timeEnd += 20; + while( timeGetTime() < timeEnd ); //do nothing + ProfileGetTime( n[ k ] ); + n[ k ] -= start; - // convert to 1 second - if( QueryPerformanceCounter( (LARGE_INTEGER*)&endQPC ) ) - { - QueryPerformanceFrequency( (LARGE_INTEGER*)&s_ticksPerSec ); - n[ k ] = ( n[ k ] * s_ticksPerSec ) / ( endQPC - startQPC ); - } - else - { - n[ k ] = ( n[ k ] * 1000 ) / 20; - } - } + // convert to 1 second + if( QueryPerformanceCounter( (LARGE_INTEGER*)&endQPC ) ) + { + QueryPerformanceFrequency( (LARGE_INTEGER*)&s_ticksPerSec ); + n[ k ] = ( n[ k ] * s_ticksPerSec ) / ( endQPC - startQPC ); + } + else + { + n[ k ] = ( n[ k ] * 1000 ) / 20; + } + } - // find two closest values - _int64 d01 = n[ 1 ] - n[ 0 ]; + // find two closest values + _int64 d01 = n[ 1 ] - n[ 0 ]; _int64 d02 = n[ 2 ] - n[ 0 ]; _int64 d12 = n[ 2 ] - n[ 1 ]; - if( d01 < 0 ) + if( d01 < 0 ) { d01 = -d01; } - if( d02 < 0 ) + if( d02 < 0 ) { d02 = -d02; } - if( d12 < 0 ) + if( d12 < 0 ) { d12 = -d12; } - _int64 avg; - if( d01 < d02 ) - { - avg = d01 < d12 ? n[ 0 ] + n[ 1 ] : n[ 1 ] + n[ 2 ]; - } - else - { - avg = d02 < d12 ? n[ 0 ] + n[ 2 ] : n[ 1 ] + n[ 2 ]; - } + _int64 avg; + if( d01 < d02 ) + { + avg = d01 < d12 ? n[ 0 ] + n[ 1 ] : n[ 1 ] + n[ 2 ]; + } + else + { + avg = d02 < d12 ? n[ 0 ] + n[ 2 ] : n[ 1 ] + n[ 2 ]; + } //s_ticksPerMSec = 1.0 * TotalTicks / totalTime; s_ticksPerMSec = avg / 2000.0f; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp index eb27ba747f..3b80f3d7ff 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ActionManager.cpp @@ -562,10 +562,8 @@ Bool ActionManager::canEnterObject( const Object *obj, const Object *objectToEnt return FALSE; } - - if (objectToEnter->isDisabledByType( DISABLED_SUBDUED )) - return FALSE; // a microwave tank has soldered the doors shut - + if (objectToEnter->isDisabledByType( DISABLED_SUBDUED )) + return FALSE; // a microwave tank has soldered the doors shut if( obj->isKindOf( KINDOF_STRUCTURE ) || obj->isKindOf( KINDOF_IMMOBILE ) ) { @@ -794,20 +792,20 @@ CanAttackResult ActionManager::getCanAttackObject( const Object *obj, const Obje } } } - else if( result == ATTACKRESULT_NOT_POSSIBLE )// oh dear me. The wierd case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase - { - ContainModuleInterface *contain = obj->getContain(); - if ( contain ) - { - Object *rider = contain->getClosestRider( objectToAttack->getPosition() ); - if ( rider ) - { - result = rider->getAbleToAttackSpecificObject( attackType, objectToAttack, commandSource ); - if( result != ATTACKRESULT_NOT_POSSIBLE ) - return result; - } - } - } + else if( result == ATTACKRESULT_NOT_POSSIBLE )// oh dear me. The wierd case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase + { + ContainModuleInterface *contain = obj->getContain(); + if ( contain ) + { + Object *rider = contain->getClosestRider( objectToAttack->getPosition() ); + if ( rider ) + { + result = rider->getAbleToAttackSpecificObject( attackType, objectToAttack, commandSource ); + if( result != ATTACKRESULT_NOT_POSSIBLE ) + return result; + } + } + } } return ATTACKRESULT_NOT_POSSIBLE; @@ -1479,7 +1477,7 @@ Bool ActionManager::canDoSpecialPowerAtLocation( const Object *obj, const Coord3 return false; } } - + // First check terrain type, if it is cared about. Don't return a true, since there are more checks. switch( spTemplate->getSpecialPowerType() ) { @@ -1548,11 +1546,10 @@ Bool ActionManager::canDoSpecialPowerAtLocation( const Object *obj, const Coord3 case SPECIAL_RADAR_VAN_SCAN: case SPECIAL_SPY_DRONE: case SPECIAL_HELIX_NAPALM_BOMB: - - //These specials can be used anywhere! - return isPointOnMap( loc ); - case SPECIAL_LAUNCH_BAIKONUR_ROCKET: - return TRUE; + //These specials can be used anywhere! + return isPointOnMap( loc ); + case SPECIAL_LAUNCH_BAIKONUR_ROCKET: + return true; //These special powers require object targets! case SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES: @@ -1897,7 +1894,7 @@ Bool ActionManager::canDoSpecialPower( const Object *obj, const SpecialPowerTemp case SPECIAL_SCUD_STORM: case SPECIAL_A10_THUNDERBOLT_STRIKE: case AIRF_SPECIAL_A10_THUNDERBOLT_STRIKE: - case SPECIAL_SPECTRE_GUNSHIP: + case SPECIAL_SPECTRE_GUNSHIP: case AIRF_SPECIAL_SPECTRE_GUNSHIP: case SPECIAL_ARTILLERY_BARRAGE: case SPECIAL_FRENZY: @@ -1905,7 +1902,7 @@ Bool ActionManager::canDoSpecialPower( const Object *obj, const SpecialPowerTemp case SPECIAL_DISGUISE_AS_VEHICLE: case SPECIAL_REPAIR_VEHICLES: case EARLY_SPECIAL_REPAIR_VEHICLES: - case SPECIAL_GPS_SCRAMBLER: + case SPECIAL_GPS_SCRAMBLER: case SLTH_SPECIAL_GPS_SCRAMBLER: case SPECIAL_PARTICLE_UPLINK_CANNON: case SPECIAL_CASH_BOUNTY: diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp index 9c3fabc581..87e3c4688e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Money.cpp @@ -139,7 +139,7 @@ void Money::loadPostProcess( void ) // ------------------------------------------------------------------------------------------------ void Money::parseMoneyAmount( INI *ini, void *instance, void *store, const void* userData ) { - // Someday, maybe, have mulitple fields like Gold:10000 Wood:1000 Tiberian:10 - Money * money = (Money *)store; - INI::parseUnsignedInt( ini, instance, &money->m_money, userData ); + // Someday, maybe, have mulitple fields like Gold:10000 Wood:1000 Tiberian:10 + Money * money = (Money *)store; + INI::parseUnsignedInt( ini, instance, &money->m_money, userData ); } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp index f77407cc36..b21e53e5cc 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp @@ -457,14 +457,14 @@ void Player::init(const PlayerTemplate* pt) if( m_money.countMoney() == 0 ) { - if ( TheGameInfo ) - { - m_money = TheGameInfo->getStartingCash(); - } - else - { - m_money = TheGlobalData->m_defaultStartingCash; - } + if ( TheGameInfo ) + { + m_money = TheGameInfo->getStartingCash(); + } + else + { + m_money = TheGlobalData->m_defaultStartingCash; + } } m_playerDisplayName.clear(); @@ -1142,8 +1142,8 @@ void Player::becomingLocalPlayer(Bool yes) Drawable *draw = object->getDrawable(); if( draw ) { - - StealthUpdate *update = object->getStealth(); + + StealthUpdate *update = object->getStealth(); if( update && update->isDisguised() ) { @@ -1200,8 +1200,7 @@ Bool Player::computeSuperweaponTarget(const SpecialPowerTemplate *power, Coord3D if (m_ai) { return m_ai->computeSuperweaponTarget(power, retPos, playerNdx, weaponRadius); } - - return FALSE; + return FALSE; } //------------------------------------------------------------------------------------------------- @@ -1698,58 +1697,58 @@ void Player::onStructureConstructionComplete( Object *builder, Object *structure if( structure->hasSpecialPower( SPECIAL_PARTICLE_UPLINK_CANNON ) || structure->hasSpecialPower( SUPW_SPECIAL_PARTICLE_UPLINK_CANNON ) || structure->hasSpecialPower( LAZR_SPECIAL_PARTICLE_UPLINK_CANNON ) ) - { - if ( localPlayer == structure->getControllingPlayer() ) - { - TheEva->setShouldPlay(EVA_SuperweaponDetected_Own_ParticleCannon); - } - else if ( localPlayer->getRelationship(structure->getTeam()) != ENEMIES ) - { - // Note: treating NEUTRAL as ally. Is this correct? - TheEva->setShouldPlay(EVA_SuperweaponDetected_Ally_ParticleCannon); - } - else - { - TheEva->setShouldPlay(EVA_SuperweaponDetected_Enemy_ParticleCannon); - } - } + { + if ( localPlayer == structure->getControllingPlayer() ) + { + TheEva->setShouldPlay(EVA_SuperweaponDetected_Own_ParticleCannon); + } + else if ( localPlayer->getRelationship(structure->getTeam()) != ENEMIES ) + { + // Note: treating NEUTRAL as ally. Is this correct? + TheEva->setShouldPlay(EVA_SuperweaponDetected_Ally_ParticleCannon); + } + else + { + TheEva->setShouldPlay(EVA_SuperweaponDetected_Enemy_ParticleCannon); + } + } if( structure->hasSpecialPower( SPECIAL_NEUTRON_MISSILE ) || structure->hasSpecialPower( NUKE_SPECIAL_NEUTRON_MISSILE ) || structure->hasSpecialPower( SUPW_SPECIAL_NEUTRON_MISSILE ) ) - { - if ( localPlayer == structure->getControllingPlayer() ) - { - TheEva->setShouldPlay(EVA_SuperweaponDetected_Own_Nuke); - } - else if ( localPlayer->getRelationship(structure->getTeam()) != ENEMIES ) - { - // Note: treating NEUTRAL as ally. Is this correct? - TheEva->setShouldPlay(EVA_SuperweaponDetected_Ally_Nuke); - } - else - { - TheEva->setShouldPlay(EVA_SuperweaponDetected_Enemy_Nuke); - } - } - + { + if ( localPlayer == structure->getControllingPlayer() ) + { + TheEva->setShouldPlay(EVA_SuperweaponDetected_Own_Nuke); + } + else if ( localPlayer->getRelationship(structure->getTeam()) != ENEMIES ) + { + // Note: treating NEUTRAL as ally. Is this correct? + TheEva->setShouldPlay(EVA_SuperweaponDetected_Ally_Nuke); + } + else + { + TheEva->setShouldPlay(EVA_SuperweaponDetected_Enemy_Nuke); + } + } + if (structure->hasSpecialPower(SPECIAL_SCUD_STORM)) - { - if ( localPlayer == structure->getControllingPlayer() ) - { - TheEva->setShouldPlay(EVA_SuperweaponDetected_Own_ScudStorm); - } - else if ( localPlayer->getRelationship(structure->getTeam()) != ENEMIES ) - { - // Note: treating NEUTRAL as ally. Is this correct? - TheEva->setShouldPlay(EVA_SuperweaponDetected_Ally_ScudStorm); - } - else - { - TheEva->setShouldPlay(EVA_SuperweaponDetected_Enemy_ScudStorm); - } - } -} // end onStructureConstructionComplete + { + if ( localPlayer == structure->getControllingPlayer() ) + { + TheEva->setShouldPlay(EVA_SuperweaponDetected_Own_ScudStorm); + } + else if ( localPlayer->getRelationship(structure->getTeam()) != ENEMIES ) + { + // Note: treating NEUTRAL as ally. Is this correct? + TheEva->setShouldPlay(EVA_SuperweaponDetected_Ally_ScudStorm); + } + else + { + TheEva->setShouldPlay(EVA_SuperweaponDetected_Enemy_ScudStorm); + } + } +} // end onStructureConstructionComplete //============================================================================= void Player::onStructureUndone(Object *structure) @@ -2311,10 +2310,10 @@ void Player::setUnitsShouldIdleOrResume(Bool idle) //------------------------------------------------------------------------------- void sellBuildings( Object *obj, void *userData ) { - if( obj->isFactionStructure() || obj->isKindOf( KINDOF_COMMANDCENTER ) || obj->isKindOf( KINDOF_FS_POWER ) ) - { - TheBuildAssistant->sellObject( obj ); - } + if( obj->isFactionStructure() || obj->isKindOf( KINDOF_COMMANDCENTER ) || obj->isKindOf( KINDOF_FS_POWER ) ) + { + TheBuildAssistant->sellObject( obj ); + } } //============================================================================= @@ -2841,15 +2840,15 @@ ScienceAvailabilityType Player::getScienceAvailabilityTypeFromString( const Asci namespace { - // ------------------------------------------------------------------------------------------------ - // For countExisting - struct TypeCountData - { - UnsignedInt count; - const ThingTemplate *type; - NameKeyType linkKey; - Bool checkProductionInterface; - }; + // ------------------------------------------------------------------------------------------------ + // For countExisting + struct TypeCountData + { + UnsignedInt count; + const ThingTemplate *type; + NameKeyType linkKey; + Bool checkProductionInterface; + }; } // ------------------------------------------------------------------------------------------------ @@ -2857,56 +2856,56 @@ namespace // ------------------------------------------------------------------------------------------------ static void countExisting( Object *obj, void *userData ) { - // Don't care about dead objects - if ( obj->isEffectivelyDead() ) - return; - - TypeCountData *typeCountData = (TypeCountData *)userData; - - // Compare templates - if ( typeCountData->type->isEquivalentTo( obj->getTemplate() ) || - ( typeCountData->linkKey != NAMEKEY_INVALID && obj->getTemplate() != NULL && typeCountData->linkKey == obj->getTemplate()->getMaxSimultaneousLinkKey() ) ) - { - typeCountData->count++; - } - - // Also consider objects that have a production update interface - if ( typeCountData->checkProductionInterface ) - { - ProductionUpdateInterface *pui = ProductionUpdate::getProductionUpdateInterfaceFromObject( obj ); - if( pui ) - { - // add the count of this type that are in the queue - typeCountData->count += pui->countUnitTypeInQueue( typeCountData->type ); - } // end if - } -} // end countInProduction + // Don't care about dead objects + if ( obj->isEffectivelyDead() ) + return; + + TypeCountData *typeCountData = (TypeCountData *)userData; + + // Compare templates + if ( typeCountData->type->isEquivalentTo( obj->getTemplate() ) || + ( typeCountData->linkKey != NAMEKEY_INVALID && obj->getTemplate() != NULL && typeCountData->linkKey == obj->getTemplate()->getMaxSimultaneousLinkKey() ) ) + { + typeCountData->count++; + } + + // Also consider objects that have a production update interface + if ( typeCountData->checkProductionInterface ) + { + ProductionUpdateInterface *pui = ProductionUpdate::getProductionUpdateInterfaceFromObject( obj ); + if( pui ) + { + // add the count of this type that are in the queue + typeCountData->count += pui->countUnitTypeInQueue( typeCountData->type ); + } // end if + } +} // end countInProduction //============================================================================= // Make sure that building another of this unit/structure/object won't exceed MaxSimultaneousOfType() Bool Player::canBuildMoreOfType( const ThingTemplate *whatToBuild ) const { - // make sure we're not maxed out for this type of unit. - UnsignedInt maxSimultaneousOfType = whatToBuild->getMaxSimultaneousOfType(); - if (maxSimultaneousOfType != 0) - { - - TypeCountData typeCountData; - typeCountData.count = 0; - typeCountData.type = whatToBuild; - typeCountData.linkKey = whatToBuild->getMaxSimultaneousLinkKey(); - // Assumption: Things with a KINDOF_STRUCTURE flag can never be built from - // a factory (ProductionUpdateInterface), because the building can't move - // out of the factory. When we do our Starcraft port and have flying Terran - // buildings, we'll have to change this ;-) - // Remember: To ASSUME makes an ASS out of U and ME. - typeCountData.checkProductionInterface = !whatToBuild->isKindOf( KINDOF_STRUCTURE ); - - iterateObjects( countExisting, &typeCountData ); - if( typeCountData.count >= maxSimultaneousOfType ) - return false; - } - return true; + // make sure we're not maxed out for this type of unit. + UnsignedInt maxSimultaneousOfType = whatToBuild->getMaxSimultaneousOfType(); + if (maxSimultaneousOfType != 0) + { + + TypeCountData typeCountData; + typeCountData.count = 0; + typeCountData.type = whatToBuild; + typeCountData.linkKey = whatToBuild->getMaxSimultaneousLinkKey(); + // Assumption: Things with a KINDOF_STRUCTURE flag can never be built from + // a factory (ProductionUpdateInterface), because the building can't move + // out of the factory. When we do our Starcraft port and have flying Terran + // buildings, we'll have to change this ;-) + // Remember: To ASSUME makes an ASS out of U and ME. + typeCountData.checkProductionInterface = !whatToBuild->isKindOf( KINDOF_STRUCTURE ); + + iterateObjects( countExisting, &typeCountData ); + if( typeCountData.count >= maxSimultaneousOfType ) + return false; + } + return true; } //============================================================================= @@ -2949,9 +2948,8 @@ Bool Player::canBuild(const ThingTemplate *tmplate) const } - if ( !canBuildMoreOfType( tmplate ) ) - return false; - + if ( !canBuildMoreOfType( tmplate ) ) + return false; return true; } @@ -3070,7 +3068,7 @@ Upgrade *Player::addUpgrade( const UpgradeTemplate *upgradeTemplate, UpgradeStat m_upgradesCompleted.set( newMask ); onUpgradeCompleted( upgradeTemplate ); } - + if( ThePlayerList->getLocalPlayer() == this ) { TheControlBar->markUIDirty(); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp index efc8dc729d..88b5638f6f 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp @@ -100,7 +100,7 @@ { "SpecialPowerShortcutWinName" ,INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_specialPowerShortcutWinName) }, { "SpecialPowerShortcutButtonCount",INI::parseInt, NULL, offsetof( PlayerTemplate, m_specialPowerShortcutButtonCount ) }, { "IsObserver", INI::parseBool, NULL, offsetof( PlayerTemplate, m_observer ) }, - { "OldFaction", INI::parseBool, NULL, offsetof( PlayerTemplate, m_oldFaction ) }, + { "OldFaction", INI::parseBool, NULL, offsetof( PlayerTemplate, m_oldFaction ) }, { "IntrinsicSciencePurchasePoints", INI::parseInt, NULL, offsetof( PlayerTemplate, m_intrinsicSPP ) }, { "ScoreScreenImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_scoreScreenImage ) }, { "LoadScreenImage", INI::parseAsciiString, NULL, offsetof( PlayerTemplate, m_loadScreenImage ) }, @@ -198,7 +198,7 @@ PlayerTemplate::PlayerTemplate() : m_nameKey(NAMEKEY_INVALID), m_observer(false), m_playableSide(false), - m_oldFaction(false), + m_oldFaction(false), m_intrinsicSPP(0), m_specialPowerShortcutButtonCount(0) { @@ -291,7 +291,6 @@ void PlayerTemplateStore::update() // nothing } - Int PlayerTemplateStore::getTemplateNumByName(AsciiString name) const { for (Int num = 0; num < m_playerTemplates.size(); num++) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp index 17b631fb97..6502d2e9da 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/StateMachine.cpp @@ -39,7 +39,6 @@ #ifdef _INTERNAL // for occasional debugging... - //#pragma optimize("", off) //#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") #endif diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp index cb8bd1b3e0..85c00b28a4 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/BuildAssistant.cpp @@ -348,7 +348,7 @@ Object *BuildAssistant::buildObjectNow( Object *constructorObject, const ThingTe ("buildObjectNow: Constructor object player is not the same as the controlling player passed in\n") ); } // end if - + // Need to validate that we can make this in case someone fakes their CommandSet // A NULL constructor Object means a script built building so let it slide. if( (constructorObject != NULL) && !isPossibleToMakeUnit(constructorObject, what) ) diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp index 95bec7eed9..d1a464e0fa 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/DataChunk.cpp @@ -369,7 +369,7 @@ void DataChunkOutput::writeUnicodeString( UnicodeString theString ) } void DataChunkOutput::writeNameKey( const NameKeyType key ) -{ +{ AsciiString kname = TheNameKeyGenerator->keyToName(key); Int keyAndType = m_contents.allocateID(kname); keyAndType <<= 8; diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp index 65797c548b..e62832102d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/DisabledTypes.cpp @@ -40,9 +40,9 @@ const char* DisabledMaskType::s_bitNameList[] = "DISABLED_UNMANNED", "DISABLED_UNDERPOWERED", "DISABLED_FREEFALL", - - "DISABLED_AWESTRUCK", - "DISABLED_BRAINWASHED", + + "DISABLED_AWESTRUCK", + "DISABLED_BRAINWASHED", "DISABLED_SUBDUED", "DISABLED_SCRIPT_DISABLED", diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp index 1a59074af2..fb5ff7241d 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp @@ -197,23 +197,23 @@ Bool FileSystem::doesFileExist(const Char *filename) const { USE_PERF_TIMER(FileSystem) - unsigned key=TheNameKeyGenerator->nameToLowercaseKey(filename); - std::map::iterator i=m_fileExist.find(key); - if (i!=m_fileExist.end()) - return i->second; + unsigned key=TheNameKeyGenerator->nameToLowercaseKey(filename); + std::map::iterator i=m_fileExist.find(key); + if (i!=m_fileExist.end()) + return i->second; if (TheLocalFileSystem->doesFileExist(filename)) - { - m_fileExist[key]=true; + { + m_fileExist[key]=true; return TRUE; } if (TheArchiveFileSystem->doesFileExist(filename)) - { - m_fileExist[key]=true; + { + m_fileExist[key]=true; return TRUE; } - m_fileExist[key]=false; + m_fileExist[key]=false; return FALSE; } @@ -267,7 +267,7 @@ Bool FileSystem::createDirectory(AsciiString directory) Bool FileSystem::areMusicFilesOnCD() { #if 1 - return TRUE; + return TRUE; #else if (!TheCDManager) { DEBUG_LOG(("FileSystem::areMusicFilesOnCD() - No CD Manager; returning false\n")); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/GameMemory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/GameMemory.cpp index 6c57bdde75..cb81489119 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/GameMemory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/GameMemory.cpp @@ -2159,7 +2159,7 @@ void DynamicMemoryAllocator::debugIgnoreLeaksForThisBlock(void* pBlockPtr) out the block. if unable to allocate, throw ERROR_OUT_OF_MEMORY. this function will never return null. - added code to make sure we're on a DWord boundary, throw exception if not + added code to make sure we're on a DWord boundary, throw exception if not */ void *DynamicMemoryAllocator::allocateBytesDoNotZeroImplementation(Int numBytes DECLARE_LITERALSTRING_ARG2) { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp index 47ef9795f9..c2e7321461 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/KindOf.cpp @@ -137,11 +137,11 @@ const char* KindOfMaskType::s_bitNameList[] = "FS_STRATEGY_CENTER", "MONEY_HACKER", "ARMOR_SALVAGER", - "REVEALS_ENEMY_PATHS", + "REVEALS_ENEMY_PATHS", "BOOBY_TRAP", "FS_FAKE", "FS_INTERNET_CENTER", - "BLAST_CRATER", + "BLAST_CRATER", "PROP", "OPTIMIZED_TREE", "FS_ADVANCED_TECH", diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp index 02a099b3fb..1571f374fb 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/ObjectStatusTypes.cpp @@ -73,7 +73,7 @@ const char* ObjectStatusMaskType::s_bitNameList[] = "STATUS_RIDER7", "STATUS_RIDER8", "FAERIE_FIRE", - "KILLING_SELF", + "KILLING_SELF", "REASSIGN_PARKING", "BOOBY_TRAPPED", "IMMOBILE", diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp index 1b792fabbf..b210992ff2 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Radar.cpp @@ -355,16 +355,16 @@ void Radar::newMap( TerrainLogic *terrain ) m_terrainAverageZ = 0.0f; m_waterAverageZ = 0.0f; Coord3D worldPoint; - - // since we're averaging let's skip every second sample... - worldPoint.y=0; + + // since we're averaging let's skip every second sample... + worldPoint.y=0; for( y = 0; y < RADAR_CELL_HEIGHT; y+=2, worldPoint.y+=2.0*m_ySample ) - { - worldPoint.x=0; - for( x = 0; x < RADAR_CELL_WIDTH; x+=2, worldPoint.x+=2.0*m_xSample ) + { + worldPoint.x=0; + for( x = 0; x < RADAR_CELL_WIDTH; x+=2, worldPoint.x+=2.0*m_xSample ) { // don't use this, we don't really need the - // Z position by this function... radarToWorld( &radarPoint, &worldPoint ); + // Z position by this function... radarToWorld( &radarPoint, &worldPoint ); // and this is done by isUnderwater anyway: z = terrain->getGroundHeight( worldPoint.x, worldPoint.y ); Real z,waterZ; if( terrain->isUnderwater( worldPoint.x, worldPoint.y, &waterZ, &z ) ) @@ -379,7 +379,7 @@ void Radar::newMap( TerrainLogic *terrain ) } } // end for x - } + } // avoid divide by zeros if( terrainSamples == 0 ) @@ -429,7 +429,7 @@ void Radar::addObject( Object *obj ) //Because we have support for disguised units pretending to be units from another //team, we need to intercept it here and make sure it's rendered appropriately //based on which client is rendering it. - StealthUpdate *update = obj->getStealth(); + StealthUpdate *update = obj->getStealth(); if( update ) { if( update->isDisguised() ) @@ -657,8 +657,8 @@ Bool Radar::radarToWorld2D( const ICoord2D *radar, Coord3D *world ) //------------------------------------------------------------------------------------------------- Bool Radar::radarToWorld( const ICoord2D *radar, Coord3D *world ) { - if (!radarToWorld2D(radar,world)) - return FALSE; + if (!radarToWorld2D(radar,world)) + return FALSE; // find the terrain height here world->z = TheTerrainLogic->getGroundHeight( world->x, world->y ); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp index 918c04abd2..5fb93a7483 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp @@ -428,7 +428,7 @@ AsciiString TheThingTemplateBeingParsedName; } thingTemplate->validate(); - + if( ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES ) { thingTemplate->resolveNames(); diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp index 93fc07e60e..c370dbfd09 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp @@ -239,14 +239,14 @@ const FieldParse ThingTemplate::s_objectFieldParseTable[] = { "ReplaceModule", ThingTemplate::parseReplaceModule, NULL, 0 }, { "InheritableModule", ThingTemplate::parseInheritableModule, NULL, 0 }, - { "OverrideableByLikeKind", ThingTemplate::OverrideableByLikeKind, NULL, 0 }, + { "OverrideableByLikeKind", ThingTemplate::OverrideableByLikeKind, NULL, 0 }, { "Locomotor", AIUpdateModuleData::parseLocomotorSet, NULL, 0 }, { "InstanceScaleFuzziness", INI::parseReal, NULL, offsetof(ThingTemplate, m_instanceScaleFuzziness ) }, { "StructureRubbleHeight", INI::parseUnsignedByte, NULL, offsetof(ThingTemplate, m_structureRubbleHeight ) }, { "ThreatValue", INI::parseUnsignedShort, NULL, offsetof(ThingTemplate, m_threatValue ) }, - { "MaxSimultaneousOfType", ThingTemplate::parseMaxSimultaneous, NULL, offsetof(ThingTemplate, m_maxSimultaneousOfType ) }, - { "MaxSimultaneousLinkKey", NameKeyGenerator::parseStringAsNameKeyType, NULL, offsetof(ThingTemplate, m_maxSimultaneousLinkKey ) }, + { "MaxSimultaneousOfType", ThingTemplate::parseMaxSimultaneous, NULL, offsetof(ThingTemplate, m_maxSimultaneousOfType ) }, + { "MaxSimultaneousLinkKey", NameKeyGenerator::parseStringAsNameKeyType, NULL, offsetof(ThingTemplate, m_maxSimultaneousLinkKey ) }, { "CrusherLevel", INI::parseUnsignedByte, NULL, offsetof( ThingTemplate, m_crusherLevel ) }, { "CrushableLevel", INI::parseUnsignedByte, NULL, offsetof( ThingTemplate, m_crushableLevel ) }, @@ -268,9 +268,9 @@ const FieldParse ThingTemplate::s_objectReskinFieldParseTable[] = { "FenceWidth", INI::parseReal, NULL, offsetof( ThingTemplate, m_fenceWidth ) }, { "FenceXOffset", INI::parseReal, NULL, offsetof( ThingTemplate, m_fenceXOffset ) }, - // Needed to avoid some cheats with the scud storm rebuild hole - { "MaxSimultaneousOfType", ThingTemplate::parseMaxSimultaneous, NULL, offsetof(ThingTemplate, m_maxSimultaneousOfType ) }, - { "MaxSimultaneousLinkKey", NameKeyGenerator::parseStringAsNameKeyType, NULL, offsetof(ThingTemplate, m_maxSimultaneousLinkKey ) }, + // Needed to avoid some cheats with the scud storm rebuild hole + { "MaxSimultaneousOfType", ThingTemplate::parseMaxSimultaneous, NULL, offsetof(ThingTemplate, m_maxSimultaneousOfType ) }, + { "MaxSimultaneousLinkKey", NameKeyGenerator::parseStringAsNameKeyType, NULL, offsetof(ThingTemplate, m_maxSimultaneousLinkKey ) }, { 0, 0, 0, 0 } // keep this last @@ -302,7 +302,7 @@ void ModuleInfo::addModuleInfo(ThingTemplate *thingTemplate, const ModuleData* data, Int interfaceMask, Bool inheritable, - Bool overrideableByLikeKind) + Bool overrideableByLikeKind) { // @@ -399,92 +399,84 @@ Bool ModuleInfo::clearModuleDataWithTag(const AsciiString& tagToClear, AsciiStri } - - - //------------------------------------------------------------------------------------------------- Bool ModuleInfo::clearCopiedFromDefaultEntries(Int interfaceMask, const AsciiString &newName, const ThingTemplate *fullTemplate ) { - static KindOfMaskType ImmuneToGPSScramblerMask; - KindOfMaskType &m = ImmuneToGPSScramblerMask; - m.set(KINDOF_AIRCRAFT);// NO PLANES or helicopters - m.set(KINDOF_SHRUBBERY);// NO trees or bushes - m.set(KINDOF_OPTIMIZED_TREE); - m.set(KINDOF_STRUCTURE);// NO buildings - m.set(KINDOF_DRAWABLE_ONLY); - m.set(KINDOF_MOB_NEXUS); - m.set(KINDOF_IGNORED_IN_GUI); - m.set(KINDOF_CLEARED_BY_BUILD); - m.set(KINDOF_DEFENSIVE_WALL); - m.set(KINDOF_BALLISTIC_MISSILE); - m.set(KINDOF_SUPPLY_SOURCE); - m.set(KINDOF_BOAT); - m.set(KINDOF_INERT); - m.set(KINDOF_BRIDGE); - m.set(KINDOF_LANDMARK_BRIDGE); - m.set(KINDOF_BRIDGE_TOWER); - Bool disallowed = fullTemplate->isAnyKindOf( ImmuneToGPSScramblerMask ); - - static KindOfMaskType CandidateForGPSScramblerMask; - CandidateForGPSScramblerMask.set(KINDOF_SCORE); - CandidateForGPSScramblerMask.set(KINDOF_VEHICLE); - CandidateForGPSScramblerMask.set(KINDOF_INFANTRY); - CandidateForGPSScramblerMask.set(KINDOF_PORTABLE_STRUCTURE); - Bool candidate = fullTemplate->isAnyKindOf( CandidateForGPSScramblerMask ); - - Bool ret = false; + static KindOfMaskType ImmuneToGPSScramblerMask; + KindOfMaskType &m = ImmuneToGPSScramblerMask; + m.set(KINDOF_AIRCRAFT);// NO PLANES or helicopters + m.set(KINDOF_SHRUBBERY);// NO trees or bushes + m.set(KINDOF_OPTIMIZED_TREE); + m.set(KINDOF_STRUCTURE);// NO buildings + m.set(KINDOF_DRAWABLE_ONLY); + m.set(KINDOF_MOB_NEXUS); + m.set(KINDOF_IGNORED_IN_GUI); + m.set(KINDOF_CLEARED_BY_BUILD); + m.set(KINDOF_DEFENSIVE_WALL); + m.set(KINDOF_BALLISTIC_MISSILE); + m.set(KINDOF_SUPPLY_SOURCE); + m.set(KINDOF_BOAT); + m.set(KINDOF_INERT); + m.set(KINDOF_BRIDGE); + m.set(KINDOF_LANDMARK_BRIDGE); + m.set(KINDOF_BRIDGE_TOWER); + Bool disallowed = fullTemplate->isAnyKindOf( ImmuneToGPSScramblerMask ); + + static KindOfMaskType CandidateForGPSScramblerMask; + CandidateForGPSScramblerMask.set(KINDOF_SCORE); + CandidateForGPSScramblerMask.set(KINDOF_VEHICLE); + CandidateForGPSScramblerMask.set(KINDOF_INFANTRY); + CandidateForGPSScramblerMask.set(KINDOF_PORTABLE_STRUCTURE); + Bool candidate = fullTemplate->isAnyKindOf( CandidateForGPSScramblerMask ); + + Bool ret = false; std::vector::iterator it = m_info.begin(); while( it != m_info.end() ) { if( (it->interfaceMask & interfaceMask) != 0 && it->copiedFromDefault ) { - if ( it->inheritable ) + if ( it->inheritable ) { if( it->m_moduleTag.compare("ModuleTag_DefaultAutoHealBehavior") == 0 && !fullTemplate->isTrainable() ) { // Don't inherit this module if it is entirely useless to us. - it = m_info.erase( it ); - ret = true; + it = m_info.erase( it ); + ret = true; } else { ++it;//skip to the next nugget, 'cause we inherit this one } } - else if ( it->overrideableByLikeKind) - { - - AsciiString oldName = it->first; - if ( oldName == newName //we will dump this instance, since the INI author requested a specific one of the same class - || disallowed // or, we just do not Add these special overrideables to these kinds of templates, so just dump it - || candidate == FALSE ) - { - it = m_info.erase( it ); - ret = true; - } - else - ++it;//no match, preserve the default instnace of this Module for now - } - else // just dump this instance of this Module, since one of the same interface mask has been added by caller - { - it = m_info.erase( it ); - ret = true; - } - } - else + else if ( it->overrideableByLikeKind) + { + + AsciiString oldName = it->first; + if ( oldName == newName //we will dump this instance, since the INI author requested a specific one of the same class + || disallowed // or, we just do not Add these special overrideables to these kinds of templates, so just dump it + || candidate == FALSE ) + { + it = m_info.erase( it ); + ret = true; + } + else + ++it;//no match, preserve the default instnace of this Module for now + } + else // just dump this instance of this Module, since one of the same interface mask has been added by caller + { + it = m_info.erase( it ); + ret = true; + } + } + else + { ++it; + } } return ret; } - - - - - - - //------------------------------------------------------------------------------------------------- Bool ModuleInfo::clearAiModuleInfo() { @@ -611,7 +603,7 @@ void ThingTemplate::parseModuleName(INI* ini, void *instance, void* store, const } Bool inheritable = (self->m_moduleParsingMode == MODULEPARSE_INHERITABLE); - Bool overrideableByLikeKind = (self->m_moduleParsingMode == MODULEPARSE_OVERRIDEABLE_BY_LIKE_KIND); + Bool overrideableByLikeKind = (self->m_moduleParsingMode == MODULEPARSE_OVERRIDEABLE_BY_LIKE_KIND); mi->addModuleInfo(self, tokenStr, moduleTagStr, data, interfaceMask, inheritable, overrideableByLikeKind); } @@ -956,31 +948,31 @@ void ThingTemplate::parseWeaponTemplateSet( INI* ini, void *instance, void * /*s // Parse the "maxSimultaneousOfType" keyword void ThingTemplate::parseMaxSimultaneous(INI *ini, void *instance, void *store, const void *userData) { - // Most of the time, this is an UnsignedShort, but sometimes this is the keyword - // "DeterminedBySuperweaponRestriction" - const char DETERMINED_BY_SUPERWEAPON_KEYWORD[] = "DeterminedBySuperweaponRestriction"; - - ThingTemplate *myTemplate = (ThingTemplate *)instance; - DEBUG_ASSERTCRASH ( &myTemplate->m_maxSimultaneousOfType == store, ("Bad store passed to parseMaxSimultaneous" ) ); - - const char * token = ini->getNextToken(); - if ( stricmp( token, DETERMINED_BY_SUPERWEAPON_KEYWORD ) == 0 ) - { - myTemplate->m_maxSimultaneousDeterminedBySuperweaponRestriction = true; - *(UnsignedShort *)store = 0; - } - else - { - // Copied from parseUnsignedShort - Int value = INI::scanInt(token); - if (value < 0 || value > 65535) - { - DEBUG_CRASH(("Bad value parseMaxSimultaneous")); - throw ERROR_BUG; - } - *(UnsignedShort *)store = (UnsignedShort)value; - myTemplate->m_maxSimultaneousDeterminedBySuperweaponRestriction = false; - } + // Most of the time, this is an UnsignedShort, but sometimes this is the keyword + // "DeterminedBySuperweaponRestriction" + const char DETERMINED_BY_SUPERWEAPON_KEYWORD[] = "DeterminedBySuperweaponRestriction"; + + ThingTemplate *myTemplate = (ThingTemplate *)instance; + DEBUG_ASSERTCRASH ( &myTemplate->m_maxSimultaneousOfType == store, ("Bad store passed to parseMaxSimultaneous" ) ); + + const char * token = ini->getNextToken(); + if ( stricmp( token, DETERMINED_BY_SUPERWEAPON_KEYWORD ) == 0 ) + { + myTemplate->m_maxSimultaneousDeterminedBySuperweaponRestriction = true; + *(UnsignedShort *)store = 0; + } + else + { + // Copied from parseUnsignedShort + Int value = INI::scanInt(token); + if (value < 0 || value > 65535) + { + DEBUG_CRASH(("Bad value parseMaxSimultaneous")); + throw ERROR_BUG; + } + *(UnsignedShort *)store = (UnsignedShort)value; + myTemplate->m_maxSimultaneousDeterminedBySuperweaponRestriction = false; + } } @@ -1453,9 +1445,9 @@ const AudioEventRTS *ThingTemplate::getPerUnitSound(const AsciiString& soundName if (it == m_perUnitSounds.end()) { #ifndef DO_UNIT_TIMINGS - DEBUG_LOG(("Unknown Audio name (%s) asked for in ThingTemplate (%s).\n", soundName.str(), m_nameString.str())); + DEBUG_LOG(("Unknown Audio name (%s) asked for in ThingTemplate (%s).\n", soundName.str(), m_nameString.str())); #endif - return &s_audioEventNoSound; + return &s_audioEventNoSound; } return &(it->second); @@ -1464,17 +1456,14 @@ const AudioEventRTS *ThingTemplate::getPerUnitSound(const AsciiString& soundName //------------------------------------------------------------------------------------------------- UnsignedInt ThingTemplate::getMaxSimultaneousOfType() const { - if ( m_maxSimultaneousDeterminedBySuperweaponRestriction && TheGameLogic ) - { - return TheGameLogic->getSuperweaponRestriction(); - } + if ( m_maxSimultaneousDeterminedBySuperweaponRestriction && TheGameLogic ) + { + return TheGameLogic->getSuperweaponRestriction(); + } - return m_maxSimultaneousOfType; + return m_maxSimultaneousOfType; } - - - //------------------------------------------------------------------------------------------------- Bool ThingTemplate::isEquivalentTo(const ThingTemplate* tt) const { diff --git a/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp b/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp index 0bebce1fe7..6899be9a7c 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/UserPreferences.cpp @@ -819,6 +819,7 @@ Int GameSpyMiscPreferences::getMaxMessagesPerUpdate( void ) { return getInt("MaxMessagesPerUpdate", 100); } + //----------------------------------------------------------------------------- // IgnorePreferences base class //----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp index b0f514e246..be302d3fd9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp @@ -122,17 +122,17 @@ static const char *TheDrawableIconNames[] = * * OK, so it's a bit of a hack, but it saves memory in every Drawable */ -static DynamicAudioEventInfo * getNoSoundMarker() +static DynamicAudioEventInfo * getNoSoundMarker() { - static DynamicAudioEventInfo * marker = NULL; - - if ( marker == NULL ) - { - // Initialize first time function is called - marker = newInstance( DynamicAudioEventInfo ); - } + static DynamicAudioEventInfo * marker = NULL; + + if ( marker == NULL ) + { + // Initialize first time function is called + marker = newInstance( DynamicAudioEventInfo ); + } - return marker; + return marker; } @@ -205,8 +205,8 @@ DrawableLocoInfo::DrawableLocoInfo() m_wheelInfo.m_framesAirborne = 0; m_wheelInfo.m_wheelAngle = 0; - m_yawModulator = 0.0f; - m_pitchModulator = 0.0f; + m_yawModulator = 0.0f; + m_pitchModulator = 0.0f; } // ------------------------------------------------------------------------------------------------ @@ -387,9 +387,9 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit TheInGameUI->isDrawableCaptionBold() )); m_ambientSound = NULL; - m_ambientSoundEnabled = true; - m_ambientSoundEnabledFromScript = true; - + m_ambientSoundEnabled = true; + m_ambientSoundEnabledFromScript = true; + m_decalOpacityFadeTarget = 0; m_decalOpacityFadeRate = 0; m_decalOpacity = 0; @@ -446,8 +446,8 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit m_secondMaterialPassOpacity = 0.0f; m_drawableFullyObscuredByShroud = false; - m_receivesDynamicLights = TRUE; // a good default... overridden by one of my draw modules if at all - + m_receivesDynamicLights = TRUE; // a good default... overridden by one of my draw modules if at all + // allocate any modules we need to, we should keep // this at or near the end of the drawable construction so that we have // all the valid data about the thing when we create the module @@ -509,22 +509,22 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatus statusBit initStaticImages(); - // If we are inside GameLogic::startNewGame(), then starting the ambient sound - // will be taken care of by Drawable::onLevelStart(). It's important that we - // wait until Drawable::onLevelStart(), because we may have a customized ambient - // sound which we'll only learn about after the constructor is finished. The - // map maker may also have disabled the ambient sound; again, we only learn that - // after the constructor is done. - // By the same token, when loading from save, we may learn that the ambient sound - // is enabled or disabled in xfer(), and we may learn we have a customized sound there, - // so don't start the ambient sound yet. - // This is all really traceable to the fact that stopAmbientSound() won't stop a sound which - // is in the middle of playing; it will only stop it when the current wavefile is finished. - // So we have to be very careful of called startAmbientSound() because we can't "take it back" later. - if ( TheGameLogic != NULL && !TheGameLogic->isLoadingMap() && TheGameState != NULL && !TheGameState->isInLoadGame() ) - { - startAmbientSound(); - } + // If we are inside GameLogic::startNewGame(), then starting the ambient sound + // will be taken care of by Drawable::onLevelStart(). It's important that we + // wait until Drawable::onLevelStart(), because we may have a customized ambient + // sound which we'll only learn about after the constructor is finished. The + // map maker may also have disabled the ambient sound; again, we only learn that + // after the constructor is done. + // By the same token, when loading from save, we may learn that the ambient sound + // is enabled or disabled in xfer(), and we may learn we have a customized sound there, + // so don't start the ambient sound yet. + // This is all really traceable to the fact that stopAmbientSound() won't stop a sound which + // is in the middle of playing; it will only stop it when the current wavefile is finished. + // So we have to be very careful of called startAmbientSound() because we can't "take it back" later. + if ( TheGameLogic != NULL && !TheGameLogic->isLoadingMap() && TheGameState != NULL && !TheGameState->isInLoadGame() ) + { + startAmbientSound(); + } } // end Drawable @@ -563,7 +563,7 @@ Drawable::~Drawable() m_ambientSound = NULL; } - clearCustomSoundAmbient( false ); + clearCustomSoundAmbient( false ); /// @todo this is nasty, we need a real general effects system // remove any entries that might be present from the ray effect system @@ -635,10 +635,10 @@ Bool Drawable::getShouldAnimate( Bool considerPower ) const if (obj->isDisabled()) { if( - ! obj->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) && - // mal sez: helicopters just look goofy if they stop animating, so keep animating them, anyway + ! obj->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) && + // mal sez: helicopters just look goofy if they stop animating, so keep animating them, anyway - ( obj->isDisabledByType( DISABLED_HACKED ) + ( obj->isDisabledByType( DISABLED_HACKED ) || obj->isDisabledByType( DISABLED_PARALYZED ) || obj->isDisabledByType( DISABLED_EMP ) || obj->isDisabledByType( DISABLED_SUBDUED ) @@ -646,7 +646,7 @@ Bool Drawable::getShouldAnimate( Bool considerPower ) const // which have a slight barrel animation even when at rest). if this causes // a problem, we will need to fix gattling tanks in another way. || obj->isDisabledByType( DISABLED_UNMANNED ) ) - + ) return FALSE; @@ -1116,10 +1116,10 @@ void Drawable::reactToBodyDamageStateChange(BodyDamageType newState) MAKE_MODELCONDITION_MASK3(MODELCONDITION_DAMAGED, MODELCONDITION_REALLY_DAMAGED, MODELCONDITION_RUBBLE), newDamage); - // When loading map, ambient sound starting is handled by onLevelStart(), so that we can - // correctly react to customizations - if ( !TheGameLogic->isLoadingMap() ) - startAmbientSound(newState, TheGlobalData->m_timeOfDay); + // When loading map, ambient sound starting is handled by onLevelStart(), so that we can + // correctly react to customizations + if ( !TheGameLogic->isLoadingMap() ) + startAmbientSound(newState, TheGlobalData->m_timeOfDay); } //------------------------------------------------------------------------------------------------- @@ -1138,29 +1138,18 @@ void Drawable::setEffectiveOpacity( Real pulseFactor, Real explicitOpacity /* = m_effectiveStealthOpacity = m_stealthOpacity + pulseAmount; } ///< get alpha/opacity value used to override defaults when drawing. - - //------------------------------------------------------------------------------------------------- void Drawable::imitateStealthLook( Drawable& otherDraw ) { - m_stealthOpacity = otherDraw.friend_getStealthOpacity(); - m_explicitOpacity = otherDraw.friend_getExplicitOpacity(); - m_effectiveStealthOpacity = otherDraw.friend_getEffectiveStealthOpacity(); - m_hidden = otherDraw.isDrawableEffectivelyHidden(); - m_hiddenByStealth = otherDraw.isDrawableEffectivelyHidden(); - m_stealthLook = otherDraw.getStealthLook(); - m_secondMaterialPassOpacity = otherDraw.getSecondMaterialPassOpacity(); - + m_stealthOpacity = otherDraw.friend_getStealthOpacity(); + m_explicitOpacity = otherDraw.friend_getExplicitOpacity(); + m_effectiveStealthOpacity = otherDraw.friend_getEffectiveStealthOpacity(); + m_hidden = otherDraw.isDrawableEffectivelyHidden(); + m_hiddenByStealth = otherDraw.isDrawableEffectivelyHidden(); + m_stealthLook = otherDraw.getStealthLook(); + m_secondMaterialPassOpacity = otherDraw.getSecondMaterialPassOpacity(); } - - - - - - - - //------------------------------------------------------------------------------------------------- /** update is called once per frame */ //------------------------------------------------------------------------------------------------- @@ -1272,9 +1261,8 @@ void Drawable::updateDrawable( void ) if (m_colorTintEnvelope == NULL) m_colorTintEnvelope = newInstance(TintEnvelope); - m_colorTintEnvelope->play( isKindOf( KINDOF_INFANTRY) ? &FRENZY_COLOR_INFANTRY:&FRENZY_COLOR, 30, 30, SUSTAIN_INDEFINITELY); - - } + m_colorTintEnvelope->play( isKindOf( KINDOF_INFANTRY) ? &FRENZY_COLOR_INFANTRY:&FRENZY_COLOR, 30, 30, SUSTAIN_INDEFINITELY); + } // else if ( testTintStatus( TINT_STATUS_POISONED) ) // { // if (m_colorTintEnvelope == NULL) @@ -1312,47 +1300,47 @@ void Drawable::updateDrawable( void ) m_selectionFlashEnvelope->update(); // selection flashing //If we have an ambient sound, and we aren't currently playing it, attempt to play it now. - // However, if the attached sound is a one-shot (non-looping) sound, don't restart it -- only - // start it ONCE. The problem is, looping sounds need to keep being restarted. Why? Because - // MilesAudioManager will kill the sound (in MilesAudioManager::processPlayingList) if gets - // out of range. Looping ambient sounds need to restart if the user moves back into range. - // The MilesAudioManager doesn't handle this, so we need to keep checking looping sounds - // to see if they are in range. But this messes up non-looping sounds -- they keep looping! - // End result: a hack of testing the looping bit and only restarting the sound if the looping - // bit is on and the loop count is 0 (loop forever). - if( m_ambientSound && m_ambientSoundEnabled && m_ambientSoundEnabledFromScript && - !m_ambientSound->m_event.getEventName().isEmpty() && !m_ambientSound->m_event.isCurrentlyPlaying() ) - { - const AudioEventInfo * eventInfo = m_ambientSound->m_event.getAudioEventInfo(); - - if ( eventInfo == NULL && TheAudio != NULL ) - { - // We'll need this in a second anyway so cache it - TheAudio->getInfoForAudioEvent( &m_ambientSound->m_event ); - eventInfo = m_ambientSound->m_event.getAudioEventInfo(); - } + // However, if the attached sound is a one-shot (non-looping) sound, don't restart it -- only + // start it ONCE. The problem is, looping sounds need to keep being restarted. Why? Because + // MilesAudioManager will kill the sound (in MilesAudioManager::processPlayingList) if gets + // out of range. Looping ambient sounds need to restart if the user moves back into range. + // The MilesAudioManager doesn't handle this, so we need to keep checking looping sounds + // to see if they are in range. But this messes up non-looping sounds -- they keep looping! + // End result: a hack of testing the looping bit and only restarting the sound if the looping + // bit is on and the loop count is 0 (loop forever). + if( m_ambientSound && m_ambientSoundEnabled && m_ambientSoundEnabledFromScript && + !m_ambientSound->m_event.getEventName().isEmpty() && !m_ambientSound->m_event.isCurrentlyPlaying() ) + { + const AudioEventInfo * eventInfo = m_ambientSound->m_event.getAudioEventInfo(); + + if ( eventInfo == NULL && TheAudio != NULL ) + { + // We'll need this in a second anyway so cache it + TheAudio->getInfoForAudioEvent( &m_ambientSound->m_event ); + eventInfo = m_ambientSound->m_event.getAudioEventInfo(); + } - if ( eventInfo == NULL || ( eventInfo->isPermanentSound() ) ) - { - startAmbientSound(); - } - } + if ( eventInfo == NULL || ( eventInfo->isPermanentSound() ) ) + { + startAmbientSound(); + } + } } //------------------------------------------------------------------------------------------------- // Called just after the level loads. Only called for NEW games, not save games. void Drawable::onLevelStart() { - // Make sure the current ambient sound is playing if it should be playing. Needed because - // the call to startAmbientSound in the constructor is too early to - // actually start the sound if the constructor is called during level load. - if( m_ambientSoundEnabled && m_ambientSoundEnabledFromScript && - ( m_ambientSound == NULL || - ( !m_ambientSound->m_event.getEventName().isEmpty() && !m_ambientSound->m_event.isCurrentlyPlaying() ) ) ) - { - // Unlike the check in the update() function, we want to do this for looping & one-shot sounds equally - startAmbientSound(); - } + // Make sure the current ambient sound is playing if it should be playing. Needed because + // the call to startAmbientSound in the constructor is too early to + // actually start the sound if the constructor is called during level load. + if( m_ambientSoundEnabled && m_ambientSoundEnabledFromScript && + ( m_ambientSound == NULL || + ( !m_ambientSound->m_event.getEventName().isEmpty() && !m_ambientSound->m_event.isCurrentlyPlaying() ) ) ) + { + // Unlike the check in the update() function, we want to do this for looping & one-shot sounds equally + startAmbientSound(); + } } //------------------------------------------------------------------------------------------------- @@ -1405,7 +1393,6 @@ void Drawable::applyPhysicsXform(Matrix3D* mtx) mtx->Rotate_Y( info.m_totalPitch ); mtx->Rotate_X( -info.m_totalRoll ); mtx->Rotate_Z( info.m_totalYaw ); - } } @@ -1448,19 +1435,19 @@ Bool Drawable::calcPhysicsXform(PhysicsXformInfo& info) } } - if (hasPhysicsXform) - { - // HOTFIX: Ensure that we are not passing denormalized values back to caller - // @todo remove hotfix - if (info.m_totalPitch>-1e-20f&&info.m_totalPitch<1e-20f) - info.m_totalPitch=0.f; - if (info.m_totalRoll>-1e-20f&&info.m_totalRoll<1e-20f) - info.m_totalRoll=0.f; - if (info.m_totalYaw>-1e-20f&&info.m_totalYaw<1e-20f) - info.m_totalYaw=0.f; - if (info.m_totalZ>-1e-20f&&info.m_totalZ<1e-20f) - info.m_totalZ=0.f; - } + if (hasPhysicsXform) + { + // HOTFIX: Ensure that we are not passing denormalized values back to caller + // @todo remove hotfix + if (info.m_totalPitch>-1e-20f&&info.m_totalPitch<1e-20f) + info.m_totalPitch=0.f; + if (info.m_totalRoll>-1e-20f&&info.m_totalRoll<1e-20f) + info.m_totalRoll=0.f; + if (info.m_totalYaw>-1e-20f&&info.m_totalYaw<1e-20f) + info.m_totalYaw=0.f; + if (info.m_totalZ>-1e-20f&&info.m_totalZ<1e-20f) + info.m_totalZ=0.f; + } return hasPhysicsXform; } @@ -1564,7 +1551,6 @@ void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, Physics const Real LATERAL_ACCEL_COEFF = locomotor->getLateralAccelCoef(); const Real UNIFORM_AXIAL_DAMPING = locomotor->getUniformAxialDamping(); - // get object from logic Object *obj = getObject(); if (obj == NULL) @@ -1649,9 +1635,8 @@ void Drawable::calcPhysicsXformHoverOrWings( const Locomotor *locomotor, Physics const Real ELEVATOR_CORRECTION_DEGREE = locomotor->getElevatorCorrectionDegree(); const Real ELEVATOR_CORRECTION_RATE = locomotor->getElevatorCorrectionRate(); - info.m_totalYaw = RUDDER_CORRECTION_DEGREE * sin( m_locoInfo->m_yawModulator += RUDDER_CORRECTION_RATE ); - info.m_totalPitch += ELEVATOR_CORRECTION_DEGREE * cos( m_locoInfo->m_pitchModulator += ELEVATOR_CORRECTION_RATE ); - + info.m_totalYaw = RUDDER_CORRECTION_DEGREE * sin( m_locoInfo->m_yawModulator += RUDDER_CORRECTION_RATE ); + info.m_totalPitch += ELEVATOR_CORRECTION_DEGREE * cos( m_locoInfo->m_pitchModulator += ELEVATOR_CORRECTION_RATE ); info.m_totalZ = 0.0f; } @@ -2636,15 +2621,15 @@ void Drawable::setStealthLook(StealthLookType look) void Drawable::draw( View *view ) { - if ( testTintStatus( TINT_STATUS_FRENZY ) == FALSE ) - { - if ( getObject() && getObject()->isEffectivelyDead() ) - m_secondMaterialPassOpacity = 0.0f;//dead folks don't stealth anyway - else if ( m_secondMaterialPassOpacity > VERY_TRANSPARENT_MATERIAL_PASS_OPACITY )// keep fading any add'l material unless something has set it to zero - m_secondMaterialPassOpacity *= MATERIAL_PASS_OPACITY_FADE_SCALAR; - else - m_secondMaterialPassOpacity = 0.0f; - } + if ( testTintStatus( TINT_STATUS_FRENZY ) == FALSE ) + { + if ( getObject() && getObject()->isEffectivelyDead() ) + m_secondMaterialPassOpacity = 0.0f;//dead folks don't stealth anyway + else if ( m_secondMaterialPassOpacity > VERY_TRANSPARENT_MATERIAL_PASS_OPACITY )// keep fading any add'l material unless something has set it to zero + m_secondMaterialPassOpacity *= MATERIAL_PASS_OPACITY_FADE_SCALAR; + else + m_secondMaterialPassOpacity = 0.0f; + } if (m_hidden || m_hiddenByStealth || getFullyObscuredByShroud()) @@ -3370,7 +3355,7 @@ void Drawable::drawEnthusiastic(const IRegion2D* healthBarRegion) scale = 0.75f; else scale = 0.5f; - + Int frameWidth = getIconInfo()->m_icon[ iconIndex ]->getCurrentFrameWidth() * scale; Int frameHeight = getIconInfo()->m_icon[ iconIndex ]->getCurrentFrameHeight() * scale; @@ -3744,8 +3729,8 @@ void Drawable::drawConstructPercent( const IRegion2D *healthBarRegion ) // convert drawable center position to screen coords TheTacticalView->worldToScreen( &pos, &screen ); - if ( screen.x < 1 ) - return; + if ( screen.x < 1 ) + return; // draw the text Color color = GameMakeColor( 255, 255, 255, 255 ); @@ -4385,11 +4370,11 @@ void Drawable::setTimeOfDay(TimeOfDay tod) */ const AudioEventInfo * Drawable::getBaseSoundAmbientInfo() const { - const AudioEventRTS * baseAmbient = getTemplate()->getSoundAmbient(); - if ( baseAmbient ) - return baseAmbient->getAudioEventInfo(); + const AudioEventRTS * baseAmbient = getTemplate()->getSoundAmbient(); + if ( baseAmbient ) + return baseAmbient->getAudioEventInfo(); - return NULL; + return NULL; } /** @@ -4397,10 +4382,10 @@ const AudioEventInfo * Drawable::getBaseSoundAmbientInfo() const */ void Drawable::mangleCustomAudioName( DynamicAudioEventInfo * audioToMangle ) const { - AsciiString customizedName; - customizedName.format( " CUSTOM %d ", (Int)getID() ); // Note space at beginning prevents collision with any names from INI file - customizedName.concat( audioToMangle->m_audioName ); - audioToMangle->overrideAudioName( customizedName ); + AsciiString customizedName; + customizedName.format( " CUSTOM %d ", (Int)getID() ); // Note space at beginning prevents collision with any names from INI file + customizedName.concat( audioToMangle->m_audioName ); + audioToMangle->overrideAudioName( customizedName ); } /** @@ -4408,9 +4393,9 @@ void Drawable::mangleCustomAudioName( DynamicAudioEventInfo * audioToMangle ) co */ void Drawable::setCustomSoundAmbientOff() { - clearCustomSoundAmbient( false ); - - m_customSoundAmbientInfo = getNoSoundMarker(); + clearCustomSoundAmbient( false ); + + m_customSoundAmbientInfo = getNoSoundMarker(); } /** @@ -4419,17 +4404,17 @@ void Drawable::setCustomSoundAmbientOff() */ void Drawable::setCustomSoundAmbientInfo( DynamicAudioEventInfo * customAmbientInfo ) { - clearCustomSoundAmbient( false ); + clearCustomSoundAmbient( false ); - // This is mostly to make sure no one delete's the no sound marker, causing it to be - // recycled as a new no sound marker - DEBUG_ASSERTCRASH( customAmbientInfo != getNoSoundMarker(), ("No sound marker passed as custom ambient") ); + // This is mostly to make sure no one delete's the no sound marker, causing it to be + // recycled as a new no sound marker + DEBUG_ASSERTCRASH( customAmbientInfo != getNoSoundMarker(), ("No sound marker passed as custom ambient") ); - // Set name to something different so we don't get confused + // Set name to something different so we don't get confused - m_customSoundAmbientInfo = customAmbientInfo; + m_customSoundAmbientInfo = customAmbientInfo; - startAmbientSound(); // Note: checks for enabled flag + startAmbientSound(); // Note: checks for enabled flag } /** @@ -4437,21 +4422,21 @@ void Drawable::setCustomSoundAmbientInfo( DynamicAudioEventInfo * customAmbientI */ void Drawable::clearCustomSoundAmbient( bool restartSound ) { - if ( m_ambientSound ) - { - // Make sure sound doesn't keep a reference to the deleted pointer - m_ambientSound->m_event.setAudioEventInfo( NULL ); - } + if ( m_ambientSound ) + { + // Make sure sound doesn't keep a reference to the deleted pointer + m_ambientSound->m_event.setAudioEventInfo( NULL ); + } - // Stop using old info - stopAmbientSound(); + // Stop using old info + stopAmbientSound(); - m_customSoundAmbientInfo = NULL; - - if ( restartSound ) - { - startAmbientSound(); // Note: checks for enabled flag - } + m_customSoundAmbientInfo = NULL; + + if ( restartSound ) + { + startAmbientSound(); // Note: checks for enabled flag + } } @@ -4462,80 +4447,80 @@ void Drawable::startAmbientSound(BodyDamageType dt, TimeOfDay tod, Bool onlyIfPe { stopAmbientSound(); - Bool trySound = FALSE; + Bool trySound = FALSE; - // Look for customized sound info - if ( dt != BODY_RUBBLE && m_customSoundAmbientInfo != NULL ) - { - if ( m_customSoundAmbientInfo != getNoSoundMarker() ) - { - if (m_ambientSound == NULL) - m_ambientSound = newInstance(DynamicAudioEventRTS); - - // Make sure m_event will accept the custom info - m_ambientSound->m_event.setEventName( m_customSoundAmbientInfo->m_audioName ); - m_ambientSound->m_event.setAudioEventInfo( m_customSoundAmbientInfo ); - trySound = TRUE; - } - } - else - { - // Didn't get customized sound - //Get the specific ambient sound for the damage type. - const AudioEventRTS& audio = getAmbientSoundByDamage(dt); - if( audio.getEventName().isNotEmpty() ) - { - if (m_ambientSound == NULL) - m_ambientSound = newInstance(DynamicAudioEventRTS); - - (m_ambientSound->m_event) = audio; - trySound = TRUE; - } - else if( dt != BODY_PRISTINE && dt != BODY_RUBBLE ) - { - //If the ambient sound was absent in the case of non-pristine damage types, - //try getting the pristine one. Most of our cases actually specify just the - //pristine sound and want to use it for all states (except dead/rubble). - const AudioEventRTS& pristineAudio = getAmbientSoundByDamage( BODY_PRISTINE ); - if( pristineAudio.getEventName().isNotEmpty() ) - { - if (m_ambientSound == NULL) - m_ambientSound = newInstance(DynamicAudioEventRTS); - (m_ambientSound->m_event) = pristineAudio; - trySound = TRUE; - } - } - } - + // Look for customized sound info + if ( dt != BODY_RUBBLE && m_customSoundAmbientInfo != NULL ) + { + if ( m_customSoundAmbientInfo != getNoSoundMarker() ) + { + if (m_ambientSound == NULL) + m_ambientSound = newInstance(DynamicAudioEventRTS); + + // Make sure m_event will accept the custom info + m_ambientSound->m_event.setEventName( m_customSoundAmbientInfo->m_audioName ); + m_ambientSound->m_event.setAudioEventInfo( m_customSoundAmbientInfo ); + trySound = TRUE; + } + } + else + { + // Didn't get customized sound + //Get the specific ambient sound for the damage type. + const AudioEventRTS& audio = getAmbientSoundByDamage(dt); + if( audio.getEventName().isNotEmpty() ) + { + if (m_ambientSound == NULL) + m_ambientSound = newInstance(DynamicAudioEventRTS); + + (m_ambientSound->m_event) = audio; + trySound = TRUE; + } + else if( dt != BODY_PRISTINE && dt != BODY_RUBBLE ) + { + //If the ambient sound was absent in the case of non-pristine damage types, + //try getting the pristine one. Most of our cases actually specify just the + //pristine sound and want to use it for all states (except dead/rubble). + const AudioEventRTS& pristineAudio = getAmbientSoundByDamage( BODY_PRISTINE ); + if( pristineAudio.getEventName().isNotEmpty() ) + { + if (m_ambientSound == NULL) + m_ambientSound = newInstance(DynamicAudioEventRTS); + (m_ambientSound->m_event) = pristineAudio; + trySound = TRUE; + } + } + } + if( trySound && m_ambientSound ) { const AudioEventInfo *info = m_ambientSound->m_event.getAudioEventInfo(); if( info ) { - if ( !onlyIfPermanent || info->isPermanentSound() ) - { - if( BitIsSet( info->m_type, ST_GLOBAL) || info->m_priority == AP_CRITICAL ) - { - //Play it anyways. - m_ambientSound->m_event.setDrawableID(getID()); - m_ambientSound->m_event.setTimeOfDay(tod); - m_ambientSound->m_event.setPlayingHandle(TheAudio->addAudioEvent( &m_ambientSound->m_event )); - } - else - { - //Check if it's close enough to try playing (optimization) - Coord3D vector = *getPosition(); - vector.sub( TheAudio->getListenerPosition() ); - Real distSqr = vector.lengthSqr(); - if( distSqr < sqr( info->m_maxDistance ) ) - { - m_ambientSound->m_event.setDrawableID(getID()); - m_ambientSound->m_event.setTimeOfDay(tod); - m_ambientSound->m_event.setPlayingHandle(TheAudio->addAudioEvent( &m_ambientSound->m_event )); - } - } - } + if ( !onlyIfPermanent || info->isPermanentSound() ) + { + if( BitIsSet( info->m_type, ST_GLOBAL) || info->m_priority == AP_CRITICAL ) + { + //Play it anyways. + m_ambientSound->m_event.setDrawableID(getID()); + m_ambientSound->m_event.setTimeOfDay(tod); + m_ambientSound->m_event.setPlayingHandle(TheAudio->addAudioEvent( &m_ambientSound->m_event )); + } + else + { + //Check if it's close enough to try playing (optimization) + Coord3D vector = *getPosition(); + vector.sub( TheAudio->getListenerPosition() ); + Real distSqr = vector.lengthSqr(); + if( distSqr < sqr( info->m_maxDistance ) ) + { + m_ambientSound->m_event.setDrawableID(getID()); + m_ambientSound->m_event.setTimeOfDay(tod); + m_ambientSound->m_event.setPlayingHandle(TheAudio->addAudioEvent( &m_ambientSound->m_event )); + } + } + } } else { @@ -4551,11 +4536,11 @@ void Drawable::startAmbientSound(BodyDamageType dt, TimeOfDay tod, Bool onlyIfPe //------------------------------------------------------------------------------------------------- void Drawable::startAmbientSound( Bool onlyIfPermanent ) { - // Must go through enableAmbientSound() if sound is disabled - if ( !m_ambientSoundEnabled || !m_ambientSoundEnabledFromScript ) - return; - - stopAmbientSound(); + // Must go through enableAmbientSound() if sound is disabled + if ( !m_ambientSoundEnabled || !m_ambientSoundEnabledFromScript ) + return; + + stopAmbientSound(); BodyDamageType bodyCondition = BODY_PRISTINE; Object *obj = getObject(); if( obj ) @@ -4603,21 +4588,21 @@ void Drawable::enableAmbientSound( Bool enable ) // Enable and disable sound because the map designer wants us too void Drawable::enableAmbientSoundFromScript( Bool enable ) { - // Note: deliberately skipping if( m_ambientSoundEnabledFromScript == enable ) check here - // Allow ENABLE_OBJECT_SOUND to trigger one-shot attached sound multiple times + // Note: deliberately skipping if( m_ambientSoundEnabledFromScript == enable ) check here + // Allow ENABLE_OBJECT_SOUND to trigger one-shot attached sound multiple times - m_ambientSoundEnabledFromScript = enable; - if( enable ) - { - if ( m_ambientSoundEnabled ) - { - startAmbientSound(); - } - } - else - { - stopAmbientSound(); - } + m_ambientSoundEnabledFromScript = enable; + if( enable ) + { + if ( m_ambientSoundEnabled ) + { + startAmbientSound(); + } + } + else + { + stopAmbientSound(); + } } @@ -4917,8 +4902,8 @@ void Drawable::xferDrawableModules( Xfer *xfer ) * during the module xfer (CBD) * 4: Added m_ambientSoundEnabled flag * 5: save full mtx, not pos+orient. - * 6: Added m_ambientSoundEnabledFromScript flag - * 7: Save the customize ambient sound info + * 6: Added m_ambientSoundEnabledFromScript flag + * 7: Save the customize ambient sound info */ // ------------------------------------------------------------------------------------------------ void Drawable::xfer( Xfer *xfer ) @@ -5314,105 +5299,105 @@ void Drawable::xfer( Xfer *xfer ) m_isModelDirty = TRUE; #endif - if( xfer->getXferMode() == XFER_LOAD ) - { - stopAmbientSound(); // Restarted in loadPostProcess() - } + if( xfer->getXferMode() == XFER_LOAD ) + { + stopAmbientSound(); // Restarted in loadPostProcess() + } - if( version >= 4 ) + if( version >= 4 ) { xfer->xferBool( &m_ambientSoundEnabled ); } - if( version >= 6 ) - { - xfer->xferBool( &m_ambientSoundEnabledFromScript ); - } + if( version >= 6 ) + { + xfer->xferBool( &m_ambientSoundEnabledFromScript ); + } - if ( version >= 7 ) - { - Bool customized = ( m_customSoundAmbientInfo != NULL ); - xfer->xferBool( &customized ); + if ( version >= 7 ) + { + Bool customized = ( m_customSoundAmbientInfo != NULL ); + xfer->xferBool( &customized ); - if ( customized ) - { - Bool customizedToSilence = ( m_customSoundAmbientInfo == getNoSoundMarker() ); - - xfer->xferBool( &customizedToSilence ); - if ( xfer->getXferMode() == XFER_LOAD ) - { - if ( customizedToSilence ) - { - setCustomSoundAmbientOff(); - } - else - { - AsciiString baseInfoName; - xfer->xferAsciiString( &baseInfoName ); - - const AudioEventInfo * baseInfo = TheAudio->findAudioEventInfo( baseInfoName ); - DynamicAudioEventInfo * customizedInfo; - Bool successfulLoad = true; - - if ( baseInfo == NULL ) - { - DEBUG_CRASH( ( "Load failed to load customized ambient sound because sound '%s' no longer exists", baseInfoName.str() ) ); - - // Keep trying to load if we possibly can... Don't completely ruin save files just because an old sound - // entry in the INI files was removed or renamed - customizedInfo = newInstance( DynamicAudioEventInfo ); - successfulLoad = false; - } - else - { - customizedInfo = newInstance( DynamicAudioEventInfo )( *baseInfo ); - } - - try - { - // Get custom name back - mangleCustomAudioName( customizedInfo ); - - customizedInfo->xferNoName( xfer ); - - if ( successfulLoad ) - { - TheAudio->addAudioEventInfo( customizedInfo ); - - clearCustomSoundAmbient( false ); - m_customSoundAmbientInfo = customizedInfo; - - customizedInfo = NULL; // Belongs to TheAudio now - } - else - { - customizedInfo->deleteInstance(); - customizedInfo = NULL; - } - } - catch( ... ) - { - // since Xfer can throw exceptions -- don't leak memory! - if ( customizedInfo != NULL ) - customizedInfo->deleteInstance(); - - throw; //rethrow - } - } - } - else // else we are saving... - { - if ( !customizedToSilence ) - { - AsciiString baseInfoName = m_customSoundAmbientInfo->getOriginalName(); - xfer->xferAsciiString( &baseInfoName ); - m_customSoundAmbientInfo->xferNoName( xfer ); - } - } - } - } -} // end xfer + if ( customized ) + { + Bool customizedToSilence = ( m_customSoundAmbientInfo == getNoSoundMarker() ); + + xfer->xferBool( &customizedToSilence ); + if ( xfer->getXferMode() == XFER_LOAD ) + { + if ( customizedToSilence ) + { + setCustomSoundAmbientOff(); + } + else + { + AsciiString baseInfoName; + xfer->xferAsciiString( &baseInfoName ); + + const AudioEventInfo * baseInfo = TheAudio->findAudioEventInfo( baseInfoName ); + DynamicAudioEventInfo * customizedInfo; + Bool successfulLoad = true; + + if ( baseInfo == NULL ) + { + DEBUG_CRASH( ( "Load failed to load customized ambient sound because sound '%s' no longer exists", baseInfoName.str() ) ); + + // Keep trying to load if we possibly can... Don't completely ruin save files just because an old sound + // entry in the INI files was removed or renamed + customizedInfo = newInstance( DynamicAudioEventInfo ); + successfulLoad = false; + } + else + { + customizedInfo = newInstance( DynamicAudioEventInfo )( *baseInfo ); + } + + try + { + // Get custom name back + mangleCustomAudioName( customizedInfo ); + + customizedInfo->xferNoName( xfer ); + + if ( successfulLoad ) + { + TheAudio->addAudioEventInfo( customizedInfo ); + + clearCustomSoundAmbient( false ); + m_customSoundAmbientInfo = customizedInfo; + + customizedInfo = NULL; // Belongs to TheAudio now + } + else + { + customizedInfo->deleteInstance(); + customizedInfo = NULL; + } + } + catch( ... ) + { + // since Xfer can throw exceptions -- don't leak memory! + if ( customizedInfo != NULL ) + customizedInfo->deleteInstance(); + + throw; //rethrow + } + } + } + else // else we are saving... + { + if ( !customizedToSilence ) + { + AsciiString baseInfoName = m_customSoundAmbientInfo->getOriginalName(); + xfer->xferAsciiString( &baseInfoName ); + m_customSoundAmbientInfo->xferNoName( xfer ); + } + } + } + } +} // end xfer // ------------------------------------------------------------------------------------------------ /** Load post process */ @@ -5428,14 +5413,14 @@ void Drawable::loadPostProcess( void ) if( m_ambientSoundEnabled && m_ambientSoundEnabledFromScript ) { - // Do we actually want to start the ambient sound up? - // If it is a permanent sound, then yes; but if it is - // a one-shot sound, we don't want to start it even - // if it's enabled (because the sound might have finished - // playing long ago). This is what the "onlyIfPermanent" - // parameter does -- almost like it was added just for - // this special case! - startAmbientSound( true ); + // Do we actually want to start the ambient sound up? + // If it is a permanent sound, then yes; but if it is + // a one-shot sound, we don't want to start it even + // if it's enabled (because the sound might have finished + // playing long ago). This is what the "onlyIfPermanent" + // parameter does -- almost like it was added just for + // this special case! + startAmbientSound( true ); } else { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp index 4721b0e348..bbe8e746c9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Eva.cpp @@ -45,40 +45,40 @@ const char *TheEvaMessageNames[] = "SUPERWEAPONDETECTED_OWN_PARTICLECANNON", "SUPERWEAPONDETECTED_OWN_NUKE", "SUPERWEAPONDETECTED_OWN_SCUDSTORM", - "SUPERWEAPONDETECTED_ALLY_PARTICLECANNON", - "SUPERWEAPONDETECTED_ALLY_NUKE", - "SUPERWEAPONDETECTED_ALLY_SCUDSTORM", - "SUPERWEAPONDETECTED_ENEMY_PARTICLECANNON", - "SUPERWEAPONDETECTED_ENEMY_NUKE", - "SUPERWEAPONDETECTED_ENEMY_SCUDSTORM", + "SUPERWEAPONDETECTED_ALLY_PARTICLECANNON", + "SUPERWEAPONDETECTED_ALLY_NUKE", + "SUPERWEAPONDETECTED_ALLY_SCUDSTORM", + "SUPERWEAPONDETECTED_ENEMY_PARTICLECANNON", + "SUPERWEAPONDETECTED_ENEMY_NUKE", + "SUPERWEAPONDETECTED_ENEMY_SCUDSTORM", "SUPERWEAPONLAUNCHED_OWN_PARTICLECANNON", "SUPERWEAPONLAUNCHED_OWN_NUKE", "SUPERWEAPONLAUNCHED_OWN_SCUDSTORM", - "SUPERWEAPONLAUNCHED_ALLY_PARTICLECANNON", - "SUPERWEAPONLAUNCHED_ALLY_NUKE", - "SUPERWEAPONLAUNCHED_ALLY_SCUDSTORM", - "SUPERWEAPONLAUNCHED_ENEMY_PARTICLECANNON", - "SUPERWEAPONLAUNCHED_ENEMY_NUKE", - "SUPERWEAPONLAUNCHED_ENEMY_SCUDSTORM", - "SUPERWEAPONREADY_OWN_PARTICLECANNON", - "SUPERWEAPONREADY_OWN_NUKE", - "SUPERWEAPONREADY_OWN_SCUDSTORM", - "SUPERWEAPONREADY_ALLY_PARTICLECANNON", - "SUPERWEAPONREADY_ALLY_NUKE", - "SUPERWEAPONREADY_ALLY_SCUDSTORM", - "SUPERWEAPONREADY_ENEMY_PARTICLECANNON", - "SUPERWEAPONREADY_ENEMY_NUKE", - "SUPERWEAPONREADY_ENEMY_SCUDSTORM", + "SUPERWEAPONLAUNCHED_ALLY_PARTICLECANNON", + "SUPERWEAPONLAUNCHED_ALLY_NUKE", + "SUPERWEAPONLAUNCHED_ALLY_SCUDSTORM", + "SUPERWEAPONLAUNCHED_ENEMY_PARTICLECANNON", + "SUPERWEAPONLAUNCHED_ENEMY_NUKE", + "SUPERWEAPONLAUNCHED_ENEMY_SCUDSTORM", + "SUPERWEAPONREADY_OWN_PARTICLECANNON", + "SUPERWEAPONREADY_OWN_NUKE", + "SUPERWEAPONREADY_OWN_SCUDSTORM", + "SUPERWEAPONREADY_ALLY_PARTICLECANNON", + "SUPERWEAPONREADY_ALLY_NUKE", + "SUPERWEAPONREADY_ALLY_SCUDSTORM", + "SUPERWEAPONREADY_ENEMY_PARTICLECANNON", + "SUPERWEAPONREADY_ENEMY_NUKE", + "SUPERWEAPONREADY_ENEMY_SCUDSTORM", "BUILDINGLOST", "BASEUNDERATTACK", "ALLYUNDERATTACK", "BEACONDETECTED", - "ENEMYBLACKLOTUSDETECTED", - "ENEMYJARMENKELLDETECTED", - "ENEMYCOLONELBURTONDETECTED", - "OWNBLACKLOTUSDETECTED", - "OWNJARMENKELLDETECTED", - "OWNCOLONELBURTONDETECTED", + "ENEMYBLACKLOTUSDETECTED", + "ENEMYJARMENKELLDETECTED", + "ENEMYCOLONELBURTONDETECTED", + "OWNBLACKLOTUSDETECTED", + "OWNJARMENKELLDETECTED", + "OWNCOLONELBURTONDETECTED", "UNITLOST", "GENERALLEVELUP", "VEHICLESTOLEN", @@ -87,12 +87,12 @@ const char *TheEvaMessageNames[] = "UPGRADECOMPLETE", "BUILDINGBEINGSTOLEN", "BUILDINGSABOTAGED", - "SUPERWEAPONLAUNCHED_OWN_GPS_SCRAMBLER", - "SUPERWEAPONLAUNCHED_ALLY_GPS_SCRAMBLER", - "SUPERWEAPONLAUNCHED_ENEMY_GPS_SCRAMBLER", - "SUPERWEAPONLAUNCHED_OWN_SNEAK_ATTACK", - "SUPERWEAPONLAUNCHED_ALLY_SNEAK_ATTACK", - "SUPERWEAPONLAUNCHED_ENEMY_SNEAK_ATTACK", + "SUPERWEAPONLAUNCHED_OWN_GPS_SCRAMBLER", + "SUPERWEAPONLAUNCHED_ALLY_GPS_SCRAMBLER", + "SUPERWEAPONLAUNCHED_ENEMY_GPS_SCRAMBLER", + "SUPERWEAPONLAUNCHED_OWN_SNEAK_ATTACK", + "SUPERWEAPONLAUNCHED_ALLY_SNEAK_ATTACK", + "SUPERWEAPONLAUNCHED_ENEMY_SNEAK_ATTACK", //**************************************************************************** //Kris: Don't forget to add another handler below -- it's ghey-ly implemented. @@ -124,39 +124,39 @@ const ShouldPlayFunc Eva::s_shouldPlayFuncs[] = Eva::shouldPlayGenericHandler, Eva::shouldPlayGenericHandler, Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, - Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, + Eva::shouldPlayGenericHandler, NULL, }; @@ -321,9 +321,9 @@ void Eva::update() //------------------------------------------------------------------------------------------------- EvaMessage Eva::nameToMessage(const AsciiString& name) { - DEBUG_ASSERTCRASH( ELEMENTS_OF( TheEvaMessageNames ) == EVA_COUNT + 1, ("TheEvaMessageNames out of sync" ) ); - DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT ], "EVA_INVALID" ) == 0, ("TheEvaMessageNames out of sync" ) ); - DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT - 1], "EVA_INVALID" ) != 0, ("TheEvaMessageNames out of sync" ) ); + DEBUG_ASSERTCRASH( ELEMENTS_OF( TheEvaMessageNames ) == EVA_COUNT + 1, ("TheEvaMessageNames out of sync" ) ); + DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT ], "EVA_INVALID" ) == 0, ("TheEvaMessageNames out of sync" ) ); + DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT - 1], "EVA_INVALID" ) != 0, ("TheEvaMessageNames out of sync" ) ); for (Int i = EVA_FIRST; i < EVA_COUNT; ++i) { if (name.compareNoCase(TheEvaMessageNames[i]) == 0) { @@ -338,11 +338,11 @@ EvaMessage Eva::nameToMessage(const AsciiString& name) //------------------------------------------------------------------------------------------------- AsciiString Eva::messageToName(EvaMessage message) { - DEBUG_ASSERTCRASH( ELEMENTS_OF( TheEvaMessageNames ) == EVA_COUNT + 1, ("TheEvaMessageNames out of sync" ) ); - DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT ], "EVA_INVALID" ) == 0, ("TheEvaMessageNames out of sync" ) ); - DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT - 1], "EVA_INVALID" ) != 0, ("TheEvaMessageNames out of sync" ) ); + DEBUG_ASSERTCRASH( ELEMENTS_OF( TheEvaMessageNames ) == EVA_COUNT + 1, ("TheEvaMessageNames out of sync" ) ); + DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT ], "EVA_INVALID" ) == 0, ("TheEvaMessageNames out of sync" ) ); + DEBUG_ASSERTCRASH( stricmp( TheEvaMessageNames[ EVA_COUNT - 1], "EVA_INVALID" ) != 0, ("TheEvaMessageNames out of sync" ) ); - if (message >= EVA_FIRST && message < EVA_COUNT) + if (message >= EVA_FIRST && message < EVA_COUNT) return TheEvaMessageNames[message]; DEBUG_CRASH(("Invalid requested Eva message translation. jkmcd")); @@ -386,8 +386,8 @@ const EvaCheckInfo *Eva::getEvaCheckInfo(AsciiString name) void Eva::setShouldPlay(EvaMessage messageToPlay) { m_shouldPlay[messageToPlay] = TRUE; - - // DEBUG_LOG( ( "Eva message %s play requested\n", messageToName( messageToPlay).str() ) ); + + // DEBUG_LOG( ( "Eva message %s play requested\n", messageToName( messageToPlay).str() ) ); } //------------------------------------------------------------------------------------------------- @@ -420,9 +420,9 @@ Bool Eva::messageShouldPlay(EvaMessage messageToTest, UnsignedInt currentFrame) return FALSE; } - DEBUG_ASSERTCRASH( ELEMENTS_OF( s_shouldPlayFuncs ) == EVA_COUNT + 1, ("Eva::s_shouldPlayFuncs out of sync" ) ); - DEBUG_ASSERTCRASH( s_shouldPlayFuncs[ EVA_COUNT ] == NULL, ("Eva::s_shouldPlayFuncs out of sync" ) ); - DEBUG_ASSERTCRASH( s_shouldPlayFuncs[ EVA_COUNT - 1] != NULL, ("Eva::s_shouldPlayFuncs out of sync" ) ); + DEBUG_ASSERTCRASH( ELEMENTS_OF( s_shouldPlayFuncs ) == EVA_COUNT + 1, ("Eva::s_shouldPlayFuncs out of sync" ) ); + DEBUG_ASSERTCRASH( s_shouldPlayFuncs[ EVA_COUNT ] == NULL, ("Eva::s_shouldPlayFuncs out of sync" ) ); + DEBUG_ASSERTCRASH( s_shouldPlayFuncs[ EVA_COUNT - 1] != NULL, ("Eva::s_shouldPlayFuncs out of sync" ) ); m_messageBeingTested = messageToTest; return s_shouldPlayFuncs[messageToTest](m_localPlayer); @@ -523,8 +523,8 @@ void Eva::processPlayingMessages(UnsignedInt currentFrame) AsciiString side = ThePlayerList->getLocalPlayer()->getSide(); Int numSides = storedIt->m_evaInfo->m_evaSideSounds.size(); - // clear it. If we can't find the side we want, don't play anything - m_evaSpeech.setEventName(AsciiString::TheEmptyString); + // clear it. If we can't find the side we want, don't play anything + m_evaSpeech.setEventName(AsciiString::TheEmptyString); for (Int i = 0; i < numSides; ++i) { if (side.compareNoCase(storedIt->m_evaInfo->m_evaSideSounds[i].m_side) == 0) { @@ -533,7 +533,7 @@ void Eva::processPlayingMessages(UnsignedInt currentFrame) Int soundToPlay = GameClientRandomValue(0, storedIt->m_evaInfo->m_evaSideSounds[i].m_soundNames.size() - 1); m_evaSpeech.setEventName(storedIt->m_evaInfo->m_evaSideSounds[i].m_soundNames[soundToPlay]); } - break; + break; } } @@ -553,16 +553,16 @@ void Eva::processPlayingMessages(UnsignedInt currentFrame) //------------------------------------------------------------------------------------------------- /*static*/void Eva::parseEvaMessageFromIni( INI * ini, void *instance, void *store, const void* userData ) { - const char *token = ini->getNextToken(); - - EvaMessage message = nameToMessage( token ); - if ( message == EVA_Invalid ) - { - // debug message already displayed - throw ERROR_BAD_INI; - } - - *((EvaMessage *)store) = message; + const char *token = ini->getNextToken(); + + EvaMessage message = nameToMessage( token ); + if ( message == EVA_Invalid ) + { + // debug message already displayed + throw ERROR_BAD_INI; + } + + *((EvaMessage *)store) = message; } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp index 1aca52d3e7..2238dc21ed 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp @@ -66,7 +66,7 @@ //----------------------------------------------------------------------------- namespace wnd { -AnimateWindow::AnimateWindow(void) +AnimateWindow::AnimateWindow( void ) { m_delay = 0; m_startPos.x = m_startPos.y = 0; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp index 4d9a8774fa..795b8a1285 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp @@ -137,7 +137,7 @@ static void commandButtonTooltip(GameWindow *window, /// mark the UI as dirty so the context of everything is re-evaluated void ControlBar::markUIDirty( void ) { - m_UIDirty = TRUE; + m_UIDirty = TRUE; #if defined( _INTERNAL ) || defined( _DEBUG ) UnsignedInt now = TheGameLogic->getFrame(); @@ -2617,7 +2617,7 @@ void ControlBar::setPortraitByObject( Object *obj ) setPortraitByObject( NULL ); return; } - StealthUpdate *stealth = obj->getStealth(); + StealthUpdate *stealth = obj->getStealth(); if( stealth && stealth->isDisguised() ) { //Fake player upgrades too! diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp index aaf3fd215a..6fcbfb7266 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp @@ -207,7 +207,6 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co m_commandWindows[ i ]->winHide( FALSE ); m_commandWindows[ i ]->winEnable( FALSE ); - ///////// poopy //Clear any potential veterancy rank, or else we'll see it when it's empty! @@ -219,8 +218,7 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co m_commandWindows[ i ]->winHide( TRUE ); } - - // is this where we set the cameos disabled when container is subdued? + // is this where we set the cameos disabled when container is subdued? // if we've counted more UI spots than the transport can hold, hide this command window if( inventoryCommandCount > transportMax ) @@ -1135,7 +1133,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com { case GUI_COMMAND_DOZER_CONSTRUCT: { - const ThingTemplate * whatToBuild = command->getThingTemplate(); + const ThingTemplate * whatToBuild = command->getThingTemplate(); // if the command is a dozer construct task and the object dozer is building anything // this command is not available if(whatToBuild) @@ -1172,7 +1170,6 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com { return COMMAND_RESTRICTED;//COMMAND_CANT_AFFORD; } - break; } @@ -1184,9 +1181,9 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com if (obj->testScriptStatusBit(OBJECT_STATUS_SCRIPT_UNSELLABLE)) return COMMAND_HIDDEN; - //since the container can be subdued, , M Lorenzen 8/11 - if ( obj->isDisabledByType( DISABLED_SUBDUED ) ) - return COMMAND_RESTRICTED; + //since the container can be subdued, , M Lorenzen 8/11 + if ( obj->isDisabledByType( DISABLED_SUBDUED ) ) + return COMMAND_RESTRICTED; break; } @@ -1375,9 +1372,9 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com // container changes the UI is completely repopulated // - //since the container can be subdued, the above is no longer true, M Lorenzen 8/11 - if ( obj->isDisabledByType( DISABLED_SUBDUED ) ) - return COMMAND_RESTRICTED; + //since the container can be subdued, the above is no longer true, M Lorenzen 8/11 + if ( obj->isDisabledByType( DISABLED_SUBDUED ) ) + return COMMAND_RESTRICTED; break; } @@ -1389,8 +1386,8 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com if( !obj->getContain() || obj->getContain()->getContainCount() <= 0 ) return COMMAND_RESTRICTED; - if ( obj->isDisabledByType( DISABLED_SUBDUED ) ) - return COMMAND_RESTRICTED; + if ( obj->isDisabledByType( DISABLED_SUBDUED ) ) + return COMMAND_RESTRICTED; break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp index d898043ffc..108f686c30 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp @@ -462,7 +462,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, break; } // end build unit - + //--------------------------------------------------------------------------------------------- case GUI_COMMAND_CANCEL_UNIT_BUILD: { @@ -709,7 +709,7 @@ CBCommandStatus ControlBar::processCommandUI( GameWindow *control, } // end if - //what if container is subdued... assert a logic failure, perhaps? + //what if container is subdued... assert a logic failure, perhaps? // send message to exit GameMessage *exitMsg = TheMessageStream->appendMessage( GameMessage::MSG_EXIT ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp index ebf57a867a..76f2ab2aab 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp @@ -180,7 +180,7 @@ void ControlBar::populateStructureInventory( Object *building ) m_commandWindows[ EVACUATE_ID ]->winEnable( TRUE ); m_commandWindows[ STOP_ID ]->winEnable( TRUE ); } - + // // iterate each of the objects inside the container and put them in a button, note // we're iterating in reverse order here diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp index bdf136bf30..7e75f3b3fb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanGameOptionsMenu.cpp @@ -819,8 +819,8 @@ void DeinitLanGameGadgets( void ) listboxChatWindowLanGame = NULL; textEntryChat = NULL; textEntryMapDisplay = NULL; - checkboxLimitSuperweapons = NULL; - comboBoxStartingCash = NULL; + checkboxLimitSuperweapons = NULL; + comboBoxStartingCash = NULL; windowMap = NULL; for (Int i = 0; i < MAX_SLOTS; i++) { @@ -874,8 +874,8 @@ void LanGameOptionsMenuInit( WindowLayout *layout, void *userData ) slot->setPlayerTemplate( pref.getPreferredFaction() ); slot->setNATBehavior(FirewallHelperClass::FIREWALL_TYPE_SIMPLE); game->setMap( pref.getPreferredMap() ); - game->setStartingCash( pref.getStartingCash() ); - game->setSuperweaponRestriction( pref.getSuperweaponRestricted() ? 1 : 0 ); + game->setStartingCash( pref.getStartingCash() ); + game->setSuperweaponRestriction( pref.getSuperweaponRestricted() ? 1 : 0 ); AsciiString lowerMap = pref.getPreferredMap(); lowerMap.toLower(); std::map::iterator it = TheMapCache->find(lowerMap); @@ -899,8 +899,8 @@ void LanGameOptionsMenuInit( WindowLayout *layout, void *userData ) //DEBUG_LOG(("LanGameOptionsMenuInit(): map is %s\n", TheLAN->GetMyGame()->getMap().str())); buttonStart->winSetText(TheGameText->fetch("GUI:Accept")); buttonSelectMap->winEnable( FALSE ); - checkboxLimitSuperweapons->winEnable( FALSE ); // Can look but only host can touch - comboBoxStartingCash->winEnable( FALSE ); // Ditto + checkboxLimitSuperweapons->winEnable( FALSE ); // Can look but only host can touch + comboBoxStartingCash->winEnable( FALSE ); // Ditto TheLAN->GetMyGame()->setMapCRC( TheLAN->GetMyGame()->getMapCRC() ); // force a recheck TheLAN->GetMyGame()->setMapSize( TheLAN->GetMyGame()->getMapSize() ); // of if we have the map TheLAN->RequestHasMap(); @@ -976,20 +976,20 @@ void updateGameOptions( void ) LanPositionStartSpots(); GadgetStaticTextSetText(textEntryMapDisplay, mapDisplayName); - GadgetCheckBoxSetChecked( checkboxLimitSuperweapons, theGame->getSuperweaponRestriction() != 0 ); + GadgetCheckBoxSetChecked( checkboxLimitSuperweapons, theGame->getSuperweaponRestriction() != 0 ); Int itemCount = GadgetComboBoxGetLength(comboBoxStartingCash); - Int index = 0; - for ( ; index < itemCount; index++ ) - { - Int value = (Int)GadgetComboBoxGetItemData(comboBoxStartingCash, index); - if ( value == theGame->getStartingCash().countMoney() ) - { - GadgetComboBoxSetSelectedPos(comboBoxStartingCash, index, TRUE); - break; - } - } + Int index = 0; + for ( ; index < itemCount; index++ ) + { + Int value = (Int)GadgetComboBoxGetItemData(comboBoxStartingCash, index); + if ( value == theGame->getStartingCash().countMoney() ) + { + GadgetComboBoxSetSelectedPos(comboBoxStartingCash, index, TRUE); + break; + } + } - DEBUG_ASSERTCRASH( index < itemCount, ("Could not find new starting cash amount %d in list", theGame->getStartingCash().countMoney() ) ); + DEBUG_ASSERTCRASH( index < itemCount, ("Could not find new starting cash amount %d in list", theGame->getStartingCash().countMoney() ) ); } } @@ -1144,64 +1144,64 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m Int controlID = control->winGetWindowId(); LANGameInfo *myGame = TheLAN->GetMyGame(); - if ( controlID == comboBoxStartingCashID ) - { - handleStartingCashSelection(); - } - else - { - for (Int i = 0; i < MAX_SLOTS; i++) - { - if (controlID == comboBoxColorID[i]) - { - handleColorSelection(i); - } - else if (controlID == comboBoxPlayerTemplateID[i]) - { - handlePlayerTemplateSelection(i); - } - else if (controlID == comboBoxTeamID[i]) - { - handleTeamSelection(i); - } - else if( controlID == comboBoxPlayerID[i] && myGame->amIHost() ) - { - // We don't have anything that'll happen if we click on ourselves - if(i == myGame->getLocalSlotNum()) - break; - // Get - Int pos = -1; - GadgetComboBoxGetSelectedPos(comboBoxPlayer[i], &pos); - if( pos != SLOT_PLAYER && pos >= 0) - { - if( myGame->getLANSlot(i)->getState() == SLOT_PLAYER ) - { - UnicodeString name = myGame->getPlayerName(i); - myGame->getLANSlot(i)->setState(SlotState(pos)); - myGame->resetAccepted(); - TheLAN->OnPlayerLeave(name); - } - else if( myGame->getLANSlot(i)->getState() != pos ) - { - Bool wasAI = (myGame->getLANSlot(i)->isAI()); - myGame->getLANSlot(i)->setState(SlotState(pos)); - Bool isAI = (myGame->getLANSlot(i)->isAI()); - if (wasAI || isAI) - myGame->resetAccepted(); - if (wasAI ^ isAI) - PopulatePlayerTemplateComboBox(i, comboBoxPlayerTemplate, myGame, wasAI); - if (!s_isIniting) - { - TheLAN->RequestGameOptions(GenerateGameOptionsString(), true); - lanUpdateSlotList(); - } - } - } - break; - } - } + if ( controlID == comboBoxStartingCashID ) + { + handleStartingCashSelection(); + } + else + { + for (Int i = 0; i < MAX_SLOTS; i++) + { + if (controlID == comboBoxColorID[i]) + { + handleColorSelection(i); + } + else if (controlID == comboBoxPlayerTemplateID[i]) + { + handlePlayerTemplateSelection(i); + } + else if (controlID == comboBoxTeamID[i]) + { + handleTeamSelection(i); + } + else if( controlID == comboBoxPlayerID[i] && myGame->amIHost() ) + { + // We don't have anything that'll happen if we click on ourselves + if(i == myGame->getLocalSlotNum()) + break; + // Get + Int pos = -1; + GadgetComboBoxGetSelectedPos(comboBoxPlayer[i], &pos); + if( pos != SLOT_PLAYER && pos >= 0) + { + if( myGame->getLANSlot(i)->getState() == SLOT_PLAYER ) + { + UnicodeString name = myGame->getPlayerName(i); + myGame->getLANSlot(i)->setState(SlotState(pos)); + myGame->resetAccepted(); + TheLAN->OnPlayerLeave(name); + } + else if( myGame->getLANSlot(i)->getState() != pos ) + { + Bool wasAI = (myGame->getLANSlot(i)->isAI()); + myGame->getLANSlot(i)->setState(SlotState(pos)); + Bool isAI = (myGame->getLANSlot(i)->isAI()); + if (wasAI || isAI) + myGame->resetAccepted(); + if (wasAI ^ isAI) + PopulatePlayerTemplateComboBox(i, comboBoxPlayerTemplate, myGame, wasAI); + if (!s_isIniting) + { + TheLAN->RequestGameOptions(GenerateGameOptionsString(), true); + lanUpdateSlotList(); + } + } + } + break; + } + } } - break; + break; }// case GCM_SELECTED: //------------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -1263,10 +1263,10 @@ WindowMsgHandledType LanGameOptionsMenuSystem( GameWindow *window, UnsignedInt m } } - else if ( controlID == checkboxLimitSuperweaponsID ) - { - handleLimitSuperweaponsClick(); - } + else if ( controlID == checkboxLimitSuperweaponsID ) + { + handleLimitSuperweaponsClick(); + } else { for (Int i = 0; i < MAX_SLOTS; i++) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp index c4094074ac..b65b8d142d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/LanLobbyMenu.cpp @@ -228,42 +228,42 @@ static const char superweaponRestrictionKey[] = "SuperweaponRestrict"; Bool LANPreferences::getSuperweaponRestricted(void) const { - LANPreferences::const_iterator it = find(superweaponRestrictionKey); - if (it == end()) - { - return false; - } - - return ( it->second.compareNoCase( "yes" ) == 0 ); + 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"; + (*this)[superweaponRestrictionKey] = superweaponRestricted ? "Yes" : "No"; } static const char startingCashKey[] = "StartingCash"; Money LANPreferences::getStartingCash(void) const { - LANPreferences::const_iterator it = find(startingCashKey); - if (it == end()) - { - return TheMultiplayerSettings->getDefaultStartingMoney(); - } + LANPreferences::const_iterator it = find(startingCashKey); + if (it == end()) + { + return TheMultiplayerSettings->getDefaultStartingMoney(); + } - Money money; - money.deposit( strtoul( it->second.str(), NULL, 10 ), FALSE ); + Money money; + money.deposit( strtoul( it->second.str(), NULL, 10 ), FALSE ); - return money; + return money; } void LANPreferences::setStartingCash( const Money & startingCash ) { - AsciiString option; + AsciiString option; - option.format( "%d", startingCash.countMoney() ); + option.format( "%d", startingCash.countMoney() ); - (*this)[startingCashKey] = option; + (*this)[startingCashKey] = option; } // PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp index c0e1bd51bd..96aa6410b4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp @@ -247,7 +247,7 @@ static void showSelectiveButtons( Int show ) buttonChinaRecentSave->winHide(!(show == SHOW_CHINA )); buttonChinaLoadGame->winHide(!(show == SHOW_CHINA )); } - + static void quitCallback( void ) { buttonPushed = TRUE; @@ -255,8 +255,6 @@ static void quitCallback( void ) TheShell->pop(); TheGameEngine->setQuitting( TRUE ); - - //if (!TheGameLODManager->didMemPass()) { //GIANT CRAPTACULAR HACK ALERT!!!! On sytems with little memory, we skip all normal exit code // //and let Windows clean up the mess. This reduces exit times from minutes to seconds. diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp index 3ecfb04a78..7d34cb7424 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp @@ -1235,15 +1235,15 @@ static void saveOptions( void ) } //Apply the sound volumes in the audio system now. - TheAudio->setVolume( sound2DVolume, (AudioAffect) (AudioAffect_Sound | AudioAffect_SystemSetting) ); + TheAudio->setVolume( sound2DVolume, (AudioAffect) (AudioAffect_Sound | AudioAffect_SystemSetting) ); TheAudio->setVolume( sound3DVolume, (AudioAffect) (AudioAffect_Sound3D | AudioAffect_SystemSetting) ); //Save the settings in the options.ini. - TheWritableGlobalData->m_SFXVolumeFactor = val; - AsciiString prefString; - prefString.format("%d", REAL_TO_INT( sound2DVolume * 100.0f ) ); - (*pref)["SFXVolume"] = prefString; - prefString.format("%d", REAL_TO_INT( sound3DVolume * 100.0f ) ); + TheWritableGlobalData->m_SFXVolumeFactor = val; + AsciiString prefString; + prefString.format("%d", REAL_TO_INT( sound2DVolume * 100.0f ) ); + (*pref)["SFXVolume"] = prefString; + prefString.format("%d", REAL_TO_INT( sound3DVolume * 100.0f ) ); (*pref)["SFX3DVolume"] = prefString; } @@ -1252,11 +1252,11 @@ static void saveOptions( void ) val = GadgetSliderGetPosition(sliderVoiceVolume); if(val != -1) { - TheWritableGlobalData->m_voiceVolumeFactor = val; - AsciiString prefString; - prefString.format("%d", val); - (*pref)["VoiceVolume"] = prefString; - TheAudio->setVolume(val / 100.0f, (AudioAffect) (AudioAffect_Speech | AudioAffect_SystemSetting)); + TheWritableGlobalData->m_voiceVolumeFactor = val; + AsciiString prefString; + prefString.format("%d", val); + (*pref)["VoiceVolume"] = prefString; + TheAudio->setVolume(val / 100.0f, (AudioAffect) (AudioAffect_Speech | AudioAffect_SystemSetting)); } //------------------------------------------------------------------------------------------------- @@ -1330,6 +1330,7 @@ static void cancelAdvancedOptions() WinAdvancedDisplay->winHide(TRUE); } + //------------------------------------------------------------------------------------------------- /** Initialize the options menu */ //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp index 31c85f4f1e..0738828df9 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp @@ -353,16 +353,16 @@ void PopupHostGameInit( WindowLayout *layout, void *userData ) GadgetComboBoxReset(comboBoxLadderName); PopulateCustomLadderComboBox(); - checkBoxUseStatsID = TheNameKeyGenerator->nameToKey(AsciiString("PopupHostGame.wnd:CheckBoxUseStats")); - checkBoxUseStats = TheWindowManager->winGetWindowFromId(parentPopup, checkBoxUseStatsID); + checkBoxUseStatsID = TheNameKeyGenerator->nameToKey(AsciiString("PopupHostGame.wnd:CheckBoxUseStats")); + checkBoxUseStats = TheWindowManager->winGetWindowFromId(parentPopup, checkBoxUseStatsID); Bool usingStats = customPref.getUseStats(); - GadgetCheckBoxSetChecked( checkBoxUseStats, usingStats ); + GadgetCheckBoxSetChecked( checkBoxUseStats, usingStats ); // limit armies is disallowed in "use stats" games - checkBoxLimitArmiesID = TheNameKeyGenerator->nameToKey(AsciiString("PopupHostGame.wnd:CheckBoxLimitArmies")); - checkBoxLimitArmies = TheWindowManager->winGetWindowFromId(parentPopup, checkBoxLimitArmiesID); + checkBoxLimitArmiesID = TheNameKeyGenerator->nameToKey(AsciiString("PopupHostGame.wnd:CheckBoxLimitArmies")); + checkBoxLimitArmies = TheWindowManager->winGetWindowFromId(parentPopup, checkBoxLimitArmiesID); checkBoxLimitArmies->winEnable(! usingStats ); - GadgetCheckBoxSetChecked( checkBoxLimitArmies, usingStats? FALSE : customPref.getFactionsLimited() ); + GadgetCheckBoxSetChecked( checkBoxLimitArmies, usingStats? FALSE : customPref.getFactionsLimited() ); TheWindowManager->winSetFocus( parentPopup ); TheWindowManager->winSetModal( parentPopup ); @@ -580,17 +580,17 @@ void createGame( void ) req.password = passwd.str(); CustomMatchPreferences customPref; Bool aO = GadgetCheckBoxIsChecked(checkBoxAllowObservers); - Bool limitArmies = GadgetCheckBoxIsChecked( checkBoxLimitArmies ); - Bool useStats = GadgetCheckBoxIsChecked( checkBoxUseStats ); + Bool limitArmies = GadgetCheckBoxIsChecked( checkBoxLimitArmies ); + Bool useStats = GadgetCheckBoxIsChecked( checkBoxUseStats ); customPref.setAllowsObserver(aO); - customPref.setFactionsLimited( limitArmies ); - customPref.setUseStats( useStats ); + customPref.setFactionsLimited( limitArmies ); + customPref.setUseStats( useStats ); customPref.write(); req.stagingRoomCreation.allowObservers = aO; - req.stagingRoomCreation.useStats = useStats; + req.stagingRoomCreation.useStats = useStats; TheGameSpyGame->setAllowObservers(aO); - TheGameSpyGame->setOldFactionsOnly( limitArmies ); - TheGameSpyGame->setUseStats( useStats ); + TheGameSpyGame->setOldFactionsOnly( limitArmies ); + TheGameSpyGame->setUseStats( useStats ); req.stagingRoomCreation.exeCRC = TheGlobalData->m_exeCRC; req.stagingRoomCreation.iniCRC = TheGlobalData->m_iniCRC; req.stagingRoomCreation.gameVersion = TheGameSpyInfo->getInternalIP(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp index b9aac9e512..0522d3953e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp @@ -299,42 +299,42 @@ static const char superweaponRestrictionKey[] = "SuperweaponRestrict"; Bool SkirmishPreferences::getSuperweaponRestricted(void) const { - const_iterator it = find(superweaponRestrictionKey); - if (it == end()) - { - return false; - } - - return ( it->second.compareNoCase( "yes" ) == 0 ); + const_iterator it = find(superweaponRestrictionKey); + if (it == end()) + { + return false; + } + + return ( it->second.compareNoCase( "yes" ) == 0 ); } void SkirmishPreferences::setSuperweaponRestricted( Bool superweaponRestricted ) { - (*this)[superweaponRestrictionKey] = superweaponRestricted ? "Yes" : "No"; + (*this)[superweaponRestrictionKey] = superweaponRestricted ? "Yes" : "No"; } static const char startingCashKey[] = "StartingCash"; Money SkirmishPreferences::getStartingCash(void) const { - const_iterator it = find(startingCashKey); - if (it == end()) - { - return TheMultiplayerSettings->getDefaultStartingMoney(); - } - - Money money; - money.deposit( strtoul( it->second.str(), NULL, 10 ), FALSE ); - - return money; + const_iterator it = find(startingCashKey); + if (it == end()) + { + return TheMultiplayerSettings->getDefaultStartingMoney(); + } + + Money money; + money.deposit( strtoul( it->second.str(), NULL, 10 ), FALSE ); + + return money; } void SkirmishPreferences::setStartingCash( const Money & startingCash ) { - AsciiString option; - - option.format( "%d", startingCash.countMoney() ); - - (*this)[startingCashKey] = option; + AsciiString option; + + option.format( "%d", startingCash.countMoney() ); + + (*this)[startingCashKey] = option; } @@ -356,8 +356,8 @@ Bool SkirmishPreferences::write(void) (*this)["UserName"] = UnicodeStringToQuotedPrintable(TheSkirmishGameInfo->getConstSlot(0)->getName()); - setStartingCash( TheSkirmishGameInfo->getStartingCash() ); - setSuperweaponRestricted( TheSkirmishGameInfo->getSuperweaponRestriction() != 0 ); + setStartingCash( TheSkirmishGameInfo->getStartingCash() ); + setSuperweaponRestricted( TheSkirmishGameInfo->getSuperweaponRestriction() != 0 ); setSlotList(); @@ -834,12 +834,12 @@ void updateMapStartSpots( GameInfo *myGame, GameWindow *buttonMapStartPositions[ if (it == TheMapCache->end()) { for (Int i = 0; i < MAX_SLOTS; ++i) - { - if ( buttonMapStartPositions[i] != NULL ) - { - buttonMapStartPositions[i]->winHide(TRUE); - } - } + { + if ( buttonMapStartPositions[i] != NULL ) + { + buttonMapStartPositions[i]->winHide(TRUE); + } + } return; } MapMetaData mmd = it->second; @@ -847,19 +847,19 @@ void updateMapStartSpots( GameInfo *myGame, GameWindow *buttonMapStartPositions[ Int i = 0; for(; i < MAX_SLOTS; ++i) { - if ( buttonMapStartPositions[i] != NULL ) - { - GadgetButtonSetText(buttonMapStartPositions[i], UnicodeString::TheEmptyString); - if (!onLoadScreen) - { - buttonMapStartPositions[i]->winSetTooltip(TheGameText->fetch("TOOLTIP:StartPosition")); - } - } + if ( buttonMapStartPositions[i] != NULL ) + { + GadgetButtonSetText(buttonMapStartPositions[i], UnicodeString::TheEmptyString); + if (!onLoadScreen) + { + buttonMapStartPositions[i]->winSetTooltip(TheGameText->fetch("TOOLTIP:StartPosition")); + } + } } for( i = 0; i < MAX_SLOTS; ++i) { - if ( buttonMapStartPositions[i] == NULL ) - continue; + if ( buttonMapStartPositions[i] == NULL ) + continue; GameSlot *gs =myGame->getSlot(i); if(onLoadScreen) @@ -1029,36 +1029,36 @@ static void handleTeamSelection(int index) static void handleStartingCashSelection() { - GameInfo *myGame = TheSkirmishGameInfo; - - if (myGame) - { - Int selIndex; - GadgetComboBoxGetSelectedPos(comboBoxStartingCash, &selIndex); + GameInfo *myGame = TheSkirmishGameInfo; + + if (myGame) + { + Int selIndex; + GadgetComboBoxGetSelectedPos(comboBoxStartingCash, &selIndex); - Money startingCash; - startingCash.deposit( (UnsignedInt)GadgetComboBoxGetItemData( comboBoxStartingCash, selIndex ), FALSE ); - myGame->setStartingCash( startingCash ); - } + Money startingCash; + startingCash.deposit( (UnsignedInt)GadgetComboBoxGetItemData( comboBoxStartingCash, selIndex ), FALSE ); + myGame->setStartingCash( startingCash ); + } } static void handleLimitSuperweaponsClick() { - GameInfo *myGame = TheSkirmishGameInfo; - - if (myGame) - { - // At the moment, 1 and 0 are the only choices supported in the GUI, though the system could - // support more. - if ( GadgetCheckBoxIsChecked( checkBoxLimitSuperweapons ) ) - { - myGame->setSuperweaponRestriction( 1 ); - } - else - { - myGame->setSuperweaponRestriction( 0 ); - } - } + GameInfo *myGame = TheSkirmishGameInfo; + + if (myGame) + { + // At the moment, 1 and 0 are the only choices supported in the GUI, though the system could + // support more. + if ( GadgetCheckBoxIsChecked( checkBoxLimitSuperweapons ) ) + { + myGame->setSuperweaponRestriction( 1 ); + } + else + { + myGame->setSuperweaponRestriction( 0 ); + } + } } @@ -1076,8 +1076,8 @@ void InitSkirmishGameGadgets( void ) buttonResetID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:ButtonReset" ) ); windowMapID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:MapWindow" ) ); staticTextGameSpeedID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:StaticTextGameSpeed" ) ); - checkBoxLimitSuperweaponsID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:CheckboxLimitSuperweapons" ) ); - comboBoxStartingCashID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:ComboBoxStartingCash" ) ); + checkBoxLimitSuperweaponsID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:CheckboxLimitSuperweapons" ) ); + comboBoxStartingCashID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:ComboBoxStartingCash" ) ); // Initialize the pointers to our gadgets parentSkirmishGameOptions = TheWindowManager->winGetWindowFromId( NULL, parentSkirmishGameOptionsID ); @@ -1094,11 +1094,11 @@ void InitSkirmishGameGadgets( void ) DEBUG_ASSERTCRASH(buttonReset, ("Could not find the buttonReset")); staticTextGameSpeed = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, staticTextGameSpeedID ); DEBUG_ASSERTCRASH(staticTextGameSpeed, ("Could not find the staticTextGameSpeed")); - checkBoxLimitSuperweapons = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, checkBoxLimitSuperweaponsID ); - DEBUG_ASSERTCRASH(checkBoxLimitSuperweapons, ("Could not find the checkBoxLimitSuperweapons")); - comboBoxStartingCash = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, comboBoxStartingCashID ); - DEBUG_ASSERTCRASH(comboBoxStartingCash, ("Could not find the comboBoxStartingCash")); - PopulateStartingCashComboBox(comboBoxStartingCash, TheSkirmishGameInfo ); + checkBoxLimitSuperweapons = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, checkBoxLimitSuperweaponsID ); + DEBUG_ASSERTCRASH(checkBoxLimitSuperweapons, ("Could not find the checkBoxLimitSuperweapons")); + comboBoxStartingCash = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, comboBoxStartingCashID ); + DEBUG_ASSERTCRASH(comboBoxStartingCash, ("Could not find the comboBoxStartingCash")); + PopulateStartingCashComboBox(comboBoxStartingCash, TheSkirmishGameInfo ); textEntryPlayerNameID = TheNameKeyGenerator->nameToKey( AsciiString( "SkirmishGameOptionsMenu.wnd:TextEntryPlayerName" ) ); textEntryPlayerName = TheWindowManager->winGetWindowFromId( NULL, textEntryPlayerNameID ); @@ -1278,20 +1278,20 @@ void updateSkirmishGameOptions( void ) } } - GadgetCheckBoxSetChecked( checkBoxLimitSuperweapons, TheSkirmishGameInfo->getSuperweaponRestriction() != 0 ); - Int itemCount = GadgetComboBoxGetLength(comboBoxStartingCash); - Int index = 0; - for ( ; index < itemCount; index++ ) - { - Int value = (Int)GadgetComboBoxGetItemData(comboBoxStartingCash, index); - if ( value == TheSkirmishGameInfo->getStartingCash().countMoney() ) - { - GadgetComboBoxSetSelectedPos(comboBoxStartingCash, index, TRUE); - break; - } - } - - DEBUG_ASSERTCRASH( index < itemCount, ("Could not find new starting cash amount %d in list", TheSkirmishGameInfo->getStartingCash().countMoney() ) ); + GadgetCheckBoxSetChecked( checkBoxLimitSuperweapons, TheSkirmishGameInfo->getSuperweaponRestriction() != 0 ); + Int itemCount = GadgetComboBoxGetLength(comboBoxStartingCash); + Int index = 0; + for ( ; index < itemCount; index++ ) + { + Int value = (Int)GadgetComboBoxGetItemData(comboBoxStartingCash, index); + if ( value == TheSkirmishGameInfo->getStartingCash().countMoney() ) + { + GadgetComboBoxSetSelectedPos(comboBoxStartingCash, index, TRUE); + break; + } + } + + DEBUG_ASSERTCRASH( index < itemCount, ("Could not find new starting cash amount %d in list", TheSkirmishGameInfo->getStartingCash().countMoney() ) ); } //------------------------------------------------------------------------------------------------- @@ -1361,10 +1361,10 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData ) TheSkirmishGameInfo->markPlayerAsPreorder(0); } - TheSkirmishGameInfo->setStartingCash( prefs.getStartingCash() ); - TheSkirmishGameInfo->setSuperweaponRestriction( prefs.getSuperweaponRestricted() ? 1 : 0 ); - - TheSkirmishGameInfo->setMap(prefs.getPreferredMap()); + TheSkirmishGameInfo->setStartingCash( prefs.getStartingCash() ); + TheSkirmishGameInfo->setSuperweaponRestriction( prefs.getSuperweaponRestricted() ? 1 : 0 ); + + TheSkirmishGameInfo->setMap(prefs.getPreferredMap()); const MapMetaData *md = TheMapCache->findMap(TheSkirmishGameInfo->getMap()); if (!md) { @@ -1382,8 +1382,8 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData ) std::map::iterator it = TheMapCache->find(lowerMap); if (it != TheMapCache->end()) { - GadgetStaticTextSetText(textEntryMapDisplay, it->second.m_displayName); - } + GadgetStaticTextSetText(textEntryMapDisplay, it->second.m_displayName); + } skirmishPositionStartSpots(); //updateSkirmishGameOptions(); @@ -1478,7 +1478,7 @@ void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) // our shutdown is complete TheTransitionHandler->reverse("SkirmishGameOptionsMenuFade"); - + } // void SkirmishGameOptionsMenuShutdown( WindowLayout *layout, void *userData ) //------------------------------------------------------------------------------------------------- @@ -1589,35 +1589,35 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned { GameWindow *control = (GameWindow *)mData1; Int controlID = control->winGetWindowId(); - if ( controlID == comboBoxStartingCashID ) - { - handleStartingCashSelection(); - } - else - { - for (Int i = 0; i < MAX_SLOTS; i++) - { - if (controlID == comboBoxColorID[i]) - { - handleColorSelection(i); - } - else if (controlID == comboBoxPlayerTemplateID[i]) - { - handlePlayerTemplateSelection(i); - } - else if (controlID == comboBoxTeamID[i]) - { - handleTeamSelection(i); - } - else if (controlID == comboBoxPlayerID[i]) - { - handlePlayerSelection(i); - } - } - } + if ( controlID == comboBoxStartingCashID ) + { + handleStartingCashSelection(); + } + else + { + for (Int i = 0; i < MAX_SLOTS; i++) + { + if (controlID == comboBoxColorID[i]) + { + handleColorSelection(i); + } + else if (controlID == comboBoxPlayerTemplateID[i]) + { + handlePlayerTemplateSelection(i); + } + else if (controlID == comboBoxTeamID[i]) + { + handleTeamSelection(i); + } + else if (controlID == comboBoxPlayerID[i]) + { + handlePlayerSelection(i); + } + } + } sandboxOk = FALSE; - skirmishUpdateSlotList(); - break; + skirmishUpdateSlotList(); + break; }// case GCM_SELECTED: //------------------------------------------------------------------------------------------------- case GSM_SLIDER_TRACK: @@ -1674,8 +1674,8 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned else if ( controlID == buttonStartID ) { buttonPushed = TRUE; - SkirmishPreferences prefs; - prefs.write(); + SkirmishPreferences prefs; + prefs.write(); startPressed(); } else if ( controlID == buttonResetID ) @@ -1685,10 +1685,10 @@ WindowMsgHandledType SkirmishGameOptionsMenuSystem( GameWindow *window, Unsigned stats.write(); populateSkirmishBattleHonors(); } - else if ( controlID == checkBoxLimitSuperweaponsID ) - { - handleLimitSuperweaponsClick(); - } + else if ( controlID == checkBoxLimitSuperweaponsID ) + { + handleLimitSuperweaponsClick(); + } else { for (Int i = 0; i < MAX_SLOTS; i++) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp index 155fff0b76..a385a9f379 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishMapSelectMenu.cpp @@ -574,21 +574,21 @@ WindowMsgHandledType SkirmishMapSelectMenuSystem( GameWindow *window, UnsignedIn win = TheWindowManager->winGetWindowFromId( parent, TheNameKeyGenerator->nameToKey("SkirmishGameOptionsMenu.wnd:TextEntryMapDisplay") ); if(win) { - if (md) - { - GadgetStaticTextSetText(win, md->m_displayName); - } - } + if (md) + { + GadgetStaticTextSetText(win, md->m_displayName); + } + } //if (mapFname) //setupGameStart(mapFname); - showSkirmishGameOptionsUnderlyingGUIElements(TRUE); - skirmishPositionStartSpots(); - skirmishUpdateSlotList(); + showSkirmishGameOptionsUnderlyingGUIElements(TRUE); + skirmishPositionStartSpots(); + skirmishUpdateSlotList(); - skirmishMapSelectLayout->destroyWindows(); - skirmishMapSelectLayout->deleteInstance(); - skirmishMapSelectLayout = NULL; + skirmishMapSelectLayout->destroyWindows(); + skirmishMapSelectLayout->deleteInstance(); + skirmishMapSelectLayout = NULL; //TheShell->pop(); } // end if diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp index 0da8930603..943e97671d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLGameSetupMenu.cpp @@ -274,6 +274,7 @@ void positionStartSpots(AsciiString mapName, GameWindow *buttonMapStartPositions void WOLPositionStartSpots( void ) { GameWindow *win = windowMap; + if (WOLMapSelectLayout != NULL) { win = TheWindowManager->winGetWindowFromId(NULL, windowMapSelectMapID); @@ -331,9 +332,9 @@ static void savePlayerInfo( void ) if (TheGameSpyGame->amIHost()) { pref.setPreferredMap(TheGameSpyGame->getMap()); - pref.setSuperweaponRestricted( TheGameSpyGame->getSuperweaponRestriction() != 0 ); - pref.setStartingCash( TheGameSpyGame->getStartingCash() ); - } + pref.setSuperweaponRestricted( TheGameSpyGame->getSuperweaponRestriction() != 0 ); + pref.setStartingCash( TheGameSpyGame->getStartingCash() ); + } pref.write(); } } @@ -765,52 +766,52 @@ static void handleTeamSelection(int index) static void handleStartingCashSelection() { - GameInfo *myGame = TheGameSpyInfo->getCurrentStagingRoom(); - - if (myGame) - { - Int selIndex; - GadgetComboBoxGetSelectedPos(comboBoxStartingCash, &selIndex); - - Money startingCash; - startingCash.deposit( (UnsignedInt)GadgetComboBoxGetItemData( comboBoxStartingCash, selIndex ), FALSE ); - myGame->setStartingCash( startingCash ); - myGame->resetAccepted(); - - if (myGame->amIHost()) - { - // send around the new data - TheGameSpyInfo->setGameOptions(); - WOLDisplaySlotList();// Update the accepted button UI - } - } + GameInfo *myGame = TheGameSpyInfo->getCurrentStagingRoom(); + + if (myGame) + { + Int selIndex; + GadgetComboBoxGetSelectedPos(comboBoxStartingCash, &selIndex); + + Money startingCash; + startingCash.deposit( (UnsignedInt)GadgetComboBoxGetItemData( comboBoxStartingCash, selIndex ), FALSE ); + myGame->setStartingCash( startingCash ); + myGame->resetAccepted(); + + if (myGame->amIHost()) + { + // send around the new data + TheGameSpyInfo->setGameOptions(); + WOLDisplaySlotList();// Update the accepted button UI + } + } } static void handleLimitSuperweaponsClick() { - GameInfo *myGame = TheGameSpyInfo->getCurrentStagingRoom(); - - if (myGame) - { - // At the moment, 1 and 0 are the only choices supported in the GUI, though the system could - // support more. - if ( GadgetCheckBoxIsChecked( checkBoxLimitSuperweapons ) ) - { - myGame->setSuperweaponRestriction( 1 ); - } - else - { - myGame->setSuperweaponRestriction( 0 ); - } - myGame->resetAccepted(); - - if (myGame->amIHost()) - { - // send around a new slotlist - TheGameSpyInfo->setGameOptions(); - WOLDisplaySlotList();// Update the accepted button UI - } - } + GameInfo *myGame = TheGameSpyInfo->getCurrentStagingRoom(); + + if (myGame) + { + // At the moment, 1 and 0 are the only choices supported in the GUI, though the system could + // support more. + if ( GadgetCheckBoxIsChecked( checkBoxLimitSuperweapons ) ) + { + myGame->setSuperweaponRestriction( 1 ); + } + else + { + myGame->setSuperweaponRestriction( 0 ); + } + myGame->resetAccepted(); + + if (myGame->amIHost()) + { + // send around a new slotlist + TheGameSpyInfo->setGameOptions(); + WOLDisplaySlotList();// Update the accepted button UI + } + } } @@ -996,51 +997,51 @@ void WOLDisplayGameOptions( void ) WOLPositionStartSpots(); updateMapStartSpots(TheGameSpyInfo->getCurrentStagingRoom(), buttonMapStartPosition); - //If our display does not match the current state of game settings, update the checkbox. - Bool isUsingStats = TheGameSpyInfo->getCurrentStagingRoom()->getUseStats() ? TRUE : FALSE; - if (GadgetCheckBoxIsChecked(checkBoxUseStats) != isUsingStats) - { - GadgetCheckBoxSetChecked(checkBoxUseStats, isUsingStats); - checkBoxUseStats->winSetTooltip( TheGameText->fetch( isUsingStats ? "TOOLTIP:UseStatsOn" : "TOOLTIP:UseStatsOff" ) ); - } - - Bool oldFactionsOnly = theGame->oldFactionsOnly(); - if (GadgetCheckBoxIsChecked(checkBoxLimitArmies) != oldFactionsOnly) - { - GadgetCheckBoxSetChecked(checkBoxLimitArmies, oldFactionsOnly); - // Repopulate the lists of available armies, since the old list is now wrong - for (Int i = 0; i < MAX_SLOTS; i++) - { - PopulatePlayerTemplateComboBox(i, comboBoxPlayerTemplate, theGame, theGame->getAllowObservers() ); - - // Make sure selections are up to date on all machines - handlePlayerTemplateSelection(i) ; - } - } - - // Note: must check if checkbox is already correct to avoid infinite recursion - Bool limitSuperweapons = (theGame->getSuperweaponRestriction() != 0); - if ( limitSuperweapons != GadgetCheckBoxIsChecked(checkBoxLimitSuperweapons)) - GadgetCheckBoxSetChecked( checkBoxLimitSuperweapons, limitSuperweapons ); - - Int itemCount = GadgetComboBoxGetLength(comboBoxStartingCash); - Int index = 0; - for ( ; index < itemCount; index++ ) - { - Int value = (Int)GadgetComboBoxGetItemData(comboBoxStartingCash, index); - if ( value == theGame->getStartingCash().countMoney() ) - { - // Note: must check if combobox is already correct to avoid infinite recursion - Int selectedIndex; - GadgetComboBoxGetSelectedPos( comboBoxStartingCash, &selectedIndex ); - if ( index != selectedIndex ) - GadgetComboBoxSetSelectedPos(comboBoxStartingCash, index, TRUE); - - break; - } - } - - DEBUG_ASSERTCRASH( index < itemCount, ("Could not find new starting cash amount %d in list", theGame->getStartingCash().countMoney() ) ); + //If our display does not match the current state of game settings, update the checkbox. + Bool isUsingStats = TheGameSpyInfo->getCurrentStagingRoom()->getUseStats() ? TRUE : FALSE; + if (GadgetCheckBoxIsChecked(checkBoxUseStats) != isUsingStats) + { + GadgetCheckBoxSetChecked(checkBoxUseStats, isUsingStats); + checkBoxUseStats->winSetTooltip( TheGameText->fetch( isUsingStats ? "TOOLTIP:UseStatsOn" : "TOOLTIP:UseStatsOff" ) ); + } + + Bool oldFactionsOnly = theGame->oldFactionsOnly(); + if (GadgetCheckBoxIsChecked(checkBoxLimitArmies) != oldFactionsOnly) + { + GadgetCheckBoxSetChecked(checkBoxLimitArmies, oldFactionsOnly); + // Repopulate the lists of available armies, since the old list is now wrong + for (Int i = 0; i < MAX_SLOTS; i++) + { + PopulatePlayerTemplateComboBox(i, comboBoxPlayerTemplate, theGame, theGame->getAllowObservers() ); + + // Make sure selections are up to date on all machines + handlePlayerTemplateSelection(i) ; + } + } + + // Note: must check if checkbox is already correct to avoid infinite recursion + Bool limitSuperweapons = (theGame->getSuperweaponRestriction() != 0); + if ( limitSuperweapons != GadgetCheckBoxIsChecked(checkBoxLimitSuperweapons)) + GadgetCheckBoxSetChecked( checkBoxLimitSuperweapons, limitSuperweapons ); + + Int itemCount = GadgetComboBoxGetLength(comboBoxStartingCash); + Int index = 0; + for ( ; index < itemCount; index++ ) + { + Int value = (Int)GadgetComboBoxGetItemData(comboBoxStartingCash, index); + if ( value == theGame->getStartingCash().countMoney() ) + { + // Note: must check if combobox is already correct to avoid infinite recursion + Int selectedIndex; + GadgetComboBoxGetSelectedPos( comboBoxStartingCash, &selectedIndex ); + if ( index != selectedIndex ) + GadgetComboBoxSetSelectedPos(comboBoxStartingCash, index, TRUE); + + break; + } + } + + DEBUG_ASSERTCRASH( index < itemCount, ("Could not find new starting cash amount %d in list", theGame->getStartingCash().countMoney() ) ); } @@ -1124,49 +1125,49 @@ void InitWOLGameGadgets( void ) buttonSelectMapID = TheNameKeyGenerator->nameToKey( AsciiString( "GameSpyGameOptionsMenu.wnd:ButtonSelectMap" ) ); checkBoxUseStatsID = TheNameKeyGenerator->nameToKey( AsciiString( "GameSpyGameOptionsMenu.wnd:CheckBoxUseStats" ) ); windowMapID = TheNameKeyGenerator->nameToKey( AsciiString( "GameSpyGameOptionsMenu.wnd:MapWindow" ) ); - checkBoxLimitSuperweaponsID = TheNameKeyGenerator->nameToKey(AsciiString("GameSpyGameOptionsMenu.wnd:CheckboxLimitSuperweapons")); - comboBoxStartingCashID = TheNameKeyGenerator->nameToKey(AsciiString("GameSpyGameOptionsMenu.wnd:ComboBoxStartingCash")); - checkBoxLimitArmiesID = TheNameKeyGenerator->nameToKey(AsciiString("GameSpyGameOptionsMenu.wnd:CheckBoxLimitArmies")); + checkBoxLimitSuperweaponsID = TheNameKeyGenerator->nameToKey(AsciiString("GameSpyGameOptionsMenu.wnd:CheckboxLimitSuperweapons")); + comboBoxStartingCashID = TheNameKeyGenerator->nameToKey(AsciiString("GameSpyGameOptionsMenu.wnd:ComboBoxStartingCash")); + checkBoxLimitArmiesID = TheNameKeyGenerator->nameToKey(AsciiString("GameSpyGameOptionsMenu.wnd:CheckBoxLimitArmies")); windowMapSelectMapID = TheNameKeyGenerator->nameToKey(AsciiString("WOLMapSelectMenu.wnd:WinMapPreview")); NameKeyType staticTextTitleID = NAMEKEY("GameSpyGameOptionsMenu.wnd:StaticTextGameName"); // Initialize the pointers to our gadgets parentWOLGameSetup = TheWindowManager->winGetWindowFromId( NULL, parentWOLGameSetupID ); - buttonEmote = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonEmoteID ); - buttonSelectMap = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonSelectMapID ); + buttonEmote = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonEmoteID ); + buttonSelectMap = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonSelectMapID ); checkBoxUseStats = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, checkBoxUseStatsID ); - buttonStart = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonStartID ); - buttonBack = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, buttonBackID); + buttonStart = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,buttonStartID ); + buttonBack = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, buttonBackID); listboxGameSetupChat = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, listboxGameSetupChatID ); textEntryChat = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, textEntryChatID ); textEntryMapDisplay = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, textEntryMapDisplayID ); - windowMap = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,windowMapID ); - DEBUG_ASSERTCRASH(windowMap, ("Could not find the parentWOLGameSetup.wnd:MapWindow" )); - - checkBoxLimitSuperweapons = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, checkBoxLimitSuperweaponsID ); - DEBUG_ASSERTCRASH(windowMap, ("Could not find the GameSpyGameOptionsMenu.wnd:CheckboxLimitSuperweapons" )); - comboBoxStartingCash = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, comboBoxStartingCashID ); - DEBUG_ASSERTCRASH(windowMap, ("Could not find the GameSpyGameOptionsMenu.wnd:ComboBoxStartingCash" )); - PopulateStartingCashComboBox( comboBoxStartingCash, TheGameSpyGame ); - checkBoxLimitArmies = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, checkBoxLimitArmiesID ); - DEBUG_ASSERTCRASH(windowMap, ("Could not find the GameSpyGameOptionsMenu.wnd:CheckBoxLimitArmies" )); - - // Limit Armies can ONLY be set in the Host Game window (PopupHostGame.wnd) - checkBoxLimitArmies->winEnable( false ); - // Ditto use stats - checkBoxUseStats->winEnable( false ); + windowMap = TheWindowManager->winGetWindowFromId( parentWOLGameSetup,windowMapID ); + DEBUG_ASSERTCRASH(windowMap, ("Could not find the parentWOLGameSetup.wnd:MapWindow" )); + + checkBoxLimitSuperweapons = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, checkBoxLimitSuperweaponsID ); + DEBUG_ASSERTCRASH(windowMap, ("Could not find the GameSpyGameOptionsMenu.wnd:CheckboxLimitSuperweapons" )); + comboBoxStartingCash = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, comboBoxStartingCashID ); + DEBUG_ASSERTCRASH(windowMap, ("Could not find the GameSpyGameOptionsMenu.wnd:ComboBoxStartingCash" )); + PopulateStartingCashComboBox( comboBoxStartingCash, TheGameSpyGame ); + checkBoxLimitArmies = TheWindowManager->winGetWindowFromId( parentWOLGameSetup, checkBoxLimitArmiesID ); + DEBUG_ASSERTCRASH(windowMap, ("Could not find the GameSpyGameOptionsMenu.wnd:CheckBoxLimitArmies" )); + + // Limit Armies can ONLY be set in the Host Game window (PopupHostGame.wnd) + checkBoxLimitArmies->winEnable( false ); + // Ditto use stats + checkBoxUseStats->winEnable( false ); Int isUsingStats = TheGameSpyGame->getUseStats(); - GadgetCheckBoxSetChecked(checkBoxUseStats, isUsingStats ); - checkBoxUseStats->winSetTooltip( TheGameText->fetch( isUsingStats ? "TOOLTIP:UseStatsOn" : "TOOLTIP:UseStatsOff" ) ); + GadgetCheckBoxSetChecked(checkBoxUseStats, isUsingStats ); + checkBoxUseStats->winSetTooltip( TheGameText->fetch( isUsingStats ? "TOOLTIP:UseStatsOn" : "TOOLTIP:UseStatsOff" ) ); - if ( !TheGameSpyGame->amIHost() ) - { - checkBoxLimitSuperweapons->winEnable( false ); - comboBoxStartingCash->winEnable( false ); + if ( !TheGameSpyGame->amIHost() ) + { + checkBoxLimitSuperweapons->winEnable( false ); + comboBoxStartingCash->winEnable( false ); NameKeyType labelID = TheNameKeyGenerator->nameToKey(AsciiString("GameSpyGameOptionsMenu.wnd:StartingCashLabel")); TheWindowManager->winGetWindowFromId(parentWOLGameSetup, labelID)->winEnable( FALSE ); - } + } if (isUsingStats) { @@ -1303,9 +1304,9 @@ void DeinitWOLGameGadgets( void ) textEntryMapDisplay = NULL; windowMap = NULL; checkBoxUseStats = NULL; - checkBoxLimitSuperweapons = NULL; - comboBoxStartingCash = NULL; - + checkBoxLimitSuperweapons = NULL; + comboBoxStartingCash = NULL; + // GameWindow *staticTextTitle = NULL; for (Int i = 0; i < MAX_SLOTS; i++) { @@ -1404,16 +1405,16 @@ void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) game->setOldFactionsOnly( 0 ); //game->setOldFactionsOnly( customPref.getFactionsLimited() ); - if ( game->oldFactionsOnly() ) - { - // Make sure host follows the old factions only restrictions! - const PlayerTemplate *fac = ThePlayerTemplateStore->getNthPlayerTemplate(hostSlot->getPlayerTemplate()); + if ( game->oldFactionsOnly() ) + { + // Make sure host follows the old factions only restrictions! + const PlayerTemplate *fac = ThePlayerTemplateStore->getNthPlayerTemplate(hostSlot->getPlayerTemplate()); - if ( fac != NULL && !fac->isOldFaction() ) - { - hostSlot->setPlayerTemplate( PLAYERTEMPLATE_RANDOM ); - } - } + if ( fac != NULL && !fac->isOldFaction() ) + { + hostSlot->setPlayerTemplate( PLAYERTEMPLATE_RANDOM ); + } + } for (Int i=1; igetPingString().str()); req.options = options.str(); TheGameSpyPeerMessageQueue->addRequest(req); - + game->setMapCRC( game->getMapCRC() ); // force a recheck game->setMapSize( game->getMapSize() ); // of if we have the map @@ -1481,8 +1482,8 @@ void WOLGameSetupMenuInit( WindowLayout *layout, void *userData ) buttonStart->winSetText(TheGameText->fetch("GUI:Accept")); buttonStart->winEnable( FALSE ); buttonSelectMap->winEnable( FALSE ); - checkBoxLimitSuperweapons->winEnable( FALSE ); // Can look but only host can touch - comboBoxStartingCash->winEnable( FALSE ); // Ditto + checkBoxLimitSuperweapons->winEnable( FALSE ); // Can look but only host can touch + comboBoxStartingCash->winEnable( FALSE ); // Ditto initialAcceptEnable = FALSE; } @@ -2311,15 +2312,15 @@ void WOLGameSetupMenuUpdate( WindowLayout * layout, void *userData) { if (val >= PLAYERTEMPLATE_MIN && val < ThePlayerTemplateStore->getPlayerTemplateCount() && val != slot->getPlayerTemplate()) { - // Validate for LimitArmies checkbox - if ( game->oldFactionsOnly() ) - { - const PlayerTemplate *fac = ThePlayerTemplateStore->getNthPlayerTemplate(val); - if ( fac != NULL && !fac->isOldFaction()) - { - val = PLAYERTEMPLATE_RANDOM; - } - } + // Validate for LimitArmies checkbox + if ( game->oldFactionsOnly() ) + { + const PlayerTemplate *fac = ThePlayerTemplateStore->getNthPlayerTemplate(val); + if ( fac != NULL && !fac->isOldFaction()) + { + val = PLAYERTEMPLATE_RANDOM; + } + } slot->setPlayerTemplate(val); if (val == PLAYERTEMPLATE_OBSERVER) @@ -2616,73 +2617,73 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg break; GameWindow *control = (GameWindow *)mData1; Int controlID = control->winGetWindowId(); - if ( controlID == comboBoxStartingCashID ) - { - handleStartingCashSelection(); - } - else - { - GameSpyStagingRoom *myGame = TheGameSpyInfo->getCurrentStagingRoom(); - for (Int i = 0; i < MAX_SLOTS; i++) - { - if (controlID == comboBoxColorID[i]) - { - handleColorSelection(i); - } - else if (controlID == comboBoxPlayerTemplateID[i]) - { - handlePlayerTemplateSelection(i); - } - else if (controlID == comboBoxTeamID[i]) - { - handleTeamSelection(i); - } - else if( controlID == comboBoxPlayerID[i] && TheGameSpyInfo->amIHost() ) - { - // We don't have anything that'll happen if we click on ourselves - if(i == myGame->getLocalSlotNum()) - break; - // Get - Int pos = -1; - GadgetComboBoxGetSelectedPos(comboBoxPlayer[i], &pos); - if( pos != SLOT_PLAYER && pos >= 0) - { - if( myGame->getSlot(i)->getState() == SLOT_PLAYER ) - { - PeerRequest req; - req.peerRequestType = PeerRequest::PEERREQUEST_UTMPLAYER; - req.UTM.isStagingRoom = TRUE; - AsciiString aName; - aName.translate(myGame->getSlot(i)->getName()); - req.nick = aName.str(); - req.id = "KICK/"; - req.options = "true"; - TheGameSpyPeerMessageQueue->addRequest(req); - - UnicodeString name = myGame->getSlot(i)->getName(); - myGame->getSlot(i)->setState(SlotState(pos)); - myGame->resetAccepted(); - TheGameSpyInfo->setGameOptions(); - WOLDisplaySlotList(); - //TheLAN->OnPlayerLeave(name); - } - else if( myGame->getSlot(i)->getState() != pos ) - { - Bool wasAI = (myGame->getSlot(i)->isAI()); - myGame->getSlot(i)->setState(SlotState(pos)); - Bool isAI = (myGame->getSlot(i)->isAI()); - myGame->resetAccepted(); - if (wasAI ^ isAI) - PopulatePlayerTemplateComboBox(i, comboBoxPlayerTemplate, myGame, wasAI && myGame->getAllowObservers()); - TheGameSpyInfo->setGameOptions(); - WOLDisplaySlotList(); - } - } - break; - } - } - } - break; + if ( controlID == comboBoxStartingCashID ) + { + handleStartingCashSelection(); + } + else + { + GameSpyStagingRoom *myGame = TheGameSpyInfo->getCurrentStagingRoom(); + for (Int i = 0; i < MAX_SLOTS; i++) + { + if (controlID == comboBoxColorID[i]) + { + handleColorSelection(i); + } + else if (controlID == comboBoxPlayerTemplateID[i]) + { + handlePlayerTemplateSelection(i); + } + else if (controlID == comboBoxTeamID[i]) + { + handleTeamSelection(i); + } + else if( controlID == comboBoxPlayerID[i] && TheGameSpyInfo->amIHost() ) + { + // We don't have anything that'll happen if we click on ourselves + if(i == myGame->getLocalSlotNum()) + break; + // Get + Int pos = -1; + GadgetComboBoxGetSelectedPos(comboBoxPlayer[i], &pos); + if( pos != SLOT_PLAYER && pos >= 0) + { + if( myGame->getSlot(i)->getState() == SLOT_PLAYER ) + { + PeerRequest req; + req.peerRequestType = PeerRequest::PEERREQUEST_UTMPLAYER; + req.UTM.isStagingRoom = TRUE; + AsciiString aName; + aName.translate(myGame->getSlot(i)->getName()); + req.nick = aName.str(); + req.id = "KICK/"; + req.options = "true"; + TheGameSpyPeerMessageQueue->addRequest(req); + + UnicodeString name = myGame->getSlot(i)->getName(); + myGame->getSlot(i)->setState(SlotState(pos)); + myGame->resetAccepted(); + TheGameSpyInfo->setGameOptions(); + WOLDisplaySlotList(); + //TheLAN->OnPlayerLeave(name); + } + else if( myGame->getSlot(i)->getState() != pos ) + { + Bool wasAI = (myGame->getSlot(i)->isAI()); + myGame->getSlot(i)->setState(SlotState(pos)); + Bool isAI = (myGame->getSlot(i)->isAI()); + myGame->resetAccepted(); + if (wasAI ^ isAI) + PopulatePlayerTemplateComboBox(i, comboBoxPlayerTemplate, myGame, wasAI && myGame->getAllowObservers()); + TheGameSpyInfo->setGameOptions(); + WOLDisplaySlotList(); + } + } + break; + } + } + } + break; }// case GCM_SELECTED: //------------------------------------------------------------------------------------------------- case GBM_SELECTED: @@ -2693,6 +2694,7 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg GameWindow *control = (GameWindow *)mData1; Int controlID = control->winGetWindowId(); static Int buttonCommunicatorID = NAMEKEY("GameSpyGameOptionsMenu.wnd:ButtonCommunicator"); + if ( controlID == buttonBackID ) { savePlayerInfo(); @@ -2764,10 +2766,10 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg WOLDisplaySlotList(); } } - else if ( controlID == checkBoxLimitSuperweaponsID ) - { - handleLimitSuperweaponsClick(); - } + else if ( controlID == checkBoxLimitSuperweaponsID ) + { + handleLimitSuperweaponsClick(); + } else { for (Int i = 0; i < MAX_SLOTS; i++) @@ -2816,11 +2818,11 @@ WindowMsgHandledType WOLGameSetupMenuSystem( GameWindow *window, UnsignedInt msg }// case GBM_SELECTED: //------------------------------------------------------------------------------------------------- case GBM_SELECTED_RIGHT: - { - if (buttonPushed) - break; - - GameWindow *control = (GameWindow *)mData1; + { + if (buttonPushed) + break; + + GameWindow *control = (GameWindow *)mData1; Int controlID = control->winGetWindowId(); for (Int i = 0; i < MAX_SLOTS; i++) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp index a8490ad6c3..07f3f05ff1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLLobbyMenu.cpp @@ -1189,7 +1189,7 @@ void WOLLobbyMenuUpdate( WindowLayout * layout, void *userData) room.setExeCRC(resp.stagingRoom.exeCRC); room.setIniCRC(resp.stagingRoom.iniCRC); room.setAllowObservers(resp.stagingRoom.allowObservers); - room.setUseStats(resp.stagingRoom.useStats); + room.setUseStats(resp.stagingRoom.useStats); room.setPingString(resp.stagingServerPingString.c_str()); room.setLadderIP(resp.stagingServerLadderIP.c_str()); room.setLadderPort(resp.stagingRoom.ladderPort); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp index 8d3dca851e..5e143d79b0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLMapSelectMenu.cpp @@ -338,9 +338,6 @@ WindowMsgHandledType WOLMapSelectMenuSystem( GameWindow *window, UnsignedInt msg break; } //--------------------------------------------------------------------------------------------- - - - case GLM_SELECTED: { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp index 51a149941f..41272d1653 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp @@ -1226,20 +1226,20 @@ void WOLQuickMatchMenuUpdate( WindowLayout * layout, void *userData) // LORENZEN EXPRESSES DOUBT ABOUT THIS ONE, AS IT MAY HAVE SUFFERED MERGE MANGLING... SORRY - // I THINK THIS IS THE OBSOLETE VERSION... SEE THE NEWER LOOKING ONE ABOVE + // I THINK THIS IS THE OBSOLETE VERSION... SEE THE NEWER LOOKING ONE ABOVE /* - case PeerResponse::PEERRESPONSE_DISCONNECT: - { - UnicodeString title, body; - AsciiString disconMunkee; - disconMunkee.format("GUI:GSDisconReason%d", resp.discon.reason); - title = TheGameText->fetch( "GUI:GSErrorTitle" ); - body = TheGameText->fetch( disconMunkee ); - GameSpyCloseAllOverlays(); - GSMessageBoxOk( title, body ); - TheGameSpyInfo->reset(); - TheShell->pop(); - } + case PeerResponse::PEERRESPONSE_DISCONNECT: + { + UnicodeString title, body; + AsciiString disconMunkee; + disconMunkee.format("GUI:GSDisconReason%d", resp.discon.reason); + title = TheGameText->fetch( "GUI:GSErrorTitle" ); + body = TheGameText->fetch( disconMunkee ); + GameSpyCloseAllOverlays(); + GSMessageBoxOk( title, body ); + TheGameSpyInfo->reset(); + TheShell->pop(); + } */ diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp index 6c673defee..263f7fcb54 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindow.cpp @@ -664,7 +664,7 @@ Int GameWindow::winEnable( Bool enable ) //============================================================================= Bool GameWindow::winGetEnabled( void ) { - return BitIsSet( m_status, WIN_STATUS_ENABLED ); + return BitIsSet( m_status, WIN_STATUS_ENABLED ); } // end winGetEnabled diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp index 4fb7455338..7839756fe4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Shell/Shell.cpp @@ -459,13 +459,13 @@ void Shell::showShell( Bool runInit ) if (!TheGlobalData->m_shellMapOn && m_screenCount == 0) - { + { #ifdef _PROFILE - Profile::StopRange("init"); + Profile::StopRange("init"); #endif //else TheShell->push( AsciiString("Menus/MainMenu.wnd") ); - } + } m_isShellActive = TRUE; } // end showShell diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp index 21be7ea196..fb4468eed3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp @@ -372,10 +372,10 @@ void GameClient::init( void ) TheInGameUI->setName("TheInGameUI"); } - TheChallengeGenerals = createChallengeGenerals(); - if( TheChallengeGenerals ) { - TheChallengeGenerals->init(); - } + TheChallengeGenerals = createChallengeGenerals(); + if( TheChallengeGenerals ) { + TheChallengeGenerals->init(); + } TheHotKeyManager = MSGNEW("GameClientSubsystem") HotKeyManager; if( TheHotKeyManager ) { @@ -608,17 +608,17 @@ void GameClient::update( void ) } // end if - if (TheInGameUI->isCameraTrackingDrawable()) - { - Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); - if ( draw ) - { - const Coord3D *pos = draw->getPosition(); - TheTacticalView->lookAt( pos ); - } - else - TheInGameUI->setCameraTrackingDrawable( FALSE ); - } + if (TheInGameUI->isCameraTrackingDrawable()) + { + Drawable *draw = TheInGameUI->getFirstSelectedDrawable(); + if ( draw ) + { + const Coord3D *pos = draw->getPosition(); + TheTacticalView->lookAt( pos ); + } + else + TheInGameUI->setCameraTrackingDrawable( FALSE ); + } if(TheGlobalData->m_playIntro || TheGlobalData->m_afterIntro) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp index cd8357d7b8..dbcab02ead 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp @@ -152,7 +152,6 @@ void GlobalLanguage::init( void ) fname = tempName; } - ini.load( fname, INI_LOAD_OVERWRITE, NULL ); StringListIt it = m_localFonts.begin(); while( it != m_localFonts.end()) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp index 1fa290fa39..a766dab445 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp @@ -358,7 +358,7 @@ void InGameUI::crc( Xfer *xfer ) * Version Info: * 1: Initial version * 2: Save NamedTimers, but not specifically their Info structs. We'll recreate them. - * 3: Added m_evaReadyPlayed boolean to transfer + * 3: Added m_evaReadyPlayed boolean to transfer */ // ------------------------------------------------------------------------------------------------ void InGameUI::xfer( Xfer *xfer ) @@ -435,10 +435,10 @@ void InGameUI::xfer( Xfer *xfer ) xfer->xferBool(&swInfo->m_hiddenByScript); xfer->xferBool(&swInfo->m_hiddenByScience); xfer->xferBool(&swInfo->m_ready); - if ( currentVersion >= 3 ) - { - xfer->xferBool( &swInfo->m_evaReadyPlayed ); - } + if ( currentVersion >= 3 ) + { + xfer->xferBool( &swInfo->m_evaReadyPlayed ); + } } } } @@ -482,14 +482,14 @@ void InGameUI::xfer( Xfer *xfer ) xfer->xferBool(&hiddenByScript); xfer->xferBool(&hiddenByScience); xfer->xferBool(&ready); - if ( currentVersion >= 3 ) - { - xfer->xferBool( &evaReadyPlayed ); - } - else - { - evaReadyPlayed = ready; - } + if ( currentVersion >= 3 ) + { + xfer->xferBool( &evaReadyPlayed ); + } + else + { + evaReadyPlayed = ready; + } // srj sez: due to order-of-operation stuff, sometimes these will already exist, // sometimes not. not sure why. so handle both cases. @@ -503,7 +503,7 @@ void InGameUI::xfer( Xfer *xfer ) hiddenByScript, hiddenByScience, ready, - evaReadyPlayed, + evaReadyPlayed, m_superweaponNormalFont, m_superweaponNormalPointSize, m_superweaponNormalBold, @@ -518,7 +518,7 @@ void InGameUI::xfer( Xfer *xfer ) swInfo->m_hiddenByScript = hiddenByScript; swInfo->m_hiddenByScience = hiddenByScience; swInfo->m_ready = ready; - swInfo->m_evaReadyPlayed = evaReadyPlayed; + swInfo->m_evaReadyPlayed = evaReadyPlayed; } swInfo->m_forceUpdateText = true; @@ -583,7 +583,7 @@ void InGameUI::addSuperweapon(Int playerIndex, const AsciiString& powerName, Obj Bool hiddenByScience = (powerTemplate->getRequiredScience() != SCIENCE_INVALID) && (player->hasScience(powerTemplate->getRequiredScience()) == false); #ifndef DO_UNIT_TIMINGS - DEBUG_LOG(("Adding superweapon UI timer\n")); + DEBUG_LOG(("Adding superweapon UI timer\n")); #endif SuperweaponInfo *info = newInstance(SuperweaponInfo)( id, @@ -593,7 +593,7 @@ void InGameUI::addSuperweapon(Int playerIndex, const AsciiString& powerName, Obj // THe trouble is: There is no mechanism to clear this bit when the science is granted, thus, // the timer never, ever, ever get drawn.... unless the owning object is post-science constructed. FALSE, // ready - FALSE, // evaReadyPlayed + FALSE, // evaReadyPlayed m_superweaponNormalFont, m_superweaponNormalPointSize, m_superweaponNormalBold, @@ -861,9 +861,9 @@ const FieldParse InGameUI::s_fieldParseTable[] = { "HelixNapalmBombRadiusCursor",RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_HELIX_NAPALM_BOMB] ) }, { "NuclearMissileRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NUCLEARMISSILE] ) }, - { "EMPPulseRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_EMPPULSE] ) }, - { "ArtilleryRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ARTILLERYBARRAGE] ) }, - { "FrenzyRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_FRENZY] ) }, + { "EMPPulseRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_EMPPULSE] ) }, + { "ArtilleryRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_ARTILLERYBARRAGE] ) }, + { "FrenzyRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_FRENZY] ) }, { "NapalmStrikeRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_NAPALMSTRIKE] ) }, { "ClusterMinesRadiusCursor", RadiusDecalTemplate::parseRadiusDecalTemplate, NULL, offsetof( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLUSTERMINES] ) }, @@ -903,8 +903,8 @@ InGameUI::InGameUI() m_nextMoveHint = 0; m_selectCount = 0; m_frameSelectionChanged = 0; - m_duringDoubleClickAttackMoveGuardHintTimer = 0; - m_duringDoubleClickAttackMoveGuardHintStashedPosition.zero(); + m_duringDoubleClickAttackMoveGuardHintTimer = 0; + m_duringDoubleClickAttackMoveGuardHintStashedPosition.zero(); m_maxSelectCount = -1; m_isScrolling = FALSE; m_isSelecting = FALSE; @@ -1261,7 +1261,7 @@ void InGameUI::setRadiusCursor(RadiusCursorType cursorType, const SpecialPowerTe case RADIUSCURSOR_PARTICLECANNON: case RADIUSCURSOR_A10STRIKE: case RADIUSCURSOR_SPECTREGUNSHIP: - case RADIUSCURSOR_HELIX_NAPALM_BOMB: + case RADIUSCURSOR_HELIX_NAPALM_BOMB: case RADIUSCURSOR_DAISYCUTTER: case RADIUSCURSOR_CARPETBOMB: case RADIUSCURSOR_PARADROP: @@ -1319,25 +1319,25 @@ void InGameUI::handleRadiusCursor() TheTacticalView->screenToTerrain( &mouseIO->pos, &pos ); - if ( TheGlobalData->m_doubleClickAttackMove && m_duringDoubleClickAttackMoveGuardHintTimer > 0 ) - { - m_curRadiusCursor.setOpacity( m_duringDoubleClickAttackMoveGuardHintTimer * 0.1f ); - m_curRadiusCursor.setPosition( m_duringDoubleClickAttackMoveGuardHintStashedPosition ); //world space position of center of decal + if ( TheGlobalData->m_doubleClickAttackMove && m_duringDoubleClickAttackMoveGuardHintTimer > 0 ) + { + m_curRadiusCursor.setOpacity( m_duringDoubleClickAttackMoveGuardHintTimer * 0.1f ); + m_curRadiusCursor.setPosition( m_duringDoubleClickAttackMoveGuardHintStashedPosition ); //world space position of center of decal - } - else - { - m_curRadiusCursor.setPosition(pos); //world space position of center of decal - m_curRadiusCursor.update(); - } + } + else + { + m_curRadiusCursor.setPosition(pos); //world space position of center of decal + m_curRadiusCursor.update(); + } - } + } } void InGameUI::triggerDoubleClickAttackMoveGuardHint( void ) { - m_duringDoubleClickAttackMoveGuardHintTimer = 11; + m_duringDoubleClickAttackMoveGuardHintTimer = 11; const MouseIO* mouseIO = TheMouse->getMouseStatus(); TheTacticalView->screenToTerrain( &mouseIO->pos, &m_duringDoubleClickAttackMoveGuardHintStashedPosition ); } @@ -2329,7 +2329,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) //Because we have support for disguised units pretending to be units from another //team, we need to intercept it here and make sure it's rendered appropriately //based on which client is rendering it. - StealthUpdate *update = obj->getStealth(); + StealthUpdate *update = obj->getStealth(); if( update ) { if( update->isDisguised() ) @@ -2421,7 +2421,7 @@ void InGameUI::createMouseoverHint( const GameMessage *msg ) str.concat(warehouseFeedback); } - if (player) + if (player) { UnicodeString tooltip; //if (TheRecorder->isMultiplayer() && player->getPlayerType() == PLAYER_HUMAN) @@ -2545,23 +2545,19 @@ void InGameUI::createCommandHint( const GameMessage *msg ) } //#endif - setRadiusCursorNone(); - if ( TheGlobalData->m_doubleClickAttackMove ) - { - if ( --m_duringDoubleClickAttackMoveGuardHintTimer > 0 ) - { - setMouseCursor(Mouse::FORCE_ATTACK_GROUND); - setRadiusCursor(RADIUSCURSOR_GUARD_AREA, - NULL, - PRIMARY_WEAPON); - return; - } - } - - - + if ( TheGlobalData->m_doubleClickAttackMove ) + { + if ( --m_duringDoubleClickAttackMoveGuardHintTimer > 0 ) + { + setMouseCursor(Mouse::FORCE_ATTACK_GROUND); + setRadiusCursor(RADIUSCURSOR_GUARD_AREA, + NULL, + PRIMARY_WEAPON); + return; + } + } // set cursor to normal if there is a window under the cursor GameWindow *window = NULL; @@ -3509,9 +3505,9 @@ void InGameUI::postDraw( void ) } // draw superweapon timers - // Also responsible for Eva saying "Superweapon is ready for launch" - // IMPORTANT: Don't bail out of this block early just because you don't - // want to display the timers -- Eva still needs to be checked + // Also responsible for Eva saying "Superweapon is ready for launch" + // IMPORTANT: Don't bail out of this block early just because you don't + // want to display the timers -- Eva still needs to be checked if (TheGameLogic->getFrame() > 0 ) { // Int superweaponCount = 0; @@ -3574,145 +3570,145 @@ void InGameUI::postDraw( void ) readySecs = (module->getReadyFrame() - TheGameLogic->getFrame()) / LOGICFRAMES_PER_SECOND; // Yes, integer math. We can't have float imprecision display 4:01 on a disabled superweapon. - // Only if we actually changed the ready status do we want to play an Eva event. - if ( isReady && !info->m_evaReadyPlayed ) - { - if ( TheGameLogic->getFrame() > 0 ) - { - SpecialPowerType type = module->getSpecialPowerTemplate()->getSpecialPowerType(); - - Player *localPlayer = ThePlayerList->getLocalPlayer(); - - if( type == SPECIAL_PARTICLE_UPLINK_CANNON || type == SUPW_SPECIAL_PARTICLE_UPLINK_CANNON || type == LAZR_SPECIAL_PARTICLE_UPLINK_CANNON ) - { - if ( localPlayer == owningObject->getControllingPlayer() ) - { - TheEva->setShouldPlay(EVA_SuperweaponReady_Own_ParticleCannon); - } - else if ( localPlayer->getRelationship(owningObject->getTeam()) != ENEMIES ) - { - // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? - TheEva->setShouldPlay(EVA_SuperweaponReady_Ally_ParticleCannon); - } - else - { - TheEva->setShouldPlay(EVA_SuperweaponReady_Enemy_ParticleCannon); - } - } - else if( type == SPECIAL_NEUTRON_MISSILE || type == NUKE_SPECIAL_NEUTRON_MISSILE || type == SUPW_SPECIAL_NEUTRON_MISSILE ) - { - if ( localPlayer == owningObject->getControllingPlayer() ) - { - TheEva->setShouldPlay(EVA_SuperweaponReady_Own_Nuke); - } - else if ( localPlayer->getRelationship(owningObject->getTeam()) != ENEMIES ) - { - // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? - TheEva->setShouldPlay(EVA_SuperweaponReady_Ally_Nuke); - } - else - { - TheEva->setShouldPlay(EVA_SuperweaponReady_Enemy_Nuke); - } - } - else if (type == SPECIAL_SCUD_STORM) - { - if ( localPlayer == owningObject->getControllingPlayer() ) - { - TheEva->setShouldPlay(EVA_SuperweaponReady_Own_ScudStorm); - } - else if ( localPlayer->getRelationship(owningObject->getTeam()) != ENEMIES ) - { - // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? - TheEva->setShouldPlay(EVA_SuperweaponReady_Ally_ScudStorm); - } - else - { - TheEva->setShouldPlay(EVA_SuperweaponReady_Enemy_ScudStorm); - } - } - } - info->m_evaReadyPlayed = true; - } - else - { - if ( !isReady ) - info->m_evaReadyPlayed = false; // Reset Eva for next time - } - - // draw the text - if ( !m_superweaponHiddenByScript && !marginExceeded ) - { - // Similarly, only checking timers is not truly indicitive of readyness. - Bool changeBolding = (readySecs != info->m_timestamp) || (isReady != info->m_ready) || info->m_forceUpdateText; - if (changeBolding) - { - if (isReady) - { - // go bold - we're good to go - info->setFont( m_superweaponReadyFont, m_superweaponReadyPointSize, m_superweaponReadyBold ); - } - else - { - // if we were at 0, we've just fired - kill the bold - if (info->m_timestamp == 0) - { - info->setFont( m_superweaponNormalFont, m_superweaponNormalPointSize, m_superweaponNormalBold ); - } - } - - - info->m_forceUpdateText = false; - info->m_ready = isReady; - info->m_timestamp = readySecs; - Int min = readySecs/60; - Int sec = readySecs - min*60; - AsciiString strIndex; - strIndex.format("GUI:%s", templateName.str()); - UnicodeString name, time; - name.format(L"%ls: ", TheGameText->fetch(strIndex.str()).str()); - time.format(L"%d:%2.2d", min, sec); - info->setText(name, time); - } - - if (isReady) - { - if ( m_superweaponFlashDuration != 0.0f ) - { - if ( TheGameLogic->getFrame() >= m_superweaponLastFlashFrame + (Int)(m_superweaponFlashDuration) ) - { - m_superweaponUsedFlashColor = !m_superweaponUsedFlashColor; - m_superweaponLastFlashFrame = TheGameLogic->getFrame(); - } - info->drawName( startX, - startY, (m_superweaponUsedFlashColor)?0:m_superweaponFlashColor, bgColor ); - info->drawTime( startX, - startY, (m_superweaponUsedFlashColor)?0:m_superweaponFlashColor, bgColor ); - } - else - { - info->drawName( startX, startY, 0, bgColor ); - info->drawTime( startX, startY, 0, bgColor ); - } - } - else - { - info->drawName( startX, startY, 0, bgColor ); - info->drawTime( startX, startY, 0, bgColor ); - } - - // increment text spot to next location - startY += info->getHeight(); - - } - if (info->getSpecialPowerTemplate()->isSharedNSync()) - break; // Wow, it is almost too easy! - // This prevents redundant timers for shared powers/superweapons - // No matter how many specialpowermodules register their timers with me, - // I will only draw the timer of the first valid one in my list, - // since they all have the same template, ans they all - // use the Player::getReadyFrame() functions to stay in sync. - } + // Only if we actually changed the ready status do we want to play an Eva event. + if ( isReady && !info->m_evaReadyPlayed ) + { + if ( TheGameLogic->getFrame() > 0 ) + { + SpecialPowerType type = module->getSpecialPowerTemplate()->getSpecialPowerType(); + + Player *localPlayer = ThePlayerList->getLocalPlayer(); + + if( type == SPECIAL_PARTICLE_UPLINK_CANNON || type == SUPW_SPECIAL_PARTICLE_UPLINK_CANNON || type == LAZR_SPECIAL_PARTICLE_UPLINK_CANNON ) + { + if ( localPlayer == owningObject->getControllingPlayer() ) + { + TheEva->setShouldPlay(EVA_SuperweaponReady_Own_ParticleCannon); + } + else if ( localPlayer->getRelationship(owningObject->getTeam()) != ENEMIES ) + { + // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? + TheEva->setShouldPlay(EVA_SuperweaponReady_Ally_ParticleCannon); + } + else + { + TheEva->setShouldPlay(EVA_SuperweaponReady_Enemy_ParticleCannon); + } + } + else if( type == SPECIAL_NEUTRON_MISSILE || type == NUKE_SPECIAL_NEUTRON_MISSILE || type == SUPW_SPECIAL_NEUTRON_MISSILE ) + { + if ( localPlayer == owningObject->getControllingPlayer() ) + { + TheEva->setShouldPlay(EVA_SuperweaponReady_Own_Nuke); + } + else if ( localPlayer->getRelationship(owningObject->getTeam()) != ENEMIES ) + { + // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? + TheEva->setShouldPlay(EVA_SuperweaponReady_Ally_Nuke); + } + else + { + TheEva->setShouldPlay(EVA_SuperweaponReady_Enemy_Nuke); + } + } + else if (type == SPECIAL_SCUD_STORM) + { + if ( localPlayer == owningObject->getControllingPlayer() ) + { + TheEva->setShouldPlay(EVA_SuperweaponReady_Own_ScudStorm); + } + else if ( localPlayer->getRelationship(owningObject->getTeam()) != ENEMIES ) + { + // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? + TheEva->setShouldPlay(EVA_SuperweaponReady_Ally_ScudStorm); + } + else + { + TheEva->setShouldPlay(EVA_SuperweaponReady_Enemy_ScudStorm); + } + } + } + info->m_evaReadyPlayed = true; + } + else + { + if ( !isReady ) + info->m_evaReadyPlayed = false; // Reset Eva for next time + } + + // draw the text + if ( !m_superweaponHiddenByScript && !marginExceeded ) + { + // Similarly, only checking timers is not truly indicitive of readyness. + Bool changeBolding = (readySecs != info->m_timestamp) || (isReady != info->m_ready) || info->m_forceUpdateText; + if (changeBolding) + { + if (isReady) + { + // go bold - we're good to go + info->setFont( m_superweaponReadyFont, m_superweaponReadyPointSize, m_superweaponReadyBold ); + } + else + { + // if we were at 0, we've just fired - kill the bold + if (info->m_timestamp == 0) + { + info->setFont( m_superweaponNormalFont, m_superweaponNormalPointSize, m_superweaponNormalBold ); + } + } + + + info->m_forceUpdateText = false; + info->m_ready = isReady; + info->m_timestamp = readySecs; + Int min = readySecs/60; + Int sec = readySecs - min*60; + AsciiString strIndex; + strIndex.format("GUI:%s", templateName.str()); + UnicodeString name, time; + name.format(L"%ls: ", TheGameText->fetch(strIndex.str()).str()); + time.format(L"%d:%2.2d", min, sec); + info->setText(name, time); + } + + if (isReady) + { + if ( m_superweaponFlashDuration != 0.0f ) + { + if ( TheGameLogic->getFrame() >= m_superweaponLastFlashFrame + (Int)(m_superweaponFlashDuration) ) + { + m_superweaponUsedFlashColor = !m_superweaponUsedFlashColor; + m_superweaponLastFlashFrame = TheGameLogic->getFrame(); + } + info->drawName( startX, + startY, (m_superweaponUsedFlashColor)?0:m_superweaponFlashColor, bgColor ); + info->drawTime( startX, + startY, (m_superweaponUsedFlashColor)?0:m_superweaponFlashColor, bgColor ); + } + else + { + info->drawName( startX, startY, 0, bgColor ); + info->drawTime( startX, startY, 0, bgColor ); + } + } + else + { + info->drawName( startX, startY, 0, bgColor ); + info->drawTime( startX, startY, 0, bgColor ); + } + + // increment text spot to next location + startY += info->getHeight(); + + } + if (info->getSpecialPowerTemplate()->isSharedNSync()) + break; // Wow, it is almost too easy! + // This prevents redundant timers for shared powers/superweapons + // No matter how many specialpowermodules register their timers with me, + // I will only draw the timer of the first valid one in my list, + // since they all have the same template, ans they all + // use the Player::getReadyFrame() functions to stay in sync. + } } } } @@ -4088,7 +4084,7 @@ void InGameUI::militarySubtitle( const AsciiString& label, Int duration ) Coord2D multiplier; multiplier.x = (float)TheDisplay->getWidth() / 800.0f; multiplier.y = (float)TheDisplay->getHeight() / 600.0f; - + // lets bring out the data structure! m_militarySubtitle = NEW MilitarySubtitleData; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp index a69c8755ff..6797fcb567 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp @@ -638,8 +638,8 @@ void Mouse::reset( void ) ///@ todo Write Mouse::reset() if there needs to be anything here // reset the text of the cursor text - if ( m_cursorTextDisplayString ) - m_cursorTextDisplayString->reset(); + if ( m_cursorTextDisplayString ) + m_cursorTextDisplayString->reset(); } // end reset @@ -678,15 +678,15 @@ void Mouse::createStreamMessages( void ) msg->appendPixelArgument( m_currMouse.pos ); msg->appendIntegerArgument( TheKeyboard->getModifierFlags() ); - Int delay = m_tooltipDelayTime; - if(m_tooltipDelay >= 0 ) - delay = m_tooltipDelay; + Int delay = m_tooltipDelayTime; + if(m_tooltipDelay >= 0 ) + delay = m_tooltipDelay; if( TheGlobalData->m_scriptDebug ) { //No delay while scriptdebugging! delay = 0; } - + if( now - m_stillTime >= delay ) { if (!m_displayTooltip) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/LanguageFilter.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/LanguageFilter.cpp index e27fe0d7cf..6c34f06b37 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/LanguageFilter.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/LanguageFilter.cpp @@ -58,7 +58,7 @@ void LanguageFilter::init() { return; } - wchar_t word[128]; + WideChar word[128]; while (readWord(file1, word)) { Int wordLen = wcslen(word); if (wordLen == 0) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp index 4ecbe7f72c..e0aa558183 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp @@ -1204,7 +1204,7 @@ Image *getMapPreviewImage( AsciiString mapName ) if (success) { - image = newInstance(Image); + image = newInstance(Image); image->setName(tempName); //image->setFullPath("mission.tga"); image->setFilename(name); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp index 02fd3145c3..e8bea3efcf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp @@ -188,40 +188,40 @@ static CanAttackResult canObjectForceAttack( Object *obj, const Object *victim, //Special case -- objects with spawn weapons have to do different checks. Stinger site with stinger soldiers is //the catalyst example. - if ( obj->isKindOf( KINDOF_SPAWNS_ARE_THE_WEAPONS ) ) - { - if( result != ATTACKRESULT_POSSIBLE && result != ATTACKRESULT_POSSIBLE_AFTER_MOVING ) - { - SpawnBehaviorInterface *spawnInterface = obj->getSpawnBehaviorInterface(); - if( spawnInterface ) - { - //We found the spawn interface, now get the closest slave to the target. - Object *slave = spawnInterface->getClosestSlave( victim->getPosition() ); - if( slave ) - { - result = slave->getAbleToAttackSpecificObject( ATTACK_NEW_TARGET_FORCED, victim, CMD_FROM_PLAYER ); - } - } - } - else // oh dear me. The wierd case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase - { - ContainModuleInterface *contain = obj->getContain(); - if ( contain ) - { - Object *rider = contain->getClosestRider( victim->getPosition() ); - if ( rider ) - { - result = rider->getAbleToAttackSpecificObject( ATTACK_NEW_TARGET_FORCED, victim, CMD_FROM_PLAYER ); - if( result != ATTACKRESULT_NOT_POSSIBLE ) - return result; - } - } - } - - } // end if spawnsRweapons + if ( obj->isKindOf( KINDOF_SPAWNS_ARE_THE_WEAPONS ) ) + { + if( result != ATTACKRESULT_POSSIBLE && result != ATTACKRESULT_POSSIBLE_AFTER_MOVING ) + { + SpawnBehaviorInterface *spawnInterface = obj->getSpawnBehaviorInterface(); + if( spawnInterface ) + { + //We found the spawn interface, now get the closest slave to the target. + Object *slave = spawnInterface->getClosestSlave( victim->getPosition() ); + if( slave ) + { + result = slave->getAbleToAttackSpecificObject( ATTACK_NEW_TARGET_FORCED, victim, CMD_FROM_PLAYER ); + } + } + } + else // oh dear me. The wierd case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase + { + ContainModuleInterface *contain = obj->getContain(); + if ( contain ) + { + Object *rider = contain->getClosestRider( victim->getPosition() ); + if ( rider ) + { + result = rider->getAbleToAttackSpecificObject( ATTACK_NEW_TARGET_FORCED, victim, CMD_FROM_PLAYER ); + if( result != ATTACKRESULT_NOT_POSSIBLE ) + return result; + } + } + } + + } // end if spawnsRweapons - return result; + return result; } else { @@ -244,20 +244,20 @@ static CanAttackResult canObjectForceAttack( Object *obj, const Object *victim, testObj = slave; } } - else - { - result = obj->getAbleToUseWeaponAgainstTarget( ATTACK_NEW_TARGET, NULL, pos, CMD_FROM_PLAYER ); - if( result != ATTACKRESULT_POSSIBLE ) // oh dear me. The wierd case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase - { - ContainModuleInterface *contain = obj->getContain(); - if ( contain ) - { - Object *rider = contain->getClosestRider( pos ); - if ( rider ) - testObj = rider; - } - } - } + else + { + result = obj->getAbleToUseWeaponAgainstTarget( ATTACK_NEW_TARGET, NULL, pos, CMD_FROM_PLAYER ); + if( result != ATTACKRESULT_POSSIBLE ) // oh dear me. The wierd case of a garrisoncontainer being a KINDOF_SPAWNS_ARE_THE_WEAPONS... the AmericaBuildingFirebase + { + ContainModuleInterface *contain = obj->getContain(); + if ( contain ) + { + Object *rider = contain->getClosestRider( pos ); + if ( rider ) + testObj = rider; + } + } + } } //Now evaluate the testObj again to see if it is capable of force attacking the pos. result = testObj->getAbleToUseWeaponAgainstTarget( ATTACK_NEW_TARGET, NULL, pos, CMD_FROM_PLAYER ); @@ -2260,25 +2260,25 @@ GameMessage::Type CommandTranslator::evaluateContextCommand( Drawable *draw, Object *obj = (*it) ? (*it)->getObject() : NULL; AIUpdateInterface *ai = obj ? obj->getAI() : NULL; if( ai ) - { - if ( ai->isQuickPathAvailable( pos ) ) - { - validQuickPath = TRUE; - break; - } - // Wait! there are some units that CAN moveTo positions that Quickpath will reject, - // namely, Colonel Burton and the CombatBike. Both have CLIFF locomotors. - // We must detect whether the position is valid for these, before just invalidating the cursor, - // out of hand. - if ( ai->hasLocomotorForSurface( LOCOMOTORSURFACE_CLIFF ) ) - { - if ( TheTerrainLogic->isCliffCell( pos->x, pos->y ) ) - { - validQuickPath = TRUE;// yeah, not really quick, but you know... - break; - } - } - } + { + if ( ai->isQuickPathAvailable( pos ) ) + { + validQuickPath = TRUE; + break; + } + // Wait! there are some units that CAN moveTo positions that Quickpath will reject, + // namely, Colonel Burton and the CombatBike. Both have CLIFF locomotors. + // We must detect whether the position is valid for these, before just invalidating the cursor, + // out of hand. + if ( ai->hasLocomotorForSurface( LOCOMOTORSURFACE_CLIFF ) ) + { + if ( TheTerrainLogic->isCliffCell( pos->x, pos->y ) ) + { + validQuickPath = TRUE;// yeah, not really quick, but you know... + break; + } + } + } } @@ -3240,7 +3240,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_META_TOGGLE_CAMERA_TRACKING_DRAWABLE: TheInGameUI->setCameraTrackingDrawable( true ); break; - //-------------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------------- case GameMessage::MSG_META_TOGGLE_FAST_FORWARD_REPLAY: { if( TheGlobalData ) @@ -3261,15 +3261,15 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } // end toggle special power delays #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)//may be defined in GameCommon.h - case GameMessage::MSG_CHEAT_RUNSCRIPT1: - case GameMessage::MSG_CHEAT_RUNSCRIPT2: - case GameMessage::MSG_CHEAT_RUNSCRIPT3: - case GameMessage::MSG_CHEAT_RUNSCRIPT4: - case GameMessage::MSG_CHEAT_RUNSCRIPT5: - case GameMessage::MSG_CHEAT_RUNSCRIPT6: - case GameMessage::MSG_CHEAT_RUNSCRIPT7: - case GameMessage::MSG_CHEAT_RUNSCRIPT8: - case GameMessage::MSG_CHEAT_RUNSCRIPT9: + case GameMessage::MSG_CHEAT_RUNSCRIPT1: + case GameMessage::MSG_CHEAT_RUNSCRIPT2: + case GameMessage::MSG_CHEAT_RUNSCRIPT3: + case GameMessage::MSG_CHEAT_RUNSCRIPT4: + case GameMessage::MSG_CHEAT_RUNSCRIPT5: + case GameMessage::MSG_CHEAT_RUNSCRIPT6: + case GameMessage::MSG_CHEAT_RUNSCRIPT7: + case GameMessage::MSG_CHEAT_RUNSCRIPT8: + case GameMessage::MSG_CHEAT_RUNSCRIPT9: { if ( !TheGameLogic->isInMultiplayerGame() ) { @@ -3284,8 +3284,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } break; } - //-------------------------------------------------------------------------------------- - case GameMessage::MSG_CHEAT_TOGGLE_SPECIAL_POWER_DELAYS: + //-------------------------------------------------------------------------------------- + case GameMessage::MSG_CHEAT_TOGGLE_SPECIAL_POWER_DELAYS: { if ( !TheGameLogic->isInMultiplayerGame() ) { @@ -3303,8 +3303,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage break; } // end toggle special power delays - //-------------------------------------------------------------------------------------- - case GameMessage::MSG_CHEAT_SWITCH_TEAMS: + //-------------------------------------------------------------------------------------- + case GameMessage::MSG_CHEAT_SWITCH_TEAMS: { if ( !TheGameLogic->isInMultiplayerGame() ) { @@ -3345,8 +3345,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } break; } - //-------------------------------------------------------------------------------------- - case GameMessage::MSG_CHEAT_KILL_SELECTION: + //-------------------------------------------------------------------------------------- + case GameMessage::MSG_CHEAT_KILL_SELECTION: { if ( !TheGameLogic->isInMultiplayerGame() ) { @@ -3356,7 +3356,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } break; } - case GameMessage::MSG_CHEAT_INSTANT_BUILD: + case GameMessage::MSG_CHEAT_INSTANT_BUILD: { if ( !TheGameLogic->isInMultiplayerGame() ) { @@ -3367,7 +3367,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } break; } - case GameMessage::MSG_CHEAT_ADD_CASH: + case GameMessage::MSG_CHEAT_ADD_CASH: { if ( !TheGameLogic->isInMultiplayerGame() ) { @@ -3377,7 +3377,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } break; } - case GameMessage::MSG_CHEAT_GIVE_ALL_SCIENCES: + case GameMessage::MSG_CHEAT_GIVE_ALL_SCIENCES: { if ( !TheGameLogic->isInMultiplayerGame() ) { @@ -3400,7 +3400,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage } break; } - case GameMessage::MSG_CHEAT_GIVE_SCIENCEPURCHASEPOINTS: + case GameMessage::MSG_CHEAT_GIVE_SCIENCEPURCHASEPOINTS: { if ( !TheGameLogic->isInMultiplayerGame() ) { @@ -3732,7 +3732,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage ThePlayerList->getLocalPlayer()->getAcademyStats()->recordDoubleClickAttackMoveOrderGiven(); - TheInGameUI->triggerDoubleClickAttackMoveGuardHint(); + TheInGameUI->triggerDoubleClickAttackMoveGuardHint(); break; } @@ -3756,9 +3756,9 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage const CommandButton *command = TheInGameUI->getGUICommand(); // maintain this as the list of GUI button initiated commands that fire with left click in alt mouse mode - Bool isFiringGUICommand = (command && (command->getCommandType() == GUI_COMMAND_SPECIAL_POWER - || command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT - || command->getCommandType() == GUI_COMMAND_FIRE_WEAPON + Bool isFiringGUICommand = (command && (command->getCommandType() == GUI_COMMAND_SPECIAL_POWER + || command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT + || command->getCommandType() == GUI_COMMAND_FIRE_WEAPON || command->getCommandType() == GUI_COMMAND_COMBATDROP || command->getCommandType() == GUICOMMANDMODE_HIJACK_VEHICLE || command->getCommandType() == GUICOMMANDMODE_CONVERT_TO_CARBOMB)); @@ -4437,7 +4437,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage d->clearAndSetModelConditionFlags(empty, empty); } } - } + } } disp = DESTROY_MESSAGE; break; @@ -4452,7 +4452,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage localPlayer->toggleIgnorePrereqs(); disp = DESTROY_MESSAGE; break; - } + } //------------------------------------------------------------------------------- DEMO MESSAGES //----------------------------------------------------------------------------------------- @@ -4509,7 +4509,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage case GameMessage::MSG_META_DEMO_RUNSCRIPT8: case GameMessage::MSG_META_DEMO_RUNSCRIPT9: { - if( TheScriptEngine ) + if( TheScriptEngine ) { Int script = t - GameMessage::MSG_META_DEMO_RUNSCRIPT1 + 1; AsciiString scriptName; @@ -4851,15 +4851,15 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage TheGlobalData->m_showCollisionExtents ? L"ON" : L"OFF" ); break; - //------------------------------------------------------------------------------- DEMO MESSAGES - //----------------------------------------------------------------------------------------- - case GameMessage::MSG_META_DEBUG_SHOW_AUDIO_LOCATIONS: - TheWritableGlobalData->m_showAudioLocations = 1 - TheGlobalData->m_showAudioLocations; - TheInGameUI->message( UnicodeString( L"Show AudioLocations %s" ), - TheGlobalData->m_showAudioLocations ? L"ON" : L"OFF" ); - break; + //------------------------------------------------------------------------------- DEMO MESSAGES + //----------------------------------------------------------------------------------------- + case GameMessage::MSG_META_DEBUG_SHOW_AUDIO_LOCATIONS: + TheWritableGlobalData->m_showAudioLocations = 1 - TheGlobalData->m_showAudioLocations; + TheInGameUI->message( UnicodeString( L"Show AudioLocations %s" ), + TheGlobalData->m_showAudioLocations ? L"ON" : L"OFF" ); + break; - //------------------------------------------------------------------------------- DEMO MESSAGES + //------------------------------------------------------------------------------- DEMO MESSAGES //----------------------------------------------------------------------------------------- case GameMessage::MSG_META_DEBUG_SHOW_HEALTH: { diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp index 557cc39166..c428c174ee 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp @@ -181,8 +181,8 @@ static const LookupListRec GameMessageMetaTypeNames[] = { "END_CAMERA_ZOOM_OUT", GameMessage::MSG_META_END_CAMERA_ZOOM_OUT }, { "CAMERA_RESET", GameMessage::MSG_META_CAMERA_RESET }, { "TOGGLE_CAMERA_TRACKING_DRAWABLE", GameMessage::MSG_META_TOGGLE_CAMERA_TRACKING_DRAWABLE }, - { "TOGGLE_FAST_FORWARD_REPLAY", GameMessage::MSG_META_TOGGLE_FAST_FORWARD_REPLAY }, - { "DEMO_INSTANT_QUIT", GameMessage::MSG_META_DEMO_INSTANT_QUIT }, + { "TOGGLE_FAST_FORWARD_REPLAY", GameMessage::MSG_META_TOGGLE_FAST_FORWARD_REPLAY }, + { "DEMO_INSTANT_QUIT", GameMessage::MSG_META_DEMO_INSTANT_QUIT }, #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)//may be defined in GameCommon.h { "CHEAT_RUNSCRIPT1", GameMessage::MSG_CHEAT_RUNSCRIPT1 }, @@ -195,16 +195,16 @@ static const LookupListRec GameMessageMetaTypeNames[] = { "CHEAT_RUNSCRIPT8", GameMessage::MSG_CHEAT_RUNSCRIPT8 }, { "CHEAT_RUNSCRIPT9", GameMessage::MSG_CHEAT_RUNSCRIPT9 }, { "CHEAT_TOGGLE_SPECIAL_POWER_DELAYS", GameMessage::MSG_CHEAT_TOGGLE_SPECIAL_POWER_DELAYS }, - { "CHEAT_SWITCH_TEAMS", GameMessage::MSG_CHEAT_SWITCH_TEAMS }, + { "CHEAT_SWITCH_TEAMS", GameMessage::MSG_CHEAT_SWITCH_TEAMS }, { "CHEAT_KILL_SELECTION", GameMessage::MSG_CHEAT_KILL_SELECTION }, { "CHEAT_TOGGLE_HAND_OF_GOD_MODE", GameMessage::MSG_CHEAT_TOGGLE_HAND_OF_GOD_MODE }, { "CHEAT_INSTANT_BUILD", GameMessage::MSG_CHEAT_INSTANT_BUILD }, { "CHEAT_DESHROUD", GameMessage::MSG_CHEAT_DESHROUD }, { "CHEAT_ADD_CASH", GameMessage::MSG_CHEAT_ADD_CASH }, { "CHEAT_GIVE_ALL_SCIENCES", GameMessage::MSG_CHEAT_GIVE_ALL_SCIENCES }, - { "CHEAT_GIVE_SCIENCEPURCHASEPOINTS", GameMessage::MSG_CHEAT_GIVE_SCIENCEPURCHASEPOINTS }, - { "CHEAT_SHOW_HEALTH", GameMessage::MSG_CHEAT_SHOW_HEALTH }, - { "CHEAT_TOGGLE_MESSAGE_TEXT", GameMessage::MSG_CHEAT_TOGGLE_MESSAGE_TEXT }, + { "CHEAT_GIVE_SCIENCEPURCHASEPOINTS", GameMessage::MSG_CHEAT_GIVE_SCIENCEPURCHASEPOINTS }, + { "CHEAT_SHOW_HEALTH", GameMessage::MSG_CHEAT_SHOW_HEALTH }, + { "CHEAT_TOGGLE_MESSAGE_TEXT", GameMessage::MSG_CHEAT_TOGGLE_MESSAGE_TEXT }, #endif @@ -276,8 +276,8 @@ static const LookupListRec GameMessageMetaTypeNames[] = { "DEMO_TOGGLE_GREEN_VIEW", GameMessage::MSG_META_DEMO_TOGGLE_GREEN_VIEW }, { "DEMO_TOGGLE_MOTION_BLUR_ZOOM", GameMessage::MSG_META_DEMO_TOGGLE_MOTION_BLUR_ZOOM }, { "DEMO_SHOW_EXTENTS", GameMessage::MSG_META_DEBUG_SHOW_EXTENTS }, - { "DEMO_SHOW_AUDIO_LOCATIONS", GameMessage::MSG_META_DEBUG_SHOW_AUDIO_LOCATIONS }, - { "DEMO_SHOW_HEALTH", GameMessage::MSG_META_DEBUG_SHOW_HEALTH }, + { "DEMO_SHOW_AUDIO_LOCATIONS", GameMessage::MSG_META_DEBUG_SHOW_AUDIO_LOCATIONS }, + { "DEMO_SHOW_HEALTH", GameMessage::MSG_META_DEBUG_SHOW_HEALTH }, { "DEMO_GIVE_VETERANCY", GameMessage::MSG_META_DEBUG_GIVE_VETERANCY }, { "DEMO_TAKE_VETERANCY", GameMessage::MSG_META_DEBUG_TAKE_VETERANCY }, { "DEMO_BATTLE_CRY", GameMessage::MSG_META_DEMO_BATTLE_CRY }, @@ -428,8 +428,7 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa newModState |= ALT; } - - for (const MetaMapRec *map = TheMetaMap->getFirstMetaMapRec(); map; map = map->m_next) + for (const MetaMapRec *map = TheMetaMap->getFirstMetaMapRec(); map; map = map->m_next) { DEBUG_ASSERTCRASH(map->m_meta > GameMessage::MSG_BEGIN_META_MESSAGES && map->m_meta < GameMessage::MSG_END_META_MESSAGES, ("hmm, expected only meta-msgs here")); @@ -453,10 +452,6 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa if (TheShell && !TheShell->isShellActive() && !(map->m_usableIn & COMMANDUSABLE_GAME) ) continue; - - - - // check for the special case of mods-only-changed. if ( map->m_key == MK_NONE && @@ -494,24 +489,24 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa else { - // THIS IS A GREASY HACK... MESSAGE SHOULD BE HANDLED IN A TRANSLATOR, BUT DURING CINEMATICS THE TRANSLATOR IS DISABLED - if( map->m_meta == GameMessage::MSG_META_TOGGLE_FAST_FORWARD_REPLAY) - { + // THIS IS A GREASY HACK... MESSAGE SHOULD BE HANDLED IN A TRANSLATOR, BUT DURING CINEMATICS THE TRANSLATOR IS DISABLED + if( map->m_meta == GameMessage::MSG_META_TOGGLE_FAST_FORWARD_REPLAY) + { #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)//may be defined in GameCommon.h - if( TheGlobalData ) + if( TheGlobalData ) #else - if( TheGlobalData && TheGameLogic->isInReplayGame()) + if( TheGlobalData && TheGameLogic->isInReplayGame()) #endif - { - if ( TheWritableGlobalData ) - TheWritableGlobalData->m_TiVOFastMode = 1 - TheGlobalData->m_TiVOFastMode; + { + if ( TheWritableGlobalData ) + TheWritableGlobalData->m_TiVOFastMode = 1 - TheGlobalData->m_TiVOFastMode; - if ( TheInGameUI ) - TheInGameUI->message( TheGlobalData->m_TiVOFastMode ? TheGameText->fetch("GUI:FF_ON") : TheGameText->fetch("GUI:FF_OFF") ); - } - disp = KEEP_MESSAGE; // cause for goodness sake, this key gets used a lot by non-replay hotkeys - break; - } + if ( TheInGameUI ) + TheInGameUI->message( TheGlobalData->m_TiVOFastMode ? TheGameText->fetch("GUI:FF_ON") : TheGameText->fetch("GUI:FF_OFF") ); + } + disp = KEEP_MESSAGE; // cause for goodness sake, this key gets used a lot by non-replay hotkeys + break; + } /*GameMessage *metaMsg =*/ TheMessageStream->appendMessage(map->m_meta); @@ -525,25 +520,25 @@ GameMessageDisposition MetaEventTranslator::translateGameMessage(const GameMessa if (t == GameMessage::MSG_RAW_KEY_DOWN) - { + { m_lastKeyDown = key; #ifdef DUMP_ALL_KEYS_TO_LOG - WideChar Wkey = TheKeyboard->getPrintableKey(key, 0); - UnicodeString uKey; - uKey.set(&Wkey); - AsciiString aKey; - aKey.translate(uKey); - DEBUG_LOG(("^%s ", aKey.str())); + WideChar Wkey = TheKeyboard->getPrintableKey(key, 0); + UnicodeString uKey; + uKey.set(&Wkey); + AsciiString aKey; + aKey.translate(uKey); + DEBUG_LOG(("^%s ", aKey.str())); #endif - } + } - m_lastModState = newModState; + m_lastModState = newModState; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp index 2ef2f2bfa5..84430c238f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/SelectionXlat.cpp @@ -285,7 +285,7 @@ SelectionTranslator::SelectionTranslator() TheSelectionTranslator = this; #if defined(_DEBUG) || defined(_INTERNAL) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - m_HandOfGodSelectionMode = FALSE; + m_HandOfGodSelectionMode = FALSE; #endif } @@ -654,44 +654,44 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa { si.selectMine = TRUE; - // EXACTLY ONE CLICKED OR DRAGGED BUILDING + // EXACTLY ONE CLICKED OR DRAGGED BUILDING if ( si.newCountMineBuildings == 1 && si.newCountMine == 1 ) { addToGroup = FALSE; si.selectMineBuildings = TRUE; - } - else if ( si.newCountMineBuildings > 0 )////////////// SO SORRY, I KNOW THIS IS MICKEY MOUSE /////////////////// - { // What we are after here is to allow the drag select to get the building, - // if the other things in the list are going to be ignored anyway - // so we find out whether the other things are not selectible - // this came up with the new AmericaBuildingFireBase, which shows its contained - // but does not let you select them. The selection is propagated to the container - // in new code in SelectionInfo.cpp, in the static addDrawableToList(); - // -Mark Lorenzen, 6/12/03 - Bool onlyTheOneBuildingIsSelectableAnyway = TRUE; - DrawableID buildingID = INVALID_DRAWABLE_ID; - for (DrawableListIt it = drawablesThatWillSelect.begin(); it != drawablesThatWillSelect.end(); ++it) - { - const Drawable *d = *it; - if ( d->isKindOf( KINDOF_STRUCTURE ) ) - {// make sure there is really only the one building in the list, as it may be multiply listed - - if ( buildingID == INVALID_DRAWABLE_ID ) // this is the first building - buildingID = d->getID(); - else if ( buildingID != d->getID() )//oops, more than one building! - onlyTheOneBuildingIsSelectableAnyway = FALSE; - } - else if ( d->isSelectable() ) - onlyTheOneBuildingIsSelectableAnyway = FALSE; - - if ( ! onlyTheOneBuildingIsSelectableAnyway ) - break; - } - if ( onlyTheOneBuildingIsSelectableAnyway ) - { - addToGroup = FALSE; - si.selectMineBuildings = TRUE; - } + } + else if ( si.newCountMineBuildings > 0 )////////////// SO SORRY, I KNOW THIS IS MICKEY MOUSE /////////////////// + { // What we are after here is to allow the drag select to get the building, + // if the other things in the list are going to be ignored anyway + // so we find out whether the other things are not selectible + // this came up with the new AmericaBuildingFireBase, which shows its contained + // but does not let you select them. The selection is propagated to the container + // in new code in SelectionInfo.cpp, in the static addDrawableToList(); + // -Mark Lorenzen, 6/12/03 + Bool onlyTheOneBuildingIsSelectableAnyway = TRUE; + DrawableID buildingID = INVALID_DRAWABLE_ID; + for (DrawableListIt it = drawablesThatWillSelect.begin(); it != drawablesThatWillSelect.end(); ++it) + { + const Drawable *d = *it; + if ( d->isKindOf( KINDOF_STRUCTURE ) ) + {// make sure there is really only the one building in the list, as it may be multiply listed + + if ( buildingID == INVALID_DRAWABLE_ID ) // this is the first building + buildingID = d->getID(); + else if ( buildingID != d->getID() )//oops, more than one building! + onlyTheOneBuildingIsSelectableAnyway = FALSE; + } + else if ( d->isSelectable() ) + onlyTheOneBuildingIsSelectableAnyway = FALSE; + + if ( ! onlyTheOneBuildingIsSelectableAnyway ) + break; + } + if ( onlyTheOneBuildingIsSelectableAnyway ) + { + addToGroup = FALSE; + si.selectMineBuildings = TRUE; + } } } @@ -838,7 +838,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa #if defined(_DEBUG) || defined(_INTERNAL) - if (m_HandOfGodSelectionMode && draw) + if (m_HandOfGodSelectionMode && draw) { Object* obj = draw->getObject(); if (obj) @@ -852,7 +852,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa } else - if (TheHurtSelectionMode && draw) + if (TheHurtSelectionMode && draw) { Object* obj = draw->getObject(); if (obj) @@ -865,7 +865,7 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa break; } - #ifdef DEBUG_OBJECT_ID_EXISTS + #ifdef DEBUG_OBJECT_ID_EXISTS if (TheDebugSelectionMode && draw && draw->getObject()) { if (TheObjectIDToDebug == 0) @@ -880,13 +880,13 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa break; } } - #endif + #endif #endif #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - if (m_HandOfGodSelectionMode && draw) + if (m_HandOfGodSelectionMode && draw) { Object* obj = draw->getObject(); if (obj) @@ -898,10 +898,8 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa disp = DESTROY_MESSAGE; break; } -#endif - - - } +#endif + } } if (disp == DESTROY_MESSAGE) diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp index 4a0d4eeb0f..19446b3dd7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/SelectionInfo.cpp @@ -211,7 +211,7 @@ extern Bool contextCommandForNewSelection(const DrawableList *currentlySelectedD if (outSelectionInfo->newCountMine > 0) { if (outSelectionInfo->newCountMine == 1 && selectionIsPoint && !TheInGameUI->isInPreferSelectionMode()) { - return TheGameClient->evaluateContextCommand(newMine, newMine->getPosition(), CommandTranslator::EVALUATE_ONLY) != GameMessage::MSG_INVALID; + return TheGameClient->evaluateContextCommand(newMine, newMine->getPosition(), CommandTranslator::EVALUATE_ONLY) != GameMessage::MSG_INVALID; } return FALSE; @@ -358,20 +358,20 @@ Bool addDrawableToList( Drawable *draw, void *userData ) return FALSE; if (!draw->isSelectable()) - { - const Object *obj = draw->getObject(); - if ( obj && obj->getContainedBy() )//hmm, interesting... he is not selectable but he is contained - {// What we are after here is to propagate the selection the selection ti the container - // if the cobtainer is non-enclosing... see also selectionxlat, in the left_click case - - ContainModuleInterface *contain = obj->getContainedBy()->getContain(); - Drawable *containDraw = obj->getContainedBy()->getDrawable(); - if (contain && ! contain->isEnclosingContainerFor( obj ) && containDraw ) - return addDrawableToList( containDraw, userData ); - } - else - return FALSE; - } + { + const Object *obj = draw->getObject(); + if ( obj && obj->getContainedBy() )//hmm, interesting... he is not selectable but he is contained + {// What we are after here is to propagate the selection the selection ti the container + // if the cobtainer is non-enclosing... see also selectionxlat, in the left_click case + + ContainModuleInterface *contain = obj->getContainedBy()->getContain(); + Drawable *containDraw = obj->getContainedBy()->getDrawable(); + if (contain && ! contain->isEnclosingContainerFor( obj ) && containDraw ) + return addDrawableToList( containDraw, userData ); + } + else + return FALSE; + } //Kris: Aug 9, 2003!!! Wow, this bug has been around a LONG time!! //Basically, it was possible to drag select a single enemy/neutral unit even if you couldn't see it diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp index e0986fd2ca..cf270c4c78 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp @@ -204,16 +204,16 @@ ImageCollection::ImageCollection( void ) //------------------------------------------------------------------------------------------------- ImageCollection::~ImageCollection( void ) { - for (std::map::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) - i->second->deleteInstance(); -} // end ~ImageCollection + for (std::map::iterator i=m_imageMap.begin();i!=m_imageMap.end();++i) + i->second->deleteInstance(); +} // end ~ImageCollection //------------------------------------------------------------------------------------------------- /** adds the given image to the collection, transfers ownership to this object */ //------------------------------------------------------------------------------------------------- void ImageCollection::addImage( Image *image ) { - m_imageMap[TheNameKeyGenerator->nameToLowercaseKey(image->getName())]=image; + m_imageMap[TheNameKeyGenerator->nameToLowercaseKey(image->getName())]=image; } // end newImage //------------------------------------------------------------------------------------------------- @@ -221,8 +221,8 @@ void ImageCollection::addImage( Image *image ) //------------------------------------------------------------------------------------------------- const Image *ImageCollection::findImageByName( const AsciiString& name ) { - std::map::iterator i=m_imageMap.find(TheNameKeyGenerator->nameToLowercaseKey(name)); - return i==m_imageMap.end()?NULL:i->second; + std::map::iterator i=m_imageMap.find(TheNameKeyGenerator->nameToLowercaseKey(name)); + return i==m_imageMap.end()?NULL:i->second; } // end findImageByName //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp index 351cd79157..c76b265a4e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -1909,14 +1909,11 @@ Bool ParticleSystem::update( Int localPlayerIndex ) if (!isShrouded) isShrouded = (objectAttachedTo->getShroudedStatus(localPlayerIndex) >= OBJECTSHROUD_FOGGED); - const Drawable * draw = objectAttachedTo->getDrawable(); - if ( draw ) - parentXfrm = draw->getTransformMatrix(); - else - parentXfrm = objectAttachedTo->getTransformMatrix(); - - - + const Drawable * draw = objectAttachedTo->getDrawable(); + if ( draw ) + parentXfrm = draw->getTransformMatrix(); + else + parentXfrm = objectAttachedTo->getTransformMatrix(); m_lastPos = m_pos; m_pos = *objectAttachedTo->getPosition(); @@ -1931,30 +1928,28 @@ Bool ParticleSystem::update( Int localPlayerIndex ) } } - - if (parentXfrm) { - if (m_skipParentXfrm) - { - //this particle system is already in world space so no need to apply parent xform. - m_transform = m_localTransform; - } - else - { - // if system has its own local transform, concatenate them - if (m_isLocalIdentity == false) - #ifdef ALLOW_TEMPORARIES - m_transform = (*parentXfrm) * m_localTransform; - #else - m_transform.mul(*parentXfrm, m_localTransform); - #endif - else - m_transform = *parentXfrm; - } - - m_isIdentity = false; - transformSet = true; + if (m_skipParentXfrm) + { + //this particle system is already in world space so no need to apply parent xform. + m_transform = m_localTransform; + } + else + { + // if system has its own local transform, concatenate them + if (m_isLocalIdentity == false) + #ifdef ALLOW_TEMPORARIES + m_transform = (*parentXfrm) * m_localTransform; + #else + m_transform.mul(*parentXfrm, m_localTransform); + #endif + else + m_transform = *parentXfrm; + } + + m_isIdentity = false; + transformSet = true; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp index 7f17d08bd6..207aaa7ced 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Terrain/TerrainVisual.cpp @@ -135,84 +135,79 @@ void TerrainVisual::loadPostProcess( void ) } // end loadPostProcess - - - - - SeismicSimulationFilterBase::SeismicSimStatusCode DomeStyleSeismicFilter::filterCallback( WorldHeightMapInterfaceClass *heightMap, const SeismicSimulationNode *node ) { - Int life = node->m_life; - - if ( heightMap == NULL ) - return SEISMIC_STATUS_INVALID; - - - if ( life == 0 ) - return SEISMIC_STATUS_ACTIVE; - if ( life < 15 ) - { - // ADD HEIGHT BECAUSE THE EXPLOSION IS PUSHING DIRT UP - - Real magnitude = node->m_magnitude; - - Real offsScalar = magnitude / (Real)life; // real-life, get it? - Int radius = node->m_radius; - Int border = heightMap->getBorderSize(); - Int centerX = node->m_center.x + border ; - Int centerY = node->m_center.y + border ; - - UnsignedInt workspaceWidth = radius*2; - Real *workspace = NEW( Real[ sqr(workspaceWidth) ] ); - Real *workspaceEnd = workspace + sqr(workspaceWidth); - - - for ( Real *t = workspace; t < workspaceEnd; ++t ) *t = 0.0f;// clear the workspace - - Int x, y; - for (x = 0; x < radius; ++x) - { - for (y = 0; y < radius; ++y) - { - - Real distance = sqrt( sqr(x) + sqr(y) );//Pythagoras - - if ( distance < radius ) - { - Real distScalar = cos( ( distance / radius * (PI/2) ) ); - Real height = (offsScalar * distScalar); - - workspace[ (radius + x) + workspaceWidth * (radius + y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX + x, centerY + y ) ;//kaleidoscope - - if ( x != 0 ) // non-zero test prevents cross-shaped double stamp - { - workspace[ (radius - x) + workspaceWidth * (radius + y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX - x, centerY + y ) ; - if ( y != 0 ) - workspace[ (radius - x) + workspaceWidth * (radius - y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX - x, centerY - y ) ; - } - if ( y != 0 ) - workspace[ (radius + x) + workspaceWidth * (radius - y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX + x, centerY - y ) ; - } - } - } - - // stuff the values from the workspace into the heightmap's velocities - for (x = 0; x < workspaceWidth; ++x) - for (y = 0; y < workspaceWidth; ++y) - heightMap->setSeismicZVelocity( centerX - radius + x, centerY - radius + y, MIN( 9.0f, workspace[ x + workspaceWidth * y ]) ); - - delete [] workspace; - - return SEISMIC_STATUS_ACTIVE; - } - else - return SEISMIC_STATUS_ZERO_ENERGY; + Int life = node->m_life; + + if ( heightMap == NULL ) + return SEISMIC_STATUS_INVALID; + + + if ( life == 0 ) + return SEISMIC_STATUS_ACTIVE; + if ( life < 15 ) + { + // ADD HEIGHT BECAUSE THE EXPLOSION IS PUSHING DIRT UP + + Real magnitude = node->m_magnitude; + + Real offsScalar = magnitude / (Real)life; // real-life, get it? + Int radius = node->m_radius; + Int border = heightMap->getBorderSize(); + Int centerX = node->m_center.x + border ; + Int centerY = node->m_center.y + border ; + + UnsignedInt workspaceWidth = radius*2; + Real *workspace = NEW( Real[ sqr(workspaceWidth) ] ); + Real *workspaceEnd = workspace + sqr(workspaceWidth); + + + for ( Real *t = workspace; t < workspaceEnd; ++t ) *t = 0.0f;// clear the workspace + + Int x, y; + for (x = 0; x < radius; ++x) + { + for (y = 0; y < radius; ++y) + { + + Real distance = sqrt( sqr(x) + sqr(y) );//Pythagoras + + if ( distance < radius ) + { + Real distScalar = cos( ( distance / radius * (PI/2) ) ); + Real height = (offsScalar * distScalar); + + workspace[ (radius + x) + workspaceWidth * (radius + y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX + x, centerY + y ) ;//kaleidoscope + + if ( x != 0 ) // non-zero test prevents cross-shaped double stamp + { + workspace[ (radius - x) + workspaceWidth * (radius + y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX - x, centerY + y ) ; + if ( y != 0 ) + workspace[ (radius - x) + workspaceWidth * (radius - y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX - x, centerY - y ) ; + } + if ( y != 0 ) + workspace[ (radius + x) + workspaceWidth * (radius - y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX + x, centerY - y ) ; + } + } + } + + // stuff the values from the workspace into the heightmap's velocities + for (x = 0; x < workspaceWidth; ++x) + for (y = 0; y < workspaceWidth; ++y) + heightMap->setSeismicZVelocity( centerX - radius + x, centerY - radius + y, MIN( 9.0f, workspace[ x + workspaceWidth * y ]) ); + + delete [] workspace; + + return SEISMIC_STATUS_ACTIVE; + } + else + return SEISMIC_STATUS_ZERO_ENERGY; } Real DomeStyleSeismicFilter::applyGravityCallback( Real velocityIn ) { - Real velocityOut = velocityIn; - velocityOut -= 1.5f; - return velocityOut; + Real velocityOut = velocityIn; + velocityOut -= 1.5f; + return velocityOut; } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp index 49869635b1..d935e2f812 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp @@ -201,8 +201,8 @@ static const FieldParse TheAIFieldParseTable[] = { "AIDozerBoredRadiusModifier", INI::parseReal,NULL, offsetof( TAiData, m_aiDozerBoredRadiusModifier ) }, { "AICrushesInfantry", INI::parseBool,NULL, offsetof( TAiData, m_aiCrushesInfantry ) }, - { "MaxRetaliationDistance", INI::parseReal,NULL, offsetof( TAiData, m_maxRetaliateDistance ) }, - { "RetaliationFriendsRadius", INI::parseReal,NULL, offsetof( TAiData, m_retaliateFriendsRadius ) }, + { "MaxRetaliationDistance", INI::parseReal,NULL, offsetof( TAiData, m_maxRetaliateDistance ) }, + { "RetaliationFriendsRadius", INI::parseReal,NULL, offsetof( TAiData, m_retaliateFriendsRadius ) }, { NULL, NULL, NULL, 0 } // keep this last diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp index 95a499c52b..e358e312ea 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGroup.cpp @@ -1522,27 +1522,27 @@ void clampWaypointPosition( Coord3D &position, Int margin ) { Region3D mapExtent; TheTerrainLogic->getExtent(&mapExtent); - - // trim some fat off of all sides, - mapExtent.hi.x -= margin; - mapExtent.hi.y -= margin; - mapExtent.lo.x += margin; - mapExtent.lo.y += margin; + + // trim some fat off of all sides, + mapExtent.hi.x -= margin; + mapExtent.hi.y -= margin; + mapExtent.lo.x += margin; + mapExtent.lo.y += margin; if ( mapExtent.isInRegionNoZ( &position ) == FALSE ) - { - if ( position.x > mapExtent.hi.x ) - position.x = mapExtent.hi.x; - else if ( position.x < mapExtent.lo.x ) - position.x = mapExtent.lo.x; + { + if ( position.x > mapExtent.hi.x ) + position.x = mapExtent.hi.x; + else if ( position.x < mapExtent.lo.x ) + position.x = mapExtent.lo.x; - if ( position.y > mapExtent.hi.y ) - position.y = mapExtent.hi.y; - else if ( position.y < mapExtent.lo.y ) - position.y = mapExtent.lo.y; + if ( position.y > mapExtent.hi.y ) + position.y = mapExtent.hi.y; + else if ( position.y < mapExtent.lo.y ) + position.y = mapExtent.lo.y; - position.z = TheTerrainLogic->getGroundHeight( position.x, position.y ); - } + position.z = TheTerrainLogic->getGroundHeight( position.x, position.y ); + } } @@ -1552,8 +1552,8 @@ void clampWaypointPosition( Coord3D &position, Int margin ) void AIGroup::groupMoveToPosition( const Coord3D *p_posIn, Bool addWaypoint, CommandSourceType cmdSource ) { - Coord3D position = *p_posIn; - Coord3D *pos = &position; + Coord3D position = *p_posIn; + Coord3D *pos = &position; Bool didInfantry = false; Bool didVehicles = false; @@ -1566,9 +1566,9 @@ void AIGroup::groupMoveToPosition( const Coord3D *p_posIn, Bool addWaypoint, Com Bool isFormation = getMinMaxAndCenter( &min, &max, ¢er ); if (addWaypoint) - { - isFormation = false; - } + { + isFormation = false; + } if (!addWaypoint && !isFormation) { @@ -1590,33 +1590,33 @@ void AIGroup::groupMoveToPosition( const Coord3D *p_posIn, Bool addWaypoint, Com } } - Real extraMargin = 0.0f; + Real extraMargin = 0.0f; for( i = m_memberList.begin(); i != m_memberList.end(); ++i ) { - const Object *groupMember = (*i); + const Object *groupMember = (*i); - if ( groupMember->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) )//helicopter - { - isFormation = FALSE; - extraMargin = MAX( extraMargin, groupMember->getGeometryInfo().getMajorRadius() ); - } - else if ( groupMember->isKindOf( KINDOF_AIRCRAFT ) )// fixed wing aircraft only - { + if ( groupMember->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) )//helicopter + { + isFormation = FALSE; + extraMargin = MAX( extraMargin, groupMember->getGeometryInfo().getMajorRadius() ); + } + else if ( groupMember->isKindOf( KINDOF_AIRCRAFT ) )// fixed wing aircraft only + { if ( groupMember->getAI() && groupMember->getAI()->isDoingGroundMovement() == FALSE ) //if unit is airborne - { - tightenGroup = FALSE; // Don't tighten aircraft. It is a bad idea. jba. + { + tightenGroup = FALSE; // Don't tighten aircraft. It is a bad idea. jba. isFormation = FALSE;//then keep spread formation after move - } + } - extraMargin = MAX( extraMargin, STD_AIRCRAFT_EXTRA_MARGIN ); + extraMargin = MAX( extraMargin, STD_AIRCRAFT_EXTRA_MARGIN ); } } - - Int margin = STD_WAYPOINT_CLAMP_MARGIN + extraMargin; - clampWaypointPosition( position, margin ); + + Int margin = STD_WAYPOINT_CLAMP_MARGIN + extraMargin; + clampWaypointPosition( position, margin ); - + if (tightenGroup) @@ -1728,7 +1728,7 @@ void AIGroup::groupMoveToPosition( const Coord3D *p_posIn, Bool addWaypoint, Com //Not stealthed, not detected -- so do auto-acquire while stealthed? if( !ai->canAutoAcquireWhileStealthed() ) { - StealthUpdate *stealth = theUnit->getStealth(); + StealthUpdate *stealth = theUnit->getStealth(); if( stealth ) { //Delay the mood check time (for autoacquire) until after the unit can stealth again. @@ -1822,30 +1822,30 @@ const Real CIRCLE = ( 2.0f * PI ); void getHelicopterOffset( Coord3D& posOut, Int idx ) { - if (idx == 0) - return; - - Real assumedHeliDiameter = 70.0f; - Real radius = assumedHeliDiameter; - Real circumference = radius * CIRCLE; - Real angle = 0; - Real angleBetweenEachChopper = assumedHeliDiameter / circumference * CIRCLE; - for (Int h = 1; h < idx; ++h ) - { - angle += angleBetweenEachChopper; + if (idx == 0) + return; + + Real assumedHeliDiameter = 70.0f; + Real radius = assumedHeliDiameter; + Real circumference = radius * CIRCLE; + Real angle = 0; + Real angleBetweenEachChopper = assumedHeliDiameter / circumference * CIRCLE; + for (Int h = 1; h < idx; ++h ) + { + angle += angleBetweenEachChopper; - if ( angle > CIRCLE ) - { - radius += assumedHeliDiameter; - circumference = radius * CIRCLE; - angleBetweenEachChopper = assumedHeliDiameter / circumference * CIRCLE; - angle -= CIRCLE; - } - } + if ( angle > CIRCLE ) + { + radius += assumedHeliDiameter; + circumference = radius * CIRCLE; + angleBetweenEachChopper = assumedHeliDiameter / circumference * CIRCLE; + angle -= CIRCLE; + } + } - Coord3D tempCtr = posOut; - posOut.x = tempCtr.x + (sin(angle) * radius); - posOut.y = tempCtr.y + (cos(angle) * radius); + Coord3D tempCtr = posOut; + posOut.x = tempCtr.x + (sin(angle) * radius); + posOut.y = tempCtr.y + (cos(angle) * radius); } @@ -1898,28 +1898,28 @@ void AIGroup::groupTightenToPosition( const Coord3D *pos, Bool addWaypoint, Comm iter->sort(ITER_SORTED_NEAR_TO_FAR); // Works better if you let the near units get the first paths... jba. - // Need a special case for helicopters, which do tighten when in groups - // but who do not reserve ground when they pathfind - // so we will send each new helicopter found in this list to a discrete - // offset from 'pos' from the s_helicopterFormation table - // a more elegant solution should have been added to AIPathfind, but given - // the late date, this is much safer. + // Need a special case for helicopters, which do tighten when in groups + // but who do not reserve ground when they pathfind + // so we will send each new helicopter found in this list to a discrete + // offset from 'pos' from the s_helicopterFormation table + // a more elegant solution should have been added to AIPathfind, but given + // the late date, this is much safer. - Int heliIdx = 0; + Int heliIdx = 0; Object *theUnit; for (theUnit = iter->first(); theUnit; theUnit = iter->next()) { AIUpdateInterface *ai = theUnit->getAIUpdateInterface(); if( !addWaypoint ) { - if ( theUnit->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) ) //NEW - { - Coord3D heliOffs = *pos; - getHelicopterOffset( heliOffs, heliIdx++ ); - ai->aiTightenToPosition( &heliOffs, CMD_FROM_AI );//NEW - } - else - ai->aiTightenToPosition( pos, cmdSource ); + if ( theUnit->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) ) //NEW + { + Coord3D heliOffs = *pos; + getHelicopterOffset( heliOffs, heliIdx++ ); + ai->aiTightenToPosition( &heliOffs, CMD_FROM_AI );//NEW + } + else + ai->aiTightenToPosition( pos, cmdSource ); } else { @@ -1934,9 +1934,6 @@ void AIGroup::groupTightenToPosition( const Coord3D *pos, Bool addWaypoint, Comm } } - - - /** * Start following the path from the given point */ @@ -2074,7 +2071,7 @@ void AIGroup::groupIdle(CommandSourceType cmdSource) //Not stealthed, not detected -- so do auto-acquire while stealthed? if( !ai->canAutoAcquireWhileStealthed() ) { - StealthUpdate *stealth = obj->getStealth(); + StealthUpdate *stealth = obj->getStealth(); if( stealth ) { //Delay the mood check time (for autoacquire) until after the unit can stealth again. @@ -2675,8 +2672,6 @@ void AIGroup::groupDoSpecialPower( UnsignedInt specialPowerID, UnsignedInt comma */ void AIGroup::groupDoSpecialPowerAtLocation( UnsignedInt specialPowerID, const Coord3D *location, Real angle, const Object *objectInWay, UnsignedInt commandOptions ) { - - //This one requires a position std::list::iterator i; for( i = m_memberList.begin(); i != m_memberList.end(); ) @@ -2686,13 +2681,13 @@ void AIGroup::groupDoSpecialPowerAtLocation( UnsignedInt specialPowerID, const C Object *object = (*i); - ++i; // just in case the act of specialpowering changes this list, - // like when the rebelambush happens over the ocean, and all the rebels drown - // and, of course, their slowdeath behavior calls deselect(), which naturally - // destroys the AIGroup list, in order to keep the selection sync'ed with the group. - // M Lorenzen... 8/23/03 - - const SpecialPowerTemplate *spTemplate = TheSpecialPowerStore->findSpecialPowerTemplateByID( specialPowerID ); + ++i; // just in case the act of specialpowering changes this list, + // like when the rebelambush happens over the ocean, and all the rebels drown + // and, of course, their slowdeath behavior calls deselect(), which naturally + // destroys the AIGroup list, in order to keep the selection sync'ed with the group. + // M Lorenzen... 8/23/03 + + const SpecialPowerTemplate *spTemplate = TheSpecialPowerStore->findSpecialPowerTemplateByID( specialPowerID ); if( spTemplate ) { // Have to justify the execution in case someone changed their button diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp index 92fb98901e..41cc1414c5 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIGuard.cpp @@ -889,10 +889,10 @@ void AIGuardAttackAggressorState::crc( Xfer *xfer ) //------------------------------------------------------------------------------------------------- void AIGuardAttackAggressorState::xfer( Xfer *xfer ) { - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); + // version + XferVersion currentVersion = 1; + XferVersion version = currentVersion; + xfer->xferVersion( &version, currentVersion ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp index fa8ea136f9..3571610fcf 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp @@ -2387,20 +2387,20 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye Int collapsedZones[maxZones]; collapsedZones[0] = 0; - i = 1; - while ( i < totalZones ) - { + i = 1; + while ( i < totalZones ) + { Int zone = zoneEquivalency[ i ]; if (zone == i) - { + { collapsedZones[ i ] = m_maxZone; ++m_maxZone; } - else + else collapsedZones[ i ] = collapsedZones[zone]; - ++i; - } + ++i; + } // for (i=1; i globalBounds.hi.x) + if (bounds.hi.x > globalBounds.hi.x) + { bounds.hi.x = globalBounds.hi.x; - - if (bounds.hi.y > globalBounds.hi.y) + } + if (bounds.hi.y > globalBounds.hi.y) + { bounds.hi.y = globalBounds.hi.y; + } // Although a good safeguard, the logic is already proven, thus skip the check // if (bounds.lo.x>bounds.hi.x || bounds.lo.y>bounds.hi.y) { @@ -2570,11 +2572,11 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye // m_hierarchicalZones[i] = i; // } i = 0; - while ( i < m_zonesAllocated ) + while ( i < m_zonesAllocated ) { - m_groundCliffZones[i] = m_groundWaterZones[i] = m_groundRubbleZones[i] = m_terrainZones[i] = m_crusherZones[i] = m_hierarchicalZones[i] = i; - i++; - } + m_groundCliffZones[i] = m_groundWaterZones[i] = m_groundRubbleZones[i] = m_terrainZones[i] = m_crusherZones[i] = m_hierarchicalZones[i] = i; + i++; + } @@ -2641,97 +2643,97 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye // // DEBUG_ASSERTCRASH(map[i][j].getZone() != 0, ("Cleared the zone.")); // } // } - register UnsignedInt maxZone = m_maxZone; + register UnsignedInt maxZone = m_maxZone; j=globalBounds.lo.y; - while( j <= globalBounds.hi.y ) - { - i=globalBounds.lo.x; + while( j <= globalBounds.hi.y ) + { + i=globalBounds.lo.x; while( i <= globalBounds.hi.x ) - { - PathfindCell &r_thisCell = map[i][j]; + { + PathfindCell &r_thisCell = map[i][j]; if ( (r_thisCell.getConnectLayer() > LAYER_GROUND) && (r_thisCell.getType() == PathfindCell::CELL_CLEAR) ) - { + { PathfindLayer *layer = layers + r_thisCell.getConnectLayer(); resolveZones(r_thisCell.getZone(), layer->getZone(), m_hierarchicalZones, maxZone); } if ( i > globalBounds.lo.x && r_thisCell.getZone() != map[i-1][j].getZone() ) - { - const PathfindCell &r_leftCell = map[i-1][j]; + { + const PathfindCell &r_leftCell = map[i-1][j]; if (r_thisCell.getType() == r_leftCell.getType()) applyZone(r_thisCell, r_leftCell, m_hierarchicalZones, maxZone);//if this is true, skip all the ones below - else - { - Bool notTerrainOrCrusher = TRUE; // if this is false, skip the if-else-ladder below - - if (terrain(r_thisCell, r_leftCell)) - { - applyZone(r_thisCell, r_leftCell, m_terrainZones, maxZone); - notTerrainOrCrusher = FALSE; - } - - if (crusherGround(r_thisCell, r_leftCell)) - { - applyZone(r_thisCell, r_leftCell, m_crusherZones, maxZone); - notTerrainOrCrusher = FALSE; - } - - if ( notTerrainOrCrusher ) - { - if (waterGround(r_thisCell, r_leftCell)) - applyZone(r_thisCell, r_leftCell, m_groundWaterZones, maxZone); - else if (groundRubble(r_thisCell, r_leftCell)) - applyZone(r_thisCell, r_leftCell, m_groundRubbleZones, maxZone); - else if (groundCliff(r_thisCell, r_leftCell)) - applyZone(r_thisCell, r_leftCell, m_groundCliffZones, maxZone); - } - - } - - } + else + { + Bool notTerrainOrCrusher = TRUE; // if this is false, skip the if-else-ladder below + + if (terrain(r_thisCell, r_leftCell)) + { + applyZone(r_thisCell, r_leftCell, m_terrainZones, maxZone); + notTerrainOrCrusher = FALSE; + } + + if (crusherGround(r_thisCell, r_leftCell)) + { + applyZone(r_thisCell, r_leftCell, m_crusherZones, maxZone); + notTerrainOrCrusher = FALSE; + } + + if ( notTerrainOrCrusher ) + { + if (waterGround(r_thisCell, r_leftCell)) + applyZone(r_thisCell, r_leftCell, m_groundWaterZones, maxZone); + else if (groundRubble(r_thisCell, r_leftCell)) + applyZone(r_thisCell, r_leftCell, m_groundRubbleZones, maxZone); + else if (groundCliff(r_thisCell, r_leftCell)) + applyZone(r_thisCell, r_leftCell, m_groundCliffZones, maxZone); + } + + } + + } if (j>globalBounds.lo.y && r_thisCell.getZone()!=map[i][j-1].getZone()) - { - const PathfindCell &r_topCell = map[i][j-1]; + { + const PathfindCell &r_topCell = map[i][j-1]; - if (r_thisCell.getType() == r_topCell.getType()) + if (r_thisCell.getType() == r_topCell.getType()) applyZone(r_thisCell, r_topCell, m_hierarchicalZones, maxZone); - else - { - Bool notTerrainOrCrusher = TRUE; // if this is false, skip the if-else-ladder below + else + { + Bool notTerrainOrCrusher = TRUE; // if this is false, skip the if-else-ladder below - if (terrain(r_thisCell, r_topCell)) - { - applyZone(r_thisCell, r_topCell, m_terrainZones, maxZone); - notTerrainOrCrusher = FALSE; - } + if (terrain(r_thisCell, r_topCell)) + { + applyZone(r_thisCell, r_topCell, m_terrainZones, maxZone); + notTerrainOrCrusher = FALSE; + } - if (crusherGround(r_thisCell, r_topCell)) - { - applyZone(r_thisCell, r_topCell, m_crusherZones, maxZone); - notTerrainOrCrusher = FALSE; - } + if (crusherGround(r_thisCell, r_topCell)) + { + applyZone(r_thisCell, r_topCell, m_crusherZones, maxZone); + notTerrainOrCrusher = FALSE; + } - if (waterGround(r_thisCell,r_topCell)) - applyZone(r_thisCell, r_topCell, m_groundWaterZones, maxZone); - else if (groundRubble(r_thisCell, r_topCell)) - applyZone(r_thisCell, r_topCell, m_groundRubbleZones, maxZone); - else if (groundCliff(r_thisCell,r_topCell)) - applyZone(r_thisCell, r_topCell, m_groundCliffZones, maxZone); + if (waterGround(r_thisCell,r_topCell)) + applyZone(r_thisCell, r_topCell, m_groundWaterZones, maxZone); + else if (groundRubble(r_thisCell, r_topCell)) + applyZone(r_thisCell, r_topCell, m_groundRubbleZones, maxZone); + else if (groundCliff(r_thisCell,r_topCell)) + applyZone(r_thisCell, r_topCell, m_groundCliffZones, maxZone); - } + } - } + } // DEBUG_ASSERTCRASH(r_thisCell.getZone() != 0, ("Cleared the zone.")); - ++i; + ++i; } - ++j; + ++j; } @@ -2751,21 +2753,21 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye // Int zone = m_hierarchicalZones[i]; // m_hierarchicalZones[i] = m_hierarchicalZones[zone]; // } - //FLATTEN HIERARCHICAL ZONES - { - i = 1; - register Int zone; - while ( i < maxZone ) - { // Flatten hierarchical zones. - zone = m_hierarchicalZones[i]; - m_hierarchicalZones[i] = m_hierarchicalZones[ zone ]; - ++i; - } - } - - - - //THIS BLOCK IS 20% + //FLATTEN HIERARCHICAL ZONES + { + i = 1; + register Int zone; + while ( i < maxZone ) + { // Flatten hierarchical zones. + zone = m_hierarchicalZones[i]; + m_hierarchicalZones[i] = m_hierarchicalZones[ zone ]; + ++i; + } + } + + + + //THIS BLOCK IS 20% flattenZones(m_groundCliffZones, m_hierarchicalZones, m_maxZone); flattenZones(m_groundWaterZones, m_hierarchicalZones, m_maxZone); flattenZones(m_groundRubbleZones, m_hierarchicalZones, m_maxZone); @@ -2779,21 +2781,21 @@ void PathfindZoneManager::calculateZones( PathfindCell **map, PathfindLayer laye timeToUpdate = ((double)(endTime64-startTime64) / (double)(freq64)); // DEBUG_LOG(("Time to calculate zones %f, cells %d\n", timeToUpdate, (globalBounds.hi.x-globalBounds.lo.x)*(globalBounds.hi.y-globalBounds.lo.y))); - if ( updateSamples < 400 ) - { - averageTimeToUpdate = ((averageTimeToUpdate * updateSamples) + timeToUpdate) / (updateSamples + 1.0f); - updateSamples++; - DEBUG_LOG(("computing...: %f, \n", averageTimeToUpdate)); - } - else if ( updateSamples == 400 ) - { - DEBUG_LOG((" =============DONE============= Average time to calculate zones: %f, \n", averageTimeToUpdate)); - DEBUG_LOG((" Percent of baseline : %f, \n", averageTimeToUpdate/0.003335f)); - updateSamples = 777; + if ( updateSamples < 400 ) + { + averageTimeToUpdate = ((averageTimeToUpdate * updateSamples) + timeToUpdate) / (updateSamples + 1.0f); + updateSamples++; + DEBUG_LOG(("computing...: %f, \n", averageTimeToUpdate)); + } + else if ( updateSamples == 400 ) + { + DEBUG_LOG((" =============DONE============= Average time to calculate zones: %f, \n", averageTimeToUpdate)); + DEBUG_LOG((" Percent of baseline : %f, \n", averageTimeToUpdate/0.003335f)); + updateSamples = 777; #ifdef forceRefreshCalling - s_stopForceCalling = TRUE; + s_stopForceCalling = TRUE; #endif - } + } #endif #endif @@ -9736,15 +9738,15 @@ void Pathfinder::updateGoal( Object *obj, const Coord3D *newGoalPos, PathfindLay - if (!ai->isDoingGroundMovement()) // exception:sniped choppers are on ground - { + if (!ai->isDoingGroundMovement()) // exception:sniped choppers are on ground + { - Bool isUnmannedHelicopter = ( obj->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) && obj->isDisabledByType( DISABLED_UNMANNED ) ) ; - if ( ! isUnmannedHelicopter ) - { - updateAircraftGoal(obj, newGoalPos); - return; - } + Bool isUnmannedHelicopter = ( obj->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) && obj->isDisabledByType( DISABLED_UNMANNED ) ) ; + if ( ! isUnmannedHelicopter ) + { + updateAircraftGoal(obj, newGoalPos); + return; + } } PathfindLayerEnum originalLayer = obj->getDestinationLayer(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp index 53f33d2f1b..95697d83c0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp @@ -157,12 +157,12 @@ void AISkirmishPlayer::processBaseBuilding( void ) // make sure dozer is working on him. ObjectID builder = bldg->getBuilderID(); Object* myDozer = TheGameLogic->findObjectByID(builder); - - if (myDozer && ( myDozer->getControllingPlayer() != m_player || myDozer->isDisabledByType( DISABLED_UNMANNED ) ) ) - {//I don't expect this dozer to work well with me. - myDozer = NULL; - bldg->setBuilder( NULL ); - } + + if (myDozer && ( myDozer->getControllingPlayer() != m_player || myDozer->isDisabledByType( DISABLED_UNMANNED ) ) ) + {//I don't expect this dozer to work well with me. + myDozer = NULL; + bldg->setBuilder( NULL ); + } if (myDozer==NULL) { DEBUG_LOG(("AI's Dozer got killed (or captured). Find another dozer.\n")); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp index 19b6170ebf..be464e4053 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/TurretAI.cpp @@ -463,9 +463,9 @@ Bool TurretAI::friend_turnTowardsPitch(Real desiredPitch, Real rateModifier) //---------------------------------------------------------------------------------------------------------- Bool TurretAI::isWeaponSlotOkToFire(WeaponSlotType wslot) const { - // If we turrets are linked, ai wants us to fire together, regardless of slot - if( getOwner()->getAI()->areTurretsLinked() ) - return TRUE; + // If we turrets are linked, ai wants us to fire together, regardless of slot + if( getOwner()->getAI()->areTurretsLinked() ) + return TRUE; return isWeaponSlotOnTurret(wslot); } @@ -659,10 +659,8 @@ void TurretAI::recenterTurret() Bool TurretAI::isTurretInNaturalPosition() const { - if( this->getOwner()->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION)) - return true;//ML so that under-construction base-defenses do not re-center while under construction - - + if( this->getOwner()->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION)) + return true;//ML so that under-construction base-defenses do not re-center while under construction if( getNaturalTurretAngle() == getTurretAngle() && getNaturalTurretPitch() == getTurretPitch() ) @@ -1127,12 +1125,12 @@ StateReturnType TurretAIAimTurretState::update() v.z -= obj->getGeometryInfo().getMaxHeightAbovePosition() / 2; // I kinda hate our logic/client split. //The point to fire from should be intrinsic to the turret, but in reality it is very slow to look it up. - Real actualPitch; - if( v.length() > 0 ) - actualPitch = ASin( v.z / v.length() ); - else - actualPitch = 0;// Don't point at NAN, just point at 0 if they are right on us - + Real actualPitch; + if( v.length() > 0 ) + actualPitch = ASin( v.z / v.length() ); + else + actualPitch = 0;// Don't point at NAN, just point at 0 if they are right on us + desiredPitch = actualPitch; if( desiredPitch < turret->getMinPitch() ) { @@ -1228,9 +1226,8 @@ StateReturnType TurretAIRecenterTurretState::update() //DEBUG_LOG(("TurretAIRecenterTurretState frame %d: %08lx\n",TheGameLogic->getFrame(),getTurretAI()->getOwner())); - if( getMachineOwner()->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION)) - return STATE_CONTINUE;//ML so that under-construction base-defenses do not re-center while under construction - + if( getMachineOwner()->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION)) + return STATE_CONTINUE;//ML so that under-construction base-defenses do not re-center while under construction TurretAI* turret = getTurretAI(); Bool angleAligned = turret->friend_turnTowardsAngle(turret->getNaturalTurretAngle(), 0.5f, 0.0f); @@ -1382,8 +1379,8 @@ StateReturnType TurretAIIdleScanState::update() { //DEBUG_LOG(("TurretAIIdleScanState frame %d: %08lx\n",TheGameLogic->getFrame(),getTurretAI()->getOwner())); - if( getMachineOwner()->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION)) - return STATE_CONTINUE;//ML so that under-construction base-defenses do not idle-scan while under construction + if( getMachineOwner()->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION)) + return STATE_CONTINUE;//ML so that under-construction base-defenses do not idle-scan while under construction Bool angleAligned = getTurretAI()->friend_turnTowardsAngle(getTurretAI()->getNaturalTurretAngle() + m_desiredAngle, 0.5f, 0.0f); Bool pitchAligned = getTurretAI()->friend_turnTowardsPitch(getTurretAI()->getNaturalTurretPitch(), 0.5f); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp index c18e65726f..7f262f9605 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/TerrainLogic.cpp @@ -2855,7 +2855,6 @@ void TerrainLogic::flattenTerrain(Object *obj) } - // ------------------------------------------------------------------------------------------------ /** Dig a deep circular gorge into the terrain beneath an object. */ // ------------------------------------------------------------------------------------------------ @@ -2865,52 +2864,47 @@ void TerrainLogic::createCraterInTerrain(Object *obj) return; const Coord3D *pos = obj->getPosition(); - Real radius = obj->getGeometryInfo().getMajorRadius(); + Real radius = obj->getGeometryInfo().getMajorRadius(); - if ( radius <= 0.0f ) - return; // sanity + if ( radius <= 0.0f ) + return; // sanity - ICoord2D iMin, iMax; - iMin.x = REAL_TO_INT_FLOOR( ( pos->x - radius ) / MAP_XY_FACTOR ); - iMin.y = REAL_TO_INT_FLOOR( ( pos->y - radius ) / MAP_XY_FACTOR ); - iMax.x = REAL_TO_INT_FLOOR( ( pos->x + radius ) / MAP_XY_FACTOR ); + ICoord2D iMin, iMax; + iMin.x = REAL_TO_INT_FLOOR( ( pos->x - radius ) / MAP_XY_FACTOR ); + iMin.y = REAL_TO_INT_FLOOR( ( pos->y - radius ) / MAP_XY_FACTOR ); + iMax.x = REAL_TO_INT_FLOOR( ( pos->x + radius ) / MAP_XY_FACTOR ); iMax.y = REAL_TO_INT_FLOOR( ( pos->y + radius ) / MAP_XY_FACTOR ); - Real deltaX, deltaY; + Real deltaX, deltaY; for (Int i = iMin.x; i <= iMax.x; i++ ) - { + { for ( Int j=0; j <= iMax.y; j++ ) - { + { deltaX = ( i * MAP_XY_FACTOR ) - pos->x; deltaY = ( j * MAP_XY_FACTOR ) - pos->y; - Real distance = sqrt( sqr( deltaX ) + sqr( deltaY ) ); + Real distance = sqrt( sqr( deltaX ) + sqr( deltaY ) ); if ( distance < radius ) //inside circle - { + { ICoord2D gridPos; gridPos.x = i; gridPos.y = j; - Real displacementAmount = radius * (1.0f - distance / radius ); + Real displacementAmount = radius * (1.0f - distance / radius ); - Int targetHeight = MAX( 1, TheTerrainVisual->getRawMapHeight( &gridPos ) - displacementAmount ); + Int targetHeight = MAX( 1, TheTerrainVisual->getRawMapHeight( &gridPos ) - displacementAmount ); TheTerrainVisual->setRawMapHeight( &gridPos, targetHeight ); } - } // next j - } // next i + } // next j + } // next i } - - - - - // ------------------------------------------------------------------------------------------------ /** CRC */ // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index b7e1252d73..410a9fd1e1 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -125,7 +125,7 @@ DumbProjectileBehavior::DumbProjectileBehavior( Thing *thing, const ModuleData* m_currentFlightPathStep = 0; m_extraBonusFlags = 0; - m_hasDetonated = FALSE; + m_hasDetonated = FALSE; } //------------------------------------------------------------------------------------------------- @@ -532,8 +532,8 @@ Bool DumbProjectileBehavior::projectileHandleCollision( Object *other ) //------------------------------------------------------------------------------------------------- void DumbProjectileBehavior::detonate() { - if ( m_hasDetonated ) - return; + if ( m_hasDetonated ) + return; Object* obj = getObject(); if (m_detonationWeaponTmpl) @@ -569,8 +569,8 @@ void DumbProjectileBehavior::detonate() if (obj->getDrawable()) obj->getDrawable()->setDrawableHidden(true); - - m_hasDetonated = TRUE; + + m_hasDetonated = TRUE; } @@ -633,35 +633,35 @@ UpdateSleepTime DumbProjectileBehavior::update() Coord3D flightStep = m_flightPath[m_currentFlightPathStep]; if (d->m_orientToFlightPath && (!d->m_tumbleRandomly) ) - { - if ( m_currentFlightPathStep > 0) - { - // this seems reasonable; however, if this object has a PhysicsBehavior on it, this calc will be wrong, - // since Physics is applying gravity, which we duly ignore, but the prevPos won't be what we expect. - // get it from the flight path instead. (srj) - //Coord3D prevPos = *getObject()->getPosition(); - - Coord3D prevPos = m_flightPath[m_currentFlightPathStep - 1]; - - Vector3 curDir(flightStep.x - prevPos.x, flightStep.y - prevPos.y, flightStep.z - prevPos.z); - curDir.Normalize(); // buildTransformMatrix wants it this way - Matrix3D orientMtx; - orientMtx.buildTransformMatrix(Vector3(flightStep.x, flightStep.y, flightStep.z), curDir); - getObject()->setTransformMatrix(&orientMtx); - } - else // oops! how do we orient the projectile on the zeroeth frame? This didn't matter until we started using the - //long, blurry projectile graphics which look badly oriented on step 0 of the flight path - // so lets orient it the same as if it were on frame 1! - { - Coord3D prevPos = m_flightPath[0]; - Coord3D curPos = m_flightPath[1]; - - Vector3 curDir(curPos.x - prevPos.x, curPos.y - prevPos.y, curPos.z - prevPos.z); - curDir.Normalize(); // buildTransformMatrix wants it this way - Matrix3D orientMtx; - orientMtx.buildTransformMatrix(Vector3(flightStep.x, flightStep.y, flightStep.z), curDir); - getObject()->setTransformMatrix(&orientMtx); - } + { + if ( m_currentFlightPathStep > 0) + { + // this seems reasonable; however, if this object has a PhysicsBehavior on it, this calc will be wrong, + // since Physics is applying gravity, which we duly ignore, but the prevPos won't be what we expect. + // get it from the flight path instead. (srj) + //Coord3D prevPos = *getObject()->getPosition(); + + Coord3D prevPos = m_flightPath[m_currentFlightPathStep - 1]; + + Vector3 curDir(flightStep.x - prevPos.x, flightStep.y - prevPos.y, flightStep.z - prevPos.z); + curDir.Normalize(); // buildTransformMatrix wants it this way + Matrix3D orientMtx; + orientMtx.buildTransformMatrix(Vector3(flightStep.x, flightStep.y, flightStep.z), curDir); + getObject()->setTransformMatrix(&orientMtx); + } + else // oops! how do we orient the projectile on the zeroeth frame? This didn't matter until we started using the + //long, blurry projectile graphics which look badly oriented on step 0 of the flight path + // so lets orient it the same as if it were on frame 1! + { + Coord3D prevPos = m_flightPath[0]; + Coord3D curPos = m_flightPath[1]; + + Vector3 curDir(curPos.x - prevPos.x, curPos.y - prevPos.y, curPos.z - prevPos.z); + curDir.Normalize(); // buildTransformMatrix wants it this way + Matrix3D orientMtx; + orientMtx.buildTransformMatrix(Vector3(flightStep.x, flightStep.y, flightStep.z), curDir); + getObject()->setTransformMatrix(&orientMtx); + } } else diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp index 8f872c932c..3852ff4b47 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/GenerateMinefieldBehavior.cpp @@ -103,9 +103,9 @@ GenerateMinefieldBehaviorModuleData::GenerateMinefieldBehaviorModuleData() { 0, 0, 0, 0 } }; - BehaviorModuleData::buildFieldParse(p); - p.add(dataFieldParse); - p.add(UpgradeMuxData::getFieldParse(), offsetof( GenerateMinefieldBehaviorModuleData, m_upgradeMuxData )); + BehaviorModuleData::buildFieldParse(p); + p.add(dataFieldParse); + p.add(UpgradeMuxData::getFieldParse(), offsetof( GenerateMinefieldBehaviorModuleData, m_upgradeMuxData )); } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp index 02cbd9ce52..c5ab8e0d87 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/JetSlowDeathBehavior.cpp @@ -152,7 +152,7 @@ JetSlowDeathBehavior::~JetSlowDeathBehavior( void ) void JetSlowDeathBehavior::onDie( const DamageInfo *damageInfo ) { Object *us = getObject(); - + // if the jet is on the ground we do just our ground fx death if( us->isSignificantlyAboveTerrain() == FALSE || us->getStatusBits().test( OBJECT_STATUS_DECK_HEIGHT_OFFSET ) ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp index 4228b823c7..ff2417afee 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/ParkingPlaceBehavior.cpp @@ -699,7 +699,7 @@ UpdateSleepTime ParkingPlaceBehavior::update() healInfo.in.m_damageType = DAMAGE_HEALING; healInfo.in.m_deathType = DEATH_NONE; healInfo.in.m_sourceID = getObject()->getID(); - healInfo.in.m_amount = HEAL_RATE_FRAMES * d->m_healAmount * SECONDS_PER_LOGICFRAME_REAL; + healInfo.in.m_amount = HEAL_RATE_FRAMES * d->m_healAmount * SECONDS_PER_LOGICFRAME_REAL; // if ( objToHeal->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) ) // healInfo.in.m_amount += HEAL_RATE_FRAMES * d->m_extraHealAmount4Helicopters * SECONDS_PER_LOGICFRAME_REAL; @@ -833,7 +833,7 @@ void ParkingPlaceBehavior::exitObjectViaDoor( Object *newObj, ExitDoorType exitD { // Lorenzen sez: aiMoveToPosition has an added benefit. // It invokes the pathfinder to find a vacant destination. - ai->aiMoveToPosition( &ppinfo.parkingSpace, CMD_FROM_AI ); + ai->aiMoveToPosition( &ppinfo.parkingSpace, CMD_FROM_AI ); } } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp index 8b17f6bdf9..c6a1b51727 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PropagandaTowerBehavior.cpp @@ -432,36 +432,36 @@ void PropagandaTowerBehavior::doScan( void ) } // end if - Bool doFX = TRUE; - // if it is us, or if it is he and we do see him - Object *overlord = us->getContainedBy(); - if ( overlord ) - { - if ( us->getControllingPlayer() != ThePlayerList->getLocalPlayer() )// daling with someone else's tower - { - if ( overlord->testStatus( OBJECT_STATUS_STEALTHED ) && !overlord->testStatus( OBJECT_STATUS_DETECTED ) ) - doFX = FALSE;// so they don't give up their position - - } - - // Sorry, this is a lot of hard coded mishmash, but it must be done... ship it! - // Propaganda towers (proper) never get contained, so they don't care about this code - // The PropTowers that ride on the backs of overlord tanks want to suppress their fx if the overlord is stealthed to the local player - // The PropTowers that ride on the bellies of Helixes also suppress their fx when hiding stealthed (never happens?) - // The PropTowers must do nothing, scanning-or-FX-wise when they are inside something... there are two cases - // 1) When the prop tower is on an Overlord that is in a helicopter (likely a Helix II) - // 2) When the prop tower is the EmperorTank, which is in a helicopter (likely a Helix II). - - if ( us->isKindOf( KINDOF_VEHICLE ) && !us->isKindOf( KINDOF_PORTABLE_STRUCTURE ) )//craptacular! - // oh my dear Lord... I am not a propaganda tower, I am an emperorTank! that means the overlord is a helix or something! - return; // proptowers that are riding IN things cannot do their scan! - - //okay this is wacky, but this proptower may be on an overlord thank that is riding in a helix... oy! - Object *helix = overlord->getContainedBy(); - if ( helix ) - return; // proptowers that are riding ON things that are in-turn riding IN things cannot do their scan! - - } + Bool doFX = TRUE; + // if it is us, or if it is he and we do see him + Object *overlord = us->getContainedBy(); + if ( overlord ) + { + if ( us->getControllingPlayer() != ThePlayerList->getLocalPlayer() )// daling with someone else's tower + { + if ( overlord->testStatus( OBJECT_STATUS_STEALTHED ) && !overlord->testStatus( OBJECT_STATUS_DETECTED ) ) + doFX = FALSE;// so they don't give up their position + + } + + // Sorry, this is a lot of hard coded mishmash, but it must be done... ship it! + // Propaganda towers (proper) never get contained, so they don't care about this code + // The PropTowers that ride on the backs of overlord tanks want to suppress their fx if the overlord is stealthed to the local player + // The PropTowers that ride on the bellies of Helixes also suppress their fx when hiding stealthed (never happens?) + // The PropTowers must do nothing, scanning-or-FX-wise when they are inside something... there are two cases + // 1) When the prop tower is on an Overlord that is in a helicopter (likely a Helix II) + // 2) When the prop tower is the EmperorTank, which is in a helicopter (likely a Helix II). + + if ( us->isKindOf( KINDOF_VEHICLE ) && !us->isKindOf( KINDOF_PORTABLE_STRUCTURE ) )//craptacular! + // oh my dear Lord... I am not a propaganda tower, I am an emperorTank! that means the overlord is a helix or something! + return; // proptowers that are riding IN things cannot do their scan! + + //okay this is wacky, but this proptower may be on an overlord thank that is riding in a helix... oy! + Object *helix = overlord->getContainedBy(); + if ( helix ) + return; // proptowers that are riding ON things that are in-turn riding IN things cannot do their scan! + + } if ( us->getControllingPlayer() != ThePlayerList->getLocalPlayer() )// daling with someone else's tower { @@ -471,14 +471,14 @@ void PropagandaTowerBehavior::doScan( void ) } } - if ( doFX ) - { - // play the right pulse - if( upgradePresent == TRUE ) - FXList::doFXObj( modData->m_upgradedPulseFX, us ); - else - FXList::doFXObj( modData->m_pulseFX, us ); - } + if ( doFX ) + { + // play the right pulse + if( upgradePresent == TRUE ) + FXList::doFXObj( modData->m_upgradedPulseFX, us ); + else + FXList::doFXObj( modData->m_pulseFX, us ); + } // setup scan filters PartitionFilterRelationship relationship( us, PartitionFilterRelationship::ALLOW_ALLIES ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp index 91fbf834c1..f5ad0eb291 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp @@ -142,7 +142,7 @@ ActiveBodyModuleData::ActiveBodyModuleData() //------------------------------------------------------------------------------------------------- void ActiveBodyModuleData::buildFieldParse(MultiIniFieldParse& p) { - ModuleData::buildFieldParse(p); + ModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = { @@ -154,7 +154,7 @@ void ActiveBodyModuleData::buildFieldParse(MultiIniFieldParse& p) { "SubdualDamageHealAmount", INI::parseReal, NULL, offsetof( ActiveBodyModuleData, m_subdualDamageHealAmount ) }, { 0, 0, 0, 0 } }; - p.add(dataFieldParse); + p.add(dataFieldParse); } //------------------------------------------------------------------------------------------------- @@ -426,8 +426,8 @@ void ActiveBody::attemptDamage( DamageInfo *damageInfo ) obj->setDisabled( DISABLED_UNMANNED ); TheGameLogic->deselectObject(obj, PLAYERMASK_ALL, TRUE); - if ( obj->getAI() ) - obj->getAI()->aiIdle( CMD_FROM_AI ); + if ( obj->getAI() ) + obj->getAI()->aiIdle( CMD_FROM_AI ); // Convert it to the neutral team so it renders gray giving visual representation that it is unmanned. obj->setTeam( ThePlayerList->getNeutralPlayer()->getDefaultTeam() ); @@ -435,7 +435,7 @@ void ActiveBody::attemptDamage( DamageInfo *damageInfo ) //We don't care which team sniped the vehicle... we use this information to flag whether or not //we captured a vehicle. - ThePlayerList->getNeutralPlayer()->getAcademyStats()->recordVehicleSniped(); + ThePlayerList->getNeutralPlayer()->getAcademyStats()->recordVehicleSniped(); } alreadyHandled = TRUE; allowModifier = FALSE; @@ -1282,9 +1282,9 @@ void ActiveBody::onSubdualChange( Bool isNowSubdued ) { me->setDisabled(DISABLED_SUBDUED); - ContainModuleInterface *contain = me->getContain(); - if ( contain ) - contain->orderAllPassengersToIdle( CMD_FROM_AI ); + ContainModuleInterface *contain = me->getContain(); + if ( contain ) + contain->orderAllPassengersToIdle( CMD_FROM_AI ); } else diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp index c10e08c811..02fd7e9c0a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/HiveStructureBody.cpp @@ -73,8 +73,8 @@ void HiveStructureBody::attemptDamage( DamageInfo *damageInfo ) if( getDamageTypeFlag( data->m_damageTypesToPropagateToSlaves, damageInfo->in.m_damageType ) ) { - - //We have the right type of damage types incoming to propagate to slaves. Do we have slaves? + + //We have the right type of damage types incoming to propagate to slaves. Do we have slaves? SpawnBehaviorInterface *spawnInterface = hive->getSpawnBehaviorInterface(); if( spawnInterface ) { @@ -101,7 +101,7 @@ void HiveStructureBody::attemptDamage( DamageInfo *damageInfo ) } else if ( hive->getContain() ) { - ContainModuleInterface *contain = hive->getContain(); + ContainModuleInterface *contain = hive->getContain(); //We found the spawn interface, now get some slaves! Object *shooter = TheGameLogic->findObjectByID( damageInfo->in.m_sourceID ); if( shooter ) @@ -122,13 +122,12 @@ void HiveStructureBody::attemptDamage( DamageInfo *damageInfo ) return; } } - } + } else { DEBUG_CRASH( ("%s has a HiveStructureBody module, which requires a SpawnBehavior module. Thus it is unable to propagate damage to slaves.", hive->getTemplate()->getName().str() ) ); } - } //Nothing to propagate (either different damage type or no slaves), diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp index 3985be20c5..6d794eedd8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp @@ -198,46 +198,46 @@ Bool CrateCollide::isValidToExecute( const Object *other ) const void CrateCollide::doSabotageFeedbackFX( const Object *other, SabotageVictimType type ) { - if ( ! getObject() ) - return; - if ( ! other ) - return; + if ( ! getObject() ) + return; + if ( ! other ) + return; AudioEventRTS soundToPlay; - switch ( type ) - { - case CrateCollide::SAB_VICTIM_FAKE_BUILDING: - { - return; // THIS NEEDS NO ADD'L FEEDBACK - } - case CrateCollide::SAB_VICTIM_COMMAND_CENTER: - case CrateCollide::SAB_VICTIM_SUPERWEAPON: - { - soundToPlay = TheAudio->getMiscAudio()->m_sabotageResetTimerBuilding; - break; - } - case CrateCollide::SAB_VICTIM_DROP_ZONE: - case CrateCollide::SAB_VICTIM_SUPPLY_CENTER: - { - soundToPlay = TheAudio->getMiscAudio()->m_moneyWithdrawSound; - break; - } - case CrateCollide::SAB_VICTIM_INTERNET_CENTER: - case CrateCollide::SAB_VICTIM_MILITARY_FACTORY: - case CrateCollide::SAB_VICTIM_POWER_PLANT: - default: - { - soundToPlay = TheAudio->getMiscAudio()->m_sabotageShutDownBuilding; - break; - } - } + switch ( type ) + { + case CrateCollide::SAB_VICTIM_FAKE_BUILDING: + { + return; // THIS NEEDS NO ADD'L FEEDBACK + } + case CrateCollide::SAB_VICTIM_COMMAND_CENTER: + case CrateCollide::SAB_VICTIM_SUPERWEAPON: + { + soundToPlay = TheAudio->getMiscAudio()->m_sabotageResetTimerBuilding; + break; + } + case CrateCollide::SAB_VICTIM_DROP_ZONE: + case CrateCollide::SAB_VICTIM_SUPPLY_CENTER: + { + soundToPlay = TheAudio->getMiscAudio()->m_moneyWithdrawSound; + break; + } + case CrateCollide::SAB_VICTIM_INTERNET_CENTER: + case CrateCollide::SAB_VICTIM_MILITARY_FACTORY: + case CrateCollide::SAB_VICTIM_POWER_PLANT: + default: + { + soundToPlay = TheAudio->getMiscAudio()->m_sabotageShutDownBuilding; + break; + } + } soundToPlay.setPosition( other->getPosition() ); TheAudio->addAudioEvent( &soundToPlay ); - Drawable *draw = other->getDrawable(); - if ( draw ) - draw->flashAsSelected(); + Drawable *draw = other->getDrawable(); + if ( draw ) + draw->flashAsSelected(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp index 4b69792e68..e90c311a03 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/GarrisonContain.cpp @@ -77,7 +77,7 @@ GarrisonContainModuleData::GarrisonContainModuleData( void ) m_doIHealObjects = false; ///< if T, then I heal objects that are inside of me m_framesForFullHeal = 1.0f; ///< the number of frames something inside of me takes to heal m_immuneToClearBuildingAttacks = false; - m_isEnclosingContainer = TRUE; ///< a sensible default for a garrison container... few exceptions, firebase is one + m_isEnclosingContainer = TRUE; ///< a sensible default for a garrison container... few exceptions, firebase is one m_initialRoster.count = 0; } // end if @@ -284,8 +284,8 @@ Bool GarrisonContain::calcBestGarrisonPosition( Coord3D *sourcePos, const Coord3 return FALSE; #if defined __DEBUG || defined _INTERNAL - const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); - DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("calcBestGarrisonPosition... SHOULD NOT GET HERE, since this container is non-enclosing") ); + const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); + DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("calcBestGarrisonPosition... SHOULD NOT GET HERE, since this container is non-enclosing") ); #endif @@ -318,8 +318,8 @@ Bool GarrisonContain::attemptBestFirePointPosition( Object *source, Weapon *weap } #if defined __DEBUG || defined _INTERNAL - const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); - DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("calcBestGarrisonPosition... SHOULD NOT GET HERE, since this container is non-enclosing") ); + const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); + DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("calcBestGarrisonPosition... SHOULD NOT GET HERE, since this container is non-enclosing") ); #endif //If this object is already at a garrison point, remove him. Int existingIndex = getObjectGarrisonPointIndex( source ); @@ -358,8 +358,8 @@ Bool GarrisonContain::attemptBestFirePointPosition( Object *source, Weapon *weap return FALSE; } #if defined __DEBUG || defined _INTERNAL - const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); - DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("calcBestGarrisonPosition... SHOULD NOT GET HERE, since this container is non-enclosing") ); + const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); + DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("calcBestGarrisonPosition... SHOULD NOT GET HERE, since this container is non-enclosing") ); #endif //If this object is already at a garrison point, remove him. @@ -399,8 +399,8 @@ void GarrisonContain::putObjectAtBestGarrisonPoint( Object *obj, Object *target, return; #if defined __DEBUG || defined _INTERNAL - const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); - DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("calcBestGarrisonPosition... SHOULD NOT GET HERE, since this container is non-enclosing") ); + const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); + DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("calcBestGarrisonPosition... SHOULD NOT GET HERE, since this container is non-enclosing") ); #endif // if obj target, override pos if (target != NULL) @@ -430,12 +430,12 @@ void GarrisonContain::putObjectAtBestGarrisonPoint( Object *obj, Object *target, void GarrisonContain::removeObjectFromGarrisonPoint( Object *obj, Int index ) { - if ( ! isEnclosingContainerFor(obj) ) - return;// since I am not enclosed, I am not at a garrison point! + if ( ! isEnclosingContainerFor(obj) ) + return;// since I am not enclosed, I am not at a garrison point! #if defined __DEBUG || defined _INTERNAL - const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); - DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("calcBestGarrisonPosition... SHOULD NOT GET HERE, since this container is non-enclosing") ); +const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); +DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("calcBestGarrisonPosition... SHOULD NOT GET HERE, since this container is non-enclosing") ); #endif // sanity @@ -511,7 +511,7 @@ GarrisonContain::GarrisonContain( Thing *thing, const ModuleData *moduleData ) : m_hideGarrisonedStateFromNonallies = FALSE; m_garrisonPointsInUse = 0; m_garrisonPointsInitialized = FALSE; - m_stationGarrisonPointsInitialized = FALSE; + m_stationGarrisonPointsInitialized = FALSE; for( i = 0; i < MAX_GARRISON_POINTS; i++ ) { @@ -531,10 +531,10 @@ GarrisonContain::GarrisonContain( Thing *thing, const ModuleData *moduleData ) : m_exitRallyPoint.zero(); - m_evacDisposition = EVAC_BURST_FROM_CENTER; // default, anyway + m_evacDisposition = EVAC_BURST_FROM_CENTER; // default, anyway - m_stationPointList.clear(); + m_stationPointList.clear(); } // end GarrisonContain @@ -588,8 +588,8 @@ Bool GarrisonContain::isValidContainerFor(const Object* obj, Bool checkCapacity) void GarrisonContain::removeInvalidObjectsFromGarrisonPoints( void ) { #if defined __DEBUG || defined _INTERNAL - const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); - DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("removeinvalidobjFromGarrisonPoint... SHOULD NOT GET HERE, since this container is non-enclosing") ); + const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); + DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("removeinvalidobjFromGarrisonPoint... SHOULD NOT GET HERE, since this container is non-enclosing") ); #endif Object *obj; @@ -639,8 +639,8 @@ void GarrisonContain::addValidObjectsToGarrisonPoints( void ) #if defined __DEBUG || defined _INTERNAL - const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); - DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("addvalidobjtoGarrisonPoint... SHOULD NOT GET HERE, since this container is non-enclosing") ); + const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); + DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("addvalidobjtoGarrisonPoint... SHOULD NOT GET HERE, since this container is non-enclosing") ); #endif @@ -683,8 +683,8 @@ void GarrisonContain::trackTargets( void ) { - if ( ! isEnclosingContainerFor( 0 ) ) - return; // since ina non-enclosing container, objects fire from their station points, instead of being juggled around between garrison firepoints + if ( ! isEnclosingContainerFor( 0 ) ) + return; // since ina non-enclosing container, objects fire from their station points, instead of being juggled around between garrison firepoints @@ -799,13 +799,13 @@ void GarrisonContain::redeployOccupants( void ) // addValidObjectsToGarrisonPoints(); - // ATTENTION... setting this false allows each redeployOccupants() call to create fresh station points, based on the new transform - // if anything wierd ever happens, like rotating buildings and such, we will need a way of transforming the points without clearing the - // list (and thus forgetting where everyone contained was stationed)... just a handy reminder. - m_stationGarrisonPointsInitialized = FALSE; + // ATTENTION... setting this false allows each redeployOccupants() call to create fresh station points, based on the new transform + // if anything wierd ever happens, like rotating buildings and such, we will need a way of transforming the points without clearing the + // list (and thus forgetting where everyone contained was stationed)... just a handy reminder. + m_stationGarrisonPointsInitialized = FALSE; - matchObjectsToGarrisonPoints(); + matchObjectsToGarrisonPoints(); // restore the frame markers that things were recorded as entering their point Int index; @@ -834,8 +834,8 @@ void GarrisonContain::updateEffects( void ) #if defined __DEBUG || defined _INTERNAL - const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); - DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("updateeffects... SHOULD NOT GET HERE, since this container is non-enclosing") ); + const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); + DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("updateeffects... SHOULD NOT GET HERE, since this container is non-enclosing") ); #endif @@ -976,26 +976,26 @@ UpdateSleepTime GarrisonContain::update( void ) // ------------------------------------------------------------------------------------------------ void GarrisonContain::matchObjectsToGarrisonPoints( void ) { - if ( isEnclosingContainerFor( NULL ) == FALSE ) - { - // enforce that everybody stays at their pre-assigned space - positionObjectsAtStationGarrisonPoints(); - } - else - { - // are there any objects at the garrison points who now need to go back to the center of the structure - removeInvalidObjectsFromGarrisonPoints(); - // are there any objects in the center that have now obtained targets and need to move to - // a garrison point - addValidObjectsToGarrisonPoints(); - // any units that have just fired need to have a muzzle flash display out of the fire point - updateEffects(); - // given all the objects that are at the garrison points shooting at something, if their - // target moves around the structure and closer to another open garrison point we want - // to shuffle our object to the new closest garrison point. We'll also track the target - // here and set orientation for any effects we need to - trackTargets(); - } + if ( isEnclosingContainerFor( NULL ) == FALSE ) + { + // enforce that everybody stays at their pre-assigned space + positionObjectsAtStationGarrisonPoints(); + } + else + { + // are there any objects at the garrison points who now need to go back to the center of the structure + removeInvalidObjectsFromGarrisonPoints(); + // are there any objects in the center that have now obtained targets and need to move to + // a garrison point + addValidObjectsToGarrisonPoints(); + // any units that have just fired need to have a muzzle flash display out of the fire point + updateEffects(); + // given all the objects that are at the garrison points shooting at something, if their + // target moves around the structure and closer to another open garrison point we want + // to shuffle our object to the new closest garrison point. We'll also track the target + // here and set orientation for any effects we need to + trackTargets(); + } } @@ -1006,40 +1006,40 @@ void GarrisonContain::matchObjectsToGarrisonPoints( void ) // ------------------------------------------------------------------------------------------------ void GarrisonContain::positionObjectsAtStationGarrisonPoints() { - if ( ! m_stationGarrisonPointsInitialized ) - { - loadStationGarrisonPoints(); - } + if ( ! m_stationGarrisonPointsInitialized ) + { + loadStationGarrisonPoints(); + } const ContainedItemsList& containList = getContainList(); Object *contained; for( ContainedItemsList::const_iterator it = containList.begin(); it != containList.end(); ++it ) { contained = *it; - Bool foundHisSpot = FALSE; - - // now lets find him in our station point list, and make sure he stays put there. - for( std::vector::const_iterator pt = m_stationPointList.begin(); - pt != m_stationPointList.end(); - ++pt) - { - const StationPointData *spd = &*pt; - - if( spd->occupantID == contained->getID() ) - { - contained->setPosition( &spd->position ); - foundHisSpot = TRUE; - break; - } - - } - - if ( ! foundHisSpot && ! pickAStationForMe( contained )) - { - DEBUG_ASSERTCRASH( foundHisSpot, ("GarrisonContain::positionObjectsAtStationGarrisonPoints found something terribly wrong... \nthere is either a station point shortage, or some other bug.")); - } - - } // end for, it + Bool foundHisSpot = FALSE; + + // now lets find him in our station point list, and make sure he stays put there. + for( std::vector::const_iterator pt = m_stationPointList.begin(); + pt != m_stationPointList.end(); + ++pt) + { + const StationPointData *spd = &*pt; + + if( spd->occupantID == contained->getID() ) + { + contained->setPosition( &spd->position ); + foundHisSpot = TRUE; + break; + } + + } + + if ( ! foundHisSpot && ! pickAStationForMe( contained )) + { + DEBUG_ASSERTCRASH( foundHisSpot, ("GarrisonContain::positionObjectsAtStationGarrisonPoints found something terribly wrong... \nthere is either a station point shortage, or some other bug.")); + } + + } // end for, it } @@ -1050,45 +1050,45 @@ void GarrisonContain::positionObjectsAtStationGarrisonPoints() // ------------------------------------------------------------------------------------------------ Bool GarrisonContain::pickAStationForMe( const Object *obj ) { - Bool foundVacancy = FALSE; - for( std::vector::iterator pt = m_stationPointList.begin(); pt != m_stationPointList.end(); ++pt) - { - StationPointData *spd = &*pt; // non const - if ( spd->occupantID == INVALID_ID ) // found a vacancy - { - spd->occupantID = obj->getID(); - foundVacancy = TRUE; - return TRUE; - } - } - - DEBUG_ASSERTCRASH(foundVacancy, ("GarrisonContain::pickAStationForMe is all kinds of bad... \n there was no vacancy found for a newly contained object.")); - - return FALSE; + Bool foundVacancy = FALSE; + for( std::vector::iterator pt = m_stationPointList.begin(); pt != m_stationPointList.end(); ++pt) + { + StationPointData *spd = &*pt; // non const + if ( spd->occupantID == INVALID_ID ) // found a vacancy + { + spd->occupantID = obj->getID(); + foundVacancy = TRUE; + return TRUE; + } + } + + DEBUG_ASSERTCRASH(foundVacancy, ("GarrisonContain::pickAStationForMe is all kinds of bad... \n there was no vacancy found for a newly contained object.")); + + return FALSE; } void GarrisonContain::removeObjectFromStationPoint( const Object *obj ) { - //sanity - if ( obj == NULL ) - return; + //sanity + if ( obj == NULL ) + return; - Bool foundOccupant = FALSE; - for( std::vector::iterator pt = m_stationPointList.begin(); pt != m_stationPointList.end(); ++pt) - { - StationPointData *spd = &*pt; // non const - if ( spd->occupantID == obj->getID() ) // found him sitting there - { - spd->occupantID = INVALID_ID;// give up your space - foundOccupant = TRUE; - return; - } - } + Bool foundOccupant = FALSE; + for( std::vector::iterator pt = m_stationPointList.begin(); pt != m_stationPointList.end(); ++pt) + { + StationPointData *spd = &*pt; // non const + if ( spd->occupantID == obj->getID() ) // found him sitting there + { + spd->occupantID = INVALID_ID;// give up your space + foundOccupant = TRUE; + return; + } + } - DEBUG_ASSERTCRASH(foundOccupant, ("GarrisonContain::removeObjectFromStationPoint is all kinds of bad... \n the contained object was not found in station point list.")); + DEBUG_ASSERTCRASH(foundOccupant, ("GarrisonContain::removeObjectFromStationPoint is all kinds of bad... \n the contained object was not found in station point list.")); } @@ -1112,7 +1112,7 @@ void GarrisonContain::onDamage( DamageInfo * /*info*/ ) // // healSingleObject(obj, modData->m_framesForFullHeal); // } - + } @@ -1142,9 +1142,6 @@ void GarrisonContain::healObjects( void ) } - - - //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- void GarrisonContain::healSingleObject( Object *obj, Real framesForFullHeal) @@ -1281,22 +1278,22 @@ void GarrisonContain::recalcApparentControllingPlayer( void ) // now that we have an object inside us, we need to get all the garrison point positions // if we don't already have them. if( getContainCount() > 0 ) - { - if ( isEnclosingContainerFor( 0 ) ) - { - if ( m_garrisonPointsInitialized == FALSE ) - { - loadGarrisonPoints(); - } - } - else // must need station points instead - { - if ( m_stationGarrisonPointsInitialized == FALSE ) - { - loadStationGarrisonPoints(); - } - } - } + { + if ( isEnclosingContainerFor( 0 ) ) + { + if ( m_garrisonPointsInitialized == FALSE ) + { + loadGarrisonPoints(); + } + } + else // must need station points instead + { + if ( m_stationGarrisonPointsInitialized == FALSE ) + { + loadStationGarrisonPoints(); + } + } + } } } @@ -1305,14 +1302,11 @@ void GarrisonContain::recalcApparentControllingPlayer( void ) // ------------------------------------------------------------------------------------------------ void GarrisonContain::loadGarrisonPoints( void ) { - - - const GarrisonContainModuleData *modData = getGarrisonContainModuleData(); - DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("loadGarrisonPoints... SHOULD NOT GET HERE, since this container is non-enclosing") ); + DEBUG_ASSERTCRASH(modData->m_isEnclosingContainer, ("loadGarrisonPoints... SHOULD NOT GET HERE, since this container is non-enclosing") ); - Object *structure = getObject(); + Object *structure = getObject(); Int i, j; Bool gBonesFound = FALSE; @@ -1453,8 +1447,8 @@ void GarrisonContain::validateRallyPoint( void ) //------------------------------------------------------------------------------------------------- void GarrisonContain::onSelling( void ) { - removeAllContained( FALSE ); - OpenContain::onSelling(); + removeAllContained( FALSE ); + OpenContain::onSelling(); } @@ -1507,7 +1501,7 @@ void GarrisonContain::exitObjectViaDoor( Object *exitObj, ExitDoorType exitDoor Real exitAngle = getObject()->getOrientation(); - // Garrison doesn't have reserveDoor or exitDelay, so if we do nothing, everyone will appear on top + // Garrison doesn't have reserveDoor or exitDelay, so if we do nothing, everyone will appear on top // of each other and get stuck inside each others' extent (except for the first guy). So we'll // scatter the start point around a little to make it better. startPosition = *getObject()->getPosition(); @@ -1530,79 +1524,78 @@ void GarrisonContain::exitObjectViaDoor( Object *exitObj, ExitDoorType exitDoor } } - - - - if ( m_evacDisposition == EVAC_TO_LEFT || m_evacDisposition == EVAC_TO_RIGHT ) - { - - Real EVAC__SCALAR = ( m_evacDisposition == EVAC_TO_LEFT ? 1.0f : -1.0f ); - - Real containerHalfLength = getObject()->getGeometryInfo().getMajorRadius() ; - Real containerHalfWidth = getObject()->getGeometryInfo().getMinorRadius() ; - - Vector3 doorPosition; - doorPosition.X = GameLogicRandomValueReal( -containerHalfLength/4, containerHalfLength/4 );// a rectangular pocket to act as the "doorway" - doorPosition.Y = GameLogicRandomValueReal( containerHalfWidth/2, containerHalfWidth * 2) * EVAC__SCALAR; - doorPosition.Z = 0; - Vector3 walkToPosition; - walkToPosition.X = GameLogicRandomValueReal( -containerHalfLength, containerHalfLength ); - walkToPosition.Y = containerHalfWidth * 10 * EVAC__SCALAR;// spread-out! - walkToPosition.Z = 0; - - const Matrix3D *mtx = getObject()->getTransformMatrix(); - mtx->Transform_Vector( *mtx, doorPosition, &doorPosition ); - startPosition.x = doorPosition.X; - startPosition.y = doorPosition.Y; - startPosition.z = doorPosition.Z; - - mtx->Transform_Vector( *mtx, walkToPosition, &walkToPosition ); - endPosition.x = walkToPosition.X; - endPosition.y = walkToPosition.Y; - endPosition.z = walkToPosition.Z; - - exitObj->setPosition( &startPosition ); - exitObj->setOrientation( exitAngle ); - - ///< @todo This really should be automatically wrapped up in an activation sequence for objects in general - // tell the AI about it - TheAI->pathfinder()->addObjectToPathfindMap( exitObj ); - if( ai ) - { - TheAI->pathfinder()->adjustToPossibleDestination(exitObj, ai->getLocomotorSet(), &endPosition); - std::vector exitPath; - exitPath.push_back(endPosition); - - ai->aiFollowPath( &exitPath, getObject(), CMD_FROM_AI ); - TheAI->pathfinder()->updateGoal(exitObj, &endPosition, TheTerrainLogic->getLayerForDestination(&endPosition)); - } - - } - else // must be EVAC_BURST_FROM_CENTER. then! - { - // if we are not enclosed, then just walk away from where we "are." - if ( isEnclosingContainerFor( exitObj )) - { - exitObj->setPosition( &startPosition ); // correct for non-ground-level station points - exitObj->setPositionZ( TheTerrainLogic->getGroundHeight( startPosition.x, startPosition.y ) ); - } - - exitObj->setOrientation( exitAngle ); - ///< @todo This really should be automatically wrapped up in an activation sequence for objects in general - // tell the AI about it - TheAI->pathfinder()->addObjectToPathfindMap( exitObj ); - endPosition = startPosition; - if( ai ) - { - TheAI->pathfinder()->adjustToPossibleDestination(exitObj, ai->getLocomotorSet(), &endPosition); - std::vector exitPath; - exitPath.push_back(endPosition); - - ai->aiFollowPath( &exitPath, getObject(), CMD_FROM_AI ); - TheAI->pathfinder()->updateGoal(exitObj, &endPosition, TheTerrainLogic->getLayerForDestination(&endPosition)); - } - } + + + if ( m_evacDisposition == EVAC_TO_LEFT || m_evacDisposition == EVAC_TO_RIGHT ) + { + + Real EVAC__SCALAR = ( m_evacDisposition == EVAC_TO_LEFT ? 1.0f : -1.0f ); + + Real containerHalfLength = getObject()->getGeometryInfo().getMajorRadius() ; + Real containerHalfWidth = getObject()->getGeometryInfo().getMinorRadius() ; + + Vector3 doorPosition; + doorPosition.X = GameLogicRandomValueReal( -containerHalfLength/4, containerHalfLength/4 );// a rectangular pocket to act as the "doorway" + doorPosition.Y = GameLogicRandomValueReal( containerHalfWidth/2, containerHalfWidth * 2) * EVAC__SCALAR; + doorPosition.Z = 0; + Vector3 walkToPosition; + walkToPosition.X = GameLogicRandomValueReal( -containerHalfLength, containerHalfLength ); + walkToPosition.Y = containerHalfWidth * 10 * EVAC__SCALAR;// spread-out! + walkToPosition.Z = 0; + + const Matrix3D *mtx = getObject()->getTransformMatrix(); + mtx->Transform_Vector( *mtx, doorPosition, &doorPosition ); + startPosition.x = doorPosition.X; + startPosition.y = doorPosition.Y; + startPosition.z = doorPosition.Z; + + mtx->Transform_Vector( *mtx, walkToPosition, &walkToPosition ); + endPosition.x = walkToPosition.X; + endPosition.y = walkToPosition.Y; + endPosition.z = walkToPosition.Z; + + exitObj->setPosition( &startPosition ); + exitObj->setOrientation( exitAngle ); + + ///< @todo This really should be automatically wrapped up in an activation sequence for objects in general + // tell the AI about it + TheAI->pathfinder()->addObjectToPathfindMap( exitObj ); + if( ai ) + { + TheAI->pathfinder()->adjustToPossibleDestination(exitObj, ai->getLocomotorSet(), &endPosition); + std::vector exitPath; + exitPath.push_back(endPosition); + + ai->aiFollowPath( &exitPath, getObject(), CMD_FROM_AI ); + TheAI->pathfinder()->updateGoal(exitObj, &endPosition, TheTerrainLogic->getLayerForDestination(&endPosition)); + } + + } + else // must be EVAC_BURST_FROM_CENTER. then! + { + // if we are not enclosed, then just walk away from where we "are." + if ( isEnclosingContainerFor( exitObj )) + { + exitObj->setPosition( &startPosition ); // correct for non-ground-level station points + exitObj->setPositionZ( TheTerrainLogic->getGroundHeight( startPosition.x, startPosition.y ) ); + } + + exitObj->setOrientation( exitAngle ); + ///< @todo This really should be automatically wrapped up in an activation sequence for objects in general + // tell the AI about it + TheAI->pathfinder()->addObjectToPathfindMap( exitObj ); + endPosition = startPosition; + if( ai ) + { + TheAI->pathfinder()->adjustToPossibleDestination(exitObj, ai->getLocomotorSet(), &endPosition); + std::vector exitPath; + exitPath.push_back(endPosition); + + ai->aiFollowPath( &exitPath, getObject(), CMD_FROM_AI ); + TheAI->pathfinder()->updateGoal(exitObj, &endPosition, TheTerrainLogic->getLayerForDestination(&endPosition)); + } + } recalcApparentControllingPlayer(); @@ -1629,8 +1622,8 @@ void GarrisonContain::onContaining( Object *obj, Bool wasSelected ) obj->setWeaponBonusCondition( WEAPONBONUSCONDITION_GARRISONED ); // put the object in the center of the building - if (isEnclosingContainerFor( obj )) - obj->setPosition( structure->getPosition() ); + if (isEnclosingContainerFor( obj )) + obj->setPosition( structure->getPosition() ); obj->getControllingPlayer()->getAcademyStats()->recordBuildingGarrisoned(); @@ -1641,9 +1634,9 @@ void GarrisonContain::onContaining( Object *obj, Bool wasSelected ) // recalcApparentControllingPlayer(); - Drawable *draw = obj->getDrawable(); - if ( draw && draw->isSelected() ) - TheInGameUI->deselectDrawable( draw ); + Drawable *draw = obj->getDrawable(); + if ( draw && draw->isSelected() ) + TheInGameUI->deselectDrawable( draw ); } // end onContaining @@ -1655,16 +1648,16 @@ void GarrisonContain::onRemoving( Object *obj ) OpenContain::onRemoving(obj); - if (isEnclosingContainerFor( obj )) - // first remove the object from any garrison fire point if it's at one - removeObjectFromGarrisonPoint( obj ); - else - { - removeObjectFromStationPoint( obj ); + if (isEnclosingContainerFor( obj )) + // first remove the object from any garrison fire point if it's at one + removeObjectFromGarrisonPoint( obj ); + else + { + removeObjectFromStationPoint( obj ); //Kris: Patch 1.01 -- Passing in correct argument for Y (instead of X) fixes cases where selling firebases //were dropping contained infantry to incorrect altitudes. - obj->setPositionZ( TheTerrainLogic->getGroundHeight( obj->getPosition()->x, obj->getPosition()->y ) ); - } + obj->setPositionZ( TheTerrainLogic->getGroundHeight( obj->getPosition()->x, obj->getPosition()->y ) ); + } // give the object back a regular weapon obj->clearWeaponBonusCondition( WEAPONBONUSCONDITION_GARRISONED ); @@ -1715,9 +1708,9 @@ void GarrisonContain::onRemoving( Object *obj ) Bool GarrisonContain::isPassengerAllowedToFire( ObjectID id ) const { - const Object *self = getObject(); - if ( self && self->isDisabledByType( DISABLED_SUBDUED ) ) - return FALSE; + const Object *self = getObject(); + if ( self && self->isDisabledByType( DISABLED_SUBDUED ) ) + return FALSE; return TRUE; @@ -2021,20 +2014,20 @@ void GarrisonContain::loadStationGarrisonPoints( void ) if ( count > 0) stationBonesFound = TRUE; - m_stationPointList.clear();// we are starting over... forget everything + m_stationPointList.clear();// we are starting over... forget everything - for( t = 0; t < count; ++t ) - { - StationPointData tempStationPointData; - tempStationPointData.position = tempBuffer[ t ]; - tempStationPointData.occupantID = INVALID_ID; - m_stationPointList.push_back( tempStationPointData ); // store for later use - } + for( t = 0; t < count; ++t ) + { + StationPointData tempStationPointData; + tempStationPointData.position = tempBuffer[ t ]; + tempStationPointData.occupantID = INVALID_ID; + m_stationPointList.push_back( tempStationPointData ); // store for later use + } // restore the original condition flags draw->replaceModelConditionFlags( originalFlags ); - //tempBuffer pops - + //tempBuffer pops + } // garrison points are now initialized diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp index 0407b838b5..6d9ea57cb7 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp @@ -148,9 +148,9 @@ OpenContain::OpenContain( Thing *thing, const ModuleData* moduleData ) : UpdateM m_noFirePointsInArt = false; m_whichExitPath = 1; m_loadSoundsEnabled = TRUE; - - m_passengerAllowedToFire = getOpenContainModuleData()->m_passengersAllowedToFire; - // overridable by setPass...() in the parent interface (for use by upgrade module) + + m_passengerAllowedToFire = getOpenContainModuleData()->m_passengersAllowedToFire; + // overridable by setPass...() in the parent interface (for use by upgrade module) for( Int i = 0; i < MAX_FIRE_POINTS; i++ ) { @@ -438,26 +438,26 @@ void OpenContain::killAllContained( void ) while ( it != m_containList.end() ) { - Object *rider = *it; + Object *rider = *it; - if ( rider ) - { - it = m_containList.erase(it); - m_containListSize--; + if ( rider ) + { + it = m_containList.erase(it); + m_containListSize--; - onRemoving( rider ); - rider->onRemovedFrom( getObject() ); - rider->kill(); + onRemoving( rider ); + rider->onRemovedFrom( getObject() ); + rider->kill(); - } - else - ++it; + } + else + ++it; - } // end while + } // end while - DEBUG_ASSERTCRASH( m_containListSize == 0, ("killallcontain just made a booboo, list size != zero.") ); + DEBUG_ASSERTCRASH( m_containListSize == 0, ("killallcontain just made a booboo, list size != zero.") ); } // end removeAllContained @@ -474,8 +474,8 @@ void OpenContain::harmAndForceExitAllContained( DamageInfo *info ) if ( rider ) { - removeFromContain( rider, true ); - rider->attemptDamage( info ); + removeFromContain( rider, true ); + rider->attemptDamage( info ); } //Kris: Patch 1.03 -- Crash fix when neutral bunker on Alpine Assault is occupied with 10 demo general @@ -578,7 +578,7 @@ void OpenContain::iterateContained( ContainIterateFunc func, void *userData, Boo // call it (*func)( rider, userData ); } - } + } } //------------------------------------------------------------------------------------------------- @@ -590,21 +590,21 @@ Object* OpenContain::getClosestRider( const Coord3D *pos ) for(ContainedItemsList::const_iterator it = m_containList.begin(); it != m_containList.end(); ++it) { - Object *rider = *it; + Object *rider = *it; - if (rider) - { - Real distance = ThePartitionManager->getDistanceSquared( rider, pos, FROM_CENTER_2D ); - if( !closest || closestDistance > distance ) - { - closest = rider; - closestDistance = distance; - } - } + if (rider) + { + Real distance = ThePartitionManager->getDistanceSquared( rider, pos, FROM_CENTER_2D ); + if( !closest || closestDistance > distance ) + { + closest = rider; + closestDistance = distance; + } + } - } + } - return closest; //Could be null! + return closest; //Could be null! } @@ -661,8 +661,8 @@ void OpenContain::removeFromContainViaIterator( ContainedItemsList::iterator it, if (isEnclosingContainerFor( rider )) { addOrRemoveObjFromWorld(rider, true); - rider->setPosition( getObject()->getPosition() ); - // if we are not enclosed, then just walk away from where we "are." + rider->setPosition( getObject()->getPosition() ); + // if we are not enclosed, then just walk away from where we "are." } @@ -817,8 +817,8 @@ void OpenContain::onCollide( Object *other, const Coord3D *loc, const Coord3D *n if( rider->isKindOf( KINDOF_STEALTH_GARRISON ) ) { // aiExit is needed to walk away from the building well, but it doesn't take the Unstealth flag - StealthUpdate* stealth = rider->getStealth(); - if( stealth ) + StealthUpdate* stealth = rider->getStealth(); + if( stealth ) { stealth->markAsDetected(); } @@ -1151,8 +1151,8 @@ void OpenContain::exitObjectInAHurry( Object *exitObj ) Bool OpenContain::isPassengerAllowedToFire( ObjectID id ) const { // const OpenContainModuleData *modData = getOpenContainModuleData(); - //this flag is owned by opencontain, now, so that the upgrade can override the template data - //M Lorenzen, 5/6/03 + //this flag is owned by opencontain, now, so that the upgrade can override the template data + //M Lorenzen, 5/6/03 if( ! m_passengerAllowedToFire ) return FALSE;// Just no, no matter what. @@ -1552,21 +1552,21 @@ Bool OpenContain::getNaturalRallyPoint( Coord3D& rallyPoint, Bool offset ) cons void testForAttackingProc( Object *obj, void *userData ) { Bool *info = (Bool*)userData; - if ( *info == TRUE ) - return; + if ( *info == TRUE ) + return; - *info = ( obj->testStatus( OBJECT_STATUS_IS_ATTACKING ) ); + *info = ( obj->testStatus( OBJECT_STATUS_IS_ATTACKING ) ); } //------------------------------------------------------------------------------------------------- Bool OpenContain::isAnyRiderAttacking( void ) const { - Bool wellIsHe = FALSE; + Bool wellIsHe = FALSE; ((ContainModuleInterface*)this)->iterateContained(testForAttackingProc, &wellIsHe, FALSE ); - return wellIsHe; + return wellIsHe; } @@ -1758,11 +1758,10 @@ void OpenContain::xfer( Xfer *xfer ) // which exit path xfer->xferInt( &m_whichExitPath ); - - if ( version >= 2 ) - { - xfer->xferBool( &m_passengerAllowedToFire ); - } + if ( version >= 2 ) + { + xfer->xferBool( &m_passengerAllowedToFire ); + } } // end xfer diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp index e0537f3ac1..e0ad7bc13f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OverlordContain.cpp @@ -66,16 +66,16 @@ OverlordContainModuleData::OverlordContainModuleData() // ------------------------------------------------------------------------------------------------ void OverlordContainModuleData::buildFieldParse(MultiIniFieldParse& p) { - TransportContainModuleData::buildFieldParse(p); + TransportContainModuleData::buildFieldParse(p); static const FieldParse dataFieldParse[] = - { - { "PayloadTemplateName", INI::parseAsciiStringVectorAppend, NULL, offsetof(OverlordContainModuleData, m_payloadTemplateNameData) }, - { "ExperienceSinkForRider", INI::parseBool, NULL, offsetof(OverlordContainModuleData, m_experienceSinkForRider) }, + { + { "PayloadTemplateName", INI::parseAsciiStringVectorAppend, NULL, offsetof(OverlordContainModuleData, m_payloadTemplateNameData) }, + { "ExperienceSinkForRider", INI::parseBool, NULL, offsetof(OverlordContainModuleData, m_experienceSinkForRider) }, { 0, 0, 0, 0 } }; - p.add(dataFieldParse); + p.add(dataFieldParse); } // ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------ @@ -97,7 +97,7 @@ OverlordContain::OverlordContain( Thing *thing, const ModuleData *moduleData ) : { m_redirectionActivated = FALSE; - m_payloadCreated = FALSE; + m_payloadCreated = FALSE; } @@ -111,7 +111,7 @@ OverlordContain::~OverlordContain( void ) void OverlordContain::onObjectCreated( void ) { - OverlordContain::createPayload(); + OverlordContain::createPayload(); } //------------------------------------------------------------------------------------------------- @@ -121,39 +121,39 @@ void OverlordContain::createPayload() OverlordContainModuleData* self = (OverlordContainModuleData*)getOverlordContainModuleData(); - // Any number of different passengers can be loaded here at init time + // Any number of different passengers can be loaded here at init time Object* object = getObject(); ContainModuleInterface *contain = object->getContain(); if( contain ) - { + { contain->enableLoadSounds( FALSE ); - TemplateNameList list = self->m_payloadTemplateNameData; - TemplateNameIterator iter = list.begin(); - while ( iter != list.end() ) - { - const ThingTemplate* temp = TheThingFactory->findTemplate( *iter ); - if (temp) - { - Object* payload = TheThingFactory->newObject( temp, object->getTeam() ); - - if( contain->isValidContainerFor( payload, true ) ) - { - contain->addToContain( payload ); - } - else - { - DEBUG_CRASH( ( "OverlordContain::createPayload: %s is full, or not valid for the payload %s!", object->getName().str(), self->m_initialPayload.name.str() ) ); - } - - } - - ++iter; - } + TemplateNameList list = self->m_payloadTemplateNameData; + TemplateNameIterator iter = list.begin(); + while ( iter != list.end() ) + { + const ThingTemplate* temp = TheThingFactory->findTemplate( *iter ); + if (temp) + { + Object* payload = TheThingFactory->newObject( temp, object->getTeam() ); + + if( contain->isValidContainerFor( payload, true ) ) + { + contain->addToContain( payload ); + } + else + { + DEBUG_CRASH( ( "OverlordContain::createPayload: %s is full, or not valid for the payload %s!", object->getName().str(), self->m_initialPayload.name.str() ) ); + } + + } + + ++iter; + } contain->enableLoadSounds( TRUE ); - } // endif contain + } // endif contain m_payloadCreated = TRUE; @@ -370,34 +370,34 @@ void OverlordContain::onContaining( Object *obj, Bool wasSelected ) TransportContain::onContaining( obj, wasSelected ); - if ( obj->isKindOf( KINDOF_PORTABLE_STRUCTURE ) ) - { - activateRedirectedContain();//Am now carrying something + if ( obj->isKindOf( KINDOF_PORTABLE_STRUCTURE ) ) + { + activateRedirectedContain();//Am now carrying something // And this contain style explicitly sucks XP from our little friend. - if( getOverlordContainModuleData()->m_experienceSinkForRider && obj->getExperienceTracker() ) + if( getOverlordContainModuleData()->m_experienceSinkForRider && obj->getExperienceTracker() ) obj->getExperienceTracker()->setExperienceSink(getObject()->getID()); - if ( obj->isKindOf( KINDOF_PORTABLE_STRUCTURE ) && getObject()->testStatus( OBJECT_STATUS_STEALTHED ) ) - { - StealthUpdate *myStealth = obj->getStealth(); - if ( myStealth ) - { - myStealth->receiveGrant( true ); - // note to anyone... once stealth is granted to this gattlingcannon ( or such ) - // let its own stealthupdate govern the allowedtostealth cases - // a portable structure never gets removed, so... - } - } - + if ( obj->isKindOf( KINDOF_PORTABLE_STRUCTURE ) && getObject()->testStatus( OBJECT_STATUS_STEALTHED ) ) + { + StealthUpdate *myStealth = obj->getStealth(); + if ( myStealth ) + { + myStealth->receiveGrant( true ); + // note to anyone... once stealth is granted to this gattlingcannon ( or such ) + // let its own stealthupdate govern the allowedtostealth cases + // a portable structure never gets removed, so... + } + } + - } - - - return; + } + + + return; } OpenContain::onContaining( obj, wasSelected ); @@ -585,11 +585,11 @@ Bool OverlordContain::isPassengerAllowedToFire( ObjectID id ) const return FALSE; } - - if ( getObject() && getObject()->getContainedBy() ) // nested containment voids firing, always - return FALSE; + + if ( getObject() && getObject()->getContainedBy() ) // nested containment voids firing, always + return FALSE; - return TransportContain::isPassengerAllowedToFire(); + return TransportContain::isPassengerAllowedToFire(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp index 024dee7969..b09ac3d3c6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/ParachuteContain.cpp @@ -34,7 +34,7 @@ #include "Common/Player.h" #include "Common/RandomValue.h" #include "Common/ThingTemplate.h" -#include "Common/Xfer.h" +#include "Common/Xfer.h" #include "GameLogic/AIPathfind.h" #include "GameLogic/Locomotor.h" @@ -351,10 +351,10 @@ UpdateSleepTime ParachuteContain::update( void ) parachuteAI->aiMoveToPosition( &target, CMD_FROM_AI ); } } - else if ( rider ) + else if ( rider ) rider->clearAndSetModelConditionState( MODELCONDITION_PARACHUTING, MODELCONDITION_FREEFALL ); - } + } draw->setDrawableHidden(!m_opened); if (!m_opened || getContainCount() == 0) @@ -565,18 +565,18 @@ void ParachuteContain::onRemoving( Object *rider ) // If we land outside the map from a faulty parachute, we die too. // Otherwise we exist outside the PartitionManger like a cheater. if( rider->isOffMap() - || (cellType == PathfindCell::CELL_CLIFF) - || (cellType == PathfindCell::CELL_WATER) - || (cellType == PathfindCell::CELL_IMPASSABLE) ) + || (cellType == PathfindCell::CELL_CLIFF) + || (cellType == PathfindCell::CELL_WATER) + || (cellType == PathfindCell::CELL_IMPASSABLE) ) { // The Paradrop command was legal, the parachute destination was legal, but the parachute // can still fail to adjust back on the map. SO this is the place to cap the cheater. rider->kill(); } - // Note: for future enhancement of this feature, we should test the object against the cell type he is on, - // using obj->getAI()->hasLocomotorForSurface( __ ). We cshould not assume here that the parachutist can not - // find happiness on cliffs or water or whatever. + // Note: for future enhancement of this feature, we should test the object against the cell type he is on, + // using obj->getAI()->hasLocomotorForSurface( __ ). We cshould not assume here that the parachutist can not + // find happiness on cliffs or water or whatever. } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp index 55dda0d174..96a32d412f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TransportContain.cpp @@ -62,7 +62,7 @@ TransportContainModuleData::TransportContainModuleData() m_orientLikeContainerOnExit = false; m_keepContainerVelocityOnExit = false; m_goAggressiveOnExit = FALSE; - m_armedRidersUpgradeWeaponSet = FALSE; + m_armedRidersUpgradeWeaponSet = FALSE; m_resetMoodCheckTimeOnExit = true; m_destroyRidersWhoAreNotFreeToExit = false; m_exitPitchRate = 0.0f; @@ -115,9 +115,9 @@ void TransportContainModuleData::buildFieldParse(MultiIniFieldParse& p) { "ArmedRidersUpgradeMyWeaponSet", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_armedRidersUpgradeWeaponSet ) }, { "DelayExitInAir", INI::parseBool, NULL, offsetof( TransportContainModuleData, m_isDelayExitInAir ) }, - { 0, 0, 0, 0 } - }; - p.add(dataFieldParse); + { 0, 0, 0, 0 } + }; + p.add(dataFieldParse); } @@ -204,9 +204,9 @@ Bool TransportContain::isValidContainerFor(const Object* rider, Bool checkCapaci if (checkCapacity) { - Int containMax = getContainMax(); - Int containCount = getContainCount(); - + Int containMax = getContainMax(); + Int containCount = getContainCount(); + return (m_extraSlotsInUse + containCount + transportSlotCount <= containMax); } @@ -223,16 +223,16 @@ Bool TransportContain::isValidContainerFor(const Object* rider, Bool checkCapaci void TransportContain::letRidersUpgradeWeaponSet( void ) { - const TransportContainModuleData * d = getTransportContainModuleData(); + const TransportContainModuleData * d = getTransportContainModuleData(); - if ( ! d->m_armedRidersUpgradeWeaponSet ) - return; + if ( ! d->m_armedRidersUpgradeWeaponSet ) + return; - Object *self = getObject(); - if ( self == NULL ) - return; + Object *self = getObject(); + if ( self == NULL ) + return; - Bool anyRiderHasViableWeapon = FALSE; + Bool anyRiderHasViableWeapon = FALSE; const ContainedItemsList* riderList = getContainedItemsList(); if( riderList ) @@ -247,32 +247,32 @@ void TransportContain::letRidersUpgradeWeaponSet( void ) //Advance to the next iterator it++; - if ( rider ) - { + if ( rider ) + { if(rider->isKindOf(KINDOF_INFANTRY) == false) continue; - Weapon *weapon = NULL; - for ( Int w = PRIMARY_WEAPON; w < WEAPONSLOT_COUNT; ++ w ) - { - weapon = rider->getWeaponInWeaponSlot( (WeaponSlotType)w ); - if ( weapon ) - { - if ( weapon->getTemplate()->isContactWeapon() == FALSE && weapon->isDamageWeapon() == TRUE ) // THIS MAY NEED TO CHECK MORE WEAPON ATTRIBUTES TO WORK BEST - { - anyRiderHasViableWeapon = TRUE; - break; - } - } - } - }//end if rider - - } - } - - if ( anyRiderHasViableWeapon ) - self->setWeaponSetFlag( WEAPONSET_PLAYER_UPGRADE ); - else - self->clearWeaponSetFlag( WEAPONSET_PLAYER_UPGRADE ); + Weapon *weapon = NULL; + for ( Int w = PRIMARY_WEAPON; w < WEAPONSLOT_COUNT; ++ w ) + { + weapon = rider->getWeaponInWeaponSlot( (WeaponSlotType)w ); + if ( weapon ) + { + if ( weapon->getTemplate()->isContactWeapon() == FALSE && weapon->isDamageWeapon() == TRUE ) // THIS MAY NEED TO CHECK MORE WEAPON ATTRIBUTES TO WORK BEST + { + anyRiderHasViableWeapon = TRUE; + break; + } + } + } + }//end if rider + + } + } + + if ( anyRiderHasViableWeapon ) + self->setWeaponSetFlag( WEAPONSET_PLAYER_UPGRADE ); + else + self->clearWeaponSetFlag( WEAPONSET_PLAYER_UPGRADE ); } @@ -306,8 +306,8 @@ void TransportContain::onContaining( Object *rider, Bool wasSelected ) } // end if - if ( getTransportContainModuleData()->m_armedRidersUpgradeWeaponSet ) - letRidersUpgradeWeaponSet(); + if ( getTransportContainModuleData()->m_armedRidersUpgradeWeaponSet ) + letRidersUpgradeWeaponSet(); //Kris: October 20, 2003 - Patch 1.01 //Force Jarmen Kell to transfer weapon timer for snipe to and from the combat bike. @@ -420,8 +420,8 @@ void TransportContain::onRemoving( Object *rider ) m_frameExitNotBusy = TheGameLogic->getFrame() + d->m_exitDelay; - if ( d->m_armedRidersUpgradeWeaponSet ) - letRidersUpgradeWeaponSet(); + if ( d->m_armedRidersUpgradeWeaponSet ) + letRidersUpgradeWeaponSet(); //Kris: October 20, 2003 - Patch 1.01 //Force Jarmen Kell to transfer weapon timer for snipe to and from the combat bike. @@ -602,20 +602,20 @@ Bool TransportContain::isPassengerAllowedToFire( ObjectID id ) const return FALSE; } - if ( ! getObject() ) - return FALSE; - - // but wait! I may be riding on an Overlord - // This code detects the case of whether the contained passenger is in a bunker riding on an overlord, inside a helix! - // Oh my God. - const Object *heWhoContainsMe = getObject()->getContainedBy(); - if ( heWhoContainsMe) - { - ContainModuleInterface *hisContain = heWhoContainsMe->getContain(); - DEBUG_ASSERTCRASH( hisContain,("TransportContain::isPassengerAllowedToFire()... CONTAINER WITHOUT A CONTAIN! AARRGH!") ); - if ( hisContain && hisContain->isSpecialOverlordStyleContainer() ) - return hisContain->isPassengerAllowedToFire( id ); - } + if ( ! getObject() ) + return FALSE; + + // but wait! I may be riding on an Overlord + // This code detects the case of whether the contained passenger is in a bunker riding on an overlord, inside a helix! + // Oh my God. + const Object *heWhoContainsMe = getObject()->getContainedBy(); + if ( heWhoContainsMe) + { + ContainModuleInterface *hisContain = heWhoContainsMe->getContain(); + DEBUG_ASSERTCRASH( hisContain,("TransportContain::isPassengerAllowedToFire()... CONTAINER WITHOUT A CONTAIN! AARRGH!") ); + if ( hisContain && hisContain->isSpecialOverlordStyleContainer() ) + return hisContain->isPassengerAllowedToFire( id ); + } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp index 02d73af63b..a9c994d756 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/TunnelContain.cpp @@ -137,7 +137,7 @@ void TunnelContain::harmAndForceExitAllContained( DamageInfo *info ) { obj = *it; removeFromContain( obj, true ); - obj->attemptDamage( info ); + obj->attemptDamage( info ); it = (*fullList).begin(); } // end while @@ -160,7 +160,7 @@ void TunnelContain::killAllContained( void ) obj = *it; it++; removeFromContain( obj, true ); - obj->kill(); + obj->kill(); } } //------------------------------------------------------------------------------------------------- @@ -200,12 +200,8 @@ void TunnelContain::onContaining( Object *obj, Bool wasSelected ) obj->setDisabled( DISABLED_HELD ); obj->getControllingPlayer()->getAcademyStats()->recordUnitEnteredTunnelNetwork(); - - - - - obj->handlePartitionCellMaintenance(); + obj->handlePartitionCellMaintenance(); } @@ -227,8 +223,6 @@ void TunnelContain::onRemoving( Object *obj ) } doUnloadSound(); - - } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp index 27798a62a6..a15fabf2bd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp @@ -52,8 +52,8 @@ void GrantUpgradeCreateModuleData::buildFieldParse(MultiIniFieldParse& p) static const FieldParse dataFieldParse[] = { - { "UpgradeToGrant", INI::parseAsciiString, NULL, offsetof( GrantUpgradeCreateModuleData, m_upgradeName ) }, - { "ExemptStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( GrantUpgradeCreateModuleData, m_exemptStatus ) }, + { "UpgradeToGrant", INI::parseAsciiString, NULL, offsetof( GrantUpgradeCreateModuleData, m_upgradeName ) }, + { "ExemptStatus", ObjectStatusMaskType::parseFromINI, NULL, offsetof( GrantUpgradeCreateModuleData, m_exemptStatus ) }, { 0, 0, 0, 0 } }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp index 8a928eb82a..8b5553ffda 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Die/RebuildHoleExposeDie.cpp @@ -105,23 +105,20 @@ void RebuildHoleExposeDie::onDie( const DamageInfo *damageInfo ) { if (!isDieApplicable(damageInfo)) return; - + #if defined(_DEBUG) || defined(_INTERNAL) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - if(TheSelectionTranslator->isHandOfGodSelectionMode()) - { - if ( getObject()->isKindOf( KINDOF_STRUCTURE ) ) - { - if ( damageInfo->in.m_damageType == DAMAGE_UNRESISTABLE ) - return; - } - } + if(TheSelectionTranslator->isHandOfGodSelectionMode()) + { + if ( getObject()->isKindOf( KINDOF_STRUCTURE ) ) + { + if ( damageInfo->in.m_damageType == DAMAGE_UNRESISTABLE ) + return; + } + } #endif - - - const RebuildHoleExposeDieModuleData *modData = getRebuildHoleExposeDieModuleData(); Object *us = getObject(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp index 4457981c63..870d5e3857 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/FiringTracker.cpp @@ -54,7 +54,7 @@ FiringTracker::FiringTracker(Thing* thing, const ModuleData *modData) : UpdateMo m_consecutiveShots = 0; m_victimID = INVALID_ID; m_frameToStartCooldown = 0; - m_frameToForceReload = 0; + m_frameToForceReload = 0; m_frameToStopLoopingSound = 0; m_audioHandle = AHSV_NoSound; setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); @@ -122,10 +122,10 @@ void FiringTracker::shotFired(const Weapon* weaponFired, ObjectID victimID) m_victimID = victimID; } - // Push back the time that we should force a reload with each shot - UnsignedInt autoReloadDelay = weaponFired->getAutoReloadWhenIdleFrames(); - if( autoReloadDelay > 0 ) - m_frameToForceReload = now + autoReloadDelay; + // Push back the time that we should force a reload with each shot + UnsignedInt autoReloadDelay = weaponFired->getAutoReloadWhenIdleFrames(); + if( autoReloadDelay > 0 ) + m_frameToForceReload = now + autoReloadDelay; UnsignedInt coast = weaponFired->getContinuousFireCoastFrames(); if (coast) @@ -190,13 +190,13 @@ UpdateSleepTime FiringTracker::update() UnsignedInt now = TheGameLogic->getFrame(); - // I have been idle long enough that I should reload, so I do not hang around with a near empty clip forever. - if( m_frameToForceReload != 0 && now >= m_frameToForceReload ) - { - getObject()->reloadAllAmmo(TRUE); - m_frameToForceReload = 0; - } - + // I have been idle long enough that I should reload, so I do not hang around with a near empty clip forever. + if( m_frameToForceReload != 0 && now >= m_frameToForceReload ) + { + getObject()->reloadAllAmmo(TRUE); + m_frameToForceReload = 0; + } + // If it has been too long since I fired. I have to start over. // (don't call if we don't need to cool down... it's expensive!) @@ -225,38 +225,38 @@ UpdateSleepTime FiringTracker::update() //------------------------------------------------------------------------------------------------- UpdateSleepTime FiringTracker::calcTimeToSleep() { - // Figure out the longest amount of time we can sleep as unneeded - - // If all the timers are off, then we aren't needed at all - if (m_frameToStopLoopingSound == 0 && m_frameToStartCooldown == 0 && m_frameToForceReload == 0) - return UPDATE_SLEEP_FOREVER; - - // Otherwise, we need to wake up to service the shortest timer - UnsignedInt now = TheGameLogic->getFrame(); - UnsignedInt sleepTime = UPDATE_SLEEP_FOREVER; - if( m_frameToStopLoopingSound != 0 ) - { - if( m_frameToStopLoopingSound <= now ) - sleepTime = UPDATE_SLEEP_NONE; - else if( (m_frameToStopLoopingSound - now) < sleepTime ) - sleepTime = m_frameToStopLoopingSound - now; - } - if( m_frameToStartCooldown != 0 ) - { - if( m_frameToStartCooldown <= now ) - sleepTime = UPDATE_SLEEP_NONE; - else if( (m_frameToStartCooldown - now) < sleepTime ) - sleepTime = m_frameToStartCooldown - now; - } - if( m_frameToForceReload != 0 ) - { - if( m_frameToForceReload <= now ) - sleepTime = UPDATE_SLEEP_NONE; - else if( (m_frameToForceReload - now) < sleepTime ) - sleepTime = m_frameToForceReload - now; - } - - return UPDATE_SLEEP(sleepTime); + // Figure out the longest amount of time we can sleep as unneeded + + // If all the timers are off, then we aren't needed at all + if (m_frameToStopLoopingSound == 0 && m_frameToStartCooldown == 0 && m_frameToForceReload == 0) + return UPDATE_SLEEP_FOREVER; + + // Otherwise, we need to wake up to service the shortest timer + UnsignedInt now = TheGameLogic->getFrame(); + UnsignedInt sleepTime = UPDATE_SLEEP_FOREVER; + if( m_frameToStopLoopingSound != 0 ) + { + if( m_frameToStopLoopingSound <= now ) + sleepTime = UPDATE_SLEEP_NONE; + else if( (m_frameToStopLoopingSound - now) < sleepTime ) + sleepTime = m_frameToStopLoopingSound - now; + } + if( m_frameToStartCooldown != 0 ) + { + if( m_frameToStartCooldown <= now ) + sleepTime = UPDATE_SLEEP_NONE; + else if( (m_frameToStartCooldown - now) < sleepTime ) + sleepTime = m_frameToStartCooldown - now; + } + if( m_frameToForceReload != 0 ) + { + if( m_frameToForceReload <= now ) + sleepTime = UPDATE_SLEEP_NONE; + else if( (m_frameToForceReload - now) < sleepTime ) + sleepTime = m_frameToForceReload - now; + } + + return UPDATE_SLEEP(sleepTime); } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp index 563437edce..88eadc82ff 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp @@ -2584,12 +2584,10 @@ void Locomotor::maintainCurrentPositionHover(Object* obj, PhysicsBehavior *physi force.y = accelForce * dir->y; force.z = 0.0f; - - // Apply a random kick (if applicable) to dirty-up visually. - // The idea is that chopper pilots have to do course corrections all the time - // Because of changes in wind, pressure, etc. - // Those changes are added here, then the - + // Apply a random kick (if applicable) to dirty-up visually. + // The idea is that chopper pilots have to do course corrections all the time + // Because of changes in wind, pressure, etc. + // Those changes are added here, then the // apply forces to object diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp index 2d375390a6..b8b73f8f17 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp @@ -193,7 +193,7 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu m_behaviors(NULL), m_body(NULL), m_contain(NULL), - m_stealth(NULL), + m_stealth(NULL), m_partitionData(NULL), m_radarData(NULL), m_drawable(NULL), @@ -432,12 +432,12 @@ Object::Object( const ThingTemplate *tt, const ObjectStatusMaskType &objectStatu m_contain = contain; } - StealthUpdate* stealth = (StealthUpdate*)newMod->getStealth(); - if ( stealth ) - { - DEBUG_ASSERTCRASH( m_stealth == NULL, ("DuplicateStealthUpdates!") ); - m_stealth = stealth; - } + StealthUpdate* stealth = (StealthUpdate*)newMod->getStealth(); + if ( stealth ) + { + DEBUG_ASSERTCRASH( m_stealth == NULL, ("DuplicateStealthUpdates!") ); + m_stealth = stealth; + } AIUpdateInterface* ai = newMod->getAIUpdateInterface(); @@ -702,8 +702,8 @@ void Object::onContainedBy( Object *containedBy ) m_containedBy = containedBy; m_containedByFrame = TheGameLogic->getFrame(); - handlePartitionCellMaintenance(); // which should unlook me now that I am contained - + handlePartitionCellMaintenance(); // which should unlook me now that I am contained + } //------------------------------------------------------------------------------------------------- @@ -715,7 +715,7 @@ void Object::onRemovedFrom( Object *removedFrom ) m_containedBy = NULL; m_containedByFrame = 0; - handlePartitionCellMaintenance(); // get a clean look, now that I am outdoors, again + handlePartitionCellMaintenance(); // get a clean look, now that I am outdoors, again } @@ -1519,8 +1519,8 @@ void Object::fireCurrentWeapon(const Coord3D* pos) //============================================================================== void Object::notifyFiringTrackerShotFired( const Weapon* weaponFired, ObjectID victimID ) { - if ( m_firingTracker ) - m_firingTracker->shotFired( weaponFired, victimID ); + if ( m_firingTracker ) + m_firingTracker->shotFired( weaponFired, victimID ); } @@ -1824,9 +1824,9 @@ void Object::attemptDamage( DamageInfo *damageInfo ) // Process any shockwave forces that might affect this object due to the incurred damage if (damageInfo->in.m_shockWaveAmount > 0.0f && damageInfo->in.m_shockWaveRadius > 0.0f) { - //KindOfMaskType immuneToShockwaveKindofs; //NEW RESTRICTIONS ADDED - //immuneToShockwaveKindofs.set(KINDOF_PROJECTILE);// projectiles go idle in midair when they get sw'd //NEW RESTRICTIONS ADDED - //immuneToShockwaveKindofs.set(KINDOF_PRODUCED_AT_HELIPAD);//helicopters go all wonky when they get shockwaved //NEW RESTRICTIONS ADDED + //KindOfMaskType immuneToShockwaveKindofs; //NEW RESTRICTIONS ADDED + //immuneToShockwaveKindofs.set(KINDOF_PROJECTILE);// projectiles go idle in midair when they get sw'd //NEW RESTRICTIONS ADDED + //immuneToShockwaveKindofs.set(KINDOF_PRODUCED_AT_HELIPAD);//helicopters go all wonky when they get shockwaved //NEW RESTRICTIONS ADDED PhysicsBehavior *behavior = getPhysics(); if ( behavior && (isAirborneTarget() == FALSE) && (! isKindOf(KINDOF_PROJECTILE) ) ) @@ -1849,13 +1849,13 @@ void Object::attemptDamage( DamageInfo *damageInfo ) behavior->applyShock(&shockWaveForce); // Add random rotation to the object for drama - + behavior->applyRandomRotation(); // Set stunned state due to the shock for the object - behavior->setStunned(true); - - setModelConditionState(MODELCONDITION_STUNNED_FLAILING); + behavior->setStunned(true); + + setModelConditionState(MODELCONDITION_STUNNED_FLAILING); } } @@ -3033,15 +3033,15 @@ Bool Object::isSelectable() const if (getTemplate()->isKindOf(KINDOF_ALWAYS_SELECTABLE)) - return TRUE; + return TRUE; if ( m_isSelectable ) - if ( !testStatus(OBJECT_STATUS_UNSELECTABLE) ) - if ( !isEffectivelyDead() ) + if ( !testStatus(OBJECT_STATUS_UNSELECTABLE) ) + if ( !isEffectivelyDead() ) //if ( !getTemplate()->isKindOf(KINDOF_DRONE) )//Most drones are unselectable from being slaved, but the SpyDrone needs help return TRUE; - return FALSE; + return FALSE; } //------------------------------------------------------------------------------------------------- @@ -3081,7 +3081,7 @@ Bool Object::hasSpecialPower( SpecialPowerType type ) const //------------------------------------------------------------------------------------------------- Bool Object::hasAnySpecialPower() const { - return SPECIALPOWERMASK_ANY_SET( m_specialPowerBits ); + return SPECIALPOWERMASK_ANY_SET( m_specialPowerBits ); } //------------------------------------------------------------------------------------------------- @@ -3200,8 +3200,8 @@ Bool Object::isAbleToAttack() const if( testStatus(OBJECT_STATUS_SOLD) ) return false; - if ( isDisabledByType( DISABLED_SUBDUED ) ) - return FALSE; // A Microwave Tank is cooking me + if ( isDisabledByType( DISABLED_SUBDUED ) ) + return FALSE; // A Microwave Tank is cooking me //We can't fire if we, as a portable structure, are aptly disabled if ( isKindOf( KINDOF_PORTABLE_STRUCTURE ) || isKindOf( KINDOF_SPAWNS_ARE_THE_WEAPONS )) @@ -3209,31 +3209,27 @@ Bool Object::isAbleToAttack() const if( isDisabledByType( DISABLED_HACKED ) || isDisabledByType( DISABLED_EMP ) ) return false; - if ( isKindOf( KINDOF_INFANTRY ) ) // I must be a stinger soldier or similar - { - for (BehaviorModule** update = getBehaviorModules(); *update; ++update)//expensive search, limited only to stinger soldiers - { - SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); - if ( sdu ) - { - ObjectID slaverID = sdu->getSlaverID(); - if ( slaverID != INVALID_ID ) - { - Object *slaver = TheGameLogic->findObjectByID( slaverID ); - if ( slaver && slaver->isDisabledByType( DISABLED_SUBDUED )) - return FALSE;// if my stinger site is subdued, so am I - } - - break;//only expect one slavedupdate, so stop searching - } - } - } - + if ( isKindOf( KINDOF_INFANTRY ) ) // I must be a stinger soldier or similar + { + for (BehaviorModule** update = getBehaviorModules(); *update; ++update)//expensive search, limited only to stinger soldiers + { + SlavedUpdateInterface* sdu = (*update)->getSlavedUpdateInterface(); + if ( sdu ) + { + ObjectID slaverID = sdu->getSlaverID(); + if ( slaverID != INVALID_ID ) + { + Object *slaver = TheGameLogic->findObjectByID( slaverID ); + if ( slaver && slaver->isDisabledByType( DISABLED_SUBDUED )) + return FALSE;// if my stinger site is subdued, so am I + } + break;//only expect one slavedupdate, so stop searching + } + } + } } - - //We can't fire if all our weapons are disabled! //Currently, only turreted weapons can be disabled. //ONLY DO THIS CHECK IF OUR UNIT DOESN'T HAVE THE @@ -3598,196 +3594,196 @@ void Object::updateObjValuesFromMapProperties(Dict* properties) } while (!valStr.isEmpty()); Drawable *drawable = getDrawable(); - if ( drawable ) - { - valInt = properties->getInt(TheKey_objectTime, &exists); - if (exists) - { - switch (valInt) - { - case 1: - drawable->clearModelConditionState(MODELCONDITION_NIGHT); - break; - case 2: - drawable->setModelConditionState(MODELCONDITION_NIGHT); - break; - default: - break; - } - } - - valInt = properties->getInt(TheKey_objectWeather, &exists); - if (exists) - { - switch (valInt) - { - case 1: - drawable->clearModelConditionState(MODELCONDITION_SNOW); - break; - case 2: - drawable->setModelConditionState(MODELCONDITION_SNOW); - break; - default: - break; - } - } - - // See if we are supposed to playing the ambient sound - Bool soundEnabledExists; - Bool soundEnabled = properties->getBool( TheKey_objectSoundAmbientEnabled, &soundEnabledExists ); - - DynamicAudioEventInfo * audioToModify = NULL; - Bool infoModified = false; - valStr = properties->getAsciiString( TheKey_objectSoundAmbient, &exists ); - if ( exists ) - { - if ( valStr.isEmpty() ) - { - drawable->setCustomSoundAmbientOff(); - soundEnabledExists = true; - soundEnabled = false; // Don't bother trying to enable later - } - else - { - const AudioEventInfo * baseInfo = TheAudio->findAudioEventInfo( valStr ); - DEBUG_ASSERTCRASH( baseInfo != NULL, ("Cannot find customized ambient sound '%s'", valStr.str() ) ); - if ( baseInfo != NULL ) - { - audioToModify = newInstance( DynamicAudioEventInfo )( *baseInfo ); - infoModified = true; - } - } - } - - // Don't do anything more to audio if we forced the ambient sound off - if ( !( exists && valStr.isEmpty() ) ) - { - valBool = properties->getBool( TheKey_objectSoundAmbientCustomized, &exists ); - if ( exists && valBool ) - { - if ( audioToModify == NULL ) - { - const AudioEventInfo * baseInfo = drawable->getBaseSoundAmbientInfo( ); - DEBUG_ASSERTCRASH( baseInfo != NULL, ("getBaseSoundAmbientInfo() return NULL" ) ); - if ( baseInfo != NULL ) - { - audioToModify = newInstance( DynamicAudioEventInfo )( *baseInfo ); - } - } - - if ( audioToModify != NULL ) - { - valBool = properties->getBool( TheKey_objectSoundAmbientLooping, &exists ); - if ( exists ) - { - audioToModify->overrideLoopFlag( valBool ); - infoModified = true; - } - - valInt = properties->getInt( TheKey_objectSoundAmbientLoopCount, &exists ); - if ( exists && BitIsSet( audioToModify->m_control, AC_LOOP ) ) - { - audioToModify->overrideLoopCount( valInt ); - infoModified = true; - } - - valReal = properties->getReal( TheKey_objectSoundAmbientMinVolume, &exists ); - if ( exists ) - { - audioToModify->overrideMinVolume( valReal ); - infoModified = true; - } - - valReal = properties->getReal( TheKey_objectSoundAmbientVolume, &exists ); - if ( exists ) - { - audioToModify->overrideVolume( valReal ); - infoModified = true; - } - - valReal = properties->getReal( TheKey_objectSoundAmbientMinRange, &exists ); - if ( exists ) - { - audioToModify->overrideMinRange( valReal ); - infoModified = true; - } - - valReal = properties->getReal( TheKey_objectSoundAmbientMaxRange, &exists ); - if ( exists ) - { - audioToModify->overrideMaxRange( valReal ); - infoModified = true; - } - - valInt = properties->getInt( TheKey_objectSoundAmbientPriority, &exists ); - if ( exists ) - { - audioToModify->overridePriority ( (AudioPriority)valInt ); - infoModified = true; - } - } - } - } - - if ( !soundEnabledExists ) - { - // Decide if the sound should start enabled or not, since the map maker didn't record - // a preference. Enable permanently looping sounds, disable one-shot sounds by default - // NOTE: This test should match the tests done in MapObjectProps::mapObjectPageSound::dictToEnabled() - // when it decided whether or not to show a customized sound as enabled - if ( audioToModify != NULL ) - { - soundEnabled = audioToModify->isPermanentSound(); - soundEnabledExists = true; // To get into enableAmbientSoundFromScript() call. - } - else - { - // Use default audio - const AudioEventInfo * baseInfo = drawable->getBaseSoundAmbientInfo( ); - if ( baseInfo != NULL ) - { - soundEnabled = baseInfo->isPermanentSound(); - soundEnabledExists = true; // To get into enableAmbientSoundFromScript() call. - } - } - } - - if ( soundEnabledExists && !soundEnabled ) - { - // Make sure sound doesn't start playing when we set it - // ...FromScript because this is also controlled by the map designer not the game logic - drawable->enableAmbientSoundFromScript( false ); - } - - if ( infoModified && audioToModify != NULL ) - { - // Give a custom, level-specific name - drawable->mangleCustomAudioName( audioToModify ); - - // Pass to TheAudio - TheAudio->addAudioEventInfo( audioToModify ); - - drawable->setCustomSoundAmbientInfo( audioToModify ); - audioToModify = NULL; // Belongs to TheAudio now - } - - if ( audioToModify != NULL ) - { - audioToModify->deleteInstance(); - audioToModify = NULL; - } - - if ( soundEnabledExists && soundEnabled ) - { - // Play sound now that it is set up, if needed. Don't call if already enabled because that - // can cause sound to play twice - // ...FromScript because this is also controlled by the map designer not the game logic - if ( !drawable->getAmbientSoundEnabledFromScript() ) - { - drawable->enableAmbientSoundFromScript( true ); - } - } - } + if ( drawable ) + { + valInt = properties->getInt(TheKey_objectTime, &exists); + if (exists) + { + switch (valInt) + { + case 1: + drawable->clearModelConditionState(MODELCONDITION_NIGHT); + break; + case 2: + drawable->setModelConditionState(MODELCONDITION_NIGHT); + break; + default: + break; + } + } + + valInt = properties->getInt(TheKey_objectWeather, &exists); + if (exists) + { + switch (valInt) + { + case 1: + drawable->clearModelConditionState(MODELCONDITION_SNOW); + break; + case 2: + drawable->setModelConditionState(MODELCONDITION_SNOW); + break; + default: + break; + } + } + + // See if we are supposed to playing the ambient sound + Bool soundEnabledExists; + Bool soundEnabled = properties->getBool( TheKey_objectSoundAmbientEnabled, &soundEnabledExists ); + + DynamicAudioEventInfo * audioToModify = NULL; + Bool infoModified = false; + valStr = properties->getAsciiString( TheKey_objectSoundAmbient, &exists ); + if ( exists ) + { + if ( valStr.isEmpty() ) + { + drawable->setCustomSoundAmbientOff(); + soundEnabledExists = true; + soundEnabled = false; // Don't bother trying to enable later + } + else + { + const AudioEventInfo * baseInfo = TheAudio->findAudioEventInfo( valStr ); + DEBUG_ASSERTCRASH( baseInfo != NULL, ("Cannot find customized ambient sound '%s'", valStr.str() ) ); + if ( baseInfo != NULL ) + { + audioToModify = newInstance( DynamicAudioEventInfo )( *baseInfo ); + infoModified = true; + } + } + } + + // Don't do anything more to audio if we forced the ambient sound off + if ( !( exists && valStr.isEmpty() ) ) + { + valBool = properties->getBool( TheKey_objectSoundAmbientCustomized, &exists ); + if ( exists && valBool ) + { + if ( audioToModify == NULL ) + { + const AudioEventInfo * baseInfo = drawable->getBaseSoundAmbientInfo( ); + DEBUG_ASSERTCRASH( baseInfo != NULL, ("getBaseSoundAmbientInfo() return NULL" ) ); + if ( baseInfo != NULL ) + { + audioToModify = newInstance( DynamicAudioEventInfo )( *baseInfo ); + } + } + + if ( audioToModify != NULL ) + { + valBool = properties->getBool( TheKey_objectSoundAmbientLooping, &exists ); + if ( exists ) + { + audioToModify->overrideLoopFlag( valBool ); + infoModified = true; + } + + valInt = properties->getInt( TheKey_objectSoundAmbientLoopCount, &exists ); + if ( exists && BitIsSet( audioToModify->m_control, AC_LOOP ) ) + { + audioToModify->overrideLoopCount( valInt ); + infoModified = true; + } + + valReal = properties->getReal( TheKey_objectSoundAmbientMinVolume, &exists ); + if ( exists ) + { + audioToModify->overrideMinVolume( valReal ); + infoModified = true; + } + + valReal = properties->getReal( TheKey_objectSoundAmbientVolume, &exists ); + if ( exists ) + { + audioToModify->overrideVolume( valReal ); + infoModified = true; + } + + valReal = properties->getReal( TheKey_objectSoundAmbientMinRange, &exists ); + if ( exists ) + { + audioToModify->overrideMinRange( valReal ); + infoModified = true; + } + + valReal = properties->getReal( TheKey_objectSoundAmbientMaxRange, &exists ); + if ( exists ) + { + audioToModify->overrideMaxRange( valReal ); + infoModified = true; + } + + valInt = properties->getInt( TheKey_objectSoundAmbientPriority, &exists ); + if ( exists ) + { + audioToModify->overridePriority ( (AudioPriority)valInt ); + infoModified = true; + } + } + } + } + + if ( !soundEnabledExists ) + { + // Decide if the sound should start enabled or not, since the map maker didn't record + // a preference. Enable permanently looping sounds, disable one-shot sounds by default + // NOTE: This test should match the tests done in MapObjectProps::mapObjectPageSound::dictToEnabled() + // when it decided whether or not to show a customized sound as enabled + if ( audioToModify != NULL ) + { + soundEnabled = audioToModify->isPermanentSound(); + soundEnabledExists = true; // To get into enableAmbientSoundFromScript() call. + } + else + { + // Use default audio + const AudioEventInfo * baseInfo = drawable->getBaseSoundAmbientInfo( ); + if ( baseInfo != NULL ) + { + soundEnabled = baseInfo->isPermanentSound(); + soundEnabledExists = true; // To get into enableAmbientSoundFromScript() call. + } + } + } + + if ( soundEnabledExists && !soundEnabled ) + { + // Make sure sound doesn't start playing when we set it + // ...FromScript because this is also controlled by the map designer not the game logic + drawable->enableAmbientSoundFromScript( false ); + } + + if ( infoModified && audioToModify != NULL ) + { + // Give a custom, level-specific name + drawable->mangleCustomAudioName( audioToModify ); + + // Pass to TheAudio + TheAudio->addAudioEventInfo( audioToModify ); + + drawable->setCustomSoundAmbientInfo( audioToModify ); + audioToModify = NULL; // Belongs to TheAudio now + } + + if ( audioToModify != NULL ) + { + audioToModify->deleteInstance(); + audioToModify = NULL; + } + + if ( soundEnabledExists && soundEnabled ) + { + // Play sound now that it is set up, if needed. Don't call if already enabled because that + // can cause sound to play twice + // ...FromScript because this is also controlled by the map designer not the game logic + if ( !drawable->getAmbientSoundEnabledFromScript() ) + { + drawable->enableAmbientSoundFromScript( true ); + } + } + } } //------------------------------------------------------------------------------------------------- @@ -3934,15 +3930,6 @@ void Object::crc( Xfer *xfer ) #endif // DEBUG_CRC - - - - - - - - - xfer->xferUser(&m_id, sizeof(m_id)); #ifdef DEBUG_CRC if (doLogging) @@ -4951,11 +4938,11 @@ void Object::look() if( !isDestroyed() && !isEffectivelyDead() ) { - ContainModuleInterface * contain = (getContainedBy() ? getContainedBy()->getContain() : NULL); - if ( contain && !contain->isGarrisonable() ) - return;// dont look, 'cause you are in a tunnel, now + ContainModuleInterface * contain = (getContainedBy() ? getContainedBy()->getContain() : NULL); + if ( contain && !contain->isGarrisonable() ) + return;// dont look, 'cause you are in a tunnel, now // GS 10-20 Need to expand that exception to all transports or else you get a perma reveal where - // you entered the transport. Remember, this hackiness is caused by the fact that we never realized that + // you entered the transport. Remember, this hackiness is caused by the fact that we never realized that // garrisoned buildings weren't looking, we were just seeing the leftover last look of the guy inside. // Otherwise we'd just have enclosingContainer control looking which is the 'correct' answer. @@ -5613,7 +5600,7 @@ void Object::doCommandButtonAtObject( const CommandButton *commandButton, Object return; } break; - + case GUICOMMANDMODE_HIJACK_VEHICLE: case GUICOMMANDMODE_CONVERT_TO_CARBOMB: case GUICOMMANDMODE_SABOTAGE_BUILDING: diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp index 19e2848423..c8c1e6ae91 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp @@ -133,7 +133,7 @@ class FireWeaponNugget : public ObjectCreationNugget public: FireWeaponNugget() : - m_weapon(NULL) + m_weapon(NULL) { } @@ -142,15 +142,15 @@ class FireWeaponNugget : public ObjectCreationNugget if (!primaryObj || !primary || !secondary) { DEBUG_CRASH(("You must have a primary and secondary source for this effect")); - return NULL; - } + return NULL; + } - if (m_weapon) - { - TheWeaponStore->createAndFireTempWeapon( m_weapon, primaryObj, secondary ); - } + if (m_weapon) + { + TheWeaponStore->createAndFireTempWeapon( m_weapon, primaryObj, secondary ); + } return NULL; - } + } static void parse(INI *ini, void *instance, void* /*store*/, const void* /*userData*/) { @@ -178,7 +178,7 @@ class AttackNugget : public ObjectCreationNugget public: AttackNugget() : - m_numberOfShots(1), + m_numberOfShots(1), m_weaponSlot(PRIMARY_WEAPON), m_deliveryDecalRadius(0) { @@ -189,8 +189,8 @@ class AttackNugget : public ObjectCreationNugget if (!primaryObj || !primary || !secondary) { DEBUG_CRASH(("You must have a primary and secondary source for this effect")); - return NULL; - } + return NULL; + } // Star trekkin, across the universe. // Boldly goin forward now, cause we can't find reverse! @@ -282,8 +282,8 @@ class DeliverPayloadNugget : public ObjectCreationNugget if (!primaryObj || !primary || !secondary) { DEBUG_CRASH(("You must have a primary and secondary source for this effect")); - return NULL; - } + return NULL; + } Team* owner = primaryObj ? primaryObj->getControllingPlayer()->getDefaultTeam() : NULL; @@ -636,23 +636,23 @@ class ApplyRandomForceNugget : public ObjectCreationNugget { /// @todo srj -- ack. const_cast is evil. PhysicsBehavior* p = const_cast(primary)->getPhysics(); - if (p) - { + if (p) + { Coord3D force; calcRandomForce(m_minMag, m_maxMag, m_minPitch, m_maxPitch, &force); p->applyForce(&force); - Real yaw = GameLogicRandomValueReal( -m_spinRate, m_spinRate ); - Real roll = GameLogicRandomValueReal( -m_spinRate, m_spinRate ); - Real pitch = GameLogicRandomValueReal( -m_spinRate, m_spinRate ); - p->setYawRate(yaw); - p->setRollRate(roll); - p->setPitchRate(pitch); - } - else - { - DEBUG_CRASH(("You must have a Physics module source for this effect")); - } + Real yaw = GameLogicRandomValueReal( -m_spinRate, m_spinRate ); + Real roll = GameLogicRandomValueReal( -m_spinRate, m_spinRate ); + Real pitch = GameLogicRandomValueReal( -m_spinRate, m_spinRate ); + p->setYawRate(yaw); + p->setRollRate(roll); + p->setPitchRate(pitch); + } + else + { + DEBUG_CRASH(("You must have a Physics module source for this effect")); + } } else { @@ -754,11 +754,11 @@ class GenericObjectCreationNugget : public ObjectCreationNugget m_minLODRequired(STATIC_GAME_LOD_LOW), m_ignorePrimaryObstacle(false), m_inheritsVeterancy(false), - m_diesOnBadLand(FALSE), + m_diesOnBadLand(FALSE), m_skipIfSignificantlyAirborne(false), m_invulnerableTime(0), m_containInsideSourceObject(FALSE), - m_minHealth(1.0f), + m_minHealth(1.0f), m_maxHealth(1.0f), m_orientInForceDirection(false), m_spreadFormation(false), @@ -1058,27 +1058,21 @@ class GenericObjectCreationNugget : public ObjectCreationNugget physics->setAllowToFall(true); } - //Lorenzen sez: - //Since the sneak attack is a structure created with an ocl, it bypasses a lot of the - //goodness that it would have gotten from dozerAI::build( the normal way to make structures ) - // but, since it is a building... lets stamp it down in the pathfind map, here. - if ( obj->isKindOf( KINDOF_STRUCTURE ) ) - { - // Flatten the terrain underneath the object, then adjust to the flattened height. jba. - TheTerrainLogic->flattenTerrain(obj); - Coord3D adjustedPos = *obj->getPosition(); - adjustedPos.z = TheTerrainLogic->getGroundHeight(pos->x, pos->y); - obj->setPosition(&adjustedPos); - // Note - very important that we add to map AFTER we flatten terrain. jba. - TheAI->pathfinder()->addObjectToPathfindMap( obj ); - - } - - - - - + //Lorenzen sez: + //Since the sneak attack is a structure created with an ocl, it bypasses a lot of the + //goodness that it would have gotten from dozerAI::build( the normal way to make structures ) + // but, since it is a building... lets stamp it down in the pathfind map, here. + if ( obj->isKindOf( KINDOF_STRUCTURE ) ) + { + // Flatten the terrain underneath the object, then adjust to the flattened height. jba. + TheTerrainLogic->flattenTerrain(obj); + Coord3D adjustedPos = *obj->getPosition(); + adjustedPos.z = TheTerrainLogic->getGroundHeight(pos->x, pos->y); + obj->setPosition(&adjustedPos); + // Note - very important that we add to map AFTER we flatten terrain. jba. + TheAI->pathfinder()->addObjectToPathfindMap( obj ); + } } @@ -1261,53 +1255,48 @@ class GenericObjectCreationNugget : public ObjectCreationNugget TheGameLogic->destroyObject(obj); } } - + if ( m_diesOnBadLand && obj ) + { + // if we land in the water, we die. alas. + const Coord3D* riderPos = obj->getPosition(); + Real waterZ, terrainZ; + if (TheTerrainLogic->isUnderwater(riderPos->x, riderPos->y, &waterZ, &terrainZ) + && riderPos->z <= waterZ + 10.0f + && obj->getLayer() == LAYER_GROUND) + { + // don't call kill(); do it manually, so we can specify DEATH_FLOODED + DamageInfo damageInfo; + damageInfo.in.m_damageType = DAMAGE_WATER; // use this instead of UNRESISTABLE so we don't get a dusty damage effect + damageInfo.in.m_deathType = DEATH_FLOODED; + damageInfo.in.m_sourceID = INVALID_ID; + damageInfo.in.m_amount = HUGE_DAMAGE_AMOUNT; + obj->attemptDamage( &damageInfo ); + } + + // Kill if materialized on impassable ground + Int cellX = REAL_TO_INT( obj->getPosition()->x / PATHFIND_CELL_SIZE ); + Int cellY = REAL_TO_INT( obj->getPosition()->y / PATHFIND_CELL_SIZE ); + + PathfindCell* cell = TheAI->pathfinder()->getCell( obj->getLayer(), cellX, cellY ); + PathfindCell::CellType cellType = cell ? cell->getType() : PathfindCell::CELL_IMPASSABLE; + + // If we land outside the map, we die too. + // Otherwise we exist outside the PartitionManger like a cheater. + if( obj->isOffMap() + || (cellType == PathfindCell::CELL_CLIFF) + || (cellType == PathfindCell::CELL_WATER) + || (cellType == PathfindCell::CELL_IMPASSABLE) ) + { + // We are sorry, for reasons beyond our control, we are experiencing technical difficulties. Please die. + obj->kill(); + } - if ( m_diesOnBadLand && obj ) - { - // if we land in the water, we die. alas. - const Coord3D* riderPos = obj->getPosition(); - Real waterZ, terrainZ; - if (TheTerrainLogic->isUnderwater(riderPos->x, riderPos->y, &waterZ, &terrainZ) - && riderPos->z <= waterZ + 10.0f - && obj->getLayer() == LAYER_GROUND) - { - // don't call kill(); do it manually, so we can specify DEATH_FLOODED - DamageInfo damageInfo; - damageInfo.in.m_damageType = DAMAGE_WATER; // use this instead of UNRESISTABLE so we don't get a dusty damage effect - damageInfo.in.m_deathType = DEATH_FLOODED; - damageInfo.in.m_sourceID = INVALID_ID; - damageInfo.in.m_amount = HUGE_DAMAGE_AMOUNT; - obj->attemptDamage( &damageInfo ); - } - - // Kill if materialized on impassable ground - Int cellX = REAL_TO_INT( obj->getPosition()->x / PATHFIND_CELL_SIZE ); - Int cellY = REAL_TO_INT( obj->getPosition()->y / PATHFIND_CELL_SIZE ); - - PathfindCell* cell = TheAI->pathfinder()->getCell( obj->getLayer(), cellX, cellY ); - PathfindCell::CellType cellType = cell ? cell->getType() : PathfindCell::CELL_IMPASSABLE; - - // If we land outside the map, we die too. - // Otherwise we exist outside the PartitionManger like a cheater. - if( obj->isOffMap() - || (cellType == PathfindCell::CELL_CLIFF) - || (cellType == PathfindCell::CELL_WATER) - || (cellType == PathfindCell::CELL_IMPASSABLE) ) - { - // We are sorry, for reasons beyond our control, we are experiencing technical difficulties. Please die. - obj->kill(); - } - - // Note: for future enhancement of this feature, we should test the object against the cell type he is on, - // using obj->getAI()->hasLocomotorForSurface( __ ). We cshould not assume here that the object can not - // find happiness on cliffs or water or whatever. - - - } - + // Note: for future enhancement of this feature, we should test the object against the cell type he is on, + // using obj->getAI()->hasLocomotorForSurface( __ ). We cshould not assume here that the object can not + // find happiness on cliffs or water or whatever. + } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp index 9652f64340..f4eda0b6c6 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cpp @@ -5524,8 +5524,8 @@ Bool PartitionFilterStealthedAndUndetected::allow( Object *objOther ) else if( disguised ) { //Exception case -- bomb trucks can't be considered stealthed units when they are disguised as the enemy. - - StealthUpdate *update = objOther->getStealth(); + + StealthUpdate *update = objOther->getStealth(); if( update && update->isDisguised() ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp index b1220f83c6..34d3cc5909 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SpecialPowerModule.cpp @@ -542,96 +542,96 @@ void SpecialPowerModule::aboutToDoSpecialPower( const Coord3D *location ) // Let EVA do her thing SpecialPowerType type = getSpecialPowerModuleData()->m_specialPowerTemplate->getSpecialPowerType(); - Player *localPlayer = ThePlayerList->getLocalPlayer(); + Player *localPlayer = ThePlayerList->getLocalPlayer(); - // Only play the EVA sounds if this is not the local player, and the local player doesn't consider the + // Only play the EVA sounds if this is not the local player, and the local player doesn't consider the // person an enemy. // Kris: Actually, all players need to hear these warnings. - // Ian: But now there are different Eva messages depending on who launched + // Ian: But now there are different Eva messages depending on who launched //if (localPlayer != getObject()->getControllingPlayer() && localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES) - { + { if( type == SPECIAL_PARTICLE_UPLINK_CANNON || type == SUPW_SPECIAL_PARTICLE_UPLINK_CANNON || type == LAZR_SPECIAL_PARTICLE_UPLINK_CANNON ) - { - if ( localPlayer == getObject()->getControllingPlayer() ) - { - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_ParticleCannon); - } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) - { - // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_ParticleCannon); - } - else - { - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Enemy_ParticleCannon); - } - } - else if( type == SPECIAL_NEUTRON_MISSILE || type == NUKE_SPECIAL_NEUTRON_MISSILE || type == SUPW_SPECIAL_NEUTRON_MISSILE ) - { - if ( localPlayer == getObject()->getControllingPlayer() ) - { - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_Nuke); - } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) - { - // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_Nuke); - } - else - { - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Enemy_Nuke); - } - } + { + if ( localPlayer == getObject()->getControllingPlayer() ) + { + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_ParticleCannon); + } + else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + { + // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_ParticleCannon); + } + else + { + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Enemy_ParticleCannon); + } + } + else if( type == SPECIAL_NEUTRON_MISSILE || type == NUKE_SPECIAL_NEUTRON_MISSILE || type == SUPW_SPECIAL_NEUTRON_MISSILE ) + { + if ( localPlayer == getObject()->getControllingPlayer() ) + { + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_Nuke); + } + else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + { + // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_Nuke); + } + else + { + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Enemy_Nuke); + } + } else if (type == SPECIAL_SCUD_STORM) - { - if ( localPlayer == getObject()->getControllingPlayer() ) - { - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_ScudStorm); - } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) - { - // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_ScudStorm); - } - else - { - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Enemy_ScudStorm); - } - } + { + if ( localPlayer == getObject()->getControllingPlayer() ) + { + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_ScudStorm); + } + else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + { + // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_ScudStorm); + } + else + { + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Enemy_ScudStorm); + } + } else if (type == SPECIAL_GPS_SCRAMBLER || type == SLTH_SPECIAL_GPS_SCRAMBLER ) - { - // This is Ghetto. Voices should be ini lines in the special power entry. You shouldn't have to + { + // This is Ghetto. Voices should be ini lines in the special power entry. You shouldn't have to // add to an enum to get a new voice - if ( localPlayer == getObject()->getControllingPlayer() ) - { - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_GPS_Scrambler); - } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) - { - // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_GPS_Scrambler); - } - else - { - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Enemy_GPS_Scrambler); - } - } + if ( localPlayer == getObject()->getControllingPlayer() ) + { + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_GPS_Scrambler); + } + else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + { + // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_GPS_Scrambler); + } + else + { + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Enemy_GPS_Scrambler); + } + } else if (type == SPECIAL_SNEAK_ATTACK) - { - if ( localPlayer == getObject()->getControllingPlayer() ) - { - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_Sneak_Attack); - } - else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) - { - // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_Sneak_Attack); - } - else - { - TheEva->setShouldPlay(EVA_SuperweaponLaunched_Enemy_Sneak_Attack); - } - } + { + if ( localPlayer == getObject()->getControllingPlayer() ) + { + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Own_Sneak_Attack); + } + else if ( localPlayer->getRelationship(getObject()->getTeam()) != ENEMIES ) + { + // Note: counting relationship NEUTRAL as ally. Not sure if this makes a difference??? + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Ally_Sneak_Attack); + } + else + { + TheEva->setShouldPlay(EVA_SuperweaponLaunched_Enemy_Sneak_Attack); + } + } } // get module data diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp index 8e744bf8ac..30c0796ea0 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp @@ -91,7 +91,7 @@ AIUpdateModuleData::AIUpdateModuleData() m_surrenderDuration = LOGICFRAMES_PER_SECOND * 120; #endif - m_forbidPlayerCommands = FALSE; + m_forbidPlayerCommands = FALSE; m_turretsLinked = FALSE; } @@ -140,11 +140,11 @@ const LocomotorTemplateVector* AIUpdateModuleData::findLocomotorTemplateVector(L #ifdef ALLOW_SURRENDER { "SurrenderDuration", INI::parseDurationUnsignedInt, NULL, offsetof(AIUpdateModuleData, m_surrenderDuration) }, #endif - { "ForbidPlayerCommands", INI::parseBool, NULL, offsetof(AIUpdateModuleData, m_forbidPlayerCommands) }, - { "TurretsLinked", INI::parseBool, NULL, offsetof( AIUpdateModuleData, m_turretsLinked ) }, + { "ForbidPlayerCommands", INI::parseBool, NULL, offsetof(AIUpdateModuleData, m_forbidPlayerCommands) }, + { "TurretsLinked", INI::parseBool, NULL, offsetof( AIUpdateModuleData, m_turretsLinked ) }, { 0, 0, 0, 0 } }; - p.add(dataFieldParse); + p.add(dataFieldParse); } //------------------------------------------------------------------------------------------------- @@ -2362,12 +2362,12 @@ void AIUpdateInterface::setLocomotorGoalNone() //------------------------------------------------------------------------------------------------- Bool AIUpdateInterface::isDoingGroundMovement(void) const { - - if (getObject()->isDisabledByType( DISABLED_UNMANNED ) - && getObject()->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) ) - { - return TRUE; // an unmanned helicopter gets grounded, eventually. - } + + if (getObject()->isDisabledByType( DISABLED_UNMANNED ) + && getObject()->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) ) + { + return TRUE; // an unmanned helicopter gets grounded, eventually. + } if (m_locomotorSet.getValidSurfaces() == LOCOMOTORSURFACE_AIR) { @@ -2607,16 +2607,16 @@ Bool AIUpdateInterface::isAllowedToRespondToAiCommands(const AICommandParms* par if ((moodParms & MM_Controller_AI) && (moodParms & MM_Mood_Sleep) && (parms->m_cmd != AICMD_MOVE_TO_POSITION_EVEN_IF_SLEEPING)) return FALSE; - const AIUpdateModuleData *data = getAIUpdateModuleData(); + const AIUpdateModuleData *data = getAIUpdateModuleData(); - Bool forbidden = data->m_forbidPlayerCommands; + Bool forbidden = data->m_forbidPlayerCommands; - if ( parms->m_cmdSource == CMD_FROM_PLAYER && forbidden ) - return FALSE; - // THIS IS JUST FOR THE SPECTREGUNSHIP FOR NOW... - // IT LOCKS OUT USER INPUT, - // ALLOWING ONLY THE SPECTREUPDATE TO COMMAND IT VIA CMD_FROM_AI - // AUTHOR, LORENZEN... 5/15/03 + if ( parms->m_cmdSource == CMD_FROM_PLAYER && forbidden ) + return FALSE; + // THIS IS JUST FOR THE SPECTREGUNSHIP FOR NOW... + // IT LOCKS OUT USER INPUT, + // ALLOWING ONLY THE SPECTREUPDATE TO COMMAND IT VIA CMD_FROM_AI + // AUTHOR, LORENZEN... 5/15/03 return TRUE; @@ -3854,8 +3854,8 @@ void AIUpdateInterface::privateExitInstantly( Object *objectToExit, CommandSourc if (!objectToExit) return; - if ( objectToExit->isDisabledByType( DISABLED_SUBDUED ) ) - return; + if ( objectToExit->isDisabledByType( DISABLED_SUBDUED ) ) + return; // we must go thru this state (rather than calling exitObjectViaDoor directly!), // because a few containers might need to delay to allow @@ -3894,8 +3894,8 @@ void AIUpdateInterface::doQuickExit( const std::vector* path ) void AIUpdateInterface::privateEvacuate( Int exposeStealthUnits, CommandSourceType cmdSource ) { - if ( getObject()->isDisabledByType( DISABLED_SUBDUED ) ) - return; + if ( getObject()->isDisabledByType( DISABLED_SUBDUED ) ) + return; ContainModuleInterface *contain = getObject()->getContain(); @@ -3916,8 +3916,8 @@ void AIUpdateInterface::privateEvacuate( Int exposeStealthUnits, CommandSourceTy void AIUpdateInterface::privateEvacuateInstantly( Int exposeStealthUnits, CommandSourceType cmdSource ) { - if ( getObject()->isDisabledByType( DISABLED_SUBDUED ) ) - return; + if ( getObject()->isDisabledByType( DISABLED_SUBDUED ) ) + return; ContainModuleInterface *contain = getObject()->getContain(); @@ -4482,9 +4482,9 @@ void AIUpdateInterface::setNextMoodCheckTime( UnsignedInt frame ) Bool AIUpdateInterface::canAutoAcquireWhileStealthed() const { - if ( getObject() && getObject()->getStealth() && getObject()->getStealth()->isGrantedBySpecialPower() ) - return TRUE; - return getAIUpdateModuleData()->m_autoAcquireEnemiesWhenIdle & AAS_Idle_Stealthed; + if ( getObject() && getObject()->getStealth() && getObject()->getStealth()->isGrantedBySpecialPower() ) + return TRUE; + return getAIUpdateModuleData()->m_autoAcquireEnemiesWhenIdle & AAS_Idle_Stealthed; } @@ -4528,13 +4528,13 @@ Object* AIUpdateInterface::getNextMoodTarget( Bool calledByAI, Bool calledDuring { if( !canAutoAcquireWhileStealthed() ) { - const Object *container = obj->getContainedBy(); - if( ! (container && container->getContain()->isPassengerAllowedToFire()) ) - { + const Object *container = obj->getContainedBy(); + if( ! (container && container->getContain()->isPassengerAllowedToFire()) ) + { // Sorry, stealthed and not allowed to idle fire when stealthed. // Being in a firing container is an exception to this veto. - return NULL; - } + return NULL; + } } } } @@ -4746,14 +4746,14 @@ void AIUpdateInterface::evaluateMoraleBonus( void ) // nationalism if( nationalism ) - { + { us->setWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ); - // fanaticism - if ( fanaticism ) - us->setWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM );// FOR THE NEW GC INFANTRY GENERAL - else - us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM ); - } + // fanaticism + if ( fanaticism ) + us->setWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM );// FOR THE NEW GC INFANTRY GENERAL + else + us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM ); + } else us->clearWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp index fdcd48ee72..64bff5e26c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/ChinookAIUpdate.cpp @@ -332,8 +332,6 @@ class ChinookTakeoffOrLandingState : public State // some bridge layer. obj->setLayer(LAYER_GROUND); } - - } }; @@ -1085,13 +1083,12 @@ UpdateSleepTime ChinookAIUpdate::update() } - // have to call our parent's isIdle, because we override it to never return true // when we have a pending command... ContainModuleInterface* contain = getObject()->getContain(); if( contain ) { - if (SupplyTruckAIUpdate::isIdle()) + if (SupplyTruckAIUpdate::isIdle()) { Bool waitingToEnterOrExit = contain->hasObjectsWantingToEnterOrExit(); if (m_hasPendingCommand) @@ -1112,36 +1109,36 @@ UpdateSleepTime ChinookAIUpdate::update() } - if ( TheGameLogic->getFrame()%10 == 1 ) - { - Object *victim = getCurrentVictim(); - if ( victim ) - { - // privateAttackObject( victim, 9999, CMD_FROM_AI ); - - //If we are attacking something, lets make sure our passengers follow suit - if ( contain->isPassengerAllowedToFire() ) - { - const ContainedItemsList *passengerList = contain->getContainedItemsList(); - ContainedItemsList::const_iterator passengerIterator; - passengerIterator = passengerList->begin(); + if ( TheGameLogic->getFrame()%10 == 1 ) + { + Object *victim = getCurrentVictim(); + if ( victim ) + { + // privateAttackObject( victim, 9999, CMD_FROM_AI ); - while( passengerIterator != passengerList->end() ) - { - Object *passenger = *passengerIterator; - //Advance to the next iterator - passengerIterator++; + //If we are attacking something, lets make sure our passengers follow suit + if ( contain->isPassengerAllowedToFire() ) + { + const ContainedItemsList *passengerList = contain->getContainedItemsList(); + ContainedItemsList::const_iterator passengerIterator; + passengerIterator = passengerList->begin(); - AIUpdateInterface *passengerAI = passenger->getAIUpdateInterface(); - if( passengerAI && (passengerAI->getCurrentVictim() == NULL) ) - { - passengerAI->aiAttackObject( victim, 999, CMD_FROM_AI ); - } - } - } + while( passengerIterator != passengerList->end() ) + { + Object *passenger = *passengerIterator; + //Advance to the next iterator + passengerIterator++; + + AIUpdateInterface *passengerAI = passenger->getAIUpdateInterface(); + if( passengerAI && (passengerAI->getCurrentVictim() == NULL) ) + { + passengerAI->aiAttackObject( victim, 999, CMD_FROM_AI ); + } + } + } - } - } + } + } @@ -1151,32 +1148,32 @@ UpdateSleepTime ChinookAIUpdate::update() - // Just a handy spot to handle that groovy client effect of the rotor wash - if ( getObject()->getShroudedStatus( ThePlayerList->getLocalPlayer()->getPlayerIndex()) == OBJECTSHROUD_CLEAR ) - { - if ( m_flightStatus == CHINOOK_LANDING || m_flightStatus == CHINOOK_TAKING_OFF || m_flightStatus == CHINOOK_LANDED ) - { - Coord3D pos = *getObject()->getPosition(); - Real chopperElevation = pos.z; - pos.z = TheTerrainLogic->getGroundHeight( pos.x, pos.y ) + 3.0f; - chopperElevation -= pos.z; + // Just a handy spot to handle that groovy client effect of the rotor wash + if ( getObject()->getShroudedStatus( ThePlayerList->getLocalPlayer()->getPlayerIndex()) == OBJECTSHROUD_CLEAR ) + { + if ( m_flightStatus == CHINOOK_LANDING || m_flightStatus == CHINOOK_TAKING_OFF || m_flightStatus == CHINOOK_LANDED ) + { + Coord3D pos = *getObject()->getPosition(); + Real chopperElevation = pos.z; + pos.z = TheTerrainLogic->getGroundHeight( pos.x, pos.y ) + 3.0f; + chopperElevation -= pos.z; - if ( GameClientRandomValueReal( 0.0f, chopperElevation ) < 5.0f ) - { - const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate( getChinookAIUpdateModuleData()->m_rotorWashParticleSystem ); - ParticleSystem *system; - if( tmp ) - { - system = TheParticleSystemManager->createParticleSystem( tmp ); - if( system ) - { - system->setPosition( &pos ); - } - } - } + if ( GameClientRandomValueReal( 0.0f, chopperElevation ) < 5.0f ) + { + const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate( getChinookAIUpdateModuleData()->m_rotorWashParticleSystem ); + ParticleSystem *system; + if( tmp ) + { + system = TheParticleSystemManager->createParticleSystem( tmp ); + if( system ) + { + system->setPosition( &pos ); + } + } + } - } - } + } + } @@ -1403,21 +1400,21 @@ void ChinookAIUpdate::loadPostProcess( void ) void ChinookAIUpdate::privateIdle(CommandSourceType cmdSource) { - // Just an extra step, here, before extending idle to parent classes. - // Living in you own privateIdle-ho. - ContainModuleInterface* contain = getObject()->getContain(); + // Just an extra step, here, before extending idle to parent classes. + // Living in you own privateIdle-ho. + ContainModuleInterface* contain = getObject()->getContain(); if( contain != NULL ) { - Object *rider = (Object*)contain->friend_getRider(); - if ( rider ) - { + Object *rider = (Object*)contain->friend_getRider(); + if ( rider ) + { AIUpdateInterface *riderAI = rider->getAIUpdateInterface(); if( riderAI ) riderAI->aiIdle( cmdSource ); } - } + } - SupplyTruckAIUpdate::privateIdle( cmdSource ); + SupplyTruckAIUpdate::privateIdle( cmdSource ); } @@ -1429,55 +1426,55 @@ void ChinookAIUpdate::privateIdle(CommandSourceType cmdSource) void ChinookAIUpdate::privateAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ) { - if ( ! getObject()->isKindOf( KINDOF_CAN_ATTACK ) ) - return; + if ( ! getObject()->isKindOf( KINDOF_CAN_ATTACK ) ) + return; - ContainModuleInterface* contain = getObject()->getContain(); + ContainModuleInterface* contain = getObject()->getContain(); if( contain != NULL ) { // As an extension of the normal attack, I may want to tell my passengers to attack - // too, but only if this is a direct command. (As opposed to a passive aquire) - if( (cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT) ) + // too, but only if this is a direct command. (As opposed to a passive aquire) + if( (cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT) ) { - //if ( contain->isPassengerAllowedToFire() )//moved to below - { - const ContainedItemsList *passengerList = contain->getContainedItemsList(); - ContainedItemsList::const_iterator passengerIterator; - passengerIterator = passengerList->begin(); - - while( passengerIterator != passengerList->end() ) - { - Object *passenger = *passengerIterator; - //Advance to the next iterator - passengerIterator++; - - - if ( ! contain->isPassengerAllowedToFire( passenger->getID() ) ) - continue; - - if ( ! passenger->isKindOf( KINDOF_INFANTRY )) - continue; - - // If I am an overlord with a gattling upgrade, I do not tell it to fire if it is disabled - if ( passenger->isKindOf( KINDOF_PORTABLE_STRUCTURE ) ) - { - if( passenger->isDisabledByType( DISABLED_HACKED ) - || passenger->isDisabledByType( DISABLED_EMP ) - || passenger->isDisabledByType( DISABLED_SUBDUED ) - || passenger->isDisabledByType( DISABLED_PARALYZED) ) - continue; - } - - AIUpdateInterface *passengerAI = passenger->getAIUpdateInterface(); - if( passengerAI ) - { - passengerAI->aiAttackObject( victim, maxShotsToFire, cmdSource ); - } - } - - } - - private___TellPortableStructureToAttackWithMe( victim, maxShotsToFire, cmdSource ); + //if ( contain->isPassengerAllowedToFire() )//moved to below + { + const ContainedItemsList *passengerList = contain->getContainedItemsList(); + ContainedItemsList::const_iterator passengerIterator; + passengerIterator = passengerList->begin(); + + while( passengerIterator != passengerList->end() ) + { + Object *passenger = *passengerIterator; + //Advance to the next iterator + passengerIterator++; + + + if ( ! contain->isPassengerAllowedToFire( passenger->getID() ) ) + continue; + + if ( ! passenger->isKindOf( KINDOF_INFANTRY )) + continue; + + // If I am an overlord with a gattling upgrade, I do not tell it to fire if it is disabled + if ( passenger->isKindOf( KINDOF_PORTABLE_STRUCTURE ) ) + { + if( passenger->isDisabledByType( DISABLED_HACKED ) + || passenger->isDisabledByType( DISABLED_EMP ) + || passenger->isDisabledByType( DISABLED_SUBDUED ) + || passenger->isDisabledByType( DISABLED_PARALYZED) ) + continue; + } + + AIUpdateInterface *passengerAI = passenger->getAIUpdateInterface(); + if( passengerAI ) + { + passengerAI->aiAttackObject( victim, maxShotsToFire, cmdSource ); + } + } + + } + + private___TellPortableStructureToAttackWithMe( victim, maxShotsToFire, cmdSource ); } } @@ -1489,25 +1486,25 @@ void ChinookAIUpdate::privateAttackObject( Object *victim, Int maxShotsToFire, C void ChinookAIUpdate::private___TellPortableStructureToAttackWithMe( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ) { - ContainModuleInterface* contain = getObject()->getContain(); + ContainModuleInterface* contain = getObject()->getContain(); if( contain != NULL ) { - //--------- THE GATTLING UPGRADE OR THE GUYS IN THE BUNKER_NOT_A_BUNKER------------- - Object *rider = (Object*)contain->friend_getRider(); + //--------- THE GATTLING UPGRADE OR THE GUYS IN THE BUNKER_NOT_A_BUNKER------------- + Object *rider = (Object*)contain->friend_getRider(); if ( rider - && rider->isKindOf( KINDOF_PORTABLE_STRUCTURE ) - && !rider->isDisabledByType( DISABLED_HACKED ) + && rider->isKindOf( KINDOF_PORTABLE_STRUCTURE ) + && !rider->isDisabledByType( DISABLED_HACKED ) && !rider->isDisabledByType( DISABLED_EMP ) && !rider->isDisabledByType( DISABLED_SUBDUED ) && !rider->isDisabledByType( DISABLED_PARALYZED) ) - { + { AIUpdateInterface *riderAI = rider->getAIUpdateInterface(); if( riderAI ) { riderAI->aiAttackObject( victim, maxShotsToFire, cmdSource ); } } - } + } } @@ -1518,63 +1515,63 @@ void ChinookAIUpdate::private___TellPortableStructureToAttackWithMe( Object *vic void ChinookAIUpdate::privateForceAttackObject( Object *victim, Int maxShotsToFire, CommandSourceType cmdSource ) { - if ( ! getObject()->isKindOf( KINDOF_CAN_ATTACK ) ) - return; + if ( ! getObject()->isKindOf( KINDOF_CAN_ATTACK ) ) + return; - ContainModuleInterface* contain = getObject()->getContain(); + ContainModuleInterface* contain = getObject()->getContain(); if( contain != NULL ) { // As an extension of the normal attack, I may want to tell my passengers to attack - // too, but only if this is a direct command. (As opposed to a passive aquire) - if( (cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT) ) + // too, but only if this is a direct command. (As opposed to a passive aquire) + if( (cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT) ) { -// if ( contain->isPassengerAllowedToFire() ) - { - const ContainedItemsList *passengerList = contain->getContainedItemsList(); - ContainedItemsList::const_iterator passengerIterator; - passengerIterator = passengerList->begin(); - - while( passengerIterator != passengerList->end() ) - { - Object *passenger = *passengerIterator; - //Advance to the next iterator - passengerIterator++; - - if ( ! contain->isPassengerAllowedToFire( passenger->getID() ) ) - continue; - - if ( ! passenger->isKindOf( KINDOF_INFANTRY )) - continue; - - // If I am an overlord with a gattling upgrade, I do not tell it to fire if it is disabled - if ( passenger->isKindOf( KINDOF_PORTABLE_STRUCTURE ) ) - { - if( passenger->isDisabledByType( DISABLED_HACKED ) - || passenger->isDisabledByType( DISABLED_EMP ) - || passenger->isDisabledByType( DISABLED_SUBDUED ) - || passenger->isDisabledByType( DISABLED_PARALYZED) ) - continue; - } - - AIUpdateInterface *passengerAI = passenger->getAIUpdateInterface(); - if( passengerAI ) - { - passengerAI->aiForceAttackObject( victim, maxShotsToFire, cmdSource ); - } - - } - } - - - //--------- THE GATTLING UPGRADE OR THE GUYS IN THE BUNKER_NOT_A_BUNKER------------- - Object *rider = (Object*)contain->friend_getRider(); +// if ( contain->isPassengerAllowedToFire() ) + { + const ContainedItemsList *passengerList = contain->getContainedItemsList(); + ContainedItemsList::const_iterator passengerIterator; + passengerIterator = passengerList->begin(); + + while( passengerIterator != passengerList->end() ) + { + Object *passenger = *passengerIterator; + //Advance to the next iterator + passengerIterator++; + + if ( ! contain->isPassengerAllowedToFire( passenger->getID() ) ) + continue; + + if ( ! passenger->isKindOf( KINDOF_INFANTRY )) + continue; + + // If I am an overlord with a gattling upgrade, I do not tell it to fire if it is disabled + if ( passenger->isKindOf( KINDOF_PORTABLE_STRUCTURE ) ) + { + if( passenger->isDisabledByType( DISABLED_HACKED ) + || passenger->isDisabledByType( DISABLED_EMP ) + || passenger->isDisabledByType( DISABLED_SUBDUED ) + || passenger->isDisabledByType( DISABLED_PARALYZED) ) + continue; + } + + AIUpdateInterface *passengerAI = passenger->getAIUpdateInterface(); + if( passengerAI ) + { + passengerAI->aiForceAttackObject( victim, maxShotsToFire, cmdSource ); + } + + } + } + + + //--------- THE GATTLING UPGRADE OR THE GUYS IN THE BUNKER_NOT_A_BUNKER------------- + Object *rider = (Object*)contain->friend_getRider(); if ( rider - && rider->isKindOf( KINDOF_PORTABLE_STRUCTURE ) - && !rider->isDisabledByType( DISABLED_HACKED ) + && rider->isKindOf( KINDOF_PORTABLE_STRUCTURE ) + && !rider->isDisabledByType( DISABLED_HACKED ) && !rider->isDisabledByType( DISABLED_EMP ) && !rider->isDisabledByType( DISABLED_SUBDUED ) && !rider->isDisabledByType( DISABLED_PARALYZED) ) - { + { AIUpdateInterface *riderAI = rider->getAIUpdateInterface(); if( riderAI ) { @@ -1595,63 +1592,63 @@ void ChinookAIUpdate::privateForceAttackObject( Object *victim, Int maxShotsToFi void ChinookAIUpdate::privateAttackPosition( const Coord3D *pos, Int maxShotsToFire, CommandSourceType cmdSource ) { - if ( ! getObject()->isKindOf( KINDOF_CAN_ATTACK ) ) - return; + if ( ! getObject()->isKindOf( KINDOF_CAN_ATTACK ) ) + return; ContainModuleInterface* contain = getObject()->getContain(); if( contain != NULL ) { // As an extension of the normal attack, I may want to tell my passengers to attack - // too, but only if this is a direct command. (As opposed to a passive aquire) - if( (cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT) ) + // too, but only if this is a direct command. (As opposed to a passive aquire) + if( (cmdSource == CMD_FROM_PLAYER || cmdSource == CMD_FROM_SCRIPT) ) { - //if ( contain->isPassengerAllowedToFire() ) - { - const ContainedItemsList *passengerList = contain->getContainedItemsList(); - ContainedItemsList::const_iterator passengerIterator; - passengerIterator = passengerList->begin(); - - while( passengerIterator != passengerList->end() ) - { - Object *passenger = *passengerIterator; - //Advance to the next iterator - passengerIterator++; - - if ( ! contain->isPassengerAllowedToFire( passenger->getID() ) ) - continue; - - if ( ! passenger->isKindOf( KINDOF_INFANTRY )) - continue; - - // If I am an overlord with a gattling upgrade, I do not tell it ti fire if it is disabled - if ( passenger->isKindOf( KINDOF_PORTABLE_STRUCTURE ) ) - { - if( passenger->isDisabledByType( DISABLED_HACKED ) - || passenger->isDisabledByType( DISABLED_EMP) - || passenger->isDisabledByType( DISABLED_SUBDUED) - || passenger->isDisabledByType( DISABLED_PARALYZED) ) - continue; - } - - AIUpdateInterface *passengerAI = passenger->getAIUpdateInterface(); - if( passengerAI ) - { - passengerAI->aiAttackPosition( pos, maxShotsToFire, cmdSource ); - } - - } - } - - //--------- THE GATTLING UPGRADE OR THE GUYS IN THE BUNKER_NOT_A_BUNKER------------- - Object *rider = (Object*)contain->friend_getRider(); + //if ( contain->isPassengerAllowedToFire() ) + { + const ContainedItemsList *passengerList = contain->getContainedItemsList(); + ContainedItemsList::const_iterator passengerIterator; + passengerIterator = passengerList->begin(); + + while( passengerIterator != passengerList->end() ) + { + Object *passenger = *passengerIterator; + //Advance to the next iterator + passengerIterator++; + + if ( ! contain->isPassengerAllowedToFire( passenger->getID() ) ) + continue; + + if ( ! passenger->isKindOf( KINDOF_INFANTRY )) + continue; + + // If I am an overlord with a gattling upgrade, I do not tell it ti fire if it is disabled + if ( passenger->isKindOf( KINDOF_PORTABLE_STRUCTURE ) ) + { + if( passenger->isDisabledByType( DISABLED_HACKED ) + || passenger->isDisabledByType( DISABLED_EMP) + || passenger->isDisabledByType( DISABLED_SUBDUED) + || passenger->isDisabledByType( DISABLED_PARALYZED) ) + continue; + } + + AIUpdateInterface *passengerAI = passenger->getAIUpdateInterface(); + if( passengerAI ) + { + passengerAI->aiAttackPosition( pos, maxShotsToFire, cmdSource ); + } + + } + } + + //--------- THE GATTLING UPGRADE OR THE GUYS IN THE BUNKER_NOT_A_BUNKER------------- + Object *rider = (Object*)contain->friend_getRider(); if ( rider - && rider->isKindOf( KINDOF_PORTABLE_STRUCTURE ) - && !rider->isDisabledByType( DISABLED_HACKED ) + && rider->isKindOf( KINDOF_PORTABLE_STRUCTURE ) + && !rider->isDisabledByType( DISABLED_HACKED ) && !rider->isDisabledByType( DISABLED_EMP ) && !rider->isDisabledByType( DISABLED_SUBDUED ) && !rider->isDisabledByType( DISABLED_PARALYZED) ) - { + { AIUpdateInterface *riderAI = rider->getAIUpdateInterface(); if( riderAI ) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp index c1ff533cce..8cd4145de3 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/DeliverPayloadAIUpdate.cpp @@ -623,14 +623,14 @@ StateReturnType ApproachState::update() if (ai->getAIStateType() != AI_MOVE_TO) { - if ( ai->getAIStateType() == AI_IDLE ) - // Because something outside us has told us to IDLE, so geez, ignore it and try our approach again - return STATE_FAILURE; - else - { - DEBUG_CRASH(("hmm, bailed from moveto state early... should this be possible?")); - ai->aiMoveToPosition( ai->getMoveToPos(), CMD_FROM_AI ); - } + if ( ai->getAIStateType() == AI_IDLE ) + // Because something outside us has told us to IDLE, so geez, ignore it and try our approach again + return STATE_FAILURE; + else + { + DEBUG_CRASH(("hmm, bailed from moveto state early... should this be possible?")); + ai->aiMoveToPosition( ai->getMoveToPos(), CMD_FROM_AI ); + } } @@ -773,7 +773,6 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often mfb->setMinefieldTarget(ai->getMoveToPos()); } - static NameKeyType key_SmartBombTargetHomingUpdate = NAMEKEY("SmartBombTargetHomingUpdate"); SmartBombTargetHomingUpdate* smthu = (SmartBombTargetHomingUpdate *)item->findUpdateModule(key_SmartBombTargetHomingUpdate); if (smthu) @@ -781,8 +780,6 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often smthu->SetTargetPosition( *ai->getMoveToPos() ); } - - if( ai->getData()->m_inheritTransportVelocity ) { Coord3D velocity = *owner->getPhysics()->getVelocity(); @@ -895,7 +892,6 @@ StateReturnType DeliveringState::update() // Kick a dude out every so often { payload->getAIUpdateInterface()->aiMoveToPosition( ai->getMoveToPos(), CMD_FROM_AI ); } - } } } @@ -1183,7 +1179,7 @@ StateReturnType HeadOffMapState::onEnter() // Give move order out of town ai->friend_setAcceptingCommands(false); - owner->getUnitDirectionVector3D( facingDirectionUponDelivery ); + owner->getUnitDirectionVector3D( facingDirectionUponDelivery ); return STATE_CONTINUE; } @@ -1200,20 +1196,20 @@ StateReturnType HeadOffMapState::update() if (ai->isOffMap()) return STATE_SUCCESS; - - // greasy as this hack seems... if terrain or objects or whatever have turned me away from the map-edge that I had first headed for,... - //I blow up, rather than face eternally spinning on the point of a mineret or derrick or something awful. - if ( owner->getPhysics()->getTurning() != 0 ) - { - Coord3D currentDirection; - owner->getUnitDirectionVector3D( currentDirection ); - Real dot = facingDirectionUponDelivery.x * currentDirection.x - + facingDirectionUponDelivery.y * currentDirection.y - + facingDirectionUponDelivery.z * currentDirection.z; - - if ( dot < 0.3f ) - owner->kill(); - } + + // greasy as this hack seems... if terrain or objects or whatever have turned me away from the map-edge that I had first headed for,... + //I blow up, rather than face eternally spinning on the point of a mineret or derrick or something awful. + if ( owner->getPhysics()->getTurning() != 0 ) + { + Coord3D currentDirection; + owner->getUnitDirectionVector3D( currentDirection ); + Real dot = facingDirectionUponDelivery.x * currentDirection.x + + facingDirectionUponDelivery.y * currentDirection.y + + facingDirectionUponDelivery.z * currentDirection.z; + + if ( dot < 0.3f ) + owner->kill(); + } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp index f98c482922..0aec9d60d4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp @@ -566,17 +566,15 @@ StateReturnType HackInternetState::update() pos.zero(); pos.add( owner->getPosition() ); pos.z += 20.0f; //add a little z to make it show up above the unit. - - - Object *internetCenter = owner->getContainedBy(); - if ( internetCenter ) - { - Real width = internetCenter->getGeometryInfo().getMajorRadius() * 0.3f; - Real depth = internetCenter->getGeometryInfo().getMinorRadius() * 0.3f; - pos.x += GameClientRandomValue(-width,width); - pos.y += GameClientRandomValue(-depth,depth); - } + Object *internetCenter = owner->getContainedBy(); + if ( internetCenter ) + { + Real width = internetCenter->getGeometryInfo().getMajorRadius() * 0.3f; + Real depth = internetCenter->getGeometryInfo().getMinorRadius() * 0.3f; + pos.x += GameClientRandomValue(-width,width); + pos.y += GameClientRandomValue(-depth,depth); + } TheInGameUI->addFloatingText( moneyString, &pos, GameMakeColor( 0, 255, 0, 255 ) ); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp index 4da9001972..7c955f9073 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp @@ -78,8 +78,8 @@ MissileAIUpdateModuleData::MissileAIUpdateModuleData() m_garrisonHitKillFX = NULL; m_lockDistance = 75.0f; m_distanceScatterWhenJammed = 75.0f; - m_detonateCallsKill = FALSE; - m_killSelfDelay = 3; // just long enough for the contrail to catch up to me + m_detonateCallsKill = FALSE; + m_killSelfDelay = 3; // just long enough for the contrail to catch up to me } //----------------------------------------------------------------------------- @@ -105,9 +105,9 @@ void MissileAIUpdateModuleData::buildFieldParse(MultiIniFieldParse& p) { "GarrisonHitKillForbiddenKindOf", KindOfMaskType::parseFromINI, NULL, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillKindofNot ) }, { "GarrisonHitKillCount", INI::parseUnsignedInt, NULL, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillCount ) }, { "GarrisonHitKillFX", INI::parseFXList, NULL, offsetof( MissileAIUpdateModuleData, m_garrisonHitKillFX ) }, - { "DetonateCallsKill", INI::parseBool, NULL, offsetof( MissileAIUpdateModuleData, m_detonateCallsKill ) }, - { "KillSelfDelay", INI::parseDurationUnsignedInt, NULL, offsetof( MissileAIUpdateModuleData, m_killSelfDelay ) }, - { 0, 0, 0, 0 } + { "DetonateCallsKill", INI::parseBool, NULL, offsetof( MissileAIUpdateModuleData, m_detonateCallsKill ) }, + { "KillSelfDelay", INI::parseDurationUnsignedInt, NULL, offsetof( MissileAIUpdateModuleData, m_killSelfDelay ) }, + { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -294,7 +294,7 @@ void MissileAIUpdate::projectileFireAtObjectOrPosition( const Object *victim, co m_victimID = INVALID_ID; } - setCurrentVictim( victim );/// extending access to the victim via the parent class + setCurrentVictim( victim );/// extending access to the victim via the parent class m_prevPos = *getObject()->getPosition(); } @@ -436,20 +436,20 @@ void MissileAIUpdate::doPrelaunchState() //------------------------------------------------------------------------------------------------- void MissileAIUpdate::doKillSelfState() { - const MissileAIUpdateModuleData *modData = getMissileAIUpdateModuleData(); + const MissileAIUpdateModuleData *modData = getMissileAIUpdateModuleData(); if (m_stateTimestamp > TheGameLogic->getFrame() - modData->m_killSelfDelay ) - { + { // Hold in this state [modData->m_killSelfDelay] frames to let the contrail catch up. jba. return; } Object* obj = getObject(); if (m_detonationWeaponTmpl) - { - if ( modData->m_detonateCallsKill ) - obj->kill(); // kill it (vs destroying it) so that its Die modules are called - else - TheGameLogic->destroyObject( obj ); + { + if ( modData->m_detonateCallsKill ) + obj->kill(); // kill it (vs destroying it) so that its Die modules are called + else + TheGameLogic->destroyObject( obj ); } switchToState(DEAD); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp index d58d9ed446..b723651f2e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp @@ -161,7 +161,7 @@ RailroadBehavior::RailroadBehavior( Thing *thing, const ModuleData *moduleData ) m_wantsToBeLeadCarraige = FALSE; m_disembark = FALSE; m_inTunnel = FALSE; - m_held = FALSE; + m_held = FALSE; m_conductorState = m_isLocomotive ? ACCELERATE : COAST; @@ -310,12 +310,10 @@ void RailroadBehavior::onCollide( Object *other, const Coord3D *loc, const Coord const Coord3D *myLoc = obj->getPosition(); const Coord3D *theirLoc = other->getPosition(); - //--------------------------- // if we made it this far, it is something we dont want to share space with - - Coord3D dlt; + Coord3D dlt; dlt.x = theirLoc->x - myLoc->x; dlt.y = theirLoc->y - myLoc->y; dlt.z = theirLoc->z - myLoc->z; @@ -334,15 +332,15 @@ void RailroadBehavior::onCollide( Object *other, const Coord3D *loc, const Coord { overlap/= 4; - dlt.scale( overlap); - Coord3D newPos; - newPos.x = theirLoc->x + dlt.x; - newPos.y = theirLoc->y + dlt.y; - newPos.z = theirLoc->z + dlt.z; - other->setPosition( &newPos ); + dlt.scale( overlap); + Coord3D newPos; + newPos.x = theirLoc->x + dlt.x; + newPos.y = theirLoc->y + dlt.y; + newPos.z = theirLoc->z + dlt.z; + other->setPosition( &newPos ); } - if ( m_conductorState == WAIT_AT_STATION || (m_conductorState == COAST && m_pullInfo.speed < modData->m_runningGarrisonSpeedMax) || !m_isLocomotive ) + if ( m_conductorState == WAIT_AT_STATION || (m_conductorState == COAST && m_pullInfo.speed < modData->m_runningGarrisonSpeedMax) || !m_isLocomotive ) { // AIUpdateInterface *ai = other->getAI(); // if ( ai ) @@ -643,24 +641,24 @@ void RailroadBehavior::loadTrackData( void ) void RailroadBehavior::makeAWallOutOfThisTrain( Bool on ) { - if ( on == TRUE ) - TheAI->pathfinder()->createAWallFromMyFootprint( getObject() ); // Temporarily treat this object as an obstacle. - else - TheAI->pathfinder()->removeWallFromMyFootprint( getObject() ); // Undo createAWallFromMyFootprint. + if ( on == TRUE ) + TheAI->pathfinder()->createAWallFromMyFootprint( getObject() ); // Temporarily treat this object as an obstacle. + else + TheAI->pathfinder()->removeWallFromMyFootprint( getObject() ); // Undo createAWallFromMyFootprint. if ( m_trailerID != INVALID_ID ) { Object *trailer = TheGameLogic->findObjectByID( m_trailerID ); - if ( trailer ) - { + if ( trailer ) + { static NameKeyType key_RGUpdate = NAMEKEY("RailroadBehavior"); RailroadBehavior *RGUpdate = (RailroadBehavior*)trailer->findUpdateModule(key_RGUpdate); if( RGUpdate ) { RGUpdate->makeAWallOutOfThisTrain( on ); // recursive down the train } - } + } } @@ -714,7 +712,7 @@ UpdateSleepTime RailroadBehavior::update( void ) m_conductorState = WAIT_AT_STATION; - makeAWallOutOfThisTrain( TRUE ); + makeAWallOutOfThisTrain( TRUE ); if ( m_disembark ) @@ -722,7 +720,7 @@ UpdateSleepTime RailroadBehavior::update( void ) disembark(); m_disembark = FALSE; } - } + } } else if ( m_conductorState == WAIT_AT_STATION) { @@ -734,7 +732,7 @@ UpdateSleepTime RailroadBehavior::update( void ) m_runningSound.setPlayingHandle(TheAudio->addAudioEvent( &m_runningSound )); - makeAWallOutOfThisTrain( FALSE ); + makeAWallOutOfThisTrain( FALSE ); } @@ -767,13 +765,6 @@ UpdateSleepTime RailroadBehavior::update( void ) } - - - - - - - if ( m_wantsToBeLeadCarraige > FRAMES_UNPULLED_LONG_ENOUGH_TO_UNHITCH )//if this flag survived until now, I have lost my puller { m_isLeadCarraige = TRUE; @@ -1326,16 +1317,11 @@ void RailroadBehavior::updatePositionTrackDistance( PullInfo *pullerInfo, PullIn Coord3D normal ; Real enforceElevation = TheTerrainLogic->getGroundHeight( turnPos.x, turnPos.y, &normal ); - - - obj->setTransformMatrix(&mtx); if (!m_inTunnel) obj->setPositionZ( enforceElevation ); - - obj->handlePartitionCellMaintenance(); } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp index 012fca881b..9dbddecc74 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AssistedTargetingUpdate.cpp @@ -190,7 +190,7 @@ void AssistedTargetingUpdate::xfer( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ void AssistedTargetingUpdate::loadPostProcess( void ) { - const AssistedTargetingUpdateModuleData *d = getAssistedTargetingUpdateModuleData(); + const AssistedTargetingUpdateModuleData *d = getAssistedTargetingUpdateModuleData(); m_laserFromAssisted = TheThingFactory->findTemplate( d->m_laserFromAssistedName ); m_laserToTarget =TheThingFactory->findTemplate( d->m_laserFromAssistedName ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp index 95236b6b33..f3ba1da57d 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AutoDepositUpdate.cpp @@ -186,29 +186,29 @@ UpdateSleepTime AutoDepositUpdate::update( void ) if( displayMoney ) { - const Object *owner = getObject(); - if ( owner ) - { - - // OY LOOK! I AM USING LOCAL PLAYER. Do not put anything other than TheInGameUI->addFloatingText in the block this controls!!! - UnicodeString moneyString; - moneyString.format( TheGameText->fetch( "GUI:AddCash" ), moneyAmount ); - Coord3D pos; - pos.set( getObject()->getPosition() ); - pos.z += 10.0f; //add a little z to make it show up above the unit. - - if ( owner->isKindOf( KINDOF_STRUCTURE ) ) - { - Real width = owner->getGeometryInfo().getMajorRadius() * 0.3f; - Real depth = owner->getGeometryInfo().getMinorRadius() * 0.3f; - pos.x += GameClientRandomValue(-width,width); - pos.y += GameClientRandomValue(-depth,depth); - } - - - Color color = getObject()->getControllingPlayer()->getPlayerColor() | GameMakeColor( 0, 0, 0, 230 ); - TheInGameUI->addFloatingText( moneyString, &pos, color ); - } + const Object *owner = getObject(); + if ( owner ) + { + + // OY LOOK! I AM USING LOCAL PLAYER. Do not put anything other than TheInGameUI->addFloatingText in the block this controls!!! + UnicodeString moneyString; + moneyString.format( TheGameText->fetch( "GUI:AddCash" ), moneyAmount ); + Coord3D pos; + pos.set( getObject()->getPosition() ); + pos.z += 10.0f; //add a little z to make it show up above the unit. + + if ( owner->isKindOf( KINDOF_STRUCTURE ) ) + { + Real width = owner->getGeometryInfo().getMajorRadius() * 0.3f; + Real depth = owner->getGeometryInfo().getMinorRadius() * 0.3f; + pos.x += GameClientRandomValue(-width,width); + pos.y += GameClientRandomValue(-depth,depth); + } + + + Color color = getObject()->getControllingPlayer()->getPlayerColor() | GameMakeColor( 0, 0, 0, 230 ); + TheInGameUI->addFloatingText( moneyString, &pos, color ); + } } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp index ec97804814..eab7d1affc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/EMPUpdate.cpp @@ -247,22 +247,22 @@ void EMPUpdate::doDisableAttack( void ) - if ( !curVictim->isKindOf( KINDOF_VEHICLE ) && !curVictim->isKindOf(KINDOF_STRUCTURE) && !curVictim->isKindOf(KINDOF_SPAWNS_ARE_THE_WEAPONS) ) + if ( !curVictim->isKindOf( KINDOF_VEHICLE ) && !curVictim->isKindOf(KINDOF_STRUCTURE) && !curVictim->isKindOf(KINDOF_SPAWNS_ARE_THE_WEAPONS) ) { //DONT DISABLE PEOPLE, EXCEPT FOR STINGER SOLDIERS continue; } else if ( curVictim->isKindOf( KINDOF_AIRCRAFT ) && curVictim->isAirborneTarget() )// is in the sky - { - // WITHIN THE SET OF ALL FLYING THINGS, WE WANT TO EXEMPT SUPERWEAPON TRANSPORTS -// if ( curVictim->isKindOf( KINDOF_TRANSPORT ) ) // is transport kindof -// if ( curVictim->getContain() ) // does carry stuff -// if ( curVictim->getContain()->getContainCount() > 0 ) // is carrying something -// if ( ! curVictim->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) ) // but not a helicopter -// continue; - - if ( curVictim->isKindOf( KINDOF_EMP_HARDENED ) ) // self-explanitory - continue; + { + // WITHIN THE SET OF ALL FLYING THINGS, WE WANT TO EXEMPT SUPERWEAPON TRANSPORTS +// if ( curVictim->isKindOf( KINDOF_TRANSPORT ) ) // is transport kindof +// if ( curVictim->getContain() ) // does carry stuff +// if ( curVictim->getContain()->getContainCount() > 0 ) // is carrying something +// if ( ! curVictim->isKindOf( KINDOF_PRODUCED_AT_HELIPAD ) ) // but not a helicopter +// continue; + + if ( curVictim->isKindOf( KINDOF_EMP_HARDENED ) ) // self-explanitory + continue; curVictim->kill();// @todo this should use some sort of DEADSTICK DIE or something... Drawable *drw = curVictim->getDrawable(); @@ -306,7 +306,7 @@ void EMPUpdate::doDisableAttack( void ) Real victimVolume = victimFootprintArea * MIN(victimHeight, 10.0f); UnsignedInt emitterCount = MAX(15, REAL_TO_INT_CEIL(data->m_sparksPerCubicFoot * victimVolume)); - + for (Int e = 0 ; e < emitterCount; ++e) { @@ -346,7 +346,7 @@ void EMPUpdate::doDisableAttack( void ) //Handle edge case when the EMP explodes, but "misses" the intended target. if( intendedVictim && !intendedVictimProcessed && intendedVictim->isKindOf( KINDOF_AIRCRAFT ) ) { - if( !intendedVictim->isKindOf( KINDOF_EMP_HARDENED ) ) + if( !intendedVictim->isKindOf( KINDOF_EMP_HARDENED ) ) { //Victim position Coord3D coord; @@ -418,7 +418,7 @@ void EMPUpdate::loadPostProcess( void ) LeafletDropBehavior::LeafletDropBehavior( Thing *thing, const ModuleData* moduleData ) : UpdateModule( thing, moduleData ) { - m_fxFired = FALSE; + m_fxFired = FALSE; //s_lastInstanceSpunPositive = !s_lastInstanceSpunPositive; //TOGGLES STATIC BOOL const LeafletDropBehaviorModuleData *data = getLeafletDropBehaviorModuleData(); @@ -427,7 +427,7 @@ LeafletDropBehavior::LeafletDropBehavior( Thing *thing, const ModuleData* module //SANITY DEBUG_ASSERTCRASH( TheGameLogic, ("LeafletDropBehavior::LeafletDropBehavior - TheGameLogic is NULL\n" ) ); UnsignedInt now = TheGameLogic->getFrame(); - m_startFrame = now + data->m_delayFrames; + m_startFrame = now + data->m_delayFrames; return; } @@ -449,40 +449,40 @@ LeafletDropBehavior::~LeafletDropBehavior( void ) UpdateSleepTime LeafletDropBehavior::update( void ) { - if ( ! m_fxFired ) - { - // start shoveling out those leaflets, boys. - const LeafletDropBehaviorModuleData *data = getLeafletDropBehaviorModuleData(); - const ParticleSystemTemplate *tmp = data->m_leafletFXParticleSystem; - if (tmp) - { - ParticleSystem *sys = TheParticleSystemManager->createParticleSystem(tmp); - if (sys) - sys->attachToObject(getObject()); - } + if ( ! m_fxFired ) + { + // start shoveling out those leaflets, boys. + const LeafletDropBehaviorModuleData *data = getLeafletDropBehaviorModuleData(); + const ParticleSystemTemplate *tmp = data->m_leafletFXParticleSystem; + if (tmp) + { + ParticleSystem *sys = TheParticleSystemManager->createParticleSystem(tmp); + if (sys) + sys->attachToObject(getObject()); + } - m_fxFired = TRUE; // hey, at least we tried. - } + m_fxFired = TRUE; // hey, at least we tried. + } - if( TheGameLogic->getFrame() < m_startFrame ) - { + if( TheGameLogic->getFrame() < m_startFrame ) + { // TheGameLogic->destroyObject( getObject() ); - return UPDATE_SLEEP_FOREVER; - } + return UPDATE_SLEEP_FOREVER; + } - doDisableAttack(); + doDisableAttack(); - return UPDATE_SLEEP_NONE; + return UPDATE_SLEEP_NONE; } //------------------------------------------------------------------------------------------------- //------------------------------------------------------------------------------------------------- void LeafletDropBehavior::onDie( const DamageInfo *damageInfo ) { - // the dieModule callback + // the dieModule callback - doDisableAttack(); + doDisableAttack(); } @@ -516,12 +516,12 @@ void LeafletDropBehavior::doDisableAttack( void ) { if ( curVictim != object) { - if ( ! (curVictim->isKindOf( KINDOF_INFANTRY) || curVictim->isKindOf( KINDOF_VEHICLE ) ) ) // both commuters and pedestrians + if ( ! (curVictim->isKindOf( KINDOF_INFANTRY) || curVictim->isKindOf( KINDOF_VEHICLE ) ) ) // both commuters and pedestrians continue; - if ( curVictim->getRelationship( object ) != ENEMIES ) // only enemies + if ( curVictim->getRelationship( object ) != ENEMIES ) // only enemies continue; - + //Disable the target for a specified amount of time. curVictim->setDisabledUntil( DISABLED_EMP, TheGameLogic->getFrame() + data->m_disabledDuration ); @@ -551,7 +551,7 @@ void LeafletDropBehavior::xfer( Xfer *xfer ) XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); - xfer->xferUnsignedInt( &m_startFrame ); + xfer->xferUnsignedInt( &m_startFrame ); } // end xfer @@ -563,23 +563,3 @@ void LeafletDropBehavior::loadPostProcess( void ) } // end loadPostProcess - - - - - - - - - - - - - - - - - - - - diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp index b242dd1f6a..17ed1850ec 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FireWeaponUpdate.cpp @@ -47,7 +47,7 @@ FireWeaponUpdateModuleData::FireWeaponUpdateModuleData() { m_weaponTemplate = NULL; - m_initialDelayFrames = 0; + m_initialDelayFrames = 0; m_exclusiveWeaponDelay = 0; } @@ -58,7 +58,7 @@ FireWeaponUpdateModuleData::FireWeaponUpdateModuleData() static const FieldParse dataFieldParse[] = { - { "Weapon", INI::parseWeaponTemplate, NULL, offsetof( FireWeaponUpdateModuleData, m_weaponTemplate ) }, + { "Weapon", INI::parseWeaponTemplate, NULL, offsetof( FireWeaponUpdateModuleData, m_weaponTemplate ) }, { "InitialDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FireWeaponUpdateModuleData, m_initialDelayFrames ) }, { "ExclusiveWeaponDelay", INI::parseDurationUnsignedInt, NULL, offsetof( FireWeaponUpdateModuleData, m_exclusiveWeaponDelay ) }, { 0, 0, 0, 0 } @@ -80,7 +80,7 @@ FireWeaponUpdate::FireWeaponUpdate( Thing *thing, const ModuleData* moduleData ) } - m_initialDelayFrame = TheGameLogic->getFrame() + getFireWeaponUpdateModuleData()->m_initialDelayFrames; + m_initialDelayFrame = TheGameLogic->getFrame() + getFireWeaponUpdateModuleData()->m_initialDelayFrames; } @@ -96,9 +96,8 @@ FireWeaponUpdate::~FireWeaponUpdate( void ) //------------------------------------------------------------------------------------------------- UpdateSleepTime FireWeaponUpdate::update( void ) { - - if ( TheGameLogic->getFrame() < m_initialDelayFrame ) - return UPDATE_SLEEP_NONE; + if ( TheGameLogic->getFrame() < m_initialDelayFrame ) + return UPDATE_SLEEP_NONE; // If my weapon is ready, shoot it. @@ -162,8 +161,8 @@ void FireWeaponUpdate::xfer( Xfer *xfer ) // weapon xfer->xferSnapshot( m_weapon ); - if ( version >= 2 ) - xfer->xferUnsignedInt( &m_initialDelayFrame ); + if ( version >= 2 ) + xfer->xferUnsignedInt( &m_initialDelayFrame ); } // end xfer diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp index bdcb9e9e2d..419d2eb976 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HordeUpdate.cpp @@ -120,8 +120,8 @@ const Int DEFAULT_UPDATE_RATE = LOGICFRAMES_PER_SECOND; //------------------------------------------------------------------------------------------------- HordeUpdateModuleData::HordeUpdateModuleData() : m_updateRate(DEFAULT_UPDATE_RATE), - m_minCount(0), - m_minDist(0.0f), + m_minCount(0), + m_minDist(0.0f), m_rubOffRadius(20.0f), m_alliesOnly(true), m_exactMatch(false), @@ -343,12 +343,12 @@ UpdateSleepTime HordeUpdate::update( void ) if ( isInfantry ) { if( obj->testWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ) == TRUE ) - { - if ( obj->testWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM ) == TRUE ) - nuType = ( TERRAIN_DECAL_HORDE_WITH_FANATICISM_UPGRADE ); - else - nuType = ( TERRAIN_DECAL_HORDE_WITH_NATIONALISM_UPGRADE ); - } + { + if ( obj->testWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM ) == TRUE ) + nuType = ( TERRAIN_DECAL_HORDE_WITH_FANATICISM_UPGRADE ); + else + nuType = ( TERRAIN_DECAL_HORDE_WITH_NATIONALISM_UPGRADE ); + } else nuType =(TERRAIN_DECAL_HORDE); @@ -361,12 +361,12 @@ UpdateSleepTime HordeUpdate::update( void ) draw->setTerrainDecalSize( size, size ); if( obj->testWeaponBonusCondition( WEAPONBONUSCONDITION_NATIONALISM ) == TRUE ) - { - if ( obj->testWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM ) == TRUE ) - nuType = ( TERRAIN_DECAL_HORDE_WITH_FANATICISM_UPGRADE ); - else - nuType = ( TERRAIN_DECAL_HORDE_WITH_NATIONALISM_UPGRADE ); - } + { + if ( obj->testWeaponBonusCondition( WEAPONBONUSCONDITION_FANATICISM ) == TRUE ) + nuType = ( TERRAIN_DECAL_HORDE_WITH_FANATICISM_UPGRADE ); + else + nuType = ( TERRAIN_DECAL_HORDE_WITH_NATIONALISM_UPGRADE ); + } else nuType = (TERRAIN_DECAL_HORDE_VEHICLE); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp index ea56a2e4da..9a43a3d153 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp @@ -305,12 +305,12 @@ Bool ParticleUplinkCannonUpdate::initiateIntentToDoSpecialPower(const SpecialPow { pos.set( targetObj->getPosition() ); } - m_startAttackFrame = max( now, (UnsignedInt)1 ); + m_startAttackFrame = max( now, (UnsignedInt)1 ); m_scriptedWaypointMode = TRUE; - m_laserStatus = LASERSTATUS_NONE; + m_laserStatus = LASERSTATUS_NONE; setLogicalStatus( STATUS_READY_TO_FIRE ); m_specialPowerModule->setReadyFrame( now ); - m_initialTargetPosition.set( &pos ); + m_initialTargetPosition.set( &pos ); m_currentTargetPosition.set( &pos ); m_nextDestWaypointID = way->getID(); @@ -338,9 +338,9 @@ Bool ParticleUplinkCannonUpdate::initiateIntentToDoSpecialPower(const SpecialPow { pos.set( targetObj->getPosition() ); } - m_initialTargetPosition.set( &pos ); - m_startAttackFrame = max( now, (UnsignedInt)1 ); - m_laserStatus = LASERSTATUS_NONE; + m_initialTargetPosition.set( &pos ); + m_startAttackFrame = max( now, (UnsignedInt)1 ); + m_laserStatus = LASERSTATUS_NONE; setLogicalStatus( STATUS_READY_TO_FIRE ); m_specialPowerModule->setReadyFrame( now ); } @@ -536,6 +536,7 @@ UpdateSleepTime ParticleUplinkCannonUpdate::update() Real dotProduct = Vector2::Dot_Product( buildingToTargetVector, cartesianTargetVector ); dotProduct = __min( 0.99999f, __max( -0.99999f, dotProduct ) ); //Account for numerical errors. Also, acos(-1.00000) is coming out QNAN on the superweapon general map. Heh. + Real angle = (Real)ACos( dotProduct ); if( buildingToTargetVector.Y >= 0 ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp index 7fe0250941..67af1da941 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ProductionUpdate.cpp @@ -282,7 +282,7 @@ Bool ProductionUpdate::queueUpgrade( const UpgradeTemplate *upgrade ) // you cannot queue the production of an upgrade twice in this queue if( isUpgradeInQueue( upgrade ) == TRUE ) return FALSE; - + // STOP cheaters by making sure they can actually build this if( !getObject()->canProduceUpgrade(upgrade) ) return FALSE; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp index a7a746d8c8..c5f82ab222 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SlavedUpdate.cpp @@ -159,8 +159,8 @@ UpdateSleepTime SlavedUpdate::update( void ) //Let's disable the drone so it crashes instead! //Added special case code in physics falling to ensure death. me->setDisabled( DISABLED_UNMANNED ); - if ( me->getAI() ) - me->getAI()->aiIdle( CMD_FROM_AI); + if ( me->getAI() ) + me->getAI()->aiIdle( CMD_FROM_AI); return UPDATE_SLEEP_NONE; } @@ -173,9 +173,6 @@ UpdateSleepTime SlavedUpdate::update( void ) me->defect( masterTeam, 0 ); } - - - } if (data->m_stayOnSameLayerAsMaster) @@ -724,18 +721,16 @@ void SlavedUpdate::startSlavedEffects( const Object *slaver ) // mark selves as not selectable getObject()->setStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_UNSELECTABLE ) ); - - if ( slaver->testStatus( OBJECT_STATUS_STEALTHED ) ) - { - StealthUpdate *myStealth = getObject()->getStealth(); - if ( myStealth ) - { - myStealth->receiveGrant( true ); - // note to anyone... once stealth is granted to this drone(or such) - // let its own stealthupdate govern the allowedtostealth cases - } - } - + if ( slaver->testStatus( OBJECT_STATUS_STEALTHED ) ) + { + StealthUpdate *myStealth = getObject()->getStealth(); + if ( myStealth ) + { + myStealth->receiveGrant( true ); + // note to anyone... once stealth is granted to this drone(or such) + // let its own stealthupdate govern the allowedtostealth cases + } + } } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp index 2d40598f6f..303f5caaeb 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/SpecialAbilityUpdate.cpp @@ -74,32 +74,32 @@ //------------------------------------------------------------------------------------------------- SpecialAbilityUpdate::SpecialAbilityUpdate( Thing *thing, const ModuleData* moduleData ) : SpecialPowerUpdateModule( thing, moduleData ) { - //Added By Sadullah Nader - //Initialization(s) inserted - m_captureFlashPhase = 0.0f; - // - m_active = false; - m_prepFrames = 0; - m_animFrames = 0; - m_targetID = INVALID_ID; - m_targetPos.zero(); - m_locationCount = 0; - m_specialObjectEntries = 0; - m_noTargetCommand = false; - m_packingState = STATE_NONE; - m_facingInitiated = false; - m_facingComplete = false; - m_withinStartAbilityRange = false; - m_doDisableFXParticles = TRUE;// true always, unless small unit causes it to toggle on-off - setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); + //Added By Sadullah Nader + //Initialization(s) inserted + m_captureFlashPhase = 0.0f; + // + m_active = false; + m_prepFrames = 0; + m_animFrames = 0; + m_targetID = INVALID_ID; + m_targetPos.zero(); + m_locationCount = 0; + m_specialObjectEntries = 0; + m_noTargetCommand = false; + m_packingState = STATE_NONE; + m_facingInitiated = false; + m_facingComplete = false; + m_withinStartAbilityRange = false; + m_doDisableFXParticles = TRUE;// true always, unless small unit causes it to toggle on-off + setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); // This is the althernate way to one-at-a-time BlackLotus' specials; we'll keep it commented her until Dustin decides, or until 12/10/02 -// setBusy( FALSE ); +// setBusy( FALSE ); } //------------------------------------------------------------------------------------------------- SpecialAbilityUpdate::~SpecialAbilityUpdate( void ) { - onExit( true ); + onExit( true ); } /*------------------------------------------------------------------------------------------------ @@ -109,135 +109,135 @@ This is the brains of the entire special ability update. There are several optio variations that can be processed for any particular type of special ability. A special ability that has every option will do the following in order: - 1 -- APPROACH: If I'm not close enough to the target, then approach it - 2 -- UNPACK: If I need to unpack before I can prepare, then do so now (this uses the model - condition unpack). - 3 -- PREPARE: If I need to perform a task for a period of time before I can trigger my special - ability, then do so now. A good example is aiming with a targetting laser for a few - seconds before firing your special weapon. - 4 -- TRIGGER: Once preparation is complete, fire your special ability now. - 5 -- PACK: If I need to pack after finishing my attack, do so now. - 6 -- FINISH: Clean up the states, and turn off the update. + 1 -- APPROACH: If I'm not close enough to the target, then approach it + 2 -- UNPACK: If I need to unpack before I can prepare, then do so now (this uses the model + condition unpack). + 3 -- PREPARE: If I need to perform a task for a period of time before I can trigger my special + ability, then do so now. A good example is aiming with a targetting laser for a few + seconds before firing your special weapon. + 4 -- TRIGGER: Once preparation is complete, fire your special ability now. + 5 -- PACK: If I need to pack after finishing my attack, do so now. + 6 -- FINISH: Clean up the states, and turn off the update. Variations: - Persistent Specials -- A persistent special will continually trigger it's effect every so often - and never end. A good example of this is the disable building hack. The hacker will run up - to the target building, unpack, prepare (firing hack stream), then after a period of time, - the building becomes disabled. But because it's persistent, we reset the preparation and - trigger the building disabled code over and over again -- which is on a timer. - No Target Specials -- You can link two different main specials together. Colonel Burton has the - ability to lay C4 charges on multiple targets. Activating these specials require a target. - The non-target version is actually the detonator, which goes through all the special objects - and detonates each one of them. + Persistent Specials -- A persistent special will continually trigger it's effect every so often + and never end. A good example of this is the disable building hack. The hacker will run up + to the target building, unpack, prepare (firing hack stream), then after a period of time, + the building becomes disabled. But because it's persistent, we reset the preparation and + trigger the building disabled code over and over again -- which is on a timer. + No Target Specials -- You can link two different main specials together. Colonel Burton has the + ability to lay C4 charges on multiple targets. Activating these specials require a target. + The non-target version is actually the detonator, which goes through all the special objects + and detonates each one of them. Options: - SpecialPowerTemplate -- Defines the special power template that links to a command. - StartAbilityRange -- Specify how far you want your unit to be from the target before - start your special ability. - AbilityAbortRange -- After starting an attack, it'll allow preparation unless the target goes - beyond this range. If this happens, the ability is aborted outright. - PreparationTime -- How long it takes to prepare your special once in position and unpacked. - PersistentPrepTime -- This value defines whether or not you are using a persistent special. - Once the special ability is triggered, it'll wait until this specified - delay occurs and it'll trigger it again, for ever until the unit dies, - the target dies, or the unit decides to do something else. - PackTime -- How long it takes to pack up the unit after triggering a non persistent - special ability or after ordering the unit to do something else, or the - target dies (if applicable). - PackUnpackVariationFactor -- Randomizes the pack and unpack time by specified range. The closer - to zero, the smaller the variation. 0.2 would have a pack or unpack range - of xTime +/- 20%. This is important because it represents averages. - UnpackTime -- Same as PackTime, except used once entering range of target. - SkipPackingWithNoTarget -- This option is used by the No Target Special variation, and only uses - packing/unpacking when you have a specific target. In the case of Colonel - Burton, this value is set to true. When he plants a C4 charge, he has a - target, therefore he requires unpacking (laying the charge). When he runs - away and decides to detonate the charge, he calls the same special - ability, but without a target -- therefore the packing is skipped and - detonates it right away. - SpecialObject -- Defines the special object the unit will create via the special ability. - In one case, it creates and maintains the laser or binary stream during - preparation. In Colonel Burton's case, it keeps track of the C4 charges - that he has placed. - MaxSpecialObjects -- Defines the max number of special objects that can exist at any given - time. The laser example only has one, but the C4 charges can have more. - SpecialObjectsPersistent -- If this flag is set, then the objects will remain should the owner - decides to do something else... C4 charges are a good example. - EffectDuration -- Defines the duration of the special ability. In the case of disabling - the building (hacker), this value will dictate how long the building - will be disabled should the hacker die or stop the attack. - UniqueSpecialObjectTargets -- Prevents the owner from placing multiple special objects on the - same target. C4 charges once again. - SpecialObjectsPersistWhenOwnerDies -- If the owner dies, the special objects will remain in - the world. Timed C4 charges is a good example, but remote C4 charges - is a bad example -- because it requires the owner to detonate them. - FlipObjectAfterPacking -- Simply rotates the object 180 degrees after packing (due to special - animation case). - FlipObjectAfterUnPacking -- Simply rotates the object 180 degrees after unpacking (due to - special animation case). Used by colonel burton after planting charge. - - - Lets use the Age of Kings Trebuchet as a simple example: - Variation -- PersistentPrepTime (set to true in ini file) - 1 -- APPROACH: Get within range before unpacking - 2 -- UNPACK: Unpack the treb at this location. - 3 -- PREPARE: Aim at the target - 4 -- TRIGGER: Fire the treb. - 5 -- RESET PREPARATION: Go to step 3 until target dead. - 6 -- PACK: Assuming we are done... pack up - 7 -- FINISH: Stop the special ability + SpecialPowerTemplate -- Defines the special power template that links to a command. + StartAbilityRange -- Specify how far you want your unit to be from the target before + start your special ability. + AbilityAbortRange -- After starting an attack, it'll allow preparation unless the target goes + beyond this range. If this happens, the ability is aborted outright. + PreparationTime -- How long it takes to prepare your special once in position and unpacked. + PersistentPrepTime -- This value defines whether or not you are using a persistent special. + Once the special ability is triggered, it'll wait until this specified + delay occurs and it'll trigger it again, for ever until the unit dies, + the target dies, or the unit decides to do something else. + PackTime -- How long it takes to pack up the unit after triggering a non persistent + special ability or after ordering the unit to do something else, or the + target dies (if applicable). + PackUnpackVariationFactor -- Randomizes the pack and unpack time by specified range. The closer + to zero, the smaller the variation. 0.2 would have a pack or unpack range + of xTime +/- 20%. This is important because it represents averages. + UnpackTime -- Same as PackTime, except used once entering range of target. + SkipPackingWithNoTarget -- This option is used by the No Target Special variation, and only uses + packing/unpacking when you have a specific target. In the case of Colonel + Burton, this value is set to true. When he plants a C4 charge, he has a + target, therefore he requires unpacking (laying the charge). When he runs + away and decides to detonate the charge, he calls the same special + ability, but without a target -- therefore the packing is skipped and + detonates it right away. + SpecialObject -- Defines the special object the unit will create via the special ability. + In one case, it creates and maintains the laser or binary stream during + preparation. In Colonel Burton's case, it keeps track of the C4 charges + that he has placed. + MaxSpecialObjects -- Defines the max number of special objects that can exist at any given + time. The laser example only has one, but the C4 charges can have more. + SpecialObjectsPersistent -- If this flag is set, then the objects will remain should the owner + decides to do something else... C4 charges are a good example. + EffectDuration -- Defines the duration of the special ability. In the case of disabling + the building (hacker), this value will dictate how long the building + will be disabled should the hacker die or stop the attack. + UniqueSpecialObjectTargets -- Prevents the owner from placing multiple special objects on the + same target. C4 charges once again. + SpecialObjectsPersistWhenOwnerDies -- If the owner dies, the special objects will remain in + the world. Timed C4 charges is a good example, but remote C4 charges + is a bad example -- because it requires the owner to detonate them. + FlipObjectAfterPacking -- Simply rotates the object 180 degrees after packing (due to special + animation case). + FlipObjectAfterUnPacking -- Simply rotates the object 180 degrees after unpacking (due to + special animation case). Used by colonel burton after planting charge. + + + Lets use the Age of Kings Trebuchet as a simple example: + Variation -- PersistentPrepTime (set to true in ini file) + 1 -- APPROACH: Get within range before unpacking + 2 -- UNPACK: Unpack the treb at this location. + 3 -- PREPARE: Aim at the target + 4 -- TRIGGER: Fire the treb. + 5 -- RESET PREPARATION: Go to step 3 until target dead. + 6 -- PACK: Assuming we are done... pack up + 7 -- FINISH: Stop the special ability -------------------------------------------------------------------------------------------------*/ UpdateSleepTime SpecialAbilityUpdate::update( void ) { /// @todo srj -- this could probably sleep more between stages. maybe someday. - // Note: This will be complicated because one difficult example is handling Burton when he dies while - // bombs are in the world. + // Note: This will be complicated because one difficult example is handling Burton when he dies while + // bombs are in the world. - //Validation of special objects makes sure that they still exist. Sometimes special - //objects can be destroyed or removed, or detonate, etc! When they go missing, - //they are removed from the special object list and free up slots for those units - //that can have multiple. - //We need to do this now because it's possible the special objects need to be checked while - //the the special ability is over (thus inactive). + //Validation of special objects makes sure that they still exist. Sometimes special + //objects can be destroyed or removed, or detonate, etc! When they go missing, + //they are removed from the special object list and free up slots for those units + //that can have multiple. + //We need to do this now because it's possible the special objects need to be checked while + //the the special ability is over (thus inactive). const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); validateSpecialObjects(); - - //Important! This check will see if there has been any commands issued by either the player - //or script. When told to do something else, we need to immediately cleanup our special ability. - //This also means some things might be left around like timed charges to detonate. - if( getObject()->isEffectivelyDead() ) - { - onExit( TRUE ); - return calcSleepTime(); - } - - if( !m_active ) // Not active. - return calcSleepTime(); - - AIUpdateInterface *ai = getObject()->getAIUpdateInterface(); - if( !ai ) - { - onExit( false ); - return calcSleepTime(); - } - if( ai->getLastCommandSource() != CMD_FROM_AI ) - { - onExit( false ); - return calcSleepTime(); - } + + //Important! This check will see if there has been any commands issued by either the player + //or script. When told to do something else, we need to immediately cleanup our special ability. + //This also means some things might be left around like timed charges to detonate. + if( getObject()->isEffectivelyDead() ) + { + onExit( TRUE ); + return calcSleepTime(); + } + + if( !m_active ) // Not active. + return calcSleepTime(); + + AIUpdateInterface *ai = getObject()->getAIUpdateInterface(); + if( !ai ) + { + onExit( false ); + return calcSleepTime(); + } + if( ai->getLastCommandSource() != CMD_FROM_AI ) + { + onExit( false ); + return calcSleepTime(); + } if( ai->isMoving() && isPowerCurrentlyInUse() && !m_facingInitiated ) - { + { // Capture is broken by movement just as if we had been given a direct command (above check). - // However, the time of Facing the target is considered isPowerCurrentlyInUse, but isMoving. So let that slide. + // However, the time of Facing the target is considered isPowerCurrentlyInUse, but isMoving. So let that slide. switch(data->m_specialPowerTemplate->getSpecialPowerType() ) { - case SPECIAL_INFANTRY_CAPTURE_BUILDING: - case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: + case SPECIAL_INFANTRY_CAPTURE_BUILDING: + case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: { onExit( false ); return calcSleepTime(); @@ -247,383 +247,382 @@ UpdateSleepTime SpecialAbilityUpdate::update( void ) default: break; } - } - - - //STEP 2 & 5(6) -- Handles packing and unpacking in progress. If packing - //then ends the special ability once complete. Things that don't pack - //will never be handled, nor do things that aren't in a packing state. - if( handlePackingProcessing() ) - { - return calcSleepTime(); - } - - Bool shouldAbort = false; - - // A dead target will end our special (if we are using a target). - if (m_targetID != INVALID_ID) - { - Object* target = TheGameLogic->findObjectByID(m_targetID); - - if (target != NULL) - { - if (target->isEffectivelyDead()) - shouldAbort = TRUE; - else switch (data->m_specialPowerTemplate->getSpecialPowerType()) - { - case SPECIAL_INFANTRY_CAPTURE_BUILDING: - case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: - case SPECIAL_HACKER_DISABLE_BUILDING: - { - if (target->getTeam() == getObject()->getTeam()) - { - // it's been captured by a colleague! we should stop. - shouldAbort = TRUE; - } - //deliberately falling through... - } - case SPECIAL_BLACKLOTUS_STEAL_CASH_HACK: - case SPECIAL_BOOBY_TRAP: - { - if ( target->testStatus( OBJECT_STATUS_STEALTHED ) && (target->testStatus( OBJECT_STATUS_DETECTED ) == FALSE ) ) - { - if ( !isPreparationComplete() ) - shouldAbort = TRUE; - } - break; - } - case SPECIAL_REMOTE_CHARGES: - case SPECIAL_TIMED_CHARGES: - { - if ( ! needToUnpack() ) - { - if ( target->testStatus( OBJECT_STATUS_STEALTHED ) && (target->testStatus( OBJECT_STATUS_DETECTED ) == FALSE ) ) - { - if ( !isPreparationComplete() ) - shouldAbort = TRUE; - } - } - break; - } - case SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES: - { - if ( target->isKindOf( KINDOF_STRUCTURE ) ) - shouldAbort = TRUE; - //deliberately falling through - } - case SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK: - { - if ( target->testStatus( OBJECT_STATUS_STEALTHED ) && (target->testStatus( OBJECT_STATUS_DETECTED ) == FALSE ) ) - { - // where'd my target go? 'Twas here just a second ago. - shouldAbort = TRUE; - } - break; - } - - } - - } - - } - - SpecialPowerModuleInterface *spm = getMySPM(); - - if ( shouldAbort || spm == NULL ) - { - // doh, a colleague has already captured it. just stop. - ai->aiIdle( CMD_FROM_AI ); - onExit( false ); - return calcSleepTime(); - } - - - - //DETERMINE OUR PHASE! BRAIN LOGIC - if( !isPreparationComplete() ) - { - //The special ability has fired, now continue to process the special ability - //until it expires - - Bool SPMReady = TRUE;// normally considered ready since this ability has just been initiated - // Lorenzen added this additional flag to support the NapalmBombDrop - // It causes this update to force a recharge of the SPM between drops - if( isPersistentAbility() && getDoesPersistenceRequireRecharge() )//unless I intend to persist in this ability's effect, whereupon I must verify that power is recharged - SPMReady = ( spm->isReady() && spm->getReadyFrame() < TheGameLogic->getFrame() ); - - if ( SPMReady )// if power requires recharging, lets freeze prep countdown until power is ready - m_prepFrames--; - - if( isPreparationComplete() ) - { - //STEP 4 -- TRIGGER (with preparation) - triggerAbilityEffect(); - if( isPersistentAbility() ) - { - //VARIATION -- PERSISTENCE (repeats preparation) - resetPreparation(); - - //tell the special power module to restart the recharge timer - if ( getDoesPersistenceRequireRecharge() ) - spm->startPowerRecharge(); - - - } - else - { - endPreparation(); - if( needToPack() ) - { - //STEP 5 -- PACK - //Note: If we actually do pack, then cleanup will be handled in - //handlePackingProcess(), near the top of this function. - startPacking(true); - } - else - { - //STEP 6 -- FINISH - finishAbility(); - } - } - } - else - { - //Process the preparation if it's still not complete. - Bool continuePrep = continuePreparation(); - if( !continuePrep ) - { - //We failed so abort! - endPreparation(); - if( needToPack() ) - { - //STEP 5 -- PACK - //Note: If we actually do pack, then cleanup will be handled in - //handlePackingProcess(), near the top of this function. - startPacking(false); - } - else - { - //STEP 6 -- FINISH - finishAbility(); - } - } - } - } - else if( isWithinStartAbilityRange() ) - { - m_withinStartAbilityRange = true; - if( !isFacing() && needToFace() ) - { - startFacing(); - return calcSleepTime(); - } - - if( needToUnpack() ) - { - //STEP 2 -- UNPACK - startUnpacking(); - return calcSleepTime(); - } - - if( m_packingState == STATE_UNPACKED ) - { - //STEP 3 -- PREPARE - startPreparation(); - - if( isPreparationComplete() ) - { - //STEP 4 -- TRIGGER (skipping preparation) - triggerAbilityEffect(); - - - // Lorenzen added this additional flag to support the NapalmBombDrop - // It causes this update to force a recharge of the SPM between drops - if( isPersistentAbility() && getDoesPersistenceRequireRecharge()) - { - //VARIATION -- PERSISTENCE (repeats preparation) - resetPreparation(); - - //tell the special power module to restart the recharge timer - spm->startPowerRecharge(); - - return calcSleepTime(); - - } - else - endPreparation(); - - if( needToPack() ) - { - //STEP 5 -- PACK - //Note: If we actually do pack, then cleanup will be handled in - //handlePackingProcess(), near the top of this function. - startPacking(true); - } - else - { - //STEP 6 -- FINISH - finishAbility(); - } - } - } - } - else if( ai->isIdle() ) - { - //STEP 1 -- APPROACH - approachTarget(); - } - return calcSleepTime(); + } + + + //STEP 2 & 5(6) -- Handles packing and unpacking in progress. If packing + //then ends the special ability once complete. Things that don't pack + //will never be handled, nor do things that aren't in a packing state. + if( handlePackingProcessing() ) + { + return calcSleepTime(); + } + + Bool shouldAbort = false; + + // A dead target will end our special (if we are using a target). + if (m_targetID != INVALID_ID) + { + Object* target = TheGameLogic->findObjectByID(m_targetID); + + if (target != NULL) + { + if (target->isEffectivelyDead()) + shouldAbort = TRUE; + else switch (data->m_specialPowerTemplate->getSpecialPowerType()) + { + case SPECIAL_INFANTRY_CAPTURE_BUILDING: + case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: + case SPECIAL_HACKER_DISABLE_BUILDING: + { + if (target->getTeam() == getObject()->getTeam()) + { + // it's been captured by a colleague! we should stop. + shouldAbort = TRUE; + } + //deliberately falling through... + } + case SPECIAL_BLACKLOTUS_STEAL_CASH_HACK: + case SPECIAL_BOOBY_TRAP: + { + if ( target->testStatus( OBJECT_STATUS_STEALTHED ) && (target->testStatus( OBJECT_STATUS_DETECTED ) == FALSE ) ) + { + if ( !isPreparationComplete() ) + shouldAbort = TRUE; + } + break; + } + case SPECIAL_REMOTE_CHARGES: + case SPECIAL_TIMED_CHARGES: + { + if ( ! needToUnpack() ) + { + if ( target->testStatus( OBJECT_STATUS_STEALTHED ) && (target->testStatus( OBJECT_STATUS_DETECTED ) == FALSE ) ) + { + if ( !isPreparationComplete() ) + shouldAbort = TRUE; + } + } + break; + } + case SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES: + { + if ( target->isKindOf( KINDOF_STRUCTURE ) ) + shouldAbort = TRUE; + //deliberately falling through + } + case SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK: + { + if ( target->testStatus( OBJECT_STATUS_STEALTHED ) && (target->testStatus( OBJECT_STATUS_DETECTED ) == FALSE ) ) + { + // where'd my target go? 'Twas here just a second ago. + shouldAbort = TRUE; + } + break; + } + + } + + } + + } + + SpecialPowerModuleInterface *spm = getMySPM(); + + if ( shouldAbort || spm == NULL ) + { + // doh, a colleague has already captured it. just stop. + ai->aiIdle( CMD_FROM_AI ); + onExit( false ); + return calcSleepTime(); + } + + + //DETERMINE OUR PHASE! BRAIN LOGIC + if( !isPreparationComplete() ) + { + //The special ability has fired, now continue to process the special ability + //until it expires + + Bool SPMReady = TRUE;// normally considered ready since this ability has just been initiated + // Lorenzen added this additional flag to support the NapalmBombDrop + // It causes this update to force a recharge of the SPM between drops + if( isPersistentAbility() && getDoesPersistenceRequireRecharge() )//unless I intend to persist in this ability's effect, whereupon I must verify that power is recharged + SPMReady = ( spm->isReady() && spm->getReadyFrame() < TheGameLogic->getFrame() ); + + if ( SPMReady )// if power requires recharging, lets freeze prep countdown until power is ready + m_prepFrames--; + + if( isPreparationComplete() ) + { + //STEP 4 -- TRIGGER (with preparation) + triggerAbilityEffect(); + if( isPersistentAbility() ) + { + //VARIATION -- PERSISTENCE (repeats preparation) + resetPreparation(); + + //tell the special power module to restart the recharge timer + if ( getDoesPersistenceRequireRecharge() ) + spm->startPowerRecharge(); + + + } + else + { + endPreparation(); + if( needToPack() ) + { + //STEP 5 -- PACK + //Note: If we actually do pack, then cleanup will be handled in + //handlePackingProcess(), near the top of this function. + startPacking(true); + } + else + { + //STEP 6 -- FINISH + finishAbility(); + } + } + } + else + { + //Process the preparation if it's still not complete. + Bool continuePrep = continuePreparation(); + if( !continuePrep ) + { + //We failed so abort! + endPreparation(); + if( needToPack() ) + { + //STEP 5 -- PACK + //Note: If we actually do pack, then cleanup will be handled in + //handlePackingProcess(), near the top of this function. + startPacking(false); + } + else + { + //STEP 6 -- FINISH + finishAbility(); + } + } + } + } + else if( isWithinStartAbilityRange() ) + { + m_withinStartAbilityRange = true; + if( !isFacing() && needToFace() ) + { + startFacing(); + return calcSleepTime(); + } + + if( needToUnpack() ) + { + //STEP 2 -- UNPACK + startUnpacking(); + return calcSleepTime(); + } + + if( m_packingState == STATE_UNPACKED ) + { + //STEP 3 -- PREPARE + startPreparation(); + + if( isPreparationComplete() ) + { + //STEP 4 -- TRIGGER (skipping preparation) + triggerAbilityEffect(); + + + // Lorenzen added this additional flag to support the NapalmBombDrop + // It causes this update to force a recharge of the SPM between drops + if( isPersistentAbility() && getDoesPersistenceRequireRecharge()) + { + //VARIATION -- PERSISTENCE (repeats preparation) + resetPreparation(); + + //tell the special power module to restart the recharge timer + spm->startPowerRecharge(); + + return calcSleepTime(); + + } + else + endPreparation(); + + if( needToPack() ) + { + //STEP 5 -- PACK + //Note: If we actually do pack, then cleanup will be handled in + //handlePackingProcess(), near the top of this function. + startPacking(true); + } + else + { + //STEP 6 -- FINISH + finishAbility(); + } + } + } + } + else if( ai->isIdle() ) + { + //STEP 1 -- APPROACH + approachTarget(); + } + return calcSleepTime(); } //------------------------------------------------------------------------------------------------- Bool SpecialAbilityUpdate::initiateIntentToDoSpecialPower( const SpecialPowerTemplate *specialPowerTemplate, - const Object *targetObj, - const Coord3D *targetPos, - const Waypoint *way, - UnsignedInt commandOptions ) + const Object *targetObj, + const Coord3D *targetPos, + const Waypoint *way, + UnsignedInt commandOptions ) { - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - const SpecialPowerTemplate *spTemplate = data->m_specialPowerTemplate; - - if( spTemplate != specialPowerTemplate ) - { - //Check to make sure our modules are connected. - return FALSE; - } - - //Clear target values - m_targetID = INVALID_ID; - m_targetPos.zero(); - m_locationCount = 0; - m_prepFrames = 0; - m_animFrames = 0; - m_packingState = STATE_PACKED; - m_facingInitiated = false; - m_facingComplete = false; - m_withinStartAbilityRange = false; - -// getObject()->getControllingPlayer()->getAcademyStats()->recordSpecialPowerUsed( specialPowerTemplate ); - - getObject()->clearModelConditionFlags( - MAKE_MODELCONDITION_MASK4( MODELCONDITION_UNPACKING, MODELCONDITION_PACKING, MODELCONDITION_FIRING_A, MODELCONDITION_RAISING_FLAG ) ); - - if( targetObj ) - { - //Get the target! - m_targetID = targetObj ? targetObj->getID() : INVALID_ID; - } - else if( targetPos ) - { - //Get the position! - m_targetPos = *targetPos; - } - - //Clear any old AI before starting this special ability. - if( !getObject()->getAIUpdateInterface() ) - { - return FALSE; - } - getObject()->getAIUpdateInterface()->aiIdle( CMD_FROM_AI ); - - //Determine whether we are triggering a command (rather than executing special at location or target) - m_noTargetCommand = !targetObj && !targetPos; - - if( data->m_unpackTime == 0 || m_noTargetCommand && data->m_skipPackingWithNoTarget ) - { - //Only unpack if we need to -- setting it to unpacked will skip step 2 in the update - m_packingState = STATE_UNPACKED; - } - - m_active = true; - - //Prevent other mutually exclusive specials from running (kill them now if we're starting something else) - SpecialAbilityUpdate *disableSA; - disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK ); - if( disableSA && disableSA != this ) - disableSA->onExit( FALSE ); - disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_BLACKLOTUS_STEAL_CASH_HACK ); - if( disableSA && disableSA != this ) - disableSA->onExit( FALSE ); - disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_BLACKLOTUS_CAPTURE_BUILDING ); - if( disableSA && disableSA != this ) - disableSA->onExit( FALSE ); - disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_REMOTE_CHARGES ); - if( disableSA && disableSA != this ) - disableSA->onExit( FALSE ); - disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_TIMED_CHARGES ); - if( disableSA && disableSA != this ) - disableSA->onExit( FALSE ); - disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_INFANTRY_CAPTURE_BUILDING ); - if( disableSA && disableSA != this ) - disableSA->onExit( FALSE ); - disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_BOOBY_TRAP ); - if( disableSA && disableSA != this ) - disableSA->onExit( FALSE ); - - - setWakeFrame(getObject(), UPDATE_SLEEP_NONE); - - return TRUE; + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + const SpecialPowerTemplate *spTemplate = data->m_specialPowerTemplate; + + if( spTemplate != specialPowerTemplate ) + { + //Check to make sure our modules are connected. + return FALSE; + } + + //Clear target values + m_targetID = INVALID_ID; + m_targetPos.zero(); + m_locationCount = 0; + m_prepFrames = 0; + m_animFrames = 0; + m_packingState = STATE_PACKED; + m_facingInitiated = false; + m_facingComplete = false; + m_withinStartAbilityRange = false; + +// getObject()->getControllingPlayer()->getAcademyStats()->recordSpecialPowerUsed( specialPowerTemplate ); + + getObject()->clearModelConditionFlags( + MAKE_MODELCONDITION_MASK4( MODELCONDITION_UNPACKING, MODELCONDITION_PACKING, MODELCONDITION_FIRING_A, MODELCONDITION_RAISING_FLAG ) ); + + if( targetObj ) + { + //Get the target! + m_targetID = targetObj ? targetObj->getID() : INVALID_ID; + } + else if( targetPos ) + { + //Get the position! + m_targetPos = *targetPos; + } + + //Clear any old AI before starting this special ability. + if( !getObject()->getAIUpdateInterface() ) + { + return FALSE; + } + getObject()->getAIUpdateInterface()->aiIdle( CMD_FROM_AI ); + + //Determine whether we are triggering a command (rather than executing special at location or target) + m_noTargetCommand = !targetObj && !targetPos; + + if( data->m_unpackTime == 0 || m_noTargetCommand && data->m_skipPackingWithNoTarget ) + { + //Only unpack if we need to -- setting it to unpacked will skip step 2 in the update + m_packingState = STATE_UNPACKED; + } + + m_active = true; + + //Prevent other mutually exclusive specials from running (kill them now if we're starting something else) + SpecialAbilityUpdate *disableSA; + disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK ); + if( disableSA && disableSA != this ) + disableSA->onExit( FALSE ); + disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_BLACKLOTUS_STEAL_CASH_HACK ); + if( disableSA && disableSA != this ) + disableSA->onExit( FALSE ); + disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_BLACKLOTUS_CAPTURE_BUILDING ); + if( disableSA && disableSA != this ) + disableSA->onExit( FALSE ); + disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_REMOTE_CHARGES ); + if( disableSA && disableSA != this ) + disableSA->onExit( FALSE ); + disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_TIMED_CHARGES ); + if( disableSA && disableSA != this ) + disableSA->onExit( FALSE ); + disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_INFANTRY_CAPTURE_BUILDING ); + if( disableSA && disableSA != this ) + disableSA->onExit( FALSE ); + disableSA = getObject()->findSpecialAbilityUpdate( SPECIAL_BOOBY_TRAP ); + if( disableSA && disableSA != this ) + disableSA->onExit( FALSE ); + + + setWakeFrame(getObject(), UPDATE_SLEEP_NONE); + + return TRUE; } //------------------------------------------------------------------------------------------------- Bool SpecialAbilityUpdate::isPowerCurrentlyInUse( const CommandButton *command ) const { - if( command ) - { - if( command->getSpecialPowerTemplate() && command->getSpecialPowerTemplate()->getSpecialPowerType() == SPECIAL_REMOTE_CHARGES ) - { - if( !BitIsSet( command->getOptions(), CONTEXTMODE_COMMAND ) ) - { - //This is the detonate charge button. Treat it backwards saying it's in use when we don't have any special objects (charges). - //That way, the button will be grayed out. - return getSpecialObjectCount() == 0; - } - } - } - - - if( m_packingState != STATE_NONE ) - { - //exception for powers with zero reload time... they are ready to use immediately! - if ( (m_packingState == STATE_PACKING || m_packingState == STATE_PACKED) && - command && command->getSpecialPowerTemplate()->getReloadTime() == 0 ) - return false; - - if ( m_withinStartAbilityRange ) - { - return true; - } - } - - return false; + if( command ) + { + if( command->getSpecialPowerTemplate() && command->getSpecialPowerTemplate()->getSpecialPowerType() == SPECIAL_REMOTE_CHARGES ) + { + if( !BitIsSet( command->getOptions(), CONTEXTMODE_COMMAND ) ) + { + //This is the detonate charge button. Treat it backwards saying it's in use when we don't have any special objects (charges). + //That way, the button will be grayed out. + return getSpecialObjectCount() == 0; + } + } + } + + + if( m_packingState != STATE_NONE ) + { + //exception for powers with zero reload time... they are ready to use immediately! + if ( (m_packingState == STATE_PACKING || m_packingState == STATE_PACKED) && + command && command->getSpecialPowerTemplate()->getReloadTime() == 0 ) + return false; + + if ( m_withinStartAbilityRange ) + { + return true; + } + } + + return false; } //------------------------------------------------------------------------------------------------- void SpecialAbilityUpdate::onExit( Bool cleanup ) { - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - getObject()->clearModelConditionFlags( - MAKE_MODELCONDITION_MASK4( MODELCONDITION_UNPACKING, MODELCONDITION_PACKING, MODELCONDITION_FIRING_A, MODELCONDITION_RAISING_FLAG ) ); - getObject()->clearStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IS_USING_ABILITY ) ); + getObject()->clearModelConditionFlags( + MAKE_MODELCONDITION_MASK4( MODELCONDITION_UNPACKING, MODELCONDITION_PACKING, MODELCONDITION_FIRING_A, MODELCONDITION_RAISING_FLAG ) ); + getObject()->clearStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IS_USING_ABILITY ) ); - TheAudio->removeAudioEvent( m_prepSoundLoop.getPlayingHandle() ); - endPreparation(); + TheAudio->removeAudioEvent( m_prepSoundLoop.getPlayingHandle() ); + endPreparation(); - if( !data->m_specialObjectsPersistent || cleanup && !data->m_specialObjectsPersistWhenOwnerDies ) - { - //Delete special objects that aren't considered persistent whenever we turn off - //leave the special ability update. - killSpecialObjects(); - } + if( !data->m_specialObjectsPersistent || cleanup && !data->m_specialObjectsPersistWhenOwnerDies ) + { + //Delete special objects that aren't considered persistent whenever we turn off + //leave the special ability update. + killSpecialObjects(); + } - m_active = false; - m_withinStartAbilityRange = false; - m_packingState = STATE_NONE; + m_active = false; + m_withinStartAbilityRange = false; + m_packingState = STATE_NONE; // This is the althernate way to one-at-a-time BlackLotus' specials; we'll keep it commented her until Dustin decides, or until 12/10/02 -// setBusy( FALSE );// My owner is no longer using me +// setBusy( FALSE );// My owner is no longer using me // no, actually, we DON'T want to call this here, since onExit is always called @@ -631,7 +630,7 @@ void SpecialAbilityUpdate::onExit( Bool cleanup ) // own update() method is a no-no (since it would just be ignored in favor // of the return value from update() anyway). just set m_active to false, // and we'll put ourselves to sleep. -// setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); +// setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); } //------------------------------------------------------------------------------------------------- @@ -641,1141 +640,1140 @@ void SpecialAbilityUpdate::onExit( Bool cleanup ) //------------------------------------------------------------------------------------------------- Bool SpecialAbilityUpdate::handlePackingProcessing() { - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - if( m_animFrames > 0 ) - { - m_animFrames--; - if( m_animFrames == 0 ) - { - // We're done, so clear the states. - getObject()->clearModelConditionFlags( MAKE_MODELCONDITION_MASK2( MODELCONDITION_UNPACKING, MODELCONDITION_PACKING ) ); - - if( m_packingState == STATE_UNPACKING ) - { - if( data->m_flipObjectAfterUnpacking ) - { - getObject()->setOrientation( getObject()->getOrientation() + PI ); - } - m_packingState = STATE_UNPACKED; - } - else if( m_packingState == STATE_PACKING ) - { - if( data->m_flipObjectAfterPacking ) - { - getObject()->setOrientation( getObject()->getOrientation() + PI ); - } - //We just finished packing up, therefore - //we have completed our special ability. - m_packingState = STATE_PACKED; - - //Do exit preparation. - finishAbility(); - - //Complete the special ability now - return true; - } - - //We're finished processing - return false; - } - - - - //This is new... the ability to disable stealth before triggering - if( getSpecialAbilityUpdateModuleData()->m_loseStealthOnTrigger && - m_animFrames < getSpecialAbilityUpdateModuleData()->m_preTriggerUnstealthFrames) - { - StealthUpdate* stealth = getObject()->getStealth(); - if( stealth ) - { - stealth->markAsDetected(); - } - } - - - - //We're still processing - return true; - } - //We're not processing - return false; + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + if( m_animFrames > 0 ) + { + m_animFrames--; + if( m_animFrames == 0 ) + { + // We're done, so clear the states. + getObject()->clearModelConditionFlags( MAKE_MODELCONDITION_MASK2( MODELCONDITION_UNPACKING, MODELCONDITION_PACKING ) ); + + if( m_packingState == STATE_UNPACKING ) + { + if( data->m_flipObjectAfterUnpacking ) + { + getObject()->setOrientation( getObject()->getOrientation() + PI ); + } + m_packingState = STATE_UNPACKED; + } + else if( m_packingState == STATE_PACKING ) + { + if( data->m_flipObjectAfterPacking ) + { + getObject()->setOrientation( getObject()->getOrientation() + PI ); + } + //We just finished packing up, therefore + //we have completed our special ability. + m_packingState = STATE_PACKED; + + //Do exit preparation. + finishAbility(); + + //Complete the special ability now + return true; + } + + //We're finished processing + return false; + } + + + + //This is new... the ability to disable stealth before triggering + if( getSpecialAbilityUpdateModuleData()->m_loseStealthOnTrigger && + m_animFrames < getSpecialAbilityUpdateModuleData()->m_preTriggerUnstealthFrames) + { + StealthUpdate* stealth = getObject()->getStealth(); + if( stealth ) + { + stealth->markAsDetected(); + } + } + + + + //We're still processing + return true; + } + //We're not processing + return false; } //------------------------------------------------------------------------------------------------- Bool SpecialAbilityUpdate::needToPack() const { - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - if( m_packingState == STATE_UNPACKED ) - { - if( data->m_skipPackingWithNoTarget && m_noTargetCommand ) - { - return false; - } - if( data->m_packTime ) - { - return true; - } - } - return false; + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + if( m_packingState == STATE_UNPACKED ) + { + if( data->m_skipPackingWithNoTarget && m_noTargetCommand ) + { + return false; + } + if( data->m_packTime ) + { + return true; + } + } + return false; } //------------------------------------------------------------------------------------------------- Bool SpecialAbilityUpdate::needToUnpack() const { - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - if( m_packingState == STATE_PACKED ) - { - if( data->m_skipPackingWithNoTarget && m_noTargetCommand ) - { - return false; - } - if( data->m_unpackTime ) - { - return true; - } - } - return false; + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + if( m_packingState == STATE_PACKED ) + { + if( data->m_skipPackingWithNoTarget && m_noTargetCommand ) + { + return false; + } + if( data->m_unpackTime ) + { + return true; + } + } + return false; } //------------------------------------------------------------------------------------------------- void SpecialAbilityUpdate::startPacking(Bool success) { - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - m_packingState = STATE_PACKING; - Real variation = GameLogicRandomValueReal( 1.0f - data->m_packUnpackVariationFactor, 1.0f + data->m_packUnpackVariationFactor ); - m_animFrames = data->m_packTime * variation; - - //Set the animation state - getObject()->clearAndSetModelConditionFlags( - MAKE_MODELCONDITION_MASK2( MODELCONDITION_UNPACKING, MODELCONDITION_RAISING_FLAG ), - MAKE_MODELCONDITION_MASK( MODELCONDITION_PACKING ) ); - - AudioEventRTS sound = data->m_packSound; - sound.setObjectID( getObject()->getID() ); - TheAudio->addAudioEvent( &sound ); - - //Sync the animation length to the time it'll take to pack. - Drawable* draw = getObject()->getDrawable(); - if (draw) - draw->setAnimationCompletionTime( m_animFrames ); - AIUpdateInterface *ai = getObject()->getAIUpdateInterface(); - if (ai) - ai->aiBusy(CMD_FROM_AI); - - if (success) - { - AudioEventRTS event; - switch( data->m_specialPowerTemplate->getSpecialPowerType() ) - { - //case SPECIAL_HACKER_DISABLE_BUILDING:// Awaiting Mical's new sound - // event = *getObject()->getTemplate()->getPerUnitSound( "VoiceDisableBuildingComplete" ); - // break; - case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: - event = *getObject()->getTemplate()->getPerUnitSound( "VoiceCaptureBuildingComplete" ); - break; - case SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK: - event = *getObject()->getTemplate()->getPerUnitSound( "VoiceDisableVehicleComplete" ); - break; - case SPECIAL_BLACKLOTUS_STEAL_CASH_HACK: - event = *getObject()->getTemplate()->getPerUnitSound( "VoiceStealCashComplete" ); - break; - default: - event = *getObject()->getTemplate()->getVoiceTaskComplete(); - break; - } - - event.setObjectID(getObject()->getID()); - TheAudio->addAudioEvent(&event); - } + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + m_packingState = STATE_PACKING; + Real variation = GameLogicRandomValueReal( 1.0f - data->m_packUnpackVariationFactor, 1.0f + data->m_packUnpackVariationFactor ); + m_animFrames = data->m_packTime * variation; + + //Set the animation state + getObject()->clearAndSetModelConditionFlags( + MAKE_MODELCONDITION_MASK2( MODELCONDITION_UNPACKING, MODELCONDITION_RAISING_FLAG ), + MAKE_MODELCONDITION_MASK( MODELCONDITION_PACKING ) ); + + AudioEventRTS sound = data->m_packSound; + sound.setObjectID( getObject()->getID() ); + TheAudio->addAudioEvent( &sound ); + + //Sync the animation length to the time it'll take to pack. + Drawable* draw = getObject()->getDrawable(); + if (draw) + draw->setAnimationCompletionTime( m_animFrames ); + AIUpdateInterface *ai = getObject()->getAIUpdateInterface(); + if (ai) + ai->aiBusy(CMD_FROM_AI); -} + if (success) + { + AudioEventRTS event; + switch( data->m_specialPowerTemplate->getSpecialPowerType() ) + { + //case SPECIAL_HACKER_DISABLE_BUILDING:// Awaiting Mical's new sound + // event = *getObject()->getTemplate()->getPerUnitSound( "VoiceDisableBuildingComplete" ); + // break; + case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: + event = *getObject()->getTemplate()->getPerUnitSound( "VoiceCaptureBuildingComplete" ); + break; + case SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK: + event = *getObject()->getTemplate()->getPerUnitSound( "VoiceDisableVehicleComplete" ); + break; + case SPECIAL_BLACKLOTUS_STEAL_CASH_HACK: + event = *getObject()->getTemplate()->getPerUnitSound( "VoiceStealCashComplete" ); + break; + default: + event = *getObject()->getTemplate()->getVoiceTaskComplete(); + break; + } -//------------------------------------------------------------------------------------------------- -void SpecialAbilityUpdate::startUnpacking() -{ - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - m_packingState = STATE_UNPACKING; - Real variation = GameLogicRandomValueReal( 1.0f - data->m_packUnpackVariationFactor, 1.0f + data->m_packUnpackVariationFactor ); - m_animFrames = data->m_unpackTime * variation; - - //Set the animation state - getObject()->clearAndSetModelConditionFlags( - MAKE_MODELCONDITION_MASK( MODELCONDITION_PACKING ), - MAKE_MODELCONDITION_MASK( MODELCONDITION_UNPACKING ) ); - - - AudioEventRTS sound = data->m_unpackSound; - sound.setObjectID( getObject()->getID() ); - TheAudio->addAudioEvent( &sound ); - - //Sync the animation length to the time it'll take to unpack. - Drawable* draw = getObject()->getDrawable(); - if (draw) - draw->setAnimationCompletionTime( m_animFrames ); - AIUpdateInterface *ai = getObject()->getAIUpdateInterface(); - if (ai) - ai->aiBusy(CMD_FROM_AI); -} + event.setObjectID(getObject()->getID()); + TheAudio->addAudioEvent(&event); + } -//------------------------------------------------------------------------------------------------- -Bool SpecialAbilityUpdate::isWithinStartAbilityRange() const -{ - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - const Object *self = getObject(); - - //Quickly convert very short range approachs to "contact" class requiring collision before - //stopping. - Real range = data->m_startAbilityRange; - const Real UNDERSIZE = PATHFIND_CELL_SIZE_F * 0.25f; - range = __max( 0.0f, range - UNDERSIZE ); - - if( m_withinStartAbilityRange ) - { - //Only get within range once. - return true; - } - - Real fDistSquared = 0.0f; - Object *target = NULL; - if( m_targetID != INVALID_ID ) - { - target = TheGameLogic->findObjectByID( m_targetID ); - if( target ) - { - fDistSquared = ThePartitionManager->getDistanceSquared( self, target, FROM_BOUNDINGSPHERE_2D ); - } - } - else if( m_targetPos.x || m_targetPos.y || m_targetPos.z ) //It's zero if not used... - { - fDistSquared = ThePartitionManager->getDistanceSquared( self, &m_targetPos, FROM_BOUNDINGSPHERE_2D ); - } - else - { - //No position, so this step is useless - return true; - } - - //Check to see how far we are from the target! - Real fStartRangeSquared = data->m_startAbilityRange * data->m_startAbilityRange; - if( fDistSquared <= fStartRangeSquared ) - { - if( range == 0.0f && m_targetID != INVALID_ID ) - { - //We want to ensure we collided with our target first! - ObjectIterator *iter = ThePartitionManager->iteratePotentialCollisions( self->getPosition(), self->getGeometryInfo(), 0.0f ); - MemoryPoolObjectHolder hold(iter); - for( Object *them = iter->first(); them; them = iter->next() ) - { - if( target == them ) - { - return true; - } - } - return false; - } - - if( data->m_approachRequiresLOS ) - { - //Make sure we can see the target! - PartitionFilterLineOfSight filterLOS( self ); - PartitionFilter *filters[] = { &filterLOS, NULL }; - ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( self, range, FROM_BOUNDINGSPHERE_2D, filters, ITER_SORTED_NEAR_TO_FAR ); - for( Object *theTarget = iter->first(); theTarget; theTarget = iter->next() ) - { - //LOS check succeeded. - if( target == theTarget ) - { - return true; - } - } - } - else - { - return true; - } - } - return false; } //------------------------------------------------------------------------------------------------- -Bool SpecialAbilityUpdate::isWithinAbilityAbortRange() const +void SpecialAbilityUpdate::startUnpacking() { - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - const Object *self = getObject(); - - //Quickly convert very short range approachs to "contact" class requiring collision before - //stopping. - Real range = data->m_startAbilityRange; - const Real UNDERSIZE = PATHFIND_CELL_SIZE_F * 0.25f; - range = __max( 0.0f, range - UNDERSIZE ); - - Real fDistSquared = 0.0f; - Object *target = NULL; - if( m_targetID != INVALID_ID ) - { - target = TheGameLogic->findObjectByID( m_targetID ); - if( target ) - { - fDistSquared = ThePartitionManager->getDistanceSquared( self, target, FROM_BOUNDINGSPHERE_2D ); - } - } - else if( m_targetPos.x || m_targetPos.y || m_targetPos.z ) //It's zero if not used... - { - fDistSquared = ThePartitionManager->getDistanceSquared( self, &m_targetPos, FROM_BOUNDINGSPHERE_2D ); - } - else - { - //No position, so this step is useless - return true; - } - - //Check to see how far we are from the target! - Real fStartRangeSquared = data->m_abilityAbortRange * data->m_abilityAbortRange; - if( fDistSquared <= fStartRangeSquared ) - { - if( range == 0.0f && m_targetID != INVALID_ID ) - { - //We want to ensure we collided with our target first! - ObjectIterator *iter = ThePartitionManager->iteratePotentialCollisions( self->getPosition(), self->getGeometryInfo(), 0.0f ); - MemoryPoolObjectHolder hold(iter); - for( Object *them = iter->first(); them; them = iter->next() ) - { - if( target == them ) - { - return true; - } - } - return false; - } - - return true; - } - return false; -} + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + m_packingState = STATE_UNPACKING; + Real variation = GameLogicRandomValueReal( 1.0f - data->m_packUnpackVariationFactor, 1.0f + data->m_packUnpackVariationFactor ); + m_animFrames = data->m_unpackTime * variation; -//------------------------------------------------------------------------------------------------- -Bool SpecialAbilityUpdate::approachTarget() -{ - Object *self = getObject(); - if( m_targetID != INVALID_ID ) - { - Object *target = TheGameLogic->findObjectByID( m_targetID ); - if( target ) - { - AIUpdateInterface *ai = self->getAIUpdateInterface(); - if( ai ) - { - ai->ignoreObstacle( target ); - ai->aiMoveToObject( target, CMD_FROM_AI ); - return true; - } - } - } - else if( m_targetPos.x || m_targetPos.y || m_targetPos.z ) //It's zero if not used... - { - AIUpdateInterface *ai = self->getAIUpdateInterface(); - if( ai ) - { - ai->aiMoveToPosition( &m_targetPos, CMD_FROM_AI ); - return true; - } - } - return false; -} + //Set the animation state + getObject()->clearAndSetModelConditionFlags( + MAKE_MODELCONDITION_MASK( MODELCONDITION_PACKING ), + MAKE_MODELCONDITION_MASK( MODELCONDITION_UNPACKING ) ); -//------------------------------------------------------------------------------------------------- -void SpecialAbilityUpdate::startPreparation() -{ - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - const SpecialPowerTemplate *spTemplate = data->m_specialPowerTemplate; - - //Set the preparation timer - m_prepFrames = data->m_preparationFrames; - - switch( spTemplate->getSpecialPowerType() ) - { - case SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES: - { - Object *target = TheGameLogic->findObjectByID( m_targetID ); - if( target ) - { - //Specialized code that specifically creates and looks up a laser update. - Object *specialObject = createSpecialObject(); - if( specialObject ) - { - if (!initLaser(specialObject, target)) - return; - } - } - break; - } - case SPECIAL_INFANTRY_CAPTURE_BUILDING: - { - Object *target = TheGameLogic->findObjectByID( m_targetID ); - if (target) - { - if (target->getTeam() == getObject()->getTeam()) - { - // it's been captured by a colleague! we should stop. - return; - } - if( target->checkAndDetonateBoobyTrap(getObject()) ) - { - // Whoops, it was mined. Cancel if it is now dead. - if( target->isEffectivelyDead() ) - { - return; - } - } - } - - - getObject()->clearAndSetModelConditionFlags( MAKE_MODELCONDITION_MASK( MODELCONDITION_UNPACKING ), - MAKE_MODELCONDITION_MASK( MODELCONDITION_RAISING_FLAG ) ); - Drawable* draw = getObject()->getDrawable(); - if (draw) - draw->setAnimationCompletionTime(data->m_preparationFrames); - - //Warn the victim so he might have a chance to react! - if( target && target->isLocallyControlled() ) - { - TheEva->setShouldPlay( EVA_BuildingBeingStolen ); - } - TheRadar->tryInfiltrationEvent( target ); - - break; - } - - case SPECIAL_HACKER_DISABLE_BUILDING: - case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: - case SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK: - case SPECIAL_BLACKLOTUS_STEAL_CASH_HACK: - { - Object *target = TheGameLogic->findObjectByID( m_targetID ); - if( target ) - { - - Relationship r = getObject()->getRelationship(target); - if( r == ALLIES ) - return; - - //Specialized code that specifically creates and looks up a laser update. - Object *specialObject = createSpecialObject(); - if( specialObject ) - { - if (!initLaser(specialObject, target)) - return; - - //For the hacker this sets up the looping typing animation. - getObject()->clearAndSetModelConditionFlags( MAKE_MODELCONDITION_MASK( MODELCONDITION_UNPACKING ), - MAKE_MODELCONDITION_MASK( MODELCONDITION_FIRING_A ) ); - } - - //Warn the victim so he might have a chance to react! - if( spTemplate->getSpecialPowerType() == SPECIAL_BLACKLOTUS_CAPTURE_BUILDING && target && target->isLocallyControlled() ) - { - TheEva->setShouldPlay( EVA_BuildingBeingStolen ); - } - TheRadar->tryInfiltrationEvent( target ); - - } - break; - } - } - - //Trigger the reset timer on the special power because we're officially starting it now! - SpecialPowerModuleInterface *spmInterface = getMySPM(); - if( spmInterface ) - { - spmInterface->markSpecialPowerTriggered(NULL);// Null for not creating a view object - } - - if (getObject()->getAI()) { - getObject()->getAI()->aiIdle( CMD_FROM_AI ); // just in case. jba. - } - getObject()->setStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IS_USING_ABILITY ) ); - - m_prepSoundLoop = data->m_prepSoundLoop; - m_prepSoundLoop.setObjectID( getObject()->getID() ); - m_prepSoundLoop.setPlayingHandle( TheAudio->addAudioEvent( &m_prepSoundLoop ) ); -} + AudioEventRTS sound = data->m_unpackSound; + sound.setObjectID( getObject()->getID() ); + TheAudio->addAudioEvent( &sound ); -//------------------------------------------------------------------------------------------------- -SpecialPowerModuleInterface* SpecialAbilityUpdate::getMySPM() -{ - const SpecialAbilityUpdateModuleData* d = getSpecialAbilityUpdateModuleData(); - return getObject()->getSpecialPowerModule(d->m_specialPowerTemplate); + //Sync the animation length to the time it'll take to unpack. + Drawable* draw = getObject()->getDrawable(); + if (draw) + draw->setAnimationCompletionTime( m_animFrames ); + AIUpdateInterface *ai = getObject()->getAIUpdateInterface(); + if (ai) + ai->aiBusy(CMD_FROM_AI); } //------------------------------------------------------------------------------------------------- -Bool SpecialAbilityUpdate::initLaser(Object* specialObject, Object* target ) +Bool SpecialAbilityUpdate::isWithinStartAbilityRange() const { - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - static NameKeyType key_LaserUpdate = NAMEKEY( "LaserUpdate" ); - Drawable *draw = specialObject->getDrawable(); - if( !draw ) - { - killSpecialObjects(); - return false; - } - LaserUpdate *update = (LaserUpdate*)draw->findClientUpdateModule( key_LaserUpdate ); - if( !update ) - { - killSpecialObjects(); - return false; - } - - Coord3D startPos; - if( !getObject()->getSingleLogicalBonePosition( data->m_specialObjectAttachToBoneName.str(), &startPos, NULL ) ) - { - //If we can't find the bone, then set it to our current position. - startPos.set( getObject()->getPosition() ); - } - - Coord3D endPos; - if (target) - { - target->getGeometryInfo().getCenterPosition( *target->getPosition(), endPos ); - } - else - { - endPos = startPos; - } - update->initLaser( getObject(), target, &startPos, &endPos, data->m_specialObjectAttachToBoneName ); - return true; -} + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + const Object *self = getObject(); -//------------------------------------------------------------------------------------------------- -Bool SpecialAbilityUpdate::continuePreparation() -{ - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - const SpecialPowerTemplate *spTemplate = data->m_specialPowerTemplate; - - //Check if we are within the abort distance, otherwise abort! - if( data->m_abilityAbortRange < SPECIAL_ABILITY_HUGE_DISTANCE ) - { - if( !isWithinAbilityAbortRange() ) - { - return false; - } - } - - switch( spTemplate->getSpecialPowerType() ) - { - case SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES: - case SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK: - { - Object *target = TheGameLogic->findObjectByID( m_targetID ); - - if( !target ) - { - //Target is dead, stop. - return false; - } - - Relationship r = getObject()->getRelationship(target); - if( r == ALLIES ) - { - //It's been captured by a colleague, so cancel! - return false; - } - - //Specialized code that specifically creates and looks up a laser update. - for( std::list::iterator it = m_specialObjectIDList.begin(); it != m_specialObjectIDList.end(); ++it ) - { - Object* specialObject = TheGameLogic->findObjectByID( *it ); - if( specialObject ) - { - if( !initLaser( specialObject, target ) ) - { - return false; - } - } - } - break; - } - - case SPECIAL_INFANTRY_CAPTURE_BUILDING: - case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: - - // PROCESS THE FLASHING WHILE GETTING CAPTURED FX HERE - Object* target = TheGameLogic->findObjectByID( m_targetID ); - - if( !target ) - { - //Target is dead, stop. - return false; - } - - Relationship r = getObject()->getRelationship(target); - if( r == ALLIES ) - { - //It's been captured by a colleague, so cancel! - return false; - } - - if (data->m_doCaptureFX) - { - Drawable *targetDraw = target->getDrawable(); - - if (targetDraw) // skip fx if merely 'invulnerable' - { - Bool lastPhase = ( ((Int)m_captureFlashPhase) & 1 );// were we in a flashy phase last frame? - - Real denominator = MAX(1, data->m_preparationFrames); - Real increment = 1.0f - ((Real)m_prepFrames / denominator ); - m_captureFlashPhase += increment / 3.0f; - - Bool thisPhase = ( ((Int)m_captureFlashPhase) & 1 );// are we in a flashy phase this frame? - - if ( lastPhase && ( ! thisPhase ) ) - { - - RGBColor myHouseColor; - myHouseColor.setFromInt( getObject()->getIndicatorColor() ); - - Real saturation = TheGlobalData->m_selectionFlashSaturationFactor; - targetDraw->saturateRGB( myHouseColor, saturation ); - - targetDraw->flashAsSelected( &myHouseColor ); //In MY house color, not his! - - AudioEventRTS defectorTimerSound = TheAudio->getMiscAudio()->m_defectorTimerTickSound; - defectorTimerSound.setObjectID( m_targetID ); - TheAudio->addAudioEvent(&defectorTimerSound); - - } - } - } - - - SpecialPowerModuleInterface *spmInterface = getMySPM(); - if (spmInterface && spTemplate->getSpecialPowerType() == SPECIAL_INFANTRY_CAPTURE_BUILDING ) - { - // these keep resetting the recharge timer while in use. (srj) // only for infantry capture, not black lotus which resets in triggerAbilityEffect() - spmInterface->startPowerRecharge(); - } - break; - } - return true; -} + //Quickly convert very short range approachs to "contact" class requiring collision before + //stopping. + Real range = data->m_startAbilityRange; + const Real UNDERSIZE = PATHFIND_CELL_SIZE_F * 0.25f; + range = __max( 0.0f, range - UNDERSIZE ); -//------------------------------------------------------------------------------------------------- -void SpecialAbilityUpdate::triggerAbilityEffect() -{ - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - const SpecialPowerTemplate *spTemplate = data->m_specialPowerTemplate; - Object *object = getObject(); - - //Award experience to units for triggering the ability (optional and ini specified). - //NOTE: Be award of persistant abilities that call trigger over and over again! - if( data->m_awardXPForTriggering ) - { - ExperienceTracker *xpTracker = object->getExperienceTracker(); - if( xpTracker ) - { - xpTracker->addExperiencePoints( data->m_awardXPForTriggering ); - } - } - //Also add skill points. If unspecified, it'll use the award experience to units for triggering value. - Int skillPoints = data->m_skillPointsForTriggering != -1 ? data->m_skillPointsForTriggering : data->m_awardXPForTriggering; - if( skillPoints > 0 ) - { - Player *player = object->getControllingPlayer(); - if( player ) - { - player->addSkillPoints( skillPoints ); - } - } - - AudioEventRTS sound = data->m_triggerSound; - sound.setObjectID( object->getID() ); - TheAudio->addAudioEvent( &sound ); - - - Bool okToLoseStealth = TRUE; - - switch( spTemplate->getSpecialPowerType() ) - { - case SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES: - { - Object *target = TheGameLogic->findObjectByID( m_targetID ); - if( target ) - { - const Weapon *weapon = object->getWeaponInWeaponSlot( SECONDARY_WEAPON ); - if( weapon ) - { - // lock it just till the weapon is empty or the attack is "done" - object->setWeaponLock( SECONDARY_WEAPON, LOCKED_TEMPORARILY ); - AIUpdateInterface *ai = object->getAIUpdateInterface(); - if( ai ) - { - ai->aiAttackObject( target, NO_MAX_SHOTS_LIMIT, CMD_FROM_AI ); - } - } - } - break; - } - case SPECIAL_HELIX_NAPALM_BOMB: - { - // Couldn't be simpler... the special object is the bomb - createSpecialObject(); - break; - } - case SPECIAL_TANKHUNTER_TNT_ATTACK: - case SPECIAL_TIMED_CHARGES: - case SPECIAL_BOOBY_TRAP: - { - //Place new tnt. - Object *target = TheGameLogic->findObjectByID( m_targetID ); - //sanity - if( !target ) - { - return; - } - - if( target->checkAndDetonateBoobyTrap(getObject()) ) - { - // Whoops, it was mined. Cancel if it or us is now dead. - if( target->isEffectivelyDead() || getObject()->isEffectivelyDead() ) - { - return; - } - } - - if( (spTemplate->getSpecialPowerType() == SPECIAL_BOOBY_TRAP) && target->testStatus(OBJECT_STATUS_BOOBY_TRAPPED) ) - { - // The only way it can be booby trapped after a detonate would be if it is an allied booby trap. - // Regardless of why, we can't double booby trap something. - return; + if( m_withinStartAbilityRange ) + { + //Only get within range once. + return true; + } + + Real fDistSquared = 0.0f; + Object *target = NULL; + if( m_targetID != INVALID_ID ) + { + target = TheGameLogic->findObjectByID( m_targetID ); + if( target ) + { + fDistSquared = ThePartitionManager->getDistanceSquared( self, target, FROM_BOUNDINGSPHERE_2D ); + } + } + else if( m_targetPos.x || m_targetPos.y || m_targetPos.z ) //It's zero if not used... + { + fDistSquared = ThePartitionManager->getDistanceSquared( self, &m_targetPos, FROM_BOUNDINGSPHERE_2D ); + } + else + { + //No position, so this step is useless + return true; + } + + //Check to see how far we are from the target! + Real fStartRangeSquared = data->m_startAbilityRange * data->m_startAbilityRange; + if( fDistSquared <= fStartRangeSquared ) + { + if( range == 0.0f && m_targetID != INVALID_ID ) + { + //We want to ensure we collided with our target first! + ObjectIterator *iter = ThePartitionManager->iteratePotentialCollisions( self->getPosition(), self->getGeometryInfo(), 0.0f ); + MemoryPoolObjectHolder hold(iter); + for( Object *them = iter->first(); them; them = iter->next() ) + { + if( target == them ) + { + return true; + } + } + return false; + } + + if( data->m_approachRequiresLOS ) + { + //Make sure we can see the target! + PartitionFilterLineOfSight filterLOS( self ); + PartitionFilter *filters[] = { &filterLOS, NULL }; + ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( self, range, FROM_BOUNDINGSPHERE_2D, filters, ITER_SORTED_NEAR_TO_FAR ); + for( Object *theTarget = iter->first(); theTarget; theTarget = iter->next() ) + { + //LOS check succeeded. + if( target == theTarget ) + { + return true; + } + } + } + else + { + return true; + } + } + return false; +} + +//------------------------------------------------------------------------------------------------- +Bool SpecialAbilityUpdate::isWithinAbilityAbortRange() const +{ + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + const Object *self = getObject(); + + //Quickly convert very short range approachs to "contact" class requiring collision before + //stopping. + Real range = data->m_startAbilityRange; + const Real UNDERSIZE = PATHFIND_CELL_SIZE_F * 0.25f; + range = __max( 0.0f, range - UNDERSIZE ); + + Real fDistSquared = 0.0f; + Object *target = NULL; + if( m_targetID != INVALID_ID ) + { + target = TheGameLogic->findObjectByID( m_targetID ); + if( target ) + { + fDistSquared = ThePartitionManager->getDistanceSquared( self, target, FROM_BOUNDINGSPHERE_2D ); + } + } + else if( m_targetPos.x || m_targetPos.y || m_targetPos.z ) //It's zero if not used... + { + fDistSquared = ThePartitionManager->getDistanceSquared( self, &m_targetPos, FROM_BOUNDINGSPHERE_2D ); + } + else + { + //No position, so this step is useless + return true; + } + + //Check to see how far we are from the target! + Real fStartRangeSquared = data->m_abilityAbortRange * data->m_abilityAbortRange; + if( fDistSquared <= fStartRangeSquared ) + { + if( range == 0.0f && m_targetID != INVALID_ID ) + { + //We want to ensure we collided with our target first! + ObjectIterator *iter = ThePartitionManager->iteratePotentialCollisions( self->getPosition(), self->getGeometryInfo(), 0.0f ); + MemoryPoolObjectHolder hold(iter); + for( Object *them = iter->first(); them; them = iter->next() ) + { + if( target == them ) + { + return true; + } } + return false; + } + + return true; + } + return false; +} - Object *charge = createSpecialObject(); - if( charge ) - { - static NameKeyType key_StickyBombUpdate = NAMEKEY( "StickyBombUpdate" ); - StickyBombUpdate *update = (StickyBombUpdate*)charge->findUpdateModule( key_StickyBombUpdate ); - if( !update ) - { - DEBUG_ASSERTCRASH( 0, - ("Unit '%s' attempted to place %s on %s but the bomb requires a StickyBombUpdate module.", - object->getTemplate()->getName().str(), - charge->getTemplate()->getName().str(), - target->getTemplate()->getName().str() ) ); - killSpecialObjects(); - return; - } - //Setting the producer ID allows the sticky bomb update module to initialize - //and setup timers, etc. - update->initStickyBomb( target, object ); - - - } - break; - } - case SPECIAL_HACKER_DISABLE_BUILDING: - case SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK: - { - //Disable the target temporarily. - Object *target = TheGameLogic->findObjectByID( m_targetID ); - - //sanity - if( !target ) - { - return; - } - - Relationship r = object->getRelationship(target); - if ( r == ALLIES) - return; - - //Disable the target for a specified amount of time. - target->setDisabledUntil( DISABLED_HACKED, TheGameLogic->getFrame() + data->m_effectDuration ); - - UnsignedInt durationInterleaveFactor = 1; - Real targetFootprintArea = target->getGeometryInfo().getFootprintArea(); - - if ( ( targetFootprintArea < 300) && target->isKindOf( KINDOF_STRUCTURE )) - { - m_doDisableFXParticles = !m_doDisableFXParticles; // toggle if small building - durationInterleaveFactor = 2; - } - - - if ( m_doDisableFXParticles ) - { - const ParticleSystemTemplate *tmp = data->m_disableFXParticleSystem; - if (tmp) - { - ParticleSystem *sys = TheParticleSystemManager->createParticleSystem(tmp); - if (sys) - { - Coord3D offs = {0,0,0}; - target->getGeometryInfo().makeRandomOffsetWithinFootprint( offs ); - - sys->attachToObject(target); - sys->setPosition( &offs ); - sys->setSystemLifetime( data->m_effectDuration * durationInterleaveFactor ); //lifetime of the system, not the particles - - } - } - } - break; - } - - case SPECIAL_INFANTRY_CAPTURE_BUILDING: - case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: - { - Object *target = TheGameLogic->findObjectByID( m_targetID ); - - //sanity - if( !target ) - { - return; - } - - if( target->checkAndDetonateBoobyTrap(getObject()) ) - { - // Whoops, it was mined. Cancel if it or us is now dead. - if( target->isEffectivelyDead() || getObject()->isEffectivelyDead() ) - { - return; - } - } - - if (target->getTeam() == object->getTeam()) - { - // it's been captured by a colleague! we should stop. - return; - } - - // Just in case we are capturing a building which is already garrisoned by other - ContainModuleInterface * contain = target->getContain(); - if ( contain && contain->isGarrisonable() ) - { - contain->removeAllContained( TRUE ); - break; // we do not want to set a neutral building to our team if we are not in it, that would be confusing! - } - - //Play the "building stolen" EVA event if the local player is the victim! - if( target && target->isLocallyControlled() ) - { - TheEva->setShouldPlay( EVA_BuildingStolen ); - } - - target->defect( object->getControllingPlayer()->getDefaultTeam(), 1); // one frame of flash! - - SpecialPowerModuleInterface *spmInterface = getMySPM(); - if (spmInterface && spTemplate->getSpecialPowerType() == SPECIAL_BLACKLOTUS_CAPTURE_BUILDING ) - { - // only for black lotus, not infantry capture which resets in contunueprep() - spmInterface->startPowerRecharge(); - } - - object->getControllingPlayer()->getAcademyStats()->recordBuildingCapture(); - break; - } - case SPECIAL_BLACKLOTUS_STEAL_CASH_HACK: - { - Object *target = TheGameLogic->findObjectByID( m_targetID ); - - //sanity - if( !target ) - { - return; - } - - //Steal a thousand cash from the other team! - Money *targetMoney = target->getControllingPlayer()->getMoney(); - Money *objectMoney = object->getControllingPlayer()->getMoney(); - if( targetMoney && objectMoney ) - { - UnsignedInt cash = targetMoney->countMoney(); - UnsignedInt desiredAmount = 1000; - //Check to see if they have 1000 cash, otherwise, take the remainder! - cash = min( desiredAmount, cash ); - if( cash > 0 ) - { - //Steal the cash - targetMoney->withdraw( cash ); - objectMoney->deposit( cash ); - Player* controller = object->getControllingPlayer(); - if (controller) - controller->getScoreKeeper()->addMoneyEarned( cash ); - - //Play the "cash stolen" EVA event if the local player is the victim! - if( target && target->isLocallyControlled() ) - { - TheEva->setShouldPlay( EVA_CashStolen ); - } - - //Display cash income floating over the blacklotus - UnicodeString moneyString; - moneyString.format( TheGameText->fetch( "GUI:AddCash" ), cash ); - Coord3D pos; - pos.set( object->getPosition() ); - pos.z += 20.0f; //add a little z to make it show up above the unit. - TheInGameUI->addFloatingText( moneyString, &pos, GameMakeColor( 0, 255, 0, 255 ) ); - - //Display cash lost floating over the target - moneyString.format( TheGameText->fetch( "GUI:LoseCash" ), cash ); - pos.set( target->getPosition() ); - pos.z += 30.0f; //add a little z to make it show up above the unit. - TheInGameUI->addFloatingText( moneyString, &pos, GameMakeColor( 255, 0, 0, 255 ) ); - } - } - break; - } - - case SPECIAL_REMOTE_CHARGES: - { - Object *target = TheGameLogic->findObjectByID( m_targetID ); - - if( target && target->checkAndDetonateBoobyTrap(getObject()) ) - { - // Whoops, it was mined. Cancel if it or us is now dead. - if( target->isEffectivelyDead() || getObject()->isEffectivelyDead() ) - { - return; - } - } - - static NameKeyType key_StickyBombUpdate = NAMEKEY( "StickyBombUpdate" ); - if( m_targetID == INVALID_ID && !m_targetPos.x && !m_targetPos.y && !m_targetPos.z ) - { - //If there is no target object nor position, then we are detonating the existing charges. - std::list::iterator i; - for( i = m_specialObjectIDList.begin(); i != m_specialObjectIDList.end(); ++i ) - { - Object *specialObject = TheGameLogic->findObjectByID( *i ); - if( specialObject ) - { - StickyBombUpdate *update = (StickyBombUpdate*)specialObject->findUpdateModule( key_StickyBombUpdate ); - if( update ) - { - //Blow it up!!! - update->detonate(); - okToLoseStealth = FALSE; - //Note: while the objects are detonating, they will still exist in the game. - //Our update will be responsible for validating their existance and removing them.. - //in case either the enemy player cleans one up, or after it's gone. - } - } - } - } - else - { - //Place a new charge. - //sanity - if( !target ) - { - return; - } - - Object *charge = createSpecialObject(); - if( charge ) - { - StickyBombUpdate *update = (StickyBombUpdate*)charge->findUpdateModule( key_StickyBombUpdate ); - if( !update ) - { - DEBUG_ASSERTCRASH( 0, - ("Unit '%s' attempted to place remote charge but the charge '%s' requires a StickyBombUpdate module.", - object->getTemplate()->getName().str(), - charge->getTemplate()->getName().str() ) ); - killSpecialObjects(); - return; - } - //Setting the producer ID allows the sticky bomb update module to initialize - //and setup timers, etc. - update->initStickyBomb( target, object ); - } - } - break; - } - - case SPECIAL_DISGUISE_AS_VEHICLE: - { - Object *target = TheGameLogic->findObjectByID( m_targetID ); - if( target ) - { - StealthUpdate* update = getObject()->getStealth(); - - if( update ) - { - update->disguiseAsObject( target ); - } - } - - break; - } - } - - if( data->m_loseStealthOnTrigger && okToLoseStealth) - { - StealthUpdate* stealth = getObject()->getStealth(); - if( stealth ) - { - stealth->markAsDetected(); - } - } +//------------------------------------------------------------------------------------------------- +Bool SpecialAbilityUpdate::approachTarget() +{ + Object *self = getObject(); + if( m_targetID != INVALID_ID ) + { + Object *target = TheGameLogic->findObjectByID( m_targetID ); + if( target ) + { + AIUpdateInterface *ai = self->getAIUpdateInterface(); + if( ai ) + { + ai->ignoreObstacle( target ); + ai->aiMoveToObject( target, CMD_FROM_AI ); + return true; + } + } + } + else if( m_targetPos.x || m_targetPos.y || m_targetPos.z ) //It's zero if not used... + { + AIUpdateInterface *ai = self->getAIUpdateInterface(); + if( ai ) + { + ai->aiMoveToPosition( &m_targetPos, CMD_FROM_AI ); + return true; + } + } + return false; +} + +//------------------------------------------------------------------------------------------------- +void SpecialAbilityUpdate::startPreparation() +{ + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + const SpecialPowerTemplate *spTemplate = data->m_specialPowerTemplate; + + //Set the preparation timer + m_prepFrames = data->m_preparationFrames; + + switch( spTemplate->getSpecialPowerType() ) + { + case SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES: + { + Object *target = TheGameLogic->findObjectByID( m_targetID ); + if( target ) + { + //Specialized code that specifically creates and looks up a laser update. + Object *specialObject = createSpecialObject(); + if( specialObject ) + { + if (!initLaser(specialObject, target)) + return; + } + } + break; + } + case SPECIAL_INFANTRY_CAPTURE_BUILDING: + { + Object *target = TheGameLogic->findObjectByID( m_targetID ); + if (target) + { + if (target->getTeam() == getObject()->getTeam()) + { + // it's been captured by a colleague! we should stop. + return; + } + if( target->checkAndDetonateBoobyTrap(getObject()) ) + { + // Whoops, it was mined. Cancel if it is now dead. + if( target->isEffectivelyDead() ) + { + return; + } + } + } + + getObject()->clearAndSetModelConditionFlags( MAKE_MODELCONDITION_MASK( MODELCONDITION_UNPACKING ), + MAKE_MODELCONDITION_MASK( MODELCONDITION_RAISING_FLAG ) ); + Drawable* draw = getObject()->getDrawable(); + if (draw) + draw->setAnimationCompletionTime(data->m_preparationFrames); + + //Warn the victim so he might have a chance to react! + if( target && target->isLocallyControlled() ) + { + TheEva->setShouldPlay( EVA_BuildingBeingStolen ); + } + TheRadar->tryInfiltrationEvent( target ); + + break; + } + + case SPECIAL_HACKER_DISABLE_BUILDING: + case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: + case SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK: + case SPECIAL_BLACKLOTUS_STEAL_CASH_HACK: + { + Object *target = TheGameLogic->findObjectByID( m_targetID ); + if( target ) + { + + Relationship r = getObject()->getRelationship(target); + if( r == ALLIES ) + return; + + //Specialized code that specifically creates and looks up a laser update. + Object *specialObject = createSpecialObject(); + if( specialObject ) + { + if (!initLaser(specialObject, target)) + return; + + //For the hacker this sets up the looping typing animation. + getObject()->clearAndSetModelConditionFlags( MAKE_MODELCONDITION_MASK( MODELCONDITION_UNPACKING ), + MAKE_MODELCONDITION_MASK( MODELCONDITION_FIRING_A ) ); + } + + //Warn the victim so he might have a chance to react! + if( spTemplate->getSpecialPowerType() == SPECIAL_BLACKLOTUS_CAPTURE_BUILDING && target && target->isLocallyControlled() ) + { + TheEva->setShouldPlay( EVA_BuildingBeingStolen ); + } + TheRadar->tryInfiltrationEvent( target ); + + } + break; + } + } + + //Trigger the reset timer on the special power because we're officially starting it now! + SpecialPowerModuleInterface *spmInterface = getMySPM(); + if( spmInterface ) + { + spmInterface->markSpecialPowerTriggered(NULL);// Null for not creating a view object + } + + if (getObject()->getAI()) { + getObject()->getAI()->aiIdle( CMD_FROM_AI ); // just in case. jba. + } + getObject()->setStatus( MAKE_OBJECT_STATUS_MASK( OBJECT_STATUS_IS_USING_ABILITY ) ); + + m_prepSoundLoop = data->m_prepSoundLoop; + m_prepSoundLoop.setObjectID( getObject()->getID() ); + m_prepSoundLoop.setPlayingHandle( TheAudio->addAudioEvent( &m_prepSoundLoop ) ); + +} + +//------------------------------------------------------------------------------------------------- +SpecialPowerModuleInterface* SpecialAbilityUpdate::getMySPM() +{ + const SpecialAbilityUpdateModuleData* d = getSpecialAbilityUpdateModuleData(); + return getObject()->getSpecialPowerModule(d->m_specialPowerTemplate); +} + +//------------------------------------------------------------------------------------------------- +Bool SpecialAbilityUpdate::initLaser(Object* specialObject, Object* target ) +{ + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + static NameKeyType key_LaserUpdate = NAMEKEY( "LaserUpdate" ); + Drawable *draw = specialObject->getDrawable(); + if( !draw ) + { + killSpecialObjects(); + return false; + } + LaserUpdate *update = (LaserUpdate*)draw->findClientUpdateModule( key_LaserUpdate ); + if( !update ) + { + killSpecialObjects(); + return false; + } + + Coord3D startPos; + if( !getObject()->getSingleLogicalBonePosition( data->m_specialObjectAttachToBoneName.str(), &startPos, NULL ) ) + { + //If we can't find the bone, then set it to our current position. + startPos.set( getObject()->getPosition() ); + } + + Coord3D endPos; + if (target) + { + target->getGeometryInfo().getCenterPosition( *target->getPosition(), endPos ); + } + else + { + endPos = startPos; + } + update->initLaser( getObject(), target, &startPos, &endPos, data->m_specialObjectAttachToBoneName ); + return true; +} + +//------------------------------------------------------------------------------------------------- +Bool SpecialAbilityUpdate::continuePreparation() +{ + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + const SpecialPowerTemplate *spTemplate = data->m_specialPowerTemplate; + + //Check if we are within the abort distance, otherwise abort! + if( data->m_abilityAbortRange < SPECIAL_ABILITY_HUGE_DISTANCE ) + { + if( !isWithinAbilityAbortRange() ) + { + return false; + } + } + + switch( spTemplate->getSpecialPowerType() ) + { + case SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES: + case SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK: + { + Object *target = TheGameLogic->findObjectByID( m_targetID ); + + if( !target ) + { + //Target is dead, stop. + return false; + } + + Relationship r = getObject()->getRelationship(target); + if( r == ALLIES ) + { + //It's been captured by a colleague, so cancel! + return false; + } + + //Specialized code that specifically creates and looks up a laser update. + for( std::list::iterator it = m_specialObjectIDList.begin(); it != m_specialObjectIDList.end(); ++it ) + { + Object* specialObject = TheGameLogic->findObjectByID( *it ); + if( specialObject ) + { + if( !initLaser( specialObject, target ) ) + { + return false; + } + } + } + break; + } + + case SPECIAL_INFANTRY_CAPTURE_BUILDING: + case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: + + // PROCESS THE FLASHING WHILE GETTING CAPTURED FX HERE + Object* target = TheGameLogic->findObjectByID( m_targetID ); + + if( !target ) + { + //Target is dead, stop. + return false; + } + + Relationship r = getObject()->getRelationship(target); + if( r == ALLIES ) + { + //It's been captured by a colleague, so cancel! + return false; + } + + if (data->m_doCaptureFX) + { + Drawable *targetDraw = target->getDrawable(); + + if (targetDraw) // skip fx if merely 'invulnerable' + { + Bool lastPhase = ( ((Int)m_captureFlashPhase) & 1 );// were we in a flashy phase last frame? + + Real denominator = MAX(1, data->m_preparationFrames); + Real increment = 1.0f - ((Real)m_prepFrames / denominator ); + m_captureFlashPhase += increment / 3.0f; + + Bool thisPhase = ( ((Int)m_captureFlashPhase) & 1 );// are we in a flashy phase this frame? + + if ( lastPhase && ( ! thisPhase ) ) + { + + RGBColor myHouseColor; + myHouseColor.setFromInt( getObject()->getIndicatorColor() ); + + Real saturation = TheGlobalData->m_selectionFlashSaturationFactor; + targetDraw->saturateRGB( myHouseColor, saturation ); + + targetDraw->flashAsSelected( &myHouseColor ); //In MY house color, not his! + + AudioEventRTS defectorTimerSound = TheAudio->getMiscAudio()->m_defectorTimerTickSound; + defectorTimerSound.setObjectID( m_targetID ); + TheAudio->addAudioEvent(&defectorTimerSound); + + } + } + } + + + SpecialPowerModuleInterface *spmInterface = getMySPM(); + if (spmInterface && spTemplate->getSpecialPowerType() == SPECIAL_INFANTRY_CAPTURE_BUILDING ) + { + // these keep resetting the recharge timer while in use. (srj) // only for infantry capture, not black lotus which resets in triggerAbilityEffect() + spmInterface->startPowerRecharge(); + } + break; + } + return true; +} + +//------------------------------------------------------------------------------------------------- +void SpecialAbilityUpdate::triggerAbilityEffect() +{ + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + const SpecialPowerTemplate *spTemplate = data->m_specialPowerTemplate; + Object *object = getObject(); + + //Award experience to units for triggering the ability (optional and ini specified). + //NOTE: Be award of persistant abilities that call trigger over and over again! + if( data->m_awardXPForTriggering ) + { + ExperienceTracker *xpTracker = object->getExperienceTracker(); + if( xpTracker ) + { + xpTracker->addExperiencePoints( data->m_awardXPForTriggering ); + } + } + //Also add skill points. If unspecified, it'll use the award experience to units for triggering value. + Int skillPoints = data->m_skillPointsForTriggering != -1 ? data->m_skillPointsForTriggering : data->m_awardXPForTriggering; + if( skillPoints > 0 ) + { + Player *player = object->getControllingPlayer(); + if( player ) + { + player->addSkillPoints( skillPoints ); + } + } + + AudioEventRTS sound = data->m_triggerSound; + sound.setObjectID( object->getID() ); + TheAudio->addAudioEvent( &sound ); + + + Bool okToLoseStealth = TRUE; + + switch( spTemplate->getSpecialPowerType() ) + { + case SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES: + { + Object *target = TheGameLogic->findObjectByID( m_targetID ); + if( target ) + { + const Weapon *weapon = object->getWeaponInWeaponSlot( SECONDARY_WEAPON ); + if( weapon ) + { + // lock it just till the weapon is empty or the attack is "done" + object->setWeaponLock( SECONDARY_WEAPON, LOCKED_TEMPORARILY ); + AIUpdateInterface *ai = object->getAIUpdateInterface(); + if( ai ) + { + ai->aiAttackObject( target, NO_MAX_SHOTS_LIMIT, CMD_FROM_AI ); + } + } + } + break; + } + case SPECIAL_HELIX_NAPALM_BOMB: + { + // Couldn't be simpler... the special object is the bomb + createSpecialObject(); + break; + } + case SPECIAL_TANKHUNTER_TNT_ATTACK: + case SPECIAL_TIMED_CHARGES: + case SPECIAL_BOOBY_TRAP: + { + //Place new tnt. + Object *target = TheGameLogic->findObjectByID( m_targetID ); + //sanity + if( !target ) + { + return; + } + + if( target->checkAndDetonateBoobyTrap(getObject()) ) + { + // Whoops, it was mined. Cancel if it or us is now dead. + if( target->isEffectivelyDead() || getObject()->isEffectivelyDead() ) + { + return; + } + } + + if( (spTemplate->getSpecialPowerType() == SPECIAL_BOOBY_TRAP) && target->testStatus(OBJECT_STATUS_BOOBY_TRAPPED) ) + { + // The only way it can be booby trapped after a detonate would be if it is an allied booby trap. + // Regardless of why, we can't double booby trap something. + return; + } + + Object *charge = createSpecialObject(); + if( charge ) + { + static NameKeyType key_StickyBombUpdate = NAMEKEY( "StickyBombUpdate" ); + StickyBombUpdate *update = (StickyBombUpdate*)charge->findUpdateModule( key_StickyBombUpdate ); + if( !update ) + { + DEBUG_ASSERTCRASH( 0, + ("Unit '%s' attempted to place %s on %s but the bomb requires a StickyBombUpdate module.", + object->getTemplate()->getName().str(), + charge->getTemplate()->getName().str(), + target->getTemplate()->getName().str() ) ); + killSpecialObjects(); + return; + } + //Setting the producer ID allows the sticky bomb update module to initialize + //and setup timers, etc. + update->initStickyBomb( target, object ); + + + } + break; + } + case SPECIAL_HACKER_DISABLE_BUILDING: + case SPECIAL_BLACKLOTUS_DISABLE_VEHICLE_HACK: + { + //Disable the target temporarily. + Object *target = TheGameLogic->findObjectByID( m_targetID ); + + //sanity + if( !target ) + { + return; + } + + Relationship r = object->getRelationship(target); + if ( r == ALLIES) + return; + + //Disable the target for a specified amount of time. + target->setDisabledUntil( DISABLED_HACKED, TheGameLogic->getFrame() + data->m_effectDuration ); + + UnsignedInt durationInterleaveFactor = 1; + Real targetFootprintArea = target->getGeometryInfo().getFootprintArea(); + + if ( ( targetFootprintArea < 300) && target->isKindOf( KINDOF_STRUCTURE )) + { + m_doDisableFXParticles = !m_doDisableFXParticles; // toggle if small building + durationInterleaveFactor = 2; + } + + + if ( m_doDisableFXParticles ) + { + const ParticleSystemTemplate *tmp = data->m_disableFXParticleSystem; + if (tmp) + { + ParticleSystem *sys = TheParticleSystemManager->createParticleSystem(tmp); + if (sys) + { + Coord3D offs = {0,0,0}; + target->getGeometryInfo().makeRandomOffsetWithinFootprint( offs ); + + sys->attachToObject(target); + sys->setPosition( &offs ); + sys->setSystemLifetime( data->m_effectDuration * durationInterleaveFactor ); //lifetime of the system, not the particles + + } + } + } + break; + } + + case SPECIAL_INFANTRY_CAPTURE_BUILDING: + case SPECIAL_BLACKLOTUS_CAPTURE_BUILDING: + { + Object *target = TheGameLogic->findObjectByID( m_targetID ); + + //sanity + if( !target ) + { + return; + } + + if( target->checkAndDetonateBoobyTrap(getObject()) ) + { + // Whoops, it was mined. Cancel if it or us is now dead. + if( target->isEffectivelyDead() || getObject()->isEffectivelyDead() ) + { + return; + } + } + + if (target->getTeam() == object->getTeam()) + { + // it's been captured by a colleague! we should stop. + return; + } + + // Just in case we are capturing a building which is already garrisoned by other + ContainModuleInterface * contain = target->getContain(); + if ( contain && contain->isGarrisonable() ) + { + contain->removeAllContained( TRUE ); + break; // we do not want to set a neutral building to our team if we are not in it, that would be confusing! + } + + //Play the "building stolen" EVA event if the local player is the victim! + if( target && target->isLocallyControlled() ) + { + TheEva->setShouldPlay( EVA_BuildingStolen ); + } + + target->defect( object->getControllingPlayer()->getDefaultTeam(), 1); // one frame of flash! + + SpecialPowerModuleInterface *spmInterface = getMySPM(); + if (spmInterface && spTemplate->getSpecialPowerType() == SPECIAL_BLACKLOTUS_CAPTURE_BUILDING ) + { + // only for black lotus, not infantry capture which resets in contunueprep() + spmInterface->startPowerRecharge(); + } + + object->getControllingPlayer()->getAcademyStats()->recordBuildingCapture(); + break; + } + case SPECIAL_BLACKLOTUS_STEAL_CASH_HACK: + { + Object *target = TheGameLogic->findObjectByID( m_targetID ); + + //sanity + if( !target ) + { + return; + } + + //Steal a thousand cash from the other team! + Money *targetMoney = target->getControllingPlayer()->getMoney(); + Money *objectMoney = object->getControllingPlayer()->getMoney(); + if( targetMoney && objectMoney ) + { + UnsignedInt cash = targetMoney->countMoney(); + UnsignedInt desiredAmount = 1000; + //Check to see if they have 1000 cash, otherwise, take the remainder! + cash = min( desiredAmount, cash ); + if( cash > 0 ) + { + //Steal the cash + targetMoney->withdraw( cash ); + objectMoney->deposit( cash ); + Player* controller = object->getControllingPlayer(); + if (controller) + controller->getScoreKeeper()->addMoneyEarned( cash ); + + //Play the "cash stolen" EVA event if the local player is the victim! + if( target && target->isLocallyControlled() ) + { + TheEva->setShouldPlay( EVA_CashStolen ); + } + + //Display cash income floating over the blacklotus + UnicodeString moneyString; + moneyString.format( TheGameText->fetch( "GUI:AddCash" ), cash ); + Coord3D pos; + pos.set( object->getPosition() ); + pos.z += 20.0f; //add a little z to make it show up above the unit. + TheInGameUI->addFloatingText( moneyString, &pos, GameMakeColor( 0, 255, 0, 255 ) ); + + //Display cash lost floating over the target + moneyString.format( TheGameText->fetch( "GUI:LoseCash" ), cash ); + pos.set( target->getPosition() ); + pos.z += 30.0f; //add a little z to make it show up above the unit. + TheInGameUI->addFloatingText( moneyString, &pos, GameMakeColor( 255, 0, 0, 255 ) ); + } + } + break; + } + + case SPECIAL_REMOTE_CHARGES: + { + Object *target = TheGameLogic->findObjectByID( m_targetID ); + + if( target && target->checkAndDetonateBoobyTrap(getObject()) ) + { + // Whoops, it was mined. Cancel if it or us is now dead. + if( target->isEffectivelyDead() || getObject()->isEffectivelyDead() ) + { + return; + } + } + + static NameKeyType key_StickyBombUpdate = NAMEKEY( "StickyBombUpdate" ); + if( m_targetID == INVALID_ID && !m_targetPos.x && !m_targetPos.y && !m_targetPos.z ) + { + //If there is no target object nor position, then we are detonating the existing charges. + std::list::iterator i; + for( i = m_specialObjectIDList.begin(); i != m_specialObjectIDList.end(); ++i ) + { + Object *specialObject = TheGameLogic->findObjectByID( *i ); + if( specialObject ) + { + StickyBombUpdate *update = (StickyBombUpdate*)specialObject->findUpdateModule( key_StickyBombUpdate ); + if( update ) + { + //Blow it up!!! + update->detonate(); + okToLoseStealth = FALSE; + //Note: while the objects are detonating, they will still exist in the game. + //Our update will be responsible for validating their existance and removing them.. + //in case either the enemy player cleans one up, or after it's gone. + } + } + } + } + else + { + //Place a new charge. + //sanity + if( !target ) + { + return; + } + + Object *charge = createSpecialObject(); + if( charge ) + { + StickyBombUpdate *update = (StickyBombUpdate*)charge->findUpdateModule( key_StickyBombUpdate ); + if( !update ) + { + DEBUG_ASSERTCRASH( 0, + ("Unit '%s' attempted to place remote charge but the charge '%s' requires a StickyBombUpdate module.", + object->getTemplate()->getName().str(), + charge->getTemplate()->getName().str() ) ); + killSpecialObjects(); + return; + } + //Setting the producer ID allows the sticky bomb update module to initialize + //and setup timers, etc. + update->initStickyBomb( target, object ); + } + } + break; + } + + case SPECIAL_DISGUISE_AS_VEHICLE: + { + Object *target = TheGameLogic->findObjectByID( m_targetID ); + if( target ) + { + StealthUpdate* update = getObject()->getStealth(); + + if( update ) + { + update->disguiseAsObject( target ); + } + } + + break; + } + } + + if( data->m_loseStealthOnTrigger && okToLoseStealth) + { + StealthUpdate* stealth = getObject()->getStealth(); + if( stealth ) + { + stealth->markAsDetected(); + } + } } //------------------------------------------------------------------------------------------------- Object* SpecialAbilityUpdate::createSpecialObject() { - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - Object *specialObject = NULL; - - if( m_specialObjectEntries == data->m_maxSpecialObjects ) - { - if( data->m_specialObjectsPersistent ) - { - //If we are dealing with persistent objects, and we have reached our - //limit we can have, then don't allow any more to be created.... - //We could add recycling code if need be.. but the logic that handles - //canDoSpecialPowerXXX should prevent this triggering. - return NULL; - } - else - { - //We've reached our limit with non-persistent object(s), so remove them. - killSpecialObjects(); - } - } - - //Get the template of the special object - const ThingTemplate* thingTemplate = TheThingFactory->findTemplate( data->m_specialObjectName ); - if( thingTemplate ) - { - //Create a new special object - specialObject = TheThingFactory->newObject( thingTemplate, getObject()->getTeam() ); - if( specialObject ) - { - m_specialObjectIDList.push_back( specialObject->getID() ); - m_specialObjectEntries++; - specialObject->setPosition( getObject()->getPosition() ); - - specialObject->setOrientation( getObject()->getOrientation() ); - - //So we can get experience from it when it blows up (if applicable) - //specialObject->setProducer( getObject() ); --This causes it to be an enemy which is naughty. - ExperienceTracker *xpTracker = specialObject->getExperienceTracker(); - if( xpTracker ) - { - xpTracker->setExperienceSink( getObject()->getID() ); - } - - - PhysicsBehavior* specialObjectPhysics = specialObject->getPhysics(); - if (specialObjectPhysics) - { - Real pitchRate = specialObjectPhysics->getCenterOfMassOffset(); - specialObjectPhysics->setPitchRate( pitchRate ); - specialObjectPhysics->setAllowAirborneFriction( false ); - } - - - - } - } - return specialObject; + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + Object *specialObject = NULL; + + if( m_specialObjectEntries == data->m_maxSpecialObjects ) + { + if( data->m_specialObjectsPersistent ) + { + //If we are dealing with persistent objects, and we have reached our + //limit we can have, then don't allow any more to be created.... + //We could add recycling code if need be.. but the logic that handles + //canDoSpecialPowerXXX should prevent this triggering. + return NULL; + } + else + { + //We've reached our limit with non-persistent object(s), so remove them. + killSpecialObjects(); + } + } + + //Get the template of the special object + const ThingTemplate* thingTemplate = TheThingFactory->findTemplate( data->m_specialObjectName ); + if( thingTemplate ) + { + //Create a new special object + specialObject = TheThingFactory->newObject( thingTemplate, getObject()->getTeam() ); + if( specialObject ) + { + m_specialObjectIDList.push_back( specialObject->getID() ); + m_specialObjectEntries++; + specialObject->setPosition( getObject()->getPosition() ); + + specialObject->setOrientation( getObject()->getOrientation() ); + + //So we can get experience from it when it blows up (if applicable) + //specialObject->setProducer( getObject() ); --This causes it to be an enemy which is naughty. + ExperienceTracker *xpTracker = specialObject->getExperienceTracker(); + if( xpTracker ) + { + xpTracker->setExperienceSink( getObject()->getID() ); + } + + + PhysicsBehavior* specialObjectPhysics = specialObject->getPhysics(); + if (specialObjectPhysics) + { + Real pitchRate = specialObjectPhysics->getCenterOfMassOffset(); + specialObjectPhysics->setPitchRate( pitchRate ); + specialObjectPhysics->setAllowAirborneFriction( false ); + } + + + + } + } + return specialObject; } //------------------------------------------------------------------------------------------------- void SpecialAbilityUpdate::killSpecialObjects() { - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - const SpecialPowerTemplate *spTemplate = data->m_specialPowerTemplate; - Object *specialObject; - - std::list::iterator i; - for( i = m_specialObjectIDList.begin(); i != m_specialObjectIDList.end(); ++i ) - { - specialObject = TheGameLogic->findObjectByID( *i ); - if( specialObject ) - { - //Delete the old one! - TheGameLogic->destroyObject( specialObject ); - } - } - - //Reset the list - m_specialObjectIDList.clear(); - m_specialObjectEntries = 0; - - switch( spTemplate->getSpecialPowerType() ) - { - case SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES: - //The instant we remove the laser, reset the weaponset! - Object *object = getObject(); - const Weapon *weapon = object->getWeaponInWeaponSlot( PRIMARY_WEAPON ); - if( weapon ) - { - // lock it just till the weapon is empty or the attack is "done" - object->setWeaponLock( PRIMARY_WEAPON, LOCKED_TEMPORARILY ); - } - break; - } + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + const SpecialPowerTemplate *spTemplate = data->m_specialPowerTemplate; + Object *specialObject; + + std::list::iterator i; + for( i = m_specialObjectIDList.begin(); i != m_specialObjectIDList.end(); ++i ) + { + specialObject = TheGameLogic->findObjectByID( *i ); + if( specialObject ) + { + //Delete the old one! + TheGameLogic->destroyObject( specialObject ); + } + } + + //Reset the list + m_specialObjectIDList.clear(); + m_specialObjectEntries = 0; + + switch( spTemplate->getSpecialPowerType() ) + { + case SPECIAL_MISSILE_DEFENDER_LASER_GUIDED_MISSILES: + //The instant we remove the laser, reset the weaponset! + Object *object = getObject(); + const Weapon *weapon = object->getWeaponInWeaponSlot( PRIMARY_WEAPON ); + if( weapon ) + { + // lock it just till the weapon is empty or the attack is "done" + object->setWeaponLock( PRIMARY_WEAPON, LOCKED_TEMPORARILY ); + } + break; + } } //------------------------------------------------------------------------------------------------- UnsignedInt SpecialAbilityUpdate::getSpecialObjectCount() const { - return m_specialObjectEntries; + return m_specialObjectEntries; } //------------------------------------------------------------------------------------------------- UnsignedInt SpecialAbilityUpdate::getSpecialObjectMax() const { - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - return data->m_maxSpecialObjects; + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + return data->m_maxSpecialObjects; } //------------------------------------------------------------------------------------------------- void SpecialAbilityUpdate::validateSpecialObjects() { - Object *specialObject; - - std::list::iterator i = m_specialObjectIDList.begin(); - - while( i != m_specialObjectIDList.end() ) - { - std::list::iterator prev = i; - specialObject = TheGameLogic->findObjectByID( *i ); - i++; - if( !specialObject ) - { - //Remove it from the list, and decrement our counter. - m_specialObjectIDList.erase( prev ); - --m_specialObjectEntries; - } - } + Object *specialObject; + + std::list::iterator i = m_specialObjectIDList.begin(); + + while( i != m_specialObjectIDList.end() ) + { + std::list::iterator prev = i; + specialObject = TheGameLogic->findObjectByID( *i ); + i++; + if( !specialObject ) + { + //Remove it from the list, and decrement our counter. + m_specialObjectIDList.erase( prev ); + --m_specialObjectEntries; + } + } } //------------------------------------------------------------------------------------------------- void SpecialAbilityUpdate::finishAbility() { - const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); - - m_withinStartAbilityRange = false; - m_packingState = STATE_NONE; - - //The flee range code is used only if the unit has completed a special ability against a target. - //If we don't have a valid target, then we don't flee -- the specific example is when Colonel Burton - //uses his remote charge special ability. With a target, he will plant the charge then flee. Without - //a target, he simply detonates it without fleeing. - Bool validTarget = m_targetPos.x || m_targetPos.y || m_targetPos.z || m_targetID != INVALID_ID; - if( data->m_fleeRangeAfterCompletion && validTarget ) - { - Coord3D pos; - pos.set( getObject()->getPosition() ); - - AIUpdateInterface *ai = getObject()->getAIUpdateInterface(); - if( ai ) - { - Coord3D dir; - dir.set( getObject()->getUnitDirectionVector2D() ); + const SpecialAbilityUpdateModuleData* data = getSpecialAbilityUpdateModuleData(); + + m_withinStartAbilityRange = false; + m_packingState = STATE_NONE; + + //The flee range code is used only if the unit has completed a special ability against a target. + //If we don't have a valid target, then we don't flee -- the specific example is when Colonel Burton + //uses his remote charge special ability. With a target, he will plant the charge then flee. Without + //a target, he simply detonates it without fleeing. + Bool validTarget = m_targetPos.x || m_targetPos.y || m_targetPos.z || m_targetID != INVALID_ID; + if( data->m_fleeRangeAfterCompletion && validTarget ) + { + Coord3D pos; + pos.set( getObject()->getPosition() ); + + AIUpdateInterface *ai = getObject()->getAIUpdateInterface(); + if( ai ) + { + Coord3D dir; + dir.set( getObject()->getUnitDirectionVector2D() ); dir.scale( data->m_fleeRangeAfterCompletion ); if( data->m_flipObjectAfterUnpacking || data->m_flipObjectAfterPacking ) diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp index b03784bbb9..fcb126805c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthDetectorUpdate.cpp @@ -342,7 +342,7 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) { rider = *it; - StealthUpdate *stealth = rider->getStealth(); + StealthUpdate *stealth = rider->getStealth(); if ( stealth ) { // we have found someone @@ -364,59 +364,59 @@ UpdateSleepTime StealthDetectorUpdate::update( void ) //Make sure the detector is visible to the local player before we add effects or sounds. if ( self->getShroudedStatus( localPlayer->getPlayerIndex() ) <= OBJECTSHROUD_PARTIAL_CLEAR ) { - if ( self->testStatus( OBJECT_STATUS_STEALTHED ) == FALSE || self->getControllingPlayer() == localPlayer ) - { - Drawable *myDraw = self->getDrawable(); - Coord3D bonePosition = {-1.66f,5.5f,15}; - if (myDraw) - myDraw->getPristineBonePositions( data->m_IRParticleSysBone.str(), 0, &bonePosition, NULL, 1); - - const ParticleSystemTemplate *pingTemplate; - if ( foundSomeone ) - pingTemplate = data->m_IRBrightParticleSysTmpl; - else - pingTemplate = data->m_IRParticleSysTmpl; - - if (pingTemplate) - { - ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( pingTemplate ); - if (sys) - { - if (myDraw) - sys->attachToDrawable( myDraw ); - else - sys->attachToObject( self ); - - sys->setPosition( &bonePosition ); - } - } - - const ParticleSystemTemplate *beaconTemplate = data->m_IRBeaconParticleSysTmpl; - if (beaconTemplate) - { - ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( beaconTemplate );//BEACON - if (sys) - { - if (myDraw) - sys->attachToDrawable( myDraw ); - else - sys->attachToObject( self ); - - sys->setPosition( &bonePosition ); - - } - } - - AudioEventRTS IRPingSound; - if (foundSomeone) - IRPingSound = data->m_loudPingSound; - else - IRPingSound = data->m_pingSound; - - IRPingSound.setObjectID( self->getID() ); - TheAudio->addAudioEvent(&IRPingSound); - - } + if ( self->testStatus( OBJECT_STATUS_STEALTHED ) == FALSE || self->getControllingPlayer() == localPlayer ) + { + Drawable *myDraw = self->getDrawable(); + Coord3D bonePosition = {-1.66f,5.5f,15}; + if (myDraw) + myDraw->getPristineBonePositions( data->m_IRParticleSysBone.str(), 0, &bonePosition, NULL, 1); + + const ParticleSystemTemplate *pingTemplate; + if ( foundSomeone ) + pingTemplate = data->m_IRBrightParticleSysTmpl; + else + pingTemplate = data->m_IRParticleSysTmpl; + + if (pingTemplate) + { + ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( pingTemplate ); + if (sys) + { + if (myDraw) + sys->attachToDrawable( myDraw ); + else + sys->attachToObject( self ); + + sys->setPosition( &bonePosition ); + } + } + + const ParticleSystemTemplate *beaconTemplate = data->m_IRBeaconParticleSysTmpl; + if (beaconTemplate) + { + ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( beaconTemplate );//BEACON + if (sys) + { + if (myDraw) + sys->attachToDrawable( myDraw ); + else + sys->attachToObject( self ); + + sys->setPosition( &bonePosition ); + + } + } + + AudioEventRTS IRPingSound; + if (foundSomeone) + IRPingSound = data->m_loudPingSound; + else + IRPingSound = data->m_pingSound; + + IRPingSound.setObjectID( self->getID() ); + TheAudio->addAudioEvent(&IRPingSound); + + } } // end if doIRFX diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp index 260f86224c..2dbae37476 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp @@ -68,27 +68,27 @@ StealthUpdateModuleData::StealthUpdateModuleData() { - //Added By Sadullah Nader - //Initialization(s) inserted - m_disguiseFX = NULL; - m_disguiseRevealFX = NULL; - // - m_stealthDelay = UINT_MAX; - m_stealthLevel = 0; - m_stealthSpeed = 0.0f; - m_friendlyOpacityMin = 0.5f; - m_friendlyOpacityMax = 1.0f; - m_pulseFrames = 30; - m_teamDisguised = false; - m_revealDistanceFromTarget = 0.0f; - m_orderIdleEnemiesToAttackMeUponReveal = false; - m_innateStealth = true; - m_disguiseTransitionFrames = 0; - m_disguiseRevealTransitionFrames = 0; - m_blackMarketCheckFrames = 0; - m_enemyDetectionEvaEvent = EVA_Invalid; - m_ownDetectionEvaEvent = EVA_Invalid; - m_grantedBySpecialPower = FALSE; + //Added By Sadullah Nader + //Initialization(s) inserted + m_disguiseFX = NULL; + m_disguiseRevealFX = NULL; + // + m_stealthDelay = UINT_MAX; + m_stealthLevel = 0; + m_stealthSpeed = 0.0f; + m_friendlyOpacityMin = 0.5f; + m_friendlyOpacityMax = 1.0f; + m_pulseFrames = 30; + m_teamDisguised = false; + m_revealDistanceFromTarget = 0.0f; + m_orderIdleEnemiesToAttackMeUponReveal = false; + m_innateStealth = true; + m_disguiseTransitionFrames = 0; + m_disguiseRevealTransitionFrames = 0; + m_blackMarketCheckFrames = 0; + m_enemyDetectionEvaEvent = EVA_Invalid; + m_ownDetectionEvaEvent = EVA_Invalid; + m_grantedBySpecialPower = FALSE; } @@ -160,10 +160,10 @@ StealthUpdate::StealthUpdate( Thing *thing, const ModuleData* moduleData ) : Upd } // start active, since some stealths start enabled from the get-go - if ( data->m_grantedBySpecialPower ) - setWakeFrame( getObject(), UPDATE_SLEEP_FOREVER ); - else - setWakeFrame( getObject(), UPDATE_SLEEP_NONE ); + if ( data->m_grantedBySpecialPower ) + setWakeFrame( getObject(), UPDATE_SLEEP_FOREVER ); + else + setWakeFrame( getObject(), UPDATE_SLEEP_NONE ); // we do not need to restore a disguise m_xferRestoreDisguise = FALSE; @@ -237,17 +237,17 @@ void StealthUpdate::receiveGrant( Bool active, UnsignedInt frames ) } } - const ContainModuleInterface *contain = obj->getContain(); - if ( contain && contain->isRiderChangeContain() ) - { - const Object *rider = contain->friend_getRider(); - if ( rider ) - { - StealthUpdate *riderStealth = rider->getStealth(); - if ( riderStealth ) - riderStealth->receiveGrant( active, frames ); - } - } + const ContainModuleInterface *contain = obj->getContain(); + if ( contain && contain->isRiderChangeContain() ) + { + const Object *rider = contain->friend_getRider(); + if ( rider ) + { + StealthUpdate *riderStealth = rider->getStealth(); + if ( riderStealth ) + riderStealth->receiveGrant( active, frames ); + } + } @@ -396,17 +396,17 @@ Bool StealthUpdate::allowedToStealth( Object *stealthOwner ) const } } - //new past-alpha feature, grr... + //new past-alpha feature, grr... if( flags & STEALTH_NOT_WHILE_RIDERS_ATTACKING ) { - ContainModuleInterface *myContain = self->getContain(); - if ( myContain && myContain->isPassengerAllowedToFire() ) - { - if ( myContain->isAnyRiderAttacking() ) - return FALSE; - - } - } + ContainModuleInterface *myContain = self->getContain(); + if ( myContain && myContain->isPassengerAllowedToFire() ) + { + if ( myContain->isAnyRiderAttacking() ) + return FALSE; + + } + } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp index e3fe0ab8c7..fb212ea618 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StickyBombUpdate.cpp @@ -158,8 +158,8 @@ void StickyBombUpdate::initStickyBomb( Object *target, const Object *bomber, con AudioEventRTS soundCreateBomb = *(getObject()->getTemplate()->getPerUnitSound("StickyBombCreated")); soundCreateBomb.setPosition( getObject()->getPosition() ); TheAudio->addAudioEvent(&soundCreateBomb); - - } + + } } //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp index 0f22d5b3a7..a74a82682f 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp @@ -208,7 +208,7 @@ const FieldParse WeaponTemplate::TheWeaponTemplateFieldParseTable[] = { "ContinuousFireOne", INI::parseInt, NULL, offsetof(WeaponTemplate, m_continuousFireOneShotsNeeded) }, { "ContinuousFireTwo", INI::parseInt, NULL, offsetof(WeaponTemplate, m_continuousFireTwoShotsNeeded) }, { "ContinuousFireCoast", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_continuousFireCoastFrames) }, - { "AutoReloadWhenIdle", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_autoReloadWhenIdleFrames) }, + { "AutoReloadWhenIdle", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_autoReloadWhenIdleFrames) }, { "ClipReloadTime", INI::parseDurationUnsignedInt, NULL, offsetof(WeaponTemplate, m_clipReloadTime) }, { "DelayBetweenShots", WeaponTemplate::parseShotDelay, NULL, 0 }, { "ShotsPerBarrel", INI::parseInt, NULL, offsetof(WeaponTemplate, m_shotsPerBarrel) }, @@ -301,7 +301,7 @@ WeaponTemplate::WeaponTemplate() : m_nextTemplate(NULL) m_continuousFireOneShotsNeeded = INT_MAX; m_continuousFireTwoShotsNeeded = INT_MAX; m_continuousFireCoastFrames = 0; - m_autoReloadWhenIdleFrames = 0; + m_autoReloadWhenIdleFrames = 0; m_clipReloadTime = 0; m_minDelayBetweenShots = 0; m_maxDelayBetweenShots = 0; @@ -596,18 +596,16 @@ Real WeaponTemplate::estimateWeaponTemplateDamage( } } - - // hmm.. must be shooting a firebase or such, if there is noone home to take the bullet, return 0! - if ( victimObj->isKindOf( KINDOF_STRUCTURE) && damageType == DAMAGE_SNIPER ) - { - if ( victimObj->getContain() ) - { - if ( victimObj->getContain()->getContainCount() == 0 ) - return 0.0f; - } - } - + // hmm.. must be shooting a firebase or such, if there is noone home to take the bullet, return 0! + if ( victimObj->isKindOf( KINDOF_STRUCTURE) && damageType == DAMAGE_SNIPER ) + { + if ( victimObj->getContain() ) + { + if ( victimObj->getContain()->getContainCount() == 0 ) + return 0.0f; + } + } if (damageType == DAMAGE_SURRENDER || m_allowAttackGarrisonedBldgs) @@ -3004,11 +3002,11 @@ void Weapon::processRequestAssistance( const Object *requestingObject, Object *v } //#if defined(_DEBUG) || defined(_INTERNAL) -// Real muzzleHeight = attachTransform.Get_Z_Translation(); -// DEBUG_ASSERTCRASH( muzzleHeight > 0.001f, ("YOUR TURRET HAS A VERY LOW PROJECTILE LAUNCH POSITION, BUT FOUND A VALID BONE. DID YOU PICK THE WRONG ONE? %s", launcher->getTemplate()->getName().str())); +// Real muzzleHeight = attachTransform.Get_Z_Translation(); +// DEBUG_ASSERTCRASH( muzzleHeight > 0.001f, ("YOUR TURRET HAS A VERY LOW PROJECTILE LAUNCH POSITION, BUT FOUND A VALID BONE. DID YOU PICK THE WRONG ONE? %s", launcher->getTemplate()->getName().str())); //#endif - - launcher->convertBonePosToWorldPos(NULL, &attachTransform, NULL, &worldTransform); + + launcher->convertBonePosToWorldPos(NULL, &attachTransform, NULL, &worldTransform); Vector3 tmp = worldTransform.Get_Translation(); worldPos.x = tmp.X; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp index 771c8a87ef..1a2df57d2a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp @@ -479,17 +479,17 @@ CanAttackResult WeaponSet::getAbleToAttackSpecificObject( AbleToAttackType attac if (victim->testStatus(OBJECT_STATUS_NO_ATTACK_FROM_AI) && commandSource == CMD_FROM_AI) return ATTACKRESULT_NOT_POSSIBLE; - Bool allowStealthToPreventAttacks = TRUE; + Bool allowStealthToPreventAttacks = TRUE; if (source->testStatus(OBJECT_STATUS_IGNORING_STEALTH) || sameOwnerForceAttack) allowStealthToPreventAttacks = FALSE; - if( isForcedAttack( attackType ) && victim->isKindOf( KINDOF_DISGUISER ) ) - { - // force-attack allows you to attack disguised things, which also happen to be stealthed. - // since we normally disallow attacking stealthed things (even via force-fire), we check - // for disguised and explicitly ignore stealth in that case + if( isForcedAttack( attackType ) && victim->isKindOf( KINDOF_DISGUISER ) ) + { + // force-attack allows you to attack disguised things, which also happen to be stealthed. + // since we normally disallow attacking stealthed things (even via force-fire), we check + // for disguised and explicitly ignore stealth in that case if( victim->testStatus( OBJECT_STATUS_DISGUISED ) ) - allowStealthToPreventAttacks = FALSE; - } + allowStealthToPreventAttacks = FALSE; + } // If an object is stealthed and hasn't been detected yet, then it is not a valid target to fire // on. diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp index fdc4613e73..8d48941be8 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp @@ -2147,7 +2147,7 @@ void ScriptActions::doTeamHuntWithCommandButton(const AsciiString& teamName, con case GUICOMMANDMODE_HIJACK_VEHICLE: case GUICOMMANDMODE_CONVERT_TO_CARBOMB: case GUICOMMANDMODE_SABOTAGE_BUILDING: - { + { static NameKeyType key_CommandButtonHuntUpdate = NAMEKEY("CommandButtonHuntUpdate"); CommandButtonHuntUpdate* huntUpdate = (CommandButtonHuntUpdate*)obj->findUpdateModule(key_CommandButtonHuntUpdate); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index 9ebd1bbc2e..53ee26003b 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -6938,7 +6938,7 @@ void ScriptEngine::checkConditionsForTeamNames(Script *pScript) if (!singletonTeamName.isEmpty()) { pScript->setConditionTeamName(singletonTeamName); } - } else { + } else { pScript->setConditionTeamName(multiTeamName); } @@ -7014,7 +7014,7 @@ void ScriptEngine::executeScript( Script *pScript ) // Only do this is there are actually false actions. executeActions(pScript->getFalseAction()); - } + } } } else { @@ -7789,14 +7789,14 @@ void ScriptEngine::removeAllSequentialScripts(Object *obj) for (it = m_sequentialScripts.begin(); it != m_sequentialScripts.end(); /* empty */) { SequentialScript *seqScript = (*it); if (!seqScript) { - ++it; + ++it; continue; } if (seqScript->m_objectID == id) { it = cleanupSequentialScript(it, TRUE); } - else - ++it; + else + ++it; } } @@ -10351,4 +10351,3 @@ static void _cleanUpVTune() VTResume = NULL; } #endif // VTUNE - diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp index 4f8bd84303..4411ad568c 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/Scripts.cpp @@ -1988,18 +1988,16 @@ AsciiString Parameter::getUiText(void) const default : DEBUG_CRASH(("Unknown Radar event type.")); } break; - - case LEFT_OR_RIGHT: - switch (m_int) - { - case EVAC_BURST_FROM_CENTER: uiText.format("normal (burst from center)"); break; - case EVAC_TO_LEFT: uiText.format("left"); break; - case EVAC_TO_RIGHT: uiText.format("right"); break; - default : uiText.format("unspecified"); break; - } - break; - + case LEFT_OR_RIGHT: + switch (m_int) + { + case EVAC_BURST_FROM_CENTER: uiText.format("normal (burst from center)"); break; + case EVAC_TO_LEFT: uiText.format("left"); break; + case EVAC_TO_RIGHT: uiText.format("right"); break; + default : uiText.format("unspecified"); break; + } + break; case DIALOG: uiText.format("'%s'", uiString.str()); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp index 9d5339359a..e552ec9353 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp @@ -136,9 +136,6 @@ extern void externalAddTree(Coord3D location, Real scale, Real angle, AsciiStrin //#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes") #endif - - - // I'm making this larger now that we know how big our maps are going to be. enum { OBJ_HASH_SIZE = 8192 }; @@ -625,7 +622,7 @@ LoadScreen *GameLogic::getLoadScreen( Bool loadingSaveGame ) { case GAME_SHELL: return NEW ShellGameLoadScreen; - break; + break; case GAME_SINGLE_PLAYER: { Campaign* currentCampaign = TheCampaignManager->getCurrentCampaign(); @@ -2332,18 +2329,18 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) TheGameSpyBuddyMessageQueue->addRequest(req); } - if( loadingSaveGame == FALSE ) - { - // Drawables need to do some work on level start; give them a chance to do it - Drawable * drawable = TheGameClient->getDrawableList(); - - while ( drawable != NULL ) - { - drawable->onLevelStart(); - drawable = drawable->getNextDrawable(); - } - } - + if( loadingSaveGame == FALSE ) + { + // Drawables need to do some work on level start; give them a chance to do it + Drawable * drawable = TheGameClient->getDrawableList(); + + while ( drawable != NULL ) + { + drawable->onLevelStart(); + drawable = drawable->getNextDrawable(); + } + } + //Added By Sadullah Nader //Added to fix the quit menu //ReAllows quit menu to work during loading scene @@ -2361,11 +2358,11 @@ void GameLogic::startNewGame( Bool loadingSaveGame ) if (TheGameSpyInfo) TheGameSpyInfo->updateAdditionalGameSpyDisconnections(1); - - if ( isInReplayGame() && TheInGameUI && TheGameText ) - { + + if ( isInReplayGame() && TheInGameUI && TheGameText ) + { TheInGameUI->message( TheGameText->fetch( "GUI:FastForwardInstructions" ) ); - } + } } // end startNewGame @@ -2522,7 +2519,6 @@ void GameLogic::processDestroyList( void ) DEBUG_ASSERTCRASH(sleepyUpdatesForThisObject[numSUO]->friend_getIndexInLogic() == -1, ("Hmm, expected index to be -1 here")); } - currentObject->removeFromList(&m_objList);//remove from object list // remove object from lookup table @@ -3048,11 +3044,6 @@ void GameLogic::friend_awakenUpdateModule(Object* obj, UpdateModulePtr u, Unsign } - - - - - // ------------------------------------------------------------------------------------------------ #ifdef DO_UNIT_TIMINGS @@ -3224,41 +3215,41 @@ static void unitTimings(void) thingName = "No Object"; } - sprintf(remark, "All %f: (%d ms) for %d %s's\n", timeAll, (Int)(timeAll*1000/TIME_FRAMES), TOTAL_UNITS, thingName.str() ); - DEBUG_LOG((remark)); - drawGraph( "@", graphScale, timeAll ); + sprintf(remark, "All %f: (%d ms) for %d %s's\n", timeAll, (Int)(timeAll*1000/TIME_FRAMES), TOTAL_UNITS, thingName.str() ); + DEBUG_LOG((remark)); + drawGraph( "@", graphScale, timeAll ); sprintf(remark, "Without Particles %f\n", timeNoPart); - DEBUG_LOG((remark)); - drawGraph( "@", graphScale, timeNoPart ); - - sprintf(remark, "Without Spawn %f \n", timeNoSpawn ); - DEBUG_LOG((remark)); - drawGraph( "@", graphScale, timeNoSpawn ); + DEBUG_LOG((remark)); + drawGraph( "@", graphScale, timeNoPart ); + + sprintf(remark, "Without Spawn %f \n", timeNoSpawn ); + DEBUG_LOG((remark)); + drawGraph( "@", graphScale, timeNoSpawn ); sprintf(remark, "Logic %f \n", timeLogic); - DEBUG_LOG((remark)); - drawGraph( "@", graphScale, timeLogic ); - - + DEBUG_LOG((remark)); + drawGraph( "@", graphScale, timeLogic ); + + sprintf(remark, "DrawCalls for %s \n", thingName.str() ) ; DEBUG_LOG((remark)); sprintf(remark, "All %f\n", drawCallAll ); DEBUG_LOG((remark)); - drawGraph( "#", graphScale, drawCallAll ); + drawGraph( "#", graphScale, drawCallAll ); sprintf(remark, "Without Particles %f\n", drawCallNoPart ); DEBUG_LOG((remark)); - drawGraph( "#", graphScale, drawCallNoPart ); + drawGraph( "#", graphScale, drawCallNoPart ); sprintf(remark, "Without Spawn %f \n", drawCallNoSpawn ); DEBUG_LOG((remark)); - drawGraph( "#", graphScale, drawCallNoSpawn ); + drawGraph( "#", graphScale, drawCallNoSpawn ); sprintf(remark, "Draw Call Logic %f \n", drawCallLogic ); DEBUG_LOG((remark)); - drawGraph( "#", graphScale, drawCallLogic ); + drawGraph( "#", graphScale, drawCallLogic ); if (g_UT_timingLog) { @@ -3347,15 +3338,15 @@ static void unitTimings(void) side++; unitTypes = INFANTRY; if (sides[side].isEmpty() ) // end of sides list - { + { g_UT_startTiming = false; if (g_UT_timingLog) - { + { fclose(g_UT_timingLog); g_UT_timingLog = NULL; } if (g_UT_commaLog) - { + { fclose(g_UT_commaLog); g_UT_commaLog = NULL; } @@ -3816,10 +3807,6 @@ void GameLogic::update( void ) } } - - - - // increment world time if (!m_startNewGame) { @@ -4690,7 +4677,7 @@ void GameLogic::prepareLogicForObjectLoad( void ) // ------------------------------------------------------------------------------------------------ void GameLogic::xfer( Xfer *xfer ) { - + // version const XferVersion currentVersion = 10; XferVersion version = currentVersion; @@ -5005,14 +4992,14 @@ void GameLogic::xfer( Xfer *xfer ) xfer->xferInt(&m_rankPointsToAddAtGameStart); } - if ( version >= 10 ) - { - xfer->xferUnsignedShort( &m_superweaponRestriction ); - } - else if ( xfer->getXferMode() == XFER_LOAD ) - { - m_superweaponRestriction = 0; - } + if ( version >= 10 ) + { + xfer->xferUnsignedShort( &m_superweaponRestriction ); + } + else if ( xfer->getXferMode() == XFER_LOAD ) + { + m_superweaponRestriction = 0; + } } // end xfer // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp index 2434afa6e6..22a7b70ef2 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogicDispatch.cpp @@ -933,6 +933,7 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) } break; } + //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DEBUG_HURT_OBJECT: { @@ -962,8 +963,6 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) #endif - - #ifdef ALLOW_SURRENDER //--------------------------------------------------------------------------------------------- case GameMessage::MSG_DO_SURRENDER: diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp index 87d0ee08cf..da8333ed61 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/FirewallHelper.cpp @@ -456,6 +456,7 @@ UnsignedShort FirewallHelperClass::getManglerResponse(UnsignedShort packetID, In } Int retval = m_spareSockets[i].udp->Read((unsigned char *)message, sizeof(ManglerData), &addr); if (retval > 0) { + CRC crc; crc.computeCRC((unsigned char *)(&(message->data.magic)), sizeof(ManglerData) - sizeof(unsigned int)); if (crc.get() != htonl(message->data.CRC)) { diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp index a1f2da82d6..46703f8fa4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp @@ -327,40 +327,40 @@ void PopulateTeamComboBox(Int comboBox, GameWindow *comboArray[], GameInfo *myGa // ----------------------------------------------------------------------------- static UnicodeString formatMoneyForStartingCashComboBox( const Money & moneyAmount ) { - UnicodeString rtn; - rtn.format( TheGameText->fetch( "GUI:StartingMoneyFormat" ), moneyAmount.countMoney() ); - return rtn; + UnicodeString rtn; + rtn.format( TheGameText->fetch( "GUI:StartingMoneyFormat" ), moneyAmount.countMoney() ); + return rtn; } void PopulateStartingCashComboBox(GameWindow *comboBox, GameInfo *myGame) { - GadgetComboBoxReset(comboBox); - - const MultiplayerStartingMoneyList & startingCashMap = TheMultiplayerSettings->getStartingMoneyList(); - Int currentSelectionIndex = -1; - - MultiplayerStartingMoneyList::const_iterator it = startingCashMap.begin(); - for ( ; it != startingCashMap.end(); it++ ) - { - Int newIndex = GadgetComboBoxAddEntry(comboBox, formatMoneyForStartingCashComboBox( *it ), - comboBox->winGetEnabled() ? comboBox->winGetEnabledTextColor() : comboBox->winGetDisabledTextColor()); - GadgetComboBoxSetItemData(comboBox, newIndex, (void *)it->countMoney()); - - if ( myGame->getStartingCash().amountEqual( *it ) ) - { - currentSelectionIndex = newIndex; - } - } - - if ( currentSelectionIndex == -1 ) - { - DEBUG_CRASH( ("Current selection for starting cash not found in list") ); - currentSelectionIndex = GadgetComboBoxAddEntry(comboBox, formatMoneyForStartingCashComboBox( myGame->getStartingCash() ), - comboBox->winGetEnabled() ? comboBox->winGetEnabledTextColor() : comboBox->winGetDisabledTextColor()); - GadgetComboBoxSetItemData(comboBox, currentSelectionIndex, (void *)it->countMoney() ); - } - - GadgetComboBoxSetSelectedPos(comboBox, currentSelectionIndex); + GadgetComboBoxReset(comboBox); + + const MultiplayerStartingMoneyList & startingCashMap = TheMultiplayerSettings->getStartingMoneyList(); + Int currentSelectionIndex = -1; + + MultiplayerStartingMoneyList::const_iterator it = startingCashMap.begin(); + for ( ; it != startingCashMap.end(); it++ ) + { + Int newIndex = GadgetComboBoxAddEntry(comboBox, formatMoneyForStartingCashComboBox( *it ), + comboBox->winGetEnabled() ? comboBox->winGetEnabledTextColor() : comboBox->winGetDisabledTextColor()); + GadgetComboBoxSetItemData(comboBox, newIndex, (void *)it->countMoney()); + + if ( myGame->getStartingCash().amountEqual( *it ) ) + { + currentSelectionIndex = newIndex; + } + } + + if ( currentSelectionIndex == -1 ) + { + DEBUG_CRASH( ("Current selection for starting cash not found in list") ); + currentSelectionIndex = GadgetComboBoxAddEntry(comboBox, formatMoneyForStartingCashComboBox( myGame->getStartingCash() ), + comboBox->winGetEnabled() ? comboBox->winGetEnabledTextColor() : comboBox->winGetDisabledTextColor()); + GadgetComboBoxSetItemData(comboBox, currentSelectionIndex, (void *)it->countMoney() ); + } + + GadgetComboBoxSetSelectedPos(comboBox, currentSelectionIndex); } // ----------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp index 4896328827..0ec4c168bc 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameInfo.cpp @@ -311,16 +311,16 @@ void GameInfo::reset( void ) m_seed = GetTickCount(); //GameClientRandomValue(0, INT_MAX - 1); m_useStats = TRUE; m_surrendered = FALSE; - m_oldFactionsOnly = FALSE; + m_oldFactionsOnly = FALSE; // Added By Sadullah Nader // Initializations missing and needed // m_localIP = 0; // BGC - actually we don't want this to be reset since the m_localIP is // set properly in the constructor of LANGameInfo which uses this as a base class. m_mapCRC = 0; m_mapSize = 0; - m_superweaponRestriction = 0; - m_startingCash = TheGlobalData->m_defaultStartingCash; - + m_superweaponRestriction = 0; + m_startingCash = TheGlobalData->m_defaultStartingCash; + // for (Int i=0; isetSeed(seed); game->setCRCInterval(crc); game->setUseStats(useStats); - game->setSuperweaponRestriction(restriction); - game->setStartingCash( startingCash ); - game->setOldFactionsOnly( oldFactionsOnly ); + game->setSuperweaponRestriction(restriction); + game->setStartingCash( startingCash ); + game->setOldFactionsOnly( oldFactionsOnly ); return true; } @@ -1591,24 +1591,24 @@ void SkirmishGameInfo::xfer( Xfer *xfer ) xfer->xferInt(&m_mapMask); xfer->xferInt(&m_seed); - if ( version >= 3 ) - { - xfer->xferUnsignedShort( &m_superweaponRestriction ); - - if ( version == 3 ) - { - // Version 3 had a bool which is now gone - Bool obsoleteBool; - xfer->xferBool( &obsoleteBool ); - } - - xfer->xferSnapshot( &m_startingCash ); - } - else if ( xfer->getXferMode() == XFER_LOAD ) - { - m_superweaponRestriction = 0; - m_startingCash = TheGlobalData->m_defaultStartingCash; - } + if ( version >= 3 ) + { + xfer->xferUnsignedShort( &m_superweaponRestriction ); + + if ( version == 3 ) + { + // Version 3 had a bool which is now gone + Bool obsoleteBool; + xfer->xferBool( &obsoleteBool ); + } + + xfer->xferSnapshot( &m_startingCash ); + } + else if ( xfer->getXferMode() == XFER_LOAD ) + { + m_superweaponRestriction = 0; + m_startingCash = TheGlobalData->m_defaultStartingCash; + } } // end xfer diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp index d1ef80fcbb..26a0ba1df4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/LobbyUtils.cpp @@ -77,7 +77,7 @@ static enum { COLUMN_NUMPLAYERS, COLUMN_PASSWORD, COLUMN_OBSERVER, - COLUMN_USE_STATS, + COLUMN_USE_STATS, COLUMN_PING, }; @@ -252,18 +252,18 @@ static void gameTooltip(GameWindow *window, TheMouse->setCursorTooltip( UnicodeString::TheEmptyString ); return; } - if (col == COLUMN_USE_STATS) - { - if ( room->getUseStats() ) - { - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:UseStatsOn") ); - } - else - { - TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:UseStatsOff") ); - } - return; - } + if (col == COLUMN_USE_STATS) + { + if ( room->getUseStats() ) + { + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:UseStatsOn") ); + } + else + { + TheMouse->setCursorTooltip( TheGameText->fetch("TOOLTIP:UseStatsOff") ); + } + return; + } UnicodeString tooltip; @@ -648,15 +648,15 @@ static Int insertGame( GameWindow *win, GameSpyStagingRoom *game, Bool showMap ) GadgetListBoxAddEntryText(win, UnicodeString(L" "), gameColor, index, COLUMN_OBSERVER); } - { - if (game->getUseStats()) - { - const Image *img = TheMappedImageCollection->findImageByName("GoodStatsIcon"); - GadgetListBoxAddEntryImage(win, img, index, COLUMN_USE_STATS, img->getImageHeight(), img->getImageWidth()); + { + if (game->getUseStats()) + { + const Image *img = TheMappedImageCollection->findImageByName("GoodStatsIcon"); + GadgetListBoxAddEntryImage(win, img, index, COLUMN_USE_STATS, img->getImageHeight(), img->getImageWidth()); + } + } - - } - + s.format(L"%d", game->getPingAsInt()); GadgetListBoxAddEntryText(win, s, gameColor, index, COLUMN_PING); Int ping = game->getPingAsInt(); diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp index c4a94f92fc..1a433037cd 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/PeerDefs.cpp @@ -529,20 +529,20 @@ void GameSpyInfo::markAsStagingRoomHost( void ) { m_localStagingRoomID = 0; m_joinedStagingRoom = FALSE; m_isHosting = TRUE; - - // There are a few options we don't want to reset when we are hosting (they carry over - // from the the create game dialog). - // Interesting fact: oldFactionsOnly will be carried over correctly if I remove these - // lines. UseStats won't be. I have no idea why. - Int useStats = m_localStagingRoom.getUseStats(); - Bool oldFactionsOnly = m_localStagingRoom.oldFactionsOnly(); - - m_localStagingRoom.reset(); + + // There are a few options we don't want to reset when we are hosting (they carry over + // from the the create game dialog). + // Interesting fact: oldFactionsOnly will be carried over correctly if I remove these + // lines. UseStats won't be. I have no idea why. + Int useStats = m_localStagingRoom.getUseStats(); + Bool oldFactionsOnly = m_localStagingRoom.oldFactionsOnly(); + + m_localStagingRoom.reset(); m_localStagingRoom.enterGame(); m_localStagingRoom.setSeed(GetTickCount()); - - m_localStagingRoom.setUseStats( useStats ); - m_localStagingRoom.setOldFactionsOnly( oldFactionsOnly ); + + m_localStagingRoom.setUseStats( useStats ); + m_localStagingRoom.setOldFactionsOnly( oldFactionsOnly ); GameSlot newSlot; UnicodeString uName; diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp index bad4c6c738..20e797cb5e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GameSpy/Thread/PeerThread.cpp @@ -103,7 +103,7 @@ enum INICRC_KEY, PW_KEY, OBS_KEY, - USE_STATS_KEY, + USE_STATS_KEY, LADIP_KEY, LADPORT_KEY, PINGSTR_KEY, @@ -121,7 +121,7 @@ enum #define INICRC_STR "iniCRC" #define PW_STR "pw" #define OBS_STR "obs" -#define USE_STATS_STR "stat" +#define USE_STATS_STR "stat" #define LADIP_STR "ladIP" #define LADPORT_STR "ladPort" #define PINGSTR_STR "pings" @@ -191,7 +191,7 @@ class PeerThreadClass : public ThreadClass //Added By Sadullah Nader //Initializations inserted m_roomJoined = m_allowObservers = m_hasPassword = FALSE; - m_useStats = TRUE; + m_useStats = TRUE; m_exeCRC = m_iniCRC = 0; m_gameVersion = 0; m_ladderPort = 0; @@ -244,7 +244,7 @@ class PeerThreadClass : public ThreadClass void stopHostingAlready(PEER peer); Bool hasPassword( void ) { return m_hasPassword; } Bool allowObservers( void ) { return m_allowObservers; } - Bool useStats(void) const { return m_useStats; } + Bool useStats(void) const { return m_useStats; } std::string getMapName( void ) { return m_mapName; } UnsignedInt exeCRC( void ) { return m_exeCRC; } UnsignedInt iniCRC( void ) { return m_iniCRC; } @@ -316,7 +316,7 @@ class PeerThreadClass : public ThreadClass UnsignedInt m_iniCRC; UnsignedInt m_gameVersion; Bool m_allowObservers; - Bool m_useStats; + Bool m_useStats; std::string m_pingStr; std::string m_ladderIP; UnsignedShort m_ladderPort; @@ -816,9 +816,9 @@ static void QRServerKeyCallback case OBS_KEY: ADDINT(t->allowObservers()); break; - case USE_STATS_KEY: - ADDINT(t->useStats()); - break; + case USE_STATS_KEY: + ADDINT(t->useStats()); + break; case LADIP_KEY: ADD(t->ladderIP().c_str()); break; @@ -963,7 +963,7 @@ static void QRKeyListCallback qr2_keybuffer_add(keyBuffer, INICRC_KEY); qr2_keybuffer_add(keyBuffer, PW_KEY); qr2_keybuffer_add(keyBuffer, OBS_KEY); - qr2_keybuffer_add(keyBuffer, USE_STATS_KEY); + qr2_keybuffer_add(keyBuffer, USE_STATS_KEY); qr2_keybuffer_add(keyBuffer, LADIP_KEY); qr2_keybuffer_add(keyBuffer, LADPORT_KEY); qr2_keybuffer_add(keyBuffer, PINGSTR_KEY); @@ -1214,7 +1214,7 @@ void PeerThreadClass::Thread_Function() qr2_register_key(INICRC_KEY, INICRC_STR); qr2_register_key(PW_KEY, PW_STR); qr2_register_key(OBS_KEY, OBS_STR); - qr2_register_key(USE_STATS_KEY, USE_STATS_STR); + qr2_register_key(USE_STATS_KEY, USE_STATS_STR); qr2_register_key(LADIP_KEY, LADIP_STR); qr2_register_key(LADPORT_KEY, LADPORT_STR); qr2_register_key(PINGSTR_KEY, PINGSTR_STR); @@ -1244,7 +1244,7 @@ void PeerThreadClass::Thread_Function() INICRC_KEY, PW_KEY, OBS_KEY, - USE_STATS_KEY, + USE_STATS_KEY, LADIP_KEY, LADPORT_KEY, PINGSTR_KEY, @@ -1252,7 +1252,7 @@ void PeerThreadClass::Thread_Function() NUMPLAYER_KEY, MAXPLAYER_KEY, HOSTNAME_KEY - }; + }; /* const char *allKeys = "\\pid_\\mapname\\gamever\\gamename" \ @@ -1644,7 +1644,7 @@ void PeerThreadClass::Thread_Function() s_wantStateChangedHeartbeat = FALSE; m_isHosting = TRUE; m_allowObservers = incomingRequest.stagingRoomCreation.allowObservers; - m_useStats = incomingRequest.stagingRoomCreation.useStats; + m_useStats = incomingRequest.stagingRoomCreation.useStats; m_mapName = ""; for (Int i=0; igetLANSlot( m_currentGame->getLocalSlotNum() )->getColor()); pref["Color"] = option; if (m_currentGame->amIHost()) - { - pref["Map"] = AsciiStringToQuotedPrintable(m_currentGame->getMap()); - pref.setSuperweaponRestricted( m_currentGame->getSuperweaponRestriction() > 0 ); - pref.setStartingCash( m_currentGame->getStartingCash() ); - } + { + pref["Map"] = AsciiStringToQuotedPrintable(m_currentGame->getMap()); + pref.setSuperweaponRestricted( m_currentGame->getSuperweaponRestriction() > 0 ); + pref.setStartingCash( m_currentGame->getStartingCash() ); + } pref.write(); m_isInLANMenu = FALSE; diff --git a/GeneralsMD/Code/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h b/GeneralsMD/Code/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h index 0e982e5977..996fe55b1f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h @@ -226,8 +226,7 @@ class MilesAudioManager : public AudioManager virtual void closeAnySamplesUsingFile( const void *fileToClose ); - - virtual Bool has3DSensitiveStreamsPlaying( void ) const; + virtual Bool has3DSensitiveStreamsPlaying( void ) const; protected: diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTerrainVisual.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTerrainVisual.h index 5d75cc4c98..04aaa89251 100644 --- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTerrainVisual.h +++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DTerrainVisual.h @@ -41,12 +41,6 @@ class WaterHandle; class BaseHeightMapRenderObjClass; class WorldHeightMap; - - - - - - //------------------------------------------------------------------------------------------------- /** W3D impelmentation of visual terrain details singleton */ //------------------------------------------------------------------------------------------------- @@ -134,24 +128,24 @@ class W3DTerrainVisual : public TerrainVisual /// Replace the skybox texture virtual void replaceSkyboxTextures(const AsciiString *oldTexName[NumSkyboxTextures], const AsciiString *newTexName[NumSkyboxTextures]); - //////////////////////////////////////////////////// - //////////////////////////////////////////////////// - //////////////////////////////////////////////////// + //////////////////////////////////////////////////// + //////////////////////////////////////////////////// + //////////////////////////////////////////////////// #ifdef DO_SEISMIC_SIMULATIONS - virtual void addSeismicSimulation( const SeismicSimulationNode& sim ); + virtual void addSeismicSimulation( const SeismicSimulationNode& sim ); #endif - WorldHeightMap* getLogicHeightMap( void ) {return m_logicHeightMap;}; - WorldHeightMap* getClientHeightMap( void ) - { + WorldHeightMap* getLogicHeightMap( void ) {return m_logicHeightMap;}; + WorldHeightMap* getClientHeightMap( void ) + { #ifdef DO_SEISMIC_SIMULATIONS - return m_clientHeightMap; + return m_clientHeightMap; #else - return m_logicHeightMap; + return m_logicHeightMap; #endif - } - //////////////////////////////////////////////////// - //////////////////////////////////////////////////// - //////////////////////////////////////////////////// + } + //////////////////////////////////////////////////// + //////////////////////////////////////////////////// + //////////////////////////////////////////////////// @@ -166,16 +160,16 @@ class W3DTerrainVisual : public TerrainVisual #ifdef DO_SEISMIC_SIMULATIONS - //////////////////////////////////////////////////// - //////////////////////////////////////////////////// - //////////////////////////////////////////////////// - virtual void handleSeismicSimulations( void ); - SeismicSimulationList m_seismicSimulationList; - virtual void updateSeismicSimulations( void ); /// walk the SeismicSimulationList and, well, do it. - - //////////////////////////////////////////////////// - //////////////////////////////////////////////////// - //////////////////////////////////////////////////// + //////////////////////////////////////////////////// + //////////////////////////////////////////////////// + //////////////////////////////////////////////////// + virtual void handleSeismicSimulations( void ); + SeismicSimulationList m_seismicSimulationList; + virtual void updateSeismicSimulations( void ); /// walk the SeismicSimulationList and, well, do it. + + //////////////////////////////////////////////////// + //////////////////////////////////////////////////// + //////////////////////////////////////////////////// #endif @@ -183,15 +177,15 @@ class W3DTerrainVisual : public TerrainVisual BaseHeightMapRenderObjClass *m_terrainRenderObject; ///< W3D render object for terrain WaterRenderObjClass *m_waterRenderObject; ///< W3D render object for water plane - WorldHeightMap *m_logicHeightMap; ///< height map used for render obj building - + WorldHeightMap *m_logicHeightMap; ///< height map used for render obj building + #ifdef DO_SEISMIC_SIMULATIONS - WorldHeightMap *m_clientHeightMap; ///< this is a workspace for animating the terrain elevations + WorldHeightMap *m_clientHeightMap; ///< this is a workspace for animating the terrain elevations #endif - + Bool m_isWaterGridRenderingEnabled; - - AsciiString m_currentSkyboxTexNames[NumSkyboxTextures]; ///m_width) m_drawWidthX = m_width;} inline void setDrawHeight(Int height) {m_drawHeightY = height; if (m_drawHeightY>m_height) m_drawHeightY = m_height;} virtual Int getBorderSize(void) {return m_borderSize;} - inline Int getBorderSizeInline(void) const { return m_borderSize; } + inline Int getBorderSizeInline(void) const { return m_borderSize; } /// Get height with the offset that HeightMapRenderObjClass uses built in. inline UnsignedByte getDisplayHeight(Int x, Int y) { return m_data[x+m_drawOriginX+m_width*(y+m_drawOriginY)];} diff --git a/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp index f8373631e0..650b4dd32c 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp @@ -474,10 +474,10 @@ void MilesAudioManager::reset() AudioManager::reset(); stopAllAudioImmediately(); - removeAllAudioRequests(); - // This must come after stopAllAudioImmediately() and removeAllAudioRequests(), to ensure that - // sounds pointing to the temporary AudioEventInfo handles are deleted before their info is deleted - removeLevelSpecificAudioEventInfos(); + removeAllAudioRequests(); + // This must come after stopAllAudioImmediately() and removeAllAudioRequests(), to ensure that + // sounds pointing to the temporary AudioEventInfo handles are deleted before their info is deleted + removeLevelSpecificAudioEventInfos(); } //------------------------------------------------------------------------------------------------- @@ -1166,16 +1166,16 @@ void MilesAudioManager::stopAllAudioImmediately( void ) it = m_playingStreams.erase(it); } - for (it = m_fadingAudio.begin(); it != m_fadingAudio.end(); ) { - playing = (*it); - if (!playing) { - continue; - } - - releasePlayingAudio(playing); - it = m_fadingAudio.erase(it); - } - + for (it = m_fadingAudio.begin(); it != m_fadingAudio.end(); ) { + playing = (*it); + if (!playing) { + continue; + } + + releasePlayingAudio(playing); + it = m_fadingAudio.erase(it); + } + std::list::iterator hit; for (hit = m_audioForcePlayed.begin(); hit != m_audioForcePlayed.end(); ++hit) { if (*hit) { @@ -2404,28 +2404,28 @@ void MilesAudioManager::processPlayingList( void ) Bool MilesAudioManager::has3DSensitiveStreamsPlaying( void ) const { - if ( m_playingStreams.empty() ) - return FALSE; + if ( m_playingStreams.empty() ) + return FALSE; for ( std::list< PlayingAudio* >::const_iterator it = m_playingStreams.begin(); it != m_playingStreams.end(); ++it ) - { + { const PlayingAudio *playing = (*it); - if ( ! playing ) - continue; + if ( ! playing ) + continue; - if ( playing->m_audioEventRTS->getAudioEventInfo()->m_soundType != AT_Music ) - { - return TRUE; - } + if ( playing->m_audioEventRTS->getAudioEventInfo()->m_soundType != AT_Music ) + { + return TRUE; + } - if ( playing->m_audioEventRTS->getEventName().startsWith("Game_") == FALSE ) - { - return TRUE; - } - } - - return FALSE; + if ( playing->m_audioEventRTS->getEventName().startsWith("Game_") == FALSE ) + { + return TRUE; + } + } + + return FALSE; } @@ -2529,14 +2529,14 @@ Bool MilesAudioManager::checkForSample( AudioRequest *req ) return true; } - if ( req->m_pendingEvent->getAudioEventInfo() == NULL ) - { - // Fill in event info - getInfoForAudioEvent( req->m_pendingEvent ); - } - + if ( req->m_pendingEvent->getAudioEventInfo() == NULL ) + { + // Fill in event info + getInfoForAudioEvent( req->m_pendingEvent ); + } + if (req->m_pendingEvent->getAudioEventInfo()->m_type != AT_SoundEffect) - { + { return true; } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp index dde2736450..fcef4dab14 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp @@ -225,7 +225,7 @@ VideoStreamInterface* BinkVideoPlayer::open( AsciiString movieTitle ) const Video* pVideo = getVideo(movieTitle); if (pVideo) { DEBUG_LOG(("BinkVideoPlayer::createStream() - About to open bink file\n")); - + if (TheGlobalData->m_modDir.isNotEmpty()) { char filePath[ _MAX_PATH ]; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp index 51ba67de2e..86f0772f35 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/Common/System/W3DRadar.cpp @@ -696,7 +696,7 @@ void W3DRadar::renderObjectList( const RadarObject *listHead, TextureClass *text if( obj->testStatus( OBJECT_STATUS_STEALTHED ) ) { if ( ThePlayerList->getLocalPlayer()->getRelationship(obj->getTeam()) == ENEMIES ) - if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !obj->testStatus( OBJECT_STATUS_DISGUISED ) ) + if( !obj->testStatus( OBJECT_STATUS_DETECTED ) && !obj->testStatus( OBJECT_STATUS_DISGUISED ) ) skip = TRUE; UnsignedByte r, g, b, a; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp index 1b9f4fe947..327d38db26 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DDependencyModelDraw.cpp @@ -93,25 +93,25 @@ void W3DDependencyModelDraw::doDrawModule(const Matrix3D* transformMtx) W3DModelDraw::doDrawModule( transformMtx ); m_dependencyCleared = FALSE; - - // A handy place to synchronize my drawable with container's - Drawable *myDrawable = getDrawable(); - if ( ! myDrawable ) - return; - - const Object *me = myDrawable->getObject(); - if ( ! me ) - return; - - Drawable *theirDrawable = NULL; - - if( me->getContainedBy() && !me->getContainedBy()->getContain()->isEnclosingContainerFor(me) ) - theirDrawable = me->getContainedBy()->getDrawable(); - if( ! theirDrawable ) - return; + // A handy place to synchronize my drawable with container's + Drawable *myDrawable = getDrawable(); + if ( ! myDrawable ) + return; + + const Object *me = myDrawable->getObject(); + if ( ! me ) + return; + + Drawable *theirDrawable = NULL; + + if( me->getContainedBy() && !me->getContainedBy()->getContain()->isEnclosingContainerFor(me) ) + theirDrawable = me->getContainedBy()->getDrawable(); + + if( ! theirDrawable ) + return; - myDrawable->imitateStealthLook( *theirDrawable ); + myDrawable->imitateStealthLook( *theirDrawable ); } } @@ -149,7 +149,7 @@ void W3DDependencyModelDraw::adjustTransformMtx(Matrix3D& mtx) const } else { - mtx = *theirDrawable->getTransformMatrix();//TransformMatrix(); + mtx = *theirDrawable->getTransformMatrix();//TransformMatrix(); DEBUG_LOG(("m_attachToDrawableBoneInContainer %s not found\n",getW3DDependencyModelDrawModuleData()->m_attachToDrawableBoneInContainer.str())); } } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp index cbf09f7a72..6e81e797ad 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp @@ -736,7 +736,7 @@ void ModelConditionInfo::validateWeaponBarrelInfo() const const AsciiString& recoilBoneName = m_weaponRecoilBoneName[wslot]; const AsciiString& mfName = m_weaponMuzzleFlashName[wslot]; const AsciiString& plbName = m_weaponProjectileLaunchBoneName[wslot]; - + // a useful tool for finding missing INI entries in the weapon-bone block // since this class has no idea which object it refers to, it must assume that the projectilelaunchbonename // is required if the fxBoneName is specified @@ -1021,7 +1021,7 @@ void ModelConditionInfo::clear() W3DModelDrawModuleData::W3DModelDrawModuleData() : m_validated(0), m_okToChangeModelColor(false), - m_particlesAttachedToAnimatedBones(false), + m_particlesAttachedToAnimatedBones(false), m_animationsRequirePower(true), #ifdef CACHE_ATTACH_BONE m_attachToDrawableBoneOffsetValid(false), @@ -1040,8 +1040,7 @@ W3DModelDrawModuleData::W3DModelDrawModuleData() : m_recoilDamping = RECOIL_DAMPING; m_recoilSettle = SETTLE_RATE; - - m_receivesDynamicLights = TRUE; + m_receivesDynamicLights = TRUE; // m_ignoreConditionStates defaults to all zero, which is what we want } @@ -1218,7 +1217,7 @@ void W3DModelDrawModuleData::buildFieldParse(MultiIniFieldParse& p) { "AttachToBoneInAnotherModule", parseAsciiStringLC, NULL, offsetof(W3DModelDrawModuleData, m_attachToDrawableBone) }, { "IgnoreConditionStates", ModelConditionFlags::parseFromINI, NULL, offsetof(W3DModelDrawModuleData, m_ignoreConditionStates) }, { "ReceivesDynamicLights", INI::parseBool, NULL, offsetof(W3DModelDrawModuleData, m_receivesDynamicLights) }, - { 0, 0, 0, 0 } + { 0, 0, 0, 0 } }; p.add(dataFieldParse); @@ -1757,24 +1756,24 @@ W3DModelDraw::W3DModelDraw(Thing *thing, const ModuleData* moduleData) : DrawMod Drawable* draw = getDrawable(); - if ( draw ) - { - Object* obj = draw->getObject(); - if (obj) - { - if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) - m_hexColor = obj->getNightIndicatorColor(); - else - m_hexColor = obj->getIndicatorColor(); - } - - // THE VAST MAJORITY OF THESE SHOULD BE TRUE - if ( ! getW3DModelDrawModuleData()->m_receivesDynamicLights) - { - draw->setReceivesDynamicLights( FALSE ); - DEBUG_LOG(("setReceivesDynamicLights = FALSE: %s\n", draw->getTemplate()->getName().str())); - } - } + if ( draw ) + { + Object* obj = draw->getObject(); + if (obj) + { + if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT) + m_hexColor = obj->getNightIndicatorColor(); + else + m_hexColor = obj->getIndicatorColor(); + } + + // THE VAST MAJORITY OF THESE SHOULD BE TRUE + if ( ! getW3DModelDrawModuleData()->m_receivesDynamicLights) + { + draw->setReceivesDynamicLights( FALSE ); + DEBUG_LOG(("setReceivesDynamicLights = FALSE: %s\n", draw->getTemplate()->getName().str())); + } + } setModelState(info); } @@ -2103,13 +2102,13 @@ void W3DModelDraw::doDrawModule(const Matrix3D* transformMtx) handleClientTurretPositioning(); recalcBonesForClientParticleSystems(); - - const W3DModelDrawModuleData *modData = getW3DModelDrawModuleData(); - if ( modData->m_particlesAttachedToAnimatedBones ) - updateBonesForClientParticleSystems();// LORENZEN ADDED THIS - // IT REPOSITIONS PARTICLESYSTEMS TO TSTAY IN SYNC WITH ANIMATED BONES + + const W3DModelDrawModuleData *modData = getW3DModelDrawModuleData(); + if ( modData->m_particlesAttachedToAnimatedBones ) + updateBonesForClientParticleSystems();// LORENZEN ADDED THIS + // IT REPOSITIONS PARTICLESYSTEMS TO TSTAY IN SYNC WITH ANIMATED BONES - handleClientRecoil(); + handleClientRecoil(); } @@ -2684,12 +2683,10 @@ Bool W3DModelDraw::updateBonesForClientParticleSystems() // Matrix3D originalTransform = m_renderObject->Get_Transform(); // Matrix3D tmp = originalTransform; - // Vector3 zeroTranslation(0,0,0); - // tmp.Set_Translation( zeroTranslation ); +// Vector3 zeroTranslation(0,0,0); +// tmp.Set_Translation( zeroTranslation ); // tmp.Scale(drawable->getScale()); -// m_renderObject->Set_Transform(tmp); - - +// m_renderObject->Set_Transform(tmp); for (std::vector::const_iterator it = m_particleSystemIDs.begin(); it != m_particleSystemIDs.end(); ++it) { @@ -2697,22 +2694,21 @@ Bool W3DModelDraw::updateBonesForClientParticleSystems() Int boneIndex = (*it).boneIndex; if ( (sys != NULL) && (boneIndex != 0) ) { - const Matrix3D boneTransform = m_renderObject->Get_Bone_Transform(boneIndex);// just a little worried about state changes - - Vector3 vpos = boneTransform.Get_Translation(); + const Matrix3D boneTransform = m_renderObject->Get_Bone_Transform(boneIndex);// just a little worried about state changes + Vector3 vpos = boneTransform.Get_Translation(); - Coord3D pos; + Coord3D pos; pos.x = vpos.X; pos.y = vpos.Y; pos.z = vpos.Z; sys->setPosition(&pos); - Real orientation = boneTransform.Get_Z_Rotation(); + Real orientation = boneTransform.Get_Z_Rotation(); sys->rotateLocalTransformZ(orientation); - - sys->setLocalTransform(&boneTransform); - sys->setSkipParentXfrm(true); + + sys->setLocalTransform(&boneTransform); + sys->setSkipParentXfrm(true); } }// next praticle system diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp index e46adac0e4..108681ea89 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DStaticText.cpp @@ -120,7 +120,7 @@ static void drawStaticTextText( GameWindow *window, WinInstanceData *instData, clipRegion.hi.y = origin.y + size.y; // horizontal centering? - if( tData->centered ) + if( tData->centered ) { textPos.x = origin.x + (size.x / 2) - (textWidth / 2); } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp index f551296241..16f33c7f54 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp @@ -201,26 +201,26 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) return; } - - Bool beBrief = brief & s_notFirstDump; - s_notFirstDump = TRUE; + + Bool beBrief = brief & s_notFirstDump; + s_notFirstDump = TRUE; fprintf( m_fp, "----------------------------------------------------------------\n" ); fprintf( m_fp, "Performance Statistical Dump -- Frame %d\n", TheGameLogic->getFrame() ); - if ( ! beBrief ) - { - //static char buf[1024]; - fprintf( m_fp, "Time:\t%s", getCurrentTimeString() ); - fprintf( m_fp, "Map:\t%s\n", TheGlobalData->m_mapName.str()); - fprintf( m_fp, "Side:\t%s\n", ThePlayerList->getLocalPlayer()->getSide().str()); - fprintf( m_fp, "----------------------------------------------------------------\n" ); - } + if ( ! beBrief ) + { + //static char buf[1024]; + fprintf( m_fp, "Time:\t%s", getCurrentTimeString() ); + fprintf( m_fp, "Map:\t%s\n", TheGlobalData->m_mapName.str()); + fprintf( m_fp, "Side:\t%s\n", ThePlayerList->getLocalPlayer()->getSide().str()); + fprintf( m_fp, "----------------------------------------------------------------\n" ); + } //FPS Real fps = TheDisplay->getAverageFPS(); fprintf( m_fp, "Average FPS: %.1f (%.5f msec)\n", fps, 1000.0f / fps ); - if ( flagSpikes && fps<20.0f ) - fprintf( m_fp, " FPS OUT OF TOLERANCE\n" ); + if ( flagSpikes && fps<20.0f ) + fprintf( m_fp, " FPS OUT OF TOLERANCE\n" ); //Rendering stats @@ -230,36 +230,36 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) Int onScreenParticleCount = TheParticleSystemManager->getOnScreenParticleCount(); - if ( flagSpikes ) - { - if ( Debug_Statistics::Get_Draw_Calls()>2000 ) - fprintf( m_fp, " DRAWS OUT OF TOLERANCE(2000)\n" ); - if ( Debug_Statistics::Get_Sorting_Polygons() > (onScreenParticleCount*2) + 300 ) - fprintf( m_fp, " NON-PARTICLE-SORTS OUT OF TOLERANCE(300)\n" ); - if ( Debug_Statistics::Get_DX8_Skin_Renders()>100 ) - fprintf( m_fp, " SKINS OUT OF TOLERANCE(100)\n" ); - } + if ( flagSpikes ) + { + if ( Debug_Statistics::Get_Draw_Calls()>2000 ) + fprintf( m_fp, " DRAWS OUT OF TOLERANCE(2000)\n" ); + if ( Debug_Statistics::Get_Sorting_Polygons() > (onScreenParticleCount*2) + 300 ) + fprintf( m_fp, " NON-PARTICLE-SORTS OUT OF TOLERANCE(300)\n" ); + if ( Debug_Statistics::Get_DX8_Skin_Renders()>100 ) + fprintf( m_fp, " SKINS OUT OF TOLERANCE(100)\n" ); + } //Object stats UnsignedInt objCount = TheGameLogic->getObjectCount(); UnsignedInt objScreenCount = TheGameClient->getRenderedObjectCount(); fprintf( m_fp, "Objects: %d in world (%d onscreen)\n", objCount, objScreenCount ); - if ( flagSpikes && objCount > 800 ) - fprintf( m_fp, " OBJS OUT OF TOLERANCE(800)\n" ); + if ( flagSpikes && objCount > 800 ) + fprintf( m_fp, " OBJS OUT OF TOLERANCE(800)\n" ); //AI stats UnsignedInt numAI, numMoving, numAttacking, numWaitingForPath, overallFailedPathfinds; TheGameLogic->getAIMetricsStatistics( &numAI, &numMoving, &numAttacking, &numWaitingForPath, &overallFailedPathfinds ); fprintf( m_fp, "\n" ); fprintf( m_fp, "AI Statistics:\n" ); - fprintf( m_fp, " Total AI Objects: %d\n", numAI ); - fprintf( m_fp, " -moving: %d\n", numMoving ); - fprintf( m_fp, " -attacking: %d\n", numAttacking ); - fprintf( m_fp, " -waiting for path: %d\n", numWaitingForPath ); - fprintf( m_fp, " Total failed pathfinds: %d\n", overallFailedPathfinds ); - if ( flagSpikes && overallFailedPathfinds > 0 ) - fprintf( m_fp, " FAILEDPATHFINDS OUT OF TOLERANCE(0)\n" ); + fprintf( m_fp, " Total AI Objects: %d\n", numAI ); + fprintf( m_fp, " -moving: %d\n", numMoving ); + fprintf( m_fp, " -attacking: %d\n", numAttacking ); + fprintf( m_fp, " -waiting for path: %d\n", numWaitingForPath ); + fprintf( m_fp, " Total failed pathfinds: %d\n", overallFailedPathfinds ); + if ( flagSpikes && overallFailedPathfinds > 0 ) + fprintf( m_fp, " FAILEDPATHFINDS OUT OF TOLERANCE(0)\n" ); fprintf( m_fp, "\n" ); // Script stats @@ -267,11 +267,11 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) AsciiString slowScripts = TheScriptEngine->getStats(&timeLastFrame, &slowScript1, &slowScript2); fprintf( m_fp, "\n" ); fprintf( m_fp, "Script Engine Statistics:\n" ); - fprintf( m_fp, " Total time last frame: %.5f msec\n", timeLastFrame*1000 ); - fprintf( m_fp, " -Slowest 2 scripts %s\n", slowScripts.str() ); - fprintf( m_fp, " -Slowest 2 script times %.5f msec, %.5f msec \n", slowScript1*1000, slowScript2*1000 ); - if ( flagSpikes && slowScript1*1000 > 0.2f || slowScript2*1000 > 0.2f ) - fprintf( m_fp, " SLOW SCRIPT OUT OF TOLERANCE(0.2)\n" ); + fprintf( m_fp, " Total time last frame: %.5f msec\n", timeLastFrame*1000 ); + fprintf( m_fp, " -Slowest 2 scripts %s\n", slowScripts.str() ); + fprintf( m_fp, " -Slowest 2 script times %.5f msec, %.5f msec \n", slowScript1*1000, slowScript2*1000 ); + if ( flagSpikes && slowScript1*1000 > 0.2f || slowScript2*1000 > 0.2f ) + fprintf( m_fp, " SLOW SCRIPT OUT OF TOLERANCE(0.2)\n" ); fprintf( m_fp, "\n" ); @@ -280,8 +280,8 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) double gcoTimeThisFrameTotal, gcoTimeThisFrameAvg; ThePartitionManager->getPMStats(gcoTimeThisFrameTotal, gcoTimeThisFrameAvg); fprintf(m_fp, "Partition Manager Statistics:\n"); - fprintf(m_fp, " Total time for object scans this frame is %.5f msec\n", gcoTimeThisFrameTotal); - fprintf(m_fp, " Avg time per object scan this frame is %.5f msec\n", gcoTimeThisFrameAvg); + fprintf(m_fp, " Total time for object scans this frame is %.5f msec\n", gcoTimeThisFrameTotal); + fprintf(m_fp, " Avg time per object scan this frame is %.5f msec\n", gcoTimeThisFrameAvg); fprintf( m_fp, "\n" ); // setup texture stats @@ -289,45 +289,45 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) fprintf( m_fp, "Video Statistics:\n" ); //Particle system stats - fprintf( m_fp, " Particle Systems: %d\n", TheParticleSystemManager->getParticleSystemCount() ); + fprintf( m_fp, " Particle Systems: %d\n", TheParticleSystemManager->getParticleSystemCount() ); Int totalParticles = TheParticleSystemManager->getParticleCount(); - fprintf( m_fp, " Particles: %d in world (%d onscreen)\n", totalParticles, onScreenParticleCount ); + fprintf( m_fp, " Particles: %d in world (%d onscreen)\n", totalParticles, onScreenParticleCount ); - if ( flagSpikes && totalParticles > TheGlobalData->m_maxParticleCount - 10 ) - fprintf( m_fp, " PARTICLES OUT OF TOLERANCE(CAP-10)\n" ); - if ( flagSpikes && onScreenParticleCount > TheGlobalData->m_maxParticleCount - 10 ) - fprintf( m_fp, " ON_SCREEN_PARTICLES OUT OF TOLERANCE(CAP-10)\n" ); + if ( flagSpikes && totalParticles > TheGlobalData->m_maxParticleCount - 10 ) + fprintf( m_fp, " PARTICLES OUT OF TOLERANCE(CAP-10)\n" ); + if ( flagSpikes && onScreenParticleCount > TheGlobalData->m_maxParticleCount - 10 ) + fprintf( m_fp, " ON_SCREEN_PARTICLES OUT OF TOLERANCE(CAP-10)\n" ); // polygons this frame Int polyPerFrame = Debug_Statistics::Get_DX8_Polygons(); Int polyPerSecond = (Int)(polyPerFrame * fps); - fprintf( m_fp, " Polygons: %d per frame (%d per second)\n", polyPerFrame, polyPerSecond ); + fprintf( m_fp, " Polygons: %d per frame (%d per second)\n", polyPerFrame, polyPerSecond ); // vertices this frame - fprintf( m_fp, " Vertices: %d\n", Debug_Statistics::Get_DX8_Vertices() ); + fprintf( m_fp, " Vertices: %d\n", Debug_Statistics::Get_DX8_Vertices() ); // // I'm adjusting the texture memory usage counter by subtracting // out the terrain alpha texture (since it's really == terrain texture). // - fprintf( m_fp, " Video RAM: %d\n", Debug_Statistics::Get_Record_Texture_Size() - 1376256 ); + fprintf( m_fp, " Video RAM: %d\n", Debug_Statistics::Get_Record_Texture_Size() - 1376256 ); // terrain stats - fprintf( m_fp, " 3-Way Blends: %d/%d, \n Shoreline Blends: %d/%d\n", TheTerrainRenderObject->getNumExtraBlendTiles(TRUE),TheTerrainRenderObject->getNumExtraBlendTiles(FALSE), TheTerrainRenderObject->getNumShoreLineTiles(TRUE),TheTerrainRenderObject->getNumShoreLineTiles(FALSE)); - if ( flagSpikes && TheTerrainRenderObject->getNumExtraBlendTiles(TRUE) > 2000 ) - fprintf( m_fp, " 3-WAYS OUT OF TOLERANCE(2000)\n" ); - if ( flagSpikes && TheTerrainRenderObject->getNumShoreLineTiles(TRUE) > 2000 ) - fprintf( m_fp, " SHORELINES OUT OF TOLERANCE(2000)\n" ); + fprintf( m_fp, " 3-Way Blends: %d/%d, \n Shoreline Blends: %d/%d\n", TheTerrainRenderObject->getNumExtraBlendTiles(TRUE),TheTerrainRenderObject->getNumExtraBlendTiles(FALSE), TheTerrainRenderObject->getNumShoreLineTiles(TRUE),TheTerrainRenderObject->getNumShoreLineTiles(FALSE)); + if ( flagSpikes && TheTerrainRenderObject->getNumExtraBlendTiles(TRUE) > 2000 ) + fprintf( m_fp, " 3-WAYS OUT OF TOLERANCE(2000)\n" ); + if ( flagSpikes && TheTerrainRenderObject->getNumShoreLineTiles(TRUE) > 2000 ) + fprintf( m_fp, " SHORELINES OUT OF TOLERANCE(2000)\n" ); fprintf( m_fp, "\n" ); #if defined(_DEBUG) || defined(_INTERNAL) - if ( ! beBrief ) - { - TheAudio->audioDebugDisplay( NULL, NULL, m_fp ); - fprintf( m_fp, "\n" ); - } + if ( ! beBrief ) + { + TheAudio->audioDebugDisplay( NULL, NULL, m_fp ); + fprintf( m_fp, "\n" ); + } #endif #ifdef MEMORYPOOL_DEBUG @@ -340,12 +340,12 @@ void StatDumpClass::dumpStats( Bool brief, Bool flagSpikes ) fprintf( m_fp, "%s", TheSubsystemList->dumpTimesForAll().str()); - if ( ! beBrief ) - { - fprintf( m_fp, "----------------------------------------------------------------\n" ); - fprintf( m_fp, "END -- Frame %d\n", TheGameLogic->getFrame() ); - fprintf( m_fp, "----------------------------------------------------------------\n" ); - } + if ( ! beBrief ) + { + fprintf( m_fp, "----------------------------------------------------------------\n" ); + fprintf( m_fp, "END -- Frame %d\n", TheGameLogic->getFrame() ); + fprintf( m_fp, "----------------------------------------------------------------\n" ); + } fprintf( m_fp, "\n\n" ); fflush(m_fp); } @@ -474,12 +474,12 @@ W3DDisplay::~W3DDisplay() Bool IS_FOUR_BY_THREE_ASPECT( Real x, Real y ) { - if ( y == 0 ) - return FALSE; - - Real aspectRatio = fabs( x / y ); - return (( aspectRatio > 1.332f) && ( aspectRatio < 1.334f)); - + if ( y == 0 ) + return FALSE; + + Real aspectRatio = fabs( x / y ); + return (( aspectRatio > 1.332f) && ( aspectRatio < 1.334f)); + } @@ -507,7 +507,7 @@ Int W3DDisplay::getDisplayModeCount(void) { // Is this the resolution we are looking for? if (resolutions[res].BitDepth >= 24 && resolutions[res].Width >= MIN_DISPLAY_RESOLUTION_X - && IS_FOUR_BY_THREE_ASPECT( (Real)resolutions[res].Width, (Real)resolutions[res].Height ) ) //only accept 4:3 aspect ratio modes. + && IS_FOUR_BY_THREE_ASPECT( (Real)resolutions[res].Width, (Real)resolutions[res].Height ) ) //only accept 4:3 aspect ratio modes. { numResolutions++; } @@ -526,7 +526,7 @@ void W3DDisplay::getDisplayModeDescription(Int modeIndex, Int *xres, Int *yres, { // Is this the resolution we are looking for? if ( resolutions[res].BitDepth >= 24 && resolutions[res].Width >= MIN_DISPLAY_RESOLUTION_X - && IS_FOUR_BY_THREE_ASPECT( (Real)resolutions[res].Width, (Real)resolutions[res].Height ) ) //only accept 4:3 aspect ratio modes. + && IS_FOUR_BY_THREE_ASPECT( (Real)resolutions[res].Width, (Real)resolutions[res].Height ) ) //only accept 4:3 aspect ratio modes. { if (numResolutions == modeIndex) { //found the mode @@ -1697,16 +1697,16 @@ void W3DDisplay::draw( void ) TheStatDump.dumpStats( FALSE, TRUE ); TheWritableGlobalData->m_dumpPerformanceStatistics = FALSE; } - //The <= GAME_REPLAY essentially means, GAME_SINGLE_PLAYER || GAME_LAN || GAME_SKIRMISH || GAME_REPLAY - else if ( TheGlobalData->m_dumpStatsAtInterval && TheGameLogic->getGameMode() <= GAME_REPLAY ) - { - Int interval = TheGlobalData->m_statsInterval; - if ( TheGameLogic->getFrame() > 0 && (TheGameLogic->getFrame() % interval) == 0 ) - { - TheStatDump.dumpStats( TRUE, TRUE ); - TheInGameUI->message( UnicodeString( L"-stats is running, at interval: %d." ), TheGlobalData->m_statsInterval ); - } - } + //The <= GAME_REPLAY essentially means, GAME_SINGLE_PLAYER || GAME_LAN || GAME_SKIRMISH || GAME_REPLAY + else if ( TheGlobalData->m_dumpStatsAtInterval && TheGameLogic->getGameMode() <= GAME_REPLAY ) + { + Int interval = TheGlobalData->m_statsInterval; + if ( TheGameLogic->getFrame() > 0 && (TheGameLogic->getFrame() % interval) == 0 ) + { + TheStatDump.dumpStats( TRUE, TRUE ); + TheInGameUI->message( UnicodeString( L"-stats is running, at interval: %d." ), TheGlobalData->m_statsInterval ); + } + } @@ -1846,14 +1846,14 @@ void W3DDisplay::draw( void ) //trying to refresh the visible terrain geometry. // if(TheGlobalData->m_loadScreenRender != TRUE) updateViews(); - TheParticleSystemManager->update();//LORENZEN AND WILCZYNSKI MOVED THIS FROM ITS NATIVE POSITION, ABOVE - //FOR THE PURPOSE OF LETTING THE PARTICLE SYSTEM LOOK UP THE RENDER OBJECT"S - //TRANSFORM MATRIX, WHILE IT IS STILL VALID (HAVING DONE ITS CLIENT TRANSFORMS - //BUT NOT YET RESETTING TOT HE LOGICAL TRANSFORM) - //THE RESULT IS THAT PARTICLESYSTEMS LINKED TO BONES IN DRAWABLES.OBJECTS - //MOVE WITH THE CLIENT TRANSFORMS, NOW. - //REVOLUTIONARY! - //-LORENZEN + TheParticleSystemManager->update();//LORENZEN AND WILCZYNSKI MOVED THIS FROM ITS NATIVE POSITION, ABOVE + //FOR THE PURPOSE OF LETTING THE PARTICLE SYSTEM LOOK UP THE RENDER OBJECT"S + //TRANSFORM MATRIX, WHILE IT IS STILL VALID (HAVING DONE ITS CLIENT TRANSFORMS + //BUT NOT YET RESETTING TOT HE LOGICAL TRANSFORM) + //THE RESULT IS THAT PARTICLESYSTEMS LINKED TO BONES IN DRAWABLES.OBJECTS + //MOVE WITH THE CLIENT TRANSFORMS, NOW. + //REVOLUTIONARY! + //-LORENZEN if (TheWaterRenderObj && TheGlobalData->m_waterType == 2) @@ -1872,11 +1872,11 @@ void W3DDisplay::draw( void ) Int numRenderTargetVertices=Debug_Statistics::Get_DX8_Vertices(); // start render block - #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) - if ( (TheGameLogic->getFrame() % 30 == 1) || ( ! ( !TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode) ) ) - #else - if ( (TheGameLogic->getFrame() % 30 == 1) || ( ! (!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame())) ) - #endif + #if defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE) + if ( (TheGameLogic->getFrame() % 30 == 1) || ( ! ( !TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode) ) ) + #else + if ( (TheGameLogic->getFrame() % 30 == 1) || ( ! (!TheGameLogic->isGamePaused() && TheGlobalData->m_TiVOFastMode && TheGameLogic->isInReplayGame())) ) + #endif { //USE_PERF_TIMER(BigAssRenderLoop) static Bool couldRender = true; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp index 99df197cb3..66df171449 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplayStringManager.cpp @@ -89,9 +89,9 @@ void W3DDisplayStringManager::postProcessLoad( void ) displayNumber.format( L"%d", i); m_groupNumeralStrings[i]->setText( displayNumber ); #else - AsciiString displayNumber; - displayNumber.format("NUMBER:%d", i); - m_groupNumeralStrings[i]->setText(TheGameText->fetch(displayNumber)); + AsciiString displayNumber; + displayNumber.format("NUMBER:%d", i); + m_groupNumeralStrings[i]->setText(TheGameText->fetch(displayNumber)); #endif } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp index a1980bff2d..5686a11e74 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp @@ -588,8 +588,6 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I Bool doExtraFlagsPop=FALSE; LightClass **sceneLights=m_globalLight; - - if (robj->Class_ID() == RenderObjClass::CLASSID_IMAGE3D ) { robj->Render(rinfo); //notify decals system that this track is visible return; //decals are not lit by this system yet so skip rest of lighting @@ -710,18 +708,18 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I { rinfo.materialPassEmissiveOverride = draw->getSecondMaterialPassOpacity(); - //if ( draw->testTintStatus( TINT_STATUS_FRENZY ) ) - //{ - // rinfo.Push_Material_Pass(m_heatVisionMaterialPass); - //} + //if ( draw->testTintStatus( TINT_STATUS_FRENZY ) ) + //{ + // rinfo.Push_Material_Pass(m_heatVisionMaterialPass); + //} //else - if (draw->getStealthLook() == STEALTHLOOK_VISIBLE_DETECTED ) + if (draw->getStealthLook() == STEALTHLOOK_VISIBLE_DETECTED ) { rinfo.materialPassEmissiveOverride = draw->getSecondMaterialPassOpacity(); // THIS WILL EXPLICITLY SKIP THE FIRST PASS SO THAT HEATVISION ONLY WILL RENDER rinfo.Push_Override_Flags(RenderInfoClass::RINFO_OVERRIDE_ADDITIONAL_PASSES_ONLY); rinfo.Push_Material_Pass(m_heatVisionOnlyPass); - doExtraFlagsPop = TRUE; + doExtraFlagsPop = TRUE; } else { @@ -768,23 +766,23 @@ void RTS3DScene::renderOneObject(RenderInfoClass &rinfo, RenderObjClass *robj, I } } - if( draw && draw->getReceivesDynamicLights() ) - { - // dynamic lights - RefRenderObjListIterator dynaLightIt(&m_dynamicLightList); - for (dynaLightIt.First(); !dynaLightIt.Is_Done(); dynaLightIt.Next()) - { - W3DDynamicLight* pDyna = (W3DDynamicLight*)dynaLightIt.Peek_Obj(); - if (!pDyna->isEnabled()) { - continue; - } - SphereClass lSph = pDyna->Get_Bounding_Sphere(); - if (pDyna->Get_Type() == LightClass::POINT && !Spheres_Intersect(sph, lSph)) { - continue; - } - lightEnv.Add_Light(*(LightClass*)dynaLightIt.Peek_Obj()); - } - } + if( draw && draw->getReceivesDynamicLights() ) + { + // dynamic lights + RefRenderObjListIterator dynaLightIt(&m_dynamicLightList); + for (dynaLightIt.First(); !dynaLightIt.Is_Done(); dynaLightIt.Next()) + { + W3DDynamicLight* pDyna = (W3DDynamicLight*)dynaLightIt.Peek_Obj(); + if (!pDyna->isEnabled()) { + continue; + } + SphereClass lSph = pDyna->Get_Bounding_Sphere(); + if (pDyna->Get_Type() == LightClass::POINT && !Spheres_Intersect(sph, lSph)) { + continue; + } + lightEnv.Add_Light(*(LightClass*)dynaLightIt.Peek_Obj()); + } + } lightEnv.Pre_Render_Update(rinfo.Camera.Get_Transform()); rinfo.light_environment = &lightEnv; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp index 7ae8ca361b..9afde8332e 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DShroud.cpp @@ -142,7 +142,6 @@ void W3DShroud::init(WorldHeightMap *pMap, Real worldCellSizeX, Real worldCellSi TextureLoader::Validate_Texture_Size((unsigned int &)dstTextureWidth,(unsigned int &)dstTextureHeight, depth); } - UnsignedInt srcWidth,srcHeight; srcWidth=m_numCellsX; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp index 907d5e6dcb..adaf8087ae 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp @@ -72,83 +72,83 @@ class TestSeismicFilter : public SeismicSimulationFilterBase { - virtual SeismicSimStatusCode filterCallback( WorldHeightMapInterfaceClass *heightMap, const SeismicSimulationNode *node ) - { + virtual SeismicSimStatusCode filterCallback( WorldHeightMapInterfaceClass *heightMap, const SeismicSimulationNode *node ) + { - Int life = node->m_life; - - if ( heightMap == NULL ) - return SEISMIC_STATUS_INVALID; - - - if ( life == 0 ) - return SEISMIC_STATUS_ACTIVE; - if ( life < 15 ) - { - // ADD HEIGHT BECAUSE THE EXPLOSION IS PUSHING DIRT UP - - Real magnitude = node->m_magnitude; - - Real offsScalar = magnitude / (Real)life; // real-life, get it? - Int radius = node->m_radius; - Int border = heightMap->getBorderSize(); - Int centerX = node->m_center.x + border ; - Int centerY = node->m_center.y + border ; - - UnsignedInt workspaceWidth = radius*2; - Real *workspace = NEW( Real[ sqr(workspaceWidth) ] ); - Real *workspaceEnd = workspace + sqr(workspaceWidth); - - - for ( Real *t = workspace; t < workspaceEnd; ++t ) *t = 0.0f;// clear the workspace - - Int x = 0; - for (; x < radius; ++x) - { - for (Int y = 0; y < radius; ++y) - { - - Real distance = sqrt( sqr(x) + sqr(y) );//Pythagoras - - if ( distance < radius ) - { - Real distScalar = cos( ( distance / radius * (PI/2) ) ); - Real height = (offsScalar * distScalar); - - workspace[ (radius + x) + workspaceWidth * (radius + y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX + x, centerY + y ) ;//kaleidoscope - - if ( x != 0 ) // non-zero test prevents cross-shaped double stamp - { - workspace[ (radius - x) + workspaceWidth * (radius + y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX - x, centerY + y ) ; - if ( y != 0 ) - workspace[ (radius - x) + workspaceWidth * (radius - y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX - x, centerY - y ) ; - } - if ( y != 0 ) - workspace[ (radius + x) + workspaceWidth * (radius - y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX + x, centerY - y ) ; - } - } - } - - // stuff the values from the workspace into the heightmap's velocities - for (x = 0; x < workspaceWidth; ++x) - for (Int y = 0; y < workspaceWidth; ++y) - heightMap->setSeismicZVelocity( centerX - radius + x, centerY - radius + y, workspace[ x + workspaceWidth * y ] ); - - delete [] workspace; - - return SEISMIC_STATUS_ACTIVE; - } - else - return SEISMIC_STATUS_ZERO_ENERGY; - } - - virtual Real applyGravityCallback( Real velocityIn ) - { - Real velocityOut = velocityIn; - velocityOut -= 1.5f; - return velocityOut; - } + Int life = node->m_life; + + if ( heightMap == NULL ) + return SEISMIC_STATUS_INVALID; + + + if ( life == 0 ) + return SEISMIC_STATUS_ACTIVE; + if ( life < 15 ) + { + // ADD HEIGHT BECAUSE THE EXPLOSION IS PUSHING DIRT UP + + Real magnitude = node->m_magnitude; + + Real offsScalar = magnitude / (Real)life; // real-life, get it? + Int radius = node->m_radius; + Int border = heightMap->getBorderSize(); + Int centerX = node->m_center.x + border ; + Int centerY = node->m_center.y + border ; + + UnsignedInt workspaceWidth = radius*2; + Real *workspace = NEW( Real[ sqr(workspaceWidth) ] ); + Real *workspaceEnd = workspace + sqr(workspaceWidth); + + + for ( Real *t = workspace; t < workspaceEnd; ++t ) *t = 0.0f;// clear the workspace + + Int x = 0; + for (; x < radius; ++x) + { + for (Int y = 0; y < radius; ++y) + { + + Real distance = sqrt( sqr(x) + sqr(y) );//Pythagoras + + if ( distance < radius ) + { + Real distScalar = cos( ( distance / radius * (PI/2) ) ); + Real height = (offsScalar * distScalar); + + workspace[ (radius + x) + workspaceWidth * (radius + y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX + x, centerY + y ) ;//kaleidoscope + + if ( x != 0 ) // non-zero test prevents cross-shaped double stamp + { + workspace[ (radius - x) + workspaceWidth * (radius + y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX - x, centerY + y ) ; + if ( y != 0 ) + workspace[ (radius - x) + workspaceWidth * (radius - y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX - x, centerY - y ) ; + } + if ( y != 0 ) + workspace[ (radius + x) + workspaceWidth * (radius - y) ] = height + heightMap->getBilinearSampleSeismicZVelocity( centerX + x, centerY - y ) ; + } + } + } + + // stuff the values from the workspace into the heightmap's velocities + for (x = 0; x < workspaceWidth; ++x) + for (Int y = 0; y < workspaceWidth; ++y) + heightMap->setSeismicZVelocity( centerX - radius + x, centerY - radius + y, workspace[ x + workspaceWidth * y ] ); + + delete [] workspace; + + return SEISMIC_STATUS_ACTIVE; + } + else + return SEISMIC_STATUS_ZERO_ENERGY; + } + + virtual Real applyGravityCallback( Real velocityIn ) + { + Real velocityOut = velocityIn; + velocityOut -= 1.5f; + return velocityOut; + } }; @@ -165,11 +165,10 @@ W3DTerrainVisual::W3DTerrainVisual() m_terrainRenderObject = NULL; m_waterRenderObject = NULL; TheWaterRenderObj = NULL; - - m_logicHeightMap = NULL; - + m_logicHeightMap = NULL; + #ifdef DO_SEISMIC_SIMULATIONS - m_clientHeightMap = NULL; + m_clientHeightMap = NULL; #endif @@ -345,9 +344,9 @@ void W3DTerrainVisual::reset( void ) } #ifdef DO_SEISMIC_SIMULATIONS - m_seismicSimulationList.clear(); + m_seismicSimulationList.clear(); #endif - + } // end reset //------------------------------------------------------------------------------------------------- @@ -360,7 +359,7 @@ void W3DTerrainVisual::update( void ) TerrainVisual::update(); #ifdef DO_SEISMIC_SIMULATIONS - handleSeismicSimulations(); + handleSeismicSimulations(); #endif // if we have a water render object, it has an update method if( m_waterRenderObject ) @@ -374,101 +373,101 @@ void W3DTerrainVisual::update( void ) void W3DTerrainVisual::addSeismicSimulation( const SeismicSimulationNode& sim ) { - // HERE WOULD BE A GREAT PLACE FOR AN IDIOT TEST: - // REJECT SIMULATION NODES THAT ARE OFF SCREEN!!!!!!!!!! - // HERE WOULD BE A GREAT PLACE FOR AN IDIOT TEST: - // REJECT SIMULATION NODES THAT ARE OFF SCREEN!!!!!!!!!! + // HERE WOULD BE A GREAT PLACE FOR AN IDIOT TEST: + // REJECT SIMULATION NODES THAT ARE OFF SCREEN!!!!!!!!!! + // HERE WOULD BE A GREAT PLACE FOR AN IDIOT TEST: + // REJECT SIMULATION NODES THAT ARE OFF SCREEN!!!!!!!!!! - m_seismicSimulationList.push_back( sim ); + m_seismicSimulationList.push_back( sim ); } void W3DTerrainVisual::handleSeismicSimulations( void ) { - if ( ! m_clientHeightMap || ! m_logicHeightMap || ! m_terrainRenderObject ) - return; + if ( ! m_clientHeightMap || ! m_logicHeightMap || ! m_terrainRenderObject ) + return; - if ( ! m_seismicSimulationList.empty() ) - { - SeismicSimulationListIt it = m_seismicSimulationList.begin(); - - - m_clientHeightMap->clearSeismicUpdateFlags(); - - - while ( it != m_seismicSimulationList.end() ) - { - SeismicSimulationNode *ssn = &*it; - - if ( ssn ) - { - SeismicSimulationFilterBase::SeismicSimStatusCode code = ssn->handleFilterCallback( m_clientHeightMap ); - DEBUG_ASSERTCRASH( code != SeismicSimulationFilterBase::SEISMIC_STATUS_INVALID, ("Trouble in the Seismic simulator.") ); - - switch ( code ) - { - case SeismicSimulationFilterBase::SEISMIC_STATUS_ACTIVE: - { - break; - } - case SeismicSimulationFilterBase::SEISMIC_STATUS_ZERO_ENERGY: - { - break; - } - } - - Int border = m_clientHeightMap->getBorderSizeInline(); - - // Now we apply some gravity to the dirt, so it falls back to its "original" height - UnsignedInt fallCount = 0; - for (Int x = border+ssn->m_region.lo.x; x < border+ssn->m_region.hi.x; ++x) - { - for (Int y = border+ssn->m_region.lo.y; y < border+ssn->m_region.hi.y; ++y) - { - if ( ! m_clientHeightMap->getSeismicUpdateFlag( x, y ) ) - { - UnsignedByte heightOfOriginal = m_logicHeightMap->getHeight( x, y ); // LOGIC, YES DEFINITELY THE LOGIC - - Real oldSpeed = m_clientHeightMap->getSeismicZVelocity( x, y ); - Real newSpeed = ssn->applyGravity( oldSpeed );// - 0.5f; - - m_clientHeightMap->setSeismicZVelocity( x, y, newSpeed ); - - Int heightToUse = m_clientHeightMap->getHeight( x, y ) + newSpeed ; - - - if (heightToUse <= heightOfOriginal) - { - heightToUse = heightOfOriginal; - m_clientHeightMap->setSeismicZVelocity( x, y, 0.0f ); //poof! the dirt hit ground level so stop "falling" - } - else - { - ++fallCount; - - if ( heightToUse > 255 ) - heightToUse = 255; - - } - m_clientHeightMap->setRawHeight( x, y, heightToUse ); - m_clientHeightMap->setSeismicUpdateFlag( x, y, TRUE ); - } - - } - } - - if ( fallCount == 0 ) - ssn->m_clean = TRUE; - - } - - ++it; - - } - } + if ( ! m_seismicSimulationList.empty() ) + { + SeismicSimulationListIt it = m_seismicSimulationList.begin(); + + + m_clientHeightMap->clearSeismicUpdateFlags(); + + + while ( it != m_seismicSimulationList.end() ) + { + SeismicSimulationNode *ssn = &*it; + + if ( ssn ) + { + SeismicSimulationFilterBase::SeismicSimStatusCode code = ssn->handleFilterCallback( m_clientHeightMap ); + DEBUG_ASSERTCRASH( code != SeismicSimulationFilterBase::SEISMIC_STATUS_INVALID, ("Trouble in the Seismic simulator.") ); + + switch ( code ) + { + case SeismicSimulationFilterBase::SEISMIC_STATUS_ACTIVE: + { + break; + } + case SeismicSimulationFilterBase::SEISMIC_STATUS_ZERO_ENERGY: + { + break; + } + } + + Int border = m_clientHeightMap->getBorderSizeInline(); + + // Now we apply some gravity to the dirt, so it falls back to its "original" height + UnsignedInt fallCount = 0; + for (Int x = border+ssn->m_region.lo.x; x < border+ssn->m_region.hi.x; ++x) + { + for (Int y = border+ssn->m_region.lo.y; y < border+ssn->m_region.hi.y; ++y) + { + if ( ! m_clientHeightMap->getSeismicUpdateFlag( x, y ) ) + { + UnsignedByte heightOfOriginal = m_logicHeightMap->getHeight( x, y ); // LOGIC, YES DEFINITELY THE LOGIC + + Real oldSpeed = m_clientHeightMap->getSeismicZVelocity( x, y ); + Real newSpeed = ssn->applyGravity( oldSpeed );// - 0.5f; + + m_clientHeightMap->setSeismicZVelocity( x, y, newSpeed ); + + Int heightToUse = m_clientHeightMap->getHeight( x, y ) + newSpeed ; + + + if (heightToUse <= heightOfOriginal) + { + heightToUse = heightOfOriginal; + m_clientHeightMap->setSeismicZVelocity( x, y, 0.0f ); //poof! the dirt hit ground level so stop "falling" + } + else + { + ++fallCount; + + if ( heightToUse > 255 ) + heightToUse = 255; + + } + m_clientHeightMap->setRawHeight( x, y, heightToUse ); + m_clientHeightMap->setSeismicUpdateFlag( x, y, TRUE ); + } + + } + } + + if ( fallCount == 0 ) + ssn->m_clean = TRUE; + + } + + ++it; + + } + } @@ -476,10 +475,10 @@ void W3DTerrainVisual::handleSeismicSimulations( void ) } - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void W3DTerrainVisual::updateSeismicSimulations( void ) { @@ -489,49 +488,49 @@ void W3DTerrainVisual::updateSeismicSimulations( void ) if (m_clientHeightMap==NULL) return; - if (m_terrainRenderObject==NULL) - return; + if (m_terrainRenderObject==NULL) + return; - if ( ! m_seismicSimulationList.empty() ) - { - SeismicSimulationListIt it = m_seismicSimulationList.begin(); - - // First we run through the list and do our business for each region - - while ( it != m_seismicSimulationList.end() ) - { - SeismicSimulationNode *hur = &*it; - if ( hur ) - { - Int border = m_clientHeightMap->getBorderSizeInline(); - - TheTerrainRenderObject->updateBlock( - hur->m_region.lo.x + border, - hur->m_region.lo.y + border, - hur->m_region.hi.x + border, - hur->m_region.hi.y + border, - m_clientHeightMap, - 0); - } - - ++it; - - } - // Then we check to see if these need to get erased from the list - it = m_seismicSimulationList.begin(); - while ( it != m_seismicSimulationList.end() ) - { - SeismicSimulationNode *hur = &*it; - if ( hur->m_clean ) - { - it = m_seismicSimulationList.erase( it ); - } - else - ++it; - - } - - } + if ( ! m_seismicSimulationList.empty() ) + { + SeismicSimulationListIt it = m_seismicSimulationList.begin(); + + // First we run through the list and do our business for each region + + while ( it != m_seismicSimulationList.end() ) + { + SeismicSimulationNode *hur = &*it; + if ( hur ) + { + Int border = m_clientHeightMap->getBorderSizeInline(); + + TheTerrainRenderObject->updateBlock( + hur->m_region.lo.x + border, + hur->m_region.lo.y + border, + hur->m_region.hi.x + border, + hur->m_region.hi.y + border, + m_clientHeightMap, + 0); + } + + ++it; + + } + // Then we check to see if these need to get erased from the list + it = m_seismicSimulationList.begin(); + while ( it != m_seismicSimulationList.end() ) + { + SeismicSimulationNode *hur = &*it; + if ( hur->m_clean ) + { + it = m_seismicSimulationList.erase( it ); + } + else + ++it; + + } + + } } @@ -589,10 +588,10 @@ Bool W3DTerrainVisual::load( AsciiString filename ) return FALSE; - ChunkInputStream *pStrm = &fileStrm; + ChunkInputStream *pStrm = &fileStrm; - // allocate new height map data to read from file - REF_PTR_RELEASE( m_logicHeightMap ); + // allocate new height map data to read from file + REF_PTR_RELEASE( m_logicHeightMap ); m_logicHeightMap = NEW WorldHeightMap(pStrm); @@ -600,12 +599,12 @@ Bool W3DTerrainVisual::load( AsciiString filename ) #ifdef DO_SEISMIC_SIMULATIONS - fileStrm.close(); - fileStrm.open(filename); - pStrm = &fileStrm; + fileStrm.close(); + fileStrm.open(filename); + pStrm = &fileStrm; REF_PTR_RELEASE( m_clientHeightMap ); - m_clientHeightMap = NEW WorldHeightMap( pStrm ); + m_clientHeightMap = NEW WorldHeightMap( pStrm ); #endif @@ -939,7 +938,7 @@ void W3DTerrainVisual::setRawMapHeight(const ICoord2D *gridPos, Int height) // THIS IS TRUE ONLY WHEN DO_SEISMIC_SIMULATIONS is defined M Lorenzen, 8/23/03 if (m_logicHeightMap) - { + { Int x = gridPos->x+m_logicHeightMap->getBorderSizeInline(); Int y = gridPos->y+m_logicHeightMap->getBorderSizeInline(); //if (m_logicHeightMap->getHeight(x,y) != height) //ML changed to prevent scissoring with roads @@ -950,11 +949,11 @@ void W3DTerrainVisual::setRawMapHeight(const ICoord2D *gridPos, Int height) #ifdef DO_SEISMIC_SIMULATIONS - if ( m_clientHeightMap ) - { - if ( height < m_clientHeightMap->getHeight( x,y ) ) - m_clientHeightMap->setRawHeight( x, y, height ); // if the client map is heigher than this height, it will fall down to it anyway! - } + if ( m_clientHeightMap ) + { + if ( height < m_clientHeightMap->getHeight( x,y ) ) + m_clientHeightMap->setRawHeight( x, y, height ); // if the client map is heigher than this height, it will fall down to it anyway! + } #endif } @@ -966,13 +965,13 @@ void W3DTerrainVisual::setRawMapHeight(const ICoord2D *gridPos, Int height) Int W3DTerrainVisual::getRawMapHeight(const ICoord2D *gridPos) { if (m_logicHeightMap) - { + { Int x = gridPos->x+m_logicHeightMap->getBorderSizeInline(); Int y = gridPos->y+m_logicHeightMap->getBorderSizeInline(); //if (m_logicHeightMap->getHeight(x,y) != height) //ML changed to prevent scissoring with roads - return m_logicHeightMap->getHeight(x,y) ; + return m_logicHeightMap->getHeight(x,y) ; } - return 0; + return 0; } @@ -1027,7 +1026,7 @@ void W3DTerrainVisual::addFactionBib(Object *factionBuilding, Bool highlight, Re #else if (m_logicHeightMap) #endif - { + { const Matrix3D * mtx = factionBuilding->getTransformMatrix(); Vector3 corners[4]; Coord3D pos; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp index 906ebb2c1a..de67c2f390 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DView.cpp @@ -835,18 +835,18 @@ static void drawDrawableExtents( Drawable *draw, void *userData ) // draw cylinder for( int i=0; i<2; i++ ) { - drawDebugCircle( center, radius, 1.0f, color ); + drawDebugCircle( center, radius, 1.0f, color ); - // next time 'round, draw the top of the cylinder - center.z += draw->getDrawableGeometryInfo().getMaxHeightAbovePosition(); + // next time 'round, draw the top of the cylinder + center.z += draw->getDrawableGeometryInfo().getMaxHeightAbovePosition(); } // end for i // draw centerline - ICoord2D start, end; - center = *draw->getPosition(); - TheTacticalView->worldToScreen( ¢er, &start ); - center.z += draw->getDrawableGeometryInfo().getMaxHeightAbovePosition(); - TheTacticalView->worldToScreen( ¢er, &end ); + ICoord2D start, end; + center = *draw->getPosition(); + TheTacticalView->worldToScreen( ¢er, &start ); + center.z += draw->getDrawableGeometryInfo().getMaxHeightAbovePosition(); + TheTacticalView->worldToScreen( ¢er, &end ); TheDisplay->drawLine( start.x, start.y, end.x, end.y, 1.0f, color ); break; @@ -875,12 +875,12 @@ void drawAudioLocations( Drawable *draw, void *userData ); // ------------------------------------------------------------------------------------------------ static void drawContainedAudioLocations( Object *obj, void *userData ) { - Drawable *draw = obj->getDrawable(); - - if( draw ) - drawAudioLocations( draw, userData ); - -} // end drawContainedAudio + Drawable *draw = obj->getDrawable(); + + if( draw ) + drawAudioLocations( draw, userData ); + +} // end drawContainedAudio //------------------------------------------------------------------------------------------------- @@ -888,62 +888,62 @@ static void drawContainedAudioLocations( Object *obj, void *userData ) //------------------------------------------------------------------------------------------------- static void drawAudioLocations( Drawable *draw, void *userData ) { - // draw audio for things that are contained by this - Object *obj = draw->getObject(); - if( obj ) - { - ContainModuleInterface *contain = obj->getContain(); - - if( contain ) - contain->iterateContained( drawContainedAudioLocations, userData, FALSE ); - - } // end if - - const ThingTemplate * thingTemplate = draw->getTemplate(); - - if ( thingTemplate == NULL || thingTemplate->getEditorSorting() != ES_AUDIO ) - { - return; // All done - } + // draw audio for things that are contained by this + Object *obj = draw->getObject(); + if( obj ) + { + ContainModuleInterface *contain = obj->getContain(); + + if( contain ) + contain->iterateContained( drawContainedAudioLocations, userData, FALSE ); + + } // end if - // Copied in hideously inappropriate code copying ways from DrawObject.cpp - // Should definately be a global, probably read in from an INI file - static const Int poleHeight = 20; - static const Int flagHeight = 10; - static const Int flagWidth = 10; - const Color color = GameMakeColor(0x25, 0x25, 0xEF, 0xFF); - - // Draw flag for audio-only objects: - // * - // * * - // * * - // * * - // * * - // * * - // * - // * - // * - // * - // * - - Coord3D worldPoint; - ICoord2D start, end; + const ThingTemplate * thingTemplate = draw->getTemplate(); - worldPoint = *draw->getPosition(); - TheTacticalView->worldToScreen( &worldPoint, &start ); - worldPoint.z += poleHeight; - TheTacticalView->worldToScreen( &worldPoint, &end ); - TheDisplay->drawLine( start.x, start.y, end.x, end.y, 1.0f, color ); - - worldPoint.z -= flagHeight / 2; - worldPoint.x += flagWidth; - TheTacticalView->worldToScreen( &worldPoint, &start ); - TheDisplay->drawLine( start.x, start.y, end.x, end.y, 1.0f, color ); + if ( thingTemplate == NULL || thingTemplate->getEditorSorting() != ES_AUDIO ) + { + return; // All done + } + + // Copied in hideously inappropriate code copying ways from DrawObject.cpp + // Should definately be a global, probably read in from an INI file + static const Int poleHeight = 20; + static const Int flagHeight = 10; + static const Int flagWidth = 10; + const Color color = GameMakeColor(0x25, 0x25, 0xEF, 0xFF); + + // Draw flag for audio-only objects: + // * + // * * + // * * + // * * + // * * + // * * + // * + // * + // * + // * + // * + + Coord3D worldPoint; + ICoord2D start, end; + + worldPoint = *draw->getPosition(); + TheTacticalView->worldToScreen( &worldPoint, &start ); + worldPoint.z += poleHeight; + TheTacticalView->worldToScreen( &worldPoint, &end ); + TheDisplay->drawLine( start.x, start.y, end.x, end.y, 1.0f, color ); + + worldPoint.z -= flagHeight / 2; + worldPoint.x += flagWidth; + TheTacticalView->worldToScreen( &worldPoint, &start ); + TheDisplay->drawLine( start.x, start.y, end.x, end.y, 1.0f, color ); - worldPoint.z -= flagHeight / 2; - worldPoint.x -= flagWidth; - TheTacticalView->worldToScreen( &worldPoint, &end ); - TheDisplay->drawLine( start.x, start.y, end.x, end.y, 1.0f, color ); + worldPoint.z -= flagHeight / 2; + worldPoint.x -= flagWidth; + TheTacticalView->worldToScreen( &worldPoint, &end ); + TheDisplay->drawLine( start.x, start.y, end.x, end.y, 1.0f, color ); } //------------------------------------------------------------------------------------------------- @@ -951,32 +951,32 @@ static void drawAudioLocations( Drawable *draw, void *userData ) //------------------------------------------------------------------------------------------------- static void drawAudioRadii( const Drawable * drawable ) { - - // Draw radii, if sound is playing - const AudioEventRTS * ambientSound = drawable->getAmbientSound(); - - if ( ambientSound && ambientSound->isCurrentlyPlaying() ) - { - const AudioEventInfo * ambientInfo = ambientSound->getAudioEventInfo(); - - if ( ambientInfo == NULL ) - { - // I don't think that's right... - OutputDebugString( ("Playing sound has NULL AudioEventInfo?\n" ) ); - - if ( TheAudio != NULL ) - { - ambientInfo = TheAudio->findAudioEventInfo( ambientSound->getEventName() ); - } - } - - if ( ambientInfo != NULL ) - { - // Colors match those used in WorldBuilder - drawDebugCircle( *drawable->getPosition(), ambientInfo->m_minDistance, 1.0f, GameMakeColor(0x00, 0x00, 0xFF, 0xFF) ); - drawDebugCircle( *drawable->getPosition(), ambientInfo->m_maxDistance, 1.0f, GameMakeColor(0xFF, 0x00, 0xFF, 0xFF) ); - } - } + + // Draw radii, if sound is playing + const AudioEventRTS * ambientSound = drawable->getAmbientSound(); + + if ( ambientSound && ambientSound->isCurrentlyPlaying() ) + { + const AudioEventInfo * ambientInfo = ambientSound->getAudioEventInfo(); + + if ( ambientInfo == NULL ) + { + // I don't think that's right... + OutputDebugString( ("Playing sound has NULL AudioEventInfo?\n" ) ); + + if ( TheAudio != NULL ) + { + ambientInfo = TheAudio->findAudioEventInfo( ambientSound->getEventName() ); + } + } + + if ( ambientInfo != NULL ) + { + // Colors match those used in WorldBuilder + drawDebugCircle( *drawable->getPosition(), ambientInfo->m_minDistance, 1.0f, GameMakeColor(0x00, 0x00, 0xFF, 0xFF) ); + drawDebugCircle( *drawable->getPosition(), ambientInfo->m_maxDistance, 1.0f, GameMakeColor(0xFF, 0x00, 0xFF, 0xFF) ); + } + } } #endif @@ -1379,8 +1379,8 @@ void W3DView::update(void) #ifdef DO_SEISMIC_SIMULATIONS - // Give the terrain a chance to refresh animaing (Seismic) regions, if any. - TheTerrainVisual->updateSeismicSimulations(); + // Give the terrain a chance to refresh animaing (Seismic) regions, if any. + TheTerrainVisual->updateSeismicSimulations(); #endif Region3D axisAlignedRegion; @@ -1746,17 +1746,17 @@ void W3DView::draw( void ) } - if ( TheGlobalData->m_showAudioLocations ) - { - // Draw audio radii for ALL drawables, not just those on screen - const Drawable * drawable = TheGameClient->getDrawableList(); - - while ( drawable != NULL ) - { - drawAudioRadii( drawable ); - drawable = drawable->getNextDrawable(); - } - } + if ( TheGlobalData->m_showAudioLocations ) + { + // Draw audio radii for ALL drawables, not just those on screen + const Drawable * drawable = TheGameClient->getDrawableList(); + + while ( drawable != NULL ) + { + drawAudioRadii( drawable ); + drawable = drawable->getNextDrawable(); + } + } #endif // DEBUG or INTERNAL Region3D axisAlignedRegion; @@ -2022,7 +2022,7 @@ View::WorldToScreenReturn W3DView::worldToScreenTriReturn( const Coord3D *w, ICo { // sanity if( w == NULL || s == NULL ) - return WTS_INVALID; + return WTS_INVALID; if( m_3DCamera ) { @@ -2036,7 +2036,7 @@ View::WorldToScreenReturn W3DView::worldToScreenTriReturn( const Coord3D *w, ICo // Can't get a valid number if it's beyond the clip planes. jba s->x = 0; s->y = 0; - return WTS_INVALID; + return WTS_INVALID; } // @@ -2055,14 +2055,14 @@ View::WorldToScreenReturn W3DView::worldToScreenTriReturn( const Coord3D *w, ICo // s->y = (getHeight() * (-screen.Y + 1.0f)) / 2.0f; if (projection != CameraClass::INSIDE_FRUSTUM) { - return WTS_OUTSIDE_FRUSTUM; + return WTS_OUTSIDE_FRUSTUM; } - return WTS_INSIDE_FRUSTUM; + return WTS_INSIDE_FRUSTUM; } // end if - return WTS_INVALID; + return WTS_INVALID; } // end worldToScreenTriReturn //------------------------------------------------------------------------------------------------- diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp index d7e9c4731f..1cd3573412 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3dWaypointBuffer.cpp @@ -155,11 +155,11 @@ void W3DWaypointBuffer::setDefaultLineStyle( void ) void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) { - if ( ! TheInGameUI ) - return; + if ( ! TheInGameUI ) + return; - setDefaultLineStyle(); + setDefaultLineStyle(); @@ -241,94 +241,94 @@ void W3DWaypointBuffer::drawWaypoints(RenderInfoClass &rinfo) - // WAIT! before we go browsing the drawable list for buildings that want to draw their rally points - // lets test for that very special case of having a listeningoutpost selected, and some enemy drawable moused-over - if ( obj->isKindOf( KINDOF_REVEALS_ENEMY_PATHS ) ) - { + // WAIT! before we go browsing the drawable list for buildings that want to draw their rally points + // lets test for that very special case of having a listeningoutpost selected, and some enemy drawable moused-over + if ( obj->isKindOf( KINDOF_REVEALS_ENEMY_PATHS ) ) + { - DrawableID enemyID = TheInGameUI->getMousedOverDrawableID(); - Drawable *enemyDraw = TheGameClient->findDrawableByID( enemyID ); - if ( enemyDraw ) - { - Object *enemy = enemyDraw->getObject(); - if ( enemy ) - { - if ( enemy->getRelationship( obj ) == ENEMIES ) - { - - Coord3D delta = *obj->getPosition(); - delta.sub( enemy->getPosition() ); - if ( delta.length() <= obj->getVisionRange() ) // is listening outpost close enough to do this? - { - - - ////////////////////////////////////////////////////////////////////// - AIUpdateInterface *ai = enemy->getAI(); - Int goalSize = ai ? ai->friend_getWaypointGoalPathSize() : 0; - Int gpIdx = ai ? ai->friend_getCurrentGoalPathIndex() : 0; - if( ai ) - { - Bool lineExists = FALSE; - - const Coord3D *pos = enemy->getPosition(); - points[ numPoints++ ].Set( Vector3( pos->x, pos->y, pos->z ) ); - - if ( gpIdx >= 0 && gpIdx < goalSize )// Ooh, the enemy is in waypoint mode - { - - for( int i = gpIdx; i < goalSize; i++ ) - { - const Coord3D *waypoint = ai->friend_getGoalPathPosition( i ); - if( waypoint ) - { - //Render line from previous point to current node. - - if( numPoints < MAX_DISPLAY_NODES + 1 ) - { - points[ numPoints++ ].Set( Vector3( waypoint->x, waypoint->y, waypoint->z ) ); - } - - m_waypointNodeRobj->Set_Position(Vector3(waypoint->x,waypoint->y,waypoint->z)); - WW3D::Render(*m_waypointNodeRobj,localRinfo); - lineExists = TRUE; - } - } - } - else // then enemy may be moving to a goal position - { - const Coord3D *destinationPoint = ai->getGoalPosition(); - if ( destinationPoint->length() > 1.0f ) - { - points[ numPoints++ ].Set( Vector3( destinationPoint->x, destinationPoint->y, destinationPoint->z ) ); - m_waypointNodeRobj->Set_Position(Vector3(destinationPoint->x,destinationPoint->y,destinationPoint->z)); - WW3D::Render(*m_waypointNodeRobj,localRinfo); - lineExists = TRUE; - } - } - - if ( lineExists ) - { - //Now render the lines in one pass! - - m_line->Set_Color( Vector3( 0.95f, 0.5f, 0.0f ) ); - m_line->Set_Width( 3.0f ); - - m_line->Set_Points( numPoints, points ); - m_line->Render( localRinfo ); - } - } - ////////////////////////////////////////////////////////////////////// - - - - - } - } - } - } - - break;// dont even bother with the rest, since this one listening outpost satisfies the single path-line limit - } + DrawableID enemyID = TheInGameUI->getMousedOverDrawableID(); + Drawable *enemyDraw = TheGameClient->findDrawableByID( enemyID ); + if ( enemyDraw ) + { + Object *enemy = enemyDraw->getObject(); + if ( enemy ) + { + if ( enemy->getRelationship( obj ) == ENEMIES ) + { + + Coord3D delta = *obj->getPosition(); + delta.sub( enemy->getPosition() ); + if ( delta.length() <= obj->getVisionRange() ) // is listening outpost close enough to do this? + { + + + ////////////////////////////////////////////////////////////////////// + AIUpdateInterface *ai = enemy->getAI(); + Int goalSize = ai ? ai->friend_getWaypointGoalPathSize() : 0; + Int gpIdx = ai ? ai->friend_getCurrentGoalPathIndex() : 0; + if( ai ) + { + Bool lineExists = FALSE; + + const Coord3D *pos = enemy->getPosition(); + points[ numPoints++ ].Set( Vector3( pos->x, pos->y, pos->z ) ); + + if ( gpIdx >= 0 && gpIdx < goalSize )// Ooh, the enemy is in waypoint mode + { + + for( int i = gpIdx; i < goalSize; i++ ) + { + const Coord3D *waypoint = ai->friend_getGoalPathPosition( i ); + if( waypoint ) + { + //Render line from previous point to current node. + + if( numPoints < MAX_DISPLAY_NODES + 1 ) + { + points[ numPoints++ ].Set( Vector3( waypoint->x, waypoint->y, waypoint->z ) ); + } + + m_waypointNodeRobj->Set_Position(Vector3(waypoint->x,waypoint->y,waypoint->z)); + WW3D::Render(*m_waypointNodeRobj,localRinfo); + lineExists = TRUE; + } + } + } + else // then enemy may be moving to a goal position + { + const Coord3D *destinationPoint = ai->getGoalPosition(); + if ( destinationPoint->length() > 1.0f ) + { + points[ numPoints++ ].Set( Vector3( destinationPoint->x, destinationPoint->y, destinationPoint->z ) ); + m_waypointNodeRobj->Set_Position(Vector3(destinationPoint->x,destinationPoint->y,destinationPoint->z)); + WW3D::Render(*m_waypointNodeRobj,localRinfo); + lineExists = TRUE; + } + } + + if ( lineExists ) + { + //Now render the lines in one pass! + + m_line->Set_Color( Vector3( 0.95f, 0.5f, 0.0f ) ); + m_line->Set_Width( 3.0f ); + + m_line->Set_Points( numPoints, points ); + m_line->Render( localRinfo ); + } + } + ////////////////////////////////////////////////////////////////////// + + + + + } + } + } + } + + break;// dont even bother with the rest, since this one listening outpost satisfies the single path-line limit + } diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp index 1dc0846bf4..2c496de145 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp @@ -626,8 +626,8 @@ HRESULT WaterRenderObjClass::generateVertexBuffer( Int sizeX, Int sizeY, Int ver { m_numVertices=sizeX*sizeY; //Assuming dynamic vertex buffer, allocate maximum multiple of required size to allow rendering from - //different parts of the buffer. 5-15-03: Disabled this since we use DISCARD mode instead to avoid Nvidia Runtime bug. -MW - //m_numVertices=(65536 / (sizeX*sizeY))*sizeX*sizeY; + //different parts of the buffer. 5-15-03: Disabled this since we use DISCARD mode instead to avoid Nvidia Runtime bug. -MW + //m_numVertices=(65536 / (sizeX*sizeY))*sizeX*sizeY; SEA_PATCH_VERTEX* pVertices; @@ -2245,9 +2245,9 @@ void WaterRenderObjClass::renderWaterMesh(void) if (!m_doWaterGrid) return; //the water grid is disabled. - //According to Nvidia there's a D3D bug that happens if you don't start with a - //new dynamic VB each frame - so we force a DISCARD by overflowing the counter. - m_vertexBufferD3DOffset = 0xffff; + //According to Nvidia there's a D3D bug that happens if you don't start with a + //new dynamic VB each frame - so we force a DISCARD by overflowing the counter. + m_vertexBufferD3DOffset = 0xffff; Setting *setting=&m_settings[m_tod]; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp index df259088ad..f5580bdc9f 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp @@ -882,9 +882,9 @@ Try improving the fit to vertical surfaces like cliffs. if (!m_usedModules || ShaderClass::Is_Backface_Culling_Inverted()) return; //don't render track marks in reflections. - //According to Nvidia there's a D3D bug that happens if you don't start with a - //new dynamic VB each frame - so we force a DISCARD by overflowing the counter. - m_batchStart = 0xffff; + //According to Nvidia there's a D3D bug that happens if you don't start with a + //new dynamic VB each frame - so we force a DISCARD by overflowing the counter. + m_batchStart = 0xffff; // adjust shading for time of day. Real shadeR, shadeG, shadeB; diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp index fd73bd0160..4d4c89c379 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/WorldHeightMap.cpp @@ -920,9 +920,9 @@ Bool WorldHeightMap::ParseHeightMapData(DataChunkInput &file, DataChunkInfo *inf Int numBytesY = m_height; m_seismicUpdateWidth=numBytesX; m_seismicUpdateFlag = MSGNEW("WorldHeightMap::ParseHeightMapData _ m_seismicUpdateFlag allocated") UnsignedByte[numBytesX*numBytesY]; - clearSeismicUpdateFlags(); - m_seismicZVelocities = MSGNEW("WorldHeightMap_ParseHeightMapData _ zvelocities allocated") Real[m_dataSize]; - fillSeismicZVelocities( 0 ); + clearSeismicUpdateFlags(); + m_seismicZVelocities = MSGNEW("WorldHeightMap_ParseHeightMapData _ zvelocities allocated") Real[m_dataSize]; + fillSeismicZVelocities( 0 ); file.readArrayOfBytes((char *)m_data, m_dataSize); diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp index 87843cdebc..41183a3737 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp @@ -60,17 +60,17 @@ void Win32BIGFileSystem::init() { loadBigFilesFromDirectory("", "*.big"); - // load original Generals assets - AsciiString installPath; - GetStringFromGeneralsRegistry("", "InstallPath", installPath ); - //@todo this will need to be ramped up to a crash for release + // load original Generals assets + AsciiString installPath; + GetStringFromGeneralsRegistry("", "InstallPath", installPath ); + //@todo this will need to be ramped up to a crash for release #ifndef _INTERNAL - // had to make this non-internal only, otherwise we can't autobuild - // GeneralsZH... - DEBUG_ASSERTCRASH(installPath != "", ("Be 1337! Go install Generals!")); + // had to make this non-internal only, otherwise we can't autobuild + // GeneralsZH... + DEBUG_ASSERTCRASH(installPath != "", ("Be 1337! Go install Generals!")); #endif - if (installPath!="") - loadBigFilesFromDirectory(installPath, "*.big"); + if (installPath!="") + loadBigFilesFromDirectory(installPath, "*.big"); } void Win32BIGFileSystem::reset() { diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp index 4994465ac8..982d36bd20 100644 --- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp +++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp @@ -111,10 +111,10 @@ void Win32GameEngine::update( void ) break; // keep running. } } - - // When we are alt-tabbed out... the MilesAudioManager seems to go into a coma sometimes - // and not regain focus properly when we come back. This seems to wake it up nicely. - AudioAffect aa = (AudioAffect)0x10; + + // When we are alt-tabbed out... the MilesAudioManager seems to go into a coma sometimes + // and not regain focus properly when we come back. This seems to wake it up nicely. + AudioAffect aa = (AudioAffect)0x10; TheAudio->setVolume(TheAudio->getVolume( aa ), aa ); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/CUndoable.h b/GeneralsMD/Code/Tools/WorldBuilder/include/CUndoable.h index 207ed444e1..039aa24316 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/CUndoable.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/CUndoable.h @@ -397,20 +397,20 @@ class DeletePolygonUndoable : public Undoable class MultipleUndoable : public Undoable { protected: - Undoable * m_undoableList; //< The head of the list of undoables, in the order they should be done. Reverse order for undoes + Undoable * m_undoableList; //< The head of the list of undoables, in the order they should be done. Reverse order for undoes public: MultipleUndoable(); - // destructor. - ~MultipleUndoable(void); + // destructor. + ~MultipleUndoable(void); - /** Add other undoables in the order you would want them UNdone; e.g. in the reverse order you want them done - * The MultipleUndoable object will then own the pointers. - */ - void addUndoable( Undoable * undoable ); + /** Add other undoables in the order you would want them UNdone; e.g. in the reverse order you want them done + * The MultipleUndoable object will then own the pointers. + */ + void addUndoable( Undoable * undoable ); - virtual void Do(void); - virtual void Undo(void); - virtual void Redo(void); + virtual void Do(void); + virtual void Undo(void); + virtual void Redo(void); }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/DrawObject.h b/GeneralsMD/Code/Tools/WorldBuilder/include/DrawObject.h index 9c6a87e225..21396ba13d 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/DrawObject.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/DrawObject.h @@ -83,7 +83,7 @@ class DrawObject : public RenderObjClass Int freeMapResources(void); int initData(void); - void setDrawObjects(Bool val, Bool waypoints, Bool poly, Bool bounding, Bool sight, Bool weapon, Bool sound, Bool testart, Bool letterbox) { m_drawObjects = val; m_drawWaypoints=waypoints; m_drawPolygonAreas = poly; m_drawBoundingBoxes = bounding; m_drawSightRanges = sight; m_drawWeaponRanges = weapon; m_drawSoundRanges = sound; m_drawTestArtHighlight = testart, m_drawLetterbox = letterbox;} + void setDrawObjects(Bool val, Bool waypoints, Bool poly, Bool bounding, Bool sight, Bool weapon, Bool sound, Bool testart, Bool letterbox) { m_drawObjects = val; m_drawWaypoints=waypoints; m_drawPolygonAreas = poly; m_drawBoundingBoxes = bounding; m_drawSightRanges = sight; m_drawWeaponRanges = weapon; m_drawSoundRanges = sound; m_drawTestArtHighlight = testart, m_drawLetterbox = letterbox;} static void setDoBrushFeedback(Bool val) { m_toolWantsFeedback = val; m_meshFeedback=false;} static void setDoMeshFeedback(Bool val) { m_meshFeedback = val; } static void setDoRampFeedback(Bool val) { m_rampFeedback = val; } @@ -169,7 +169,7 @@ class DrawObject : public RenderObjClass static Real m_rampWidth; protected: - void addCircleToLineRenderer( const Coord3D & center, Real radius, Real width, unsigned long color, CameraClass* camera ); + void addCircleToLineRenderer( const Coord3D & center, Real radius, Real width, unsigned long color, CameraClass* camera ); Int updateVB(DX8VertexBufferClass *vertexBufferTile, Int color, Bool doArrow, Bool doDiamond); void updatePolygonVB(PolygonTrigger *pTrig, Bool selected, Bool isOpen); void updateFeedbackVB(void); @@ -183,7 +183,7 @@ class DrawObject : public RenderObjClass void updateVBWithSightRange(MapObject *pMapObj, CameraClass* camera); void updateVBWithWeaponRange(MapObject *pMapObj, CameraClass* camera); void updateVBWithTestArtHighlight(MapObject *pMapObj, CameraClass* camera); - void updateVBWithSoundRanges(MapObject *pMapObj, CameraClass* camera); + void updateVBWithSoundRanges(MapObject *pMapObj, CameraClass* camera); bool worldToScreen(const Coord3D *w, ICoord2D *s, CameraClass* camera); }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h b/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h index a0756e0700..22afa6ff83 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/EditAction.h @@ -26,7 +26,7 @@ // -class ScriptAction; +class ScriptAction; class SidesList; ///////////////////////////////////////////////////////////////////////////// diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/LayersList.h b/GeneralsMD/Code/Tools/WorldBuilder/include/LayersList.h index 876788ec21..1d9b1afadd 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/LayersList.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/LayersList.h @@ -141,7 +141,7 @@ class LayersList : public CDialog HTREEITEM findTreeLayerNamed(const AsciiString& nameToFind); HTREEITEM findTreeObjectNamed(const AsciiString& objectToFind, HTREEITEM layerItem); - + // This function takes an MapObject, and does one of the following: // 1) Return true if the MapObject can be found, and // layerIt points to a valid layer iterator in which the MapObject was found @@ -176,7 +176,6 @@ class LayersList : public CDialog afx_msg void OnMergeViewSelection(UINT commandID); afx_msg void OnSelectActiveLayer(); - afx_msg void OnSelectLayerObject(); afx_msg void OnNewLayer(); afx_msg void OnDeleteLayer(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/mapobjectprops.h b/GeneralsMD/Code/Tools/WorldBuilder/include/mapobjectprops.h index b3924e4ea5..eefde63527 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/mapobjectprops.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/mapobjectprops.h @@ -199,11 +199,11 @@ class MapObjectProps : public COptionsPanel, public PopupSliderOwner public: static MapObject *getSingleSelectedMapObject(void); static void update(void); - + private: - /// Disallow copying: Object is not set up to be copied - MapObjectProps( const MapObjectProps & other ); // Deliberately undefined - MapObjectProps & operator=( const MapObjectProps & other ); // Deliberately undefined + /// Disallow copying: Object is not set up to be copied + MapObjectProps( const MapObjectProps & other ); // Deliberately undefined + MapObjectProps & operator=( const MapObjectProps & other ); // Deliberately undefined void updateTheUI(MapObject *pMapObj); void InitSound(void); }; diff --git a/GeneralsMD/Code/Tools/WorldBuilder/include/wbview3d.h b/GeneralsMD/Code/Tools/WorldBuilder/include/wbview3d.h index b77ef29fce..25a9bedb66 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/include/wbview3d.h +++ b/GeneralsMD/Code/Tools/WorldBuilder/include/wbview3d.h @@ -152,9 +152,9 @@ class WbView3d : public WbView, public DX8_CleanupHook afx_msg void OnUpdateViewShowMapBoundaries(CCmdUI* pCmdUI); afx_msg void OnViewShowAmbientSounds(); afx_msg void OnUpdateViewShowAmbientSounds(CCmdUI* pCmdUI); - afx_msg void OnViewShowSoundCircles(); - afx_msg void OnUpdateViewShowSoundCircles(CCmdUI* pCmdUI); - //}}AFX_MSG + afx_msg void OnViewShowSoundCircles(); + afx_msg void OnUpdateViewShowSoundCircles(CCmdUI* pCmdUI); + //}}AFX_MSG DECLARE_MESSAGE_MAP() private: @@ -208,7 +208,7 @@ class WbView3d : public WbView, public DX8_CleanupHook Bool m_showLayersList; ///< Flag whether the layers list is visible or not. Bool m_showMapBoundaries; ///< Flag whether to show all the map boundaries or not Bool m_showAmbientSounds; ///< Flag whether to show all the ambient sounds or not - Bool m_showSoundCircles; ///< Flag whether to show the minimum and maximum radii of the ambient sounds attached to the selected object + Bool m_showSoundCircles; ///< Flag whether to show the minimum and maximum radii of the ambient sounds attached to the selected object Bool m_showBoundingBoxes; Bool m_showSightRanges; Bool m_showWeaponRanges; @@ -226,7 +226,7 @@ class WbView3d : public WbView, public DX8_CleanupHook void init3dScene(); void initAssets(); void initWW3D(); - void drawCircle( HDC hdc, const Coord3D & centerPoint, Real radius, COLORREF color ); + void drawCircle( HDC hdc, const Coord3D & centerPoint, Real radius, COLORREF color ); void drawLabels(HDC hdc); void drawLabels(void); void shutdownWW3D(); diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp index 326fa753b4..2731a800e1 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp @@ -1364,7 +1364,7 @@ void DeletePolygonUndoable::Undo(void) // MultipleUndoable - constructor. // MultipleUndoable::MultipleUndoable(void) - : m_undoableList( NULL ) + : m_undoableList( NULL ) { } @@ -1373,10 +1373,10 @@ MultipleUndoable::MultipleUndoable(void) // MultipleUndoable::~MultipleUndoable(void) { - if ( m_undoableList ) - { - REF_PTR_RELEASE(m_undoableList); - } + if ( m_undoableList ) + { + REF_PTR_RELEASE(m_undoableList); + } } // @@ -1384,9 +1384,9 @@ MultipleUndoable::~MultipleUndoable(void) // void MultipleUndoable::addUndoable( Undoable * undoable ) { - undoable->LinkNext( m_undoableList ); + undoable->LinkNext( m_undoableList ); - REF_PTR_SET( m_undoableList, undoable ); + REF_PTR_SET( m_undoableList, undoable ); } @@ -1395,14 +1395,14 @@ void MultipleUndoable::addUndoable( Undoable * undoable ) // void MultipleUndoable::Do(void) { - Undoable * undoable = m_undoableList; + Undoable * undoable = m_undoableList; - while ( undoable != NULL ) - { - Undoable * next = undoable->GetNext(); - undoable->Do(); - undoable = next; - } + while ( undoable != NULL ) + { + Undoable * next = undoable->GetNext(); + undoable->Do(); + undoable = next; + } } @@ -1411,12 +1411,12 @@ void MultipleUndoable::Do(void) // static void undoHelper(Undoable * undoable) { - if ( undoable == NULL ) - return; + if ( undoable == NULL ) + return; - undoHelper( undoable->GetNext() ); + undoHelper( undoable->GetNext() ); - undoable->Undo(); + undoable->Undo(); } // @@ -1425,7 +1425,7 @@ static void undoHelper(Undoable * undoable) // void MultipleUndoable::Undo(void) { - undoHelper(m_undoableList); + undoHelper(m_undoableList); } @@ -1434,13 +1434,13 @@ void MultipleUndoable::Undo(void) // void MultipleUndoable::Redo(void) { - Undoable * undoable = m_undoableList; - - while ( undoable != NULL ) - { - Undoable * next = undoable->GetNext(); - undoable->Redo(); - undoable = next; - } + Undoable * undoable = m_undoableList; + + while ( undoable != NULL ) + { + Undoable * next = undoable->GetNext(); + undoable->Redo(); + undoable = next; + } } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp index 12673aef94..85c1ab9c39 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/DrawObject.cpp @@ -2103,7 +2103,7 @@ if (_skip_drawobject_render) { } m_waterDrawObject->update(); DX8Wrapper::Set_Vertex_Buffer(m_vertexBufferTile1); - if (m_drawObjects || m_drawWaypoints || m_drawBoundingBoxes || m_drawSightRanges || m_drawWeaponRanges || m_drawSoundRanges || m_drawTestArtHighlight) { + if (m_drawObjects || m_drawWaypoints || m_drawBoundingBoxes || m_drawSightRanges || m_drawWeaponRanges || m_drawSoundRanges || m_drawTestArtHighlight) { //Apply the shader and material //WST Variables below are for optimization to reduce VB updates which are extremely slow @@ -2120,7 +2120,7 @@ if (_skip_drawobject_render) { // DEBUG! if (pMapObj->isSelected()) { - Transform.Get_Translation(); + Transform.Get_Translation(); } Coord3D loc = *pMapObj->getLocation(); if (TheTerrainRenderObject) { diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp index f3089c11f0..9a02a97e88 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/GlobalLightOptions.cpp @@ -926,7 +926,7 @@ void GlobalLightOptions::OnClose() WbView3d * pView = CWorldBuilderDoc::GetActive3DView(); if (pView) { - Coord3D lightRay; + Coord3D lightRay; lightRay.x=0.0f;lightRay.y=0.0f;lightRay.z=-1.0f; //default light above terrain. pView->doLightFeedback(false,lightRay,0); //turn off the light direction indicator } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp index 8013201493..e56336598e 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/SelectMacrotexture.cpp @@ -116,7 +116,7 @@ BOOL SelectMacrotexture::OnInitDialog() ins.item.lParam = -1; char defaultText[] = DEFAULT; ins.item.pszText = defaultText; - ins.item.cchTextMax = strlen(defaultText); + ins.item.cchTextMax = strlen(defaultText); child = m_textureTreeView.InsertItem(&ins); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp index b868ca2564..015da10b66 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/mapobjectprops.cpp @@ -1382,17 +1382,17 @@ void MapObjectProps::_ShroudClearingDistanceToDict(void) } CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) - { - Dict newDict; - if (value != -1) { - newDict.setInt(TheKey_objectShroudClearingDistance, value); - } - DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, TheKey_objectShroudClearingDistance, m_allSelectedDicts.size()); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Do - } + if ( pDoc != NULL ) + { + Dict newDict; + if (value != -1) { + newDict.setInt(TheKey_objectShroudClearingDistance, value); + } + DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, TheKey_objectShroudClearingDistance, m_allSelectedDicts.size()); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Do + } } /// Move data from dialog controls to object @@ -1404,15 +1404,15 @@ void MapObjectProps::_RecruitableAIToDict(void) Bool isChecked = (owner->GetCheck() != 0); CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) - { - Dict newDict; - newDict.setBool(TheKey_objectRecruitableAI, isChecked); - DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Do - } + if ( pDoc != NULL ) + { + Dict newDict; + newDict.setBool(TheKey_objectRecruitableAI, isChecked); + DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size()); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Do + } } /// Move data from dialog controls to object @@ -1650,92 +1650,92 @@ void MapObjectProps::updateTheUI(void) /// Move *all* data from object to dialog controls void MapObjectProps::updateTheUI(MapObject *pMapObj) { - _DictToName(); - _DictToTeam(); - _DictToScript(); - _DictToWeather(); - _DictToTime(); - _DictToScale(); - _DictToPrebuiltUpgrades(); + _DictToName(); + _DictToTeam(); + _DictToScript(); + _DictToWeather(); + _DictToTime(); + _DictToScale(); + _DictToPrebuiltUpgrades(); _DictToHealth(); - _DictToHPs(); - _DictToEnabled(); - _DictToDestructible(); - _DictToPowered(); - _DictToAggressiveness(); - _DictToVisibilityRange(); - _DictToVeterancy(); - _DictToShroudClearingDistance(); - _DictToRecruitableAI(); - _DictToSelectable(); - _DictToStoppingDistance(); - _DictToUnsellable(); - _DictToTargetable(); + _DictToHPs(); + _DictToEnabled(); + _DictToDestructible(); + _DictToPowered(); + _DictToAggressiveness(); + _DictToVisibilityRange(); + _DictToVeterancy(); + _DictToShroudClearingDistance(); + _DictToRecruitableAI(); + _DictToSelectable(); + _DictToStoppingDistance(); + _DictToUnsellable(); + _DictToTargetable(); ShowZOffset(pMapObj); - ShowAngle(pMapObj); - ShowPosition(pMapObj); - - // Warning: order is important. dictToAttachedSound() must come before dictToCustomize(), - // dictToCustomize() must come before any of the customization controls, dictToLooping() - // must come before dictToLoopCount(), and dictToLooping() and dictToLoopCount() must - // come before dictToEnabled(). - dictToAttachedSound(); - dictToCustomize(); - dictToLooping(); - dictToLoopCount(); - dictToEnabled(); - dictToMinVolume(); - dictToVolume(); - dictToMinRange(); - dictToMaxRange(); - dictToPriority(); + ShowAngle(pMapObj); + ShowPosition(pMapObj); + + // Warning: order is important. dictToAttachedSound() must come before dictToCustomize(), + // dictToCustomize() must come before any of the customization controls, dictToLooping() + // must come before dictToLoopCount(), and dictToLooping() and dictToLoopCount() must + // come before dictToEnabled(). + dictToAttachedSound(); + dictToCustomize(); + dictToLooping(); + dictToLoopCount(); + dictToEnabled(); + dictToMinVolume(); + dictToVolume(); + dictToMinRange(); + dictToMaxRange(); + dictToPriority(); } //--------------------------------------------------------------------------------------------------- void MapObjectProps::InitSound(void) { - CComboBox * priorityComboBox = (CComboBox *)GetDlgItem(IDC_PRIORITY_COMBO); - DEBUG_ASSERTCRASH( priorityComboBox != NULL, ("Cannot find sound priority combobox" ) ); + CComboBox * priorityComboBox = (CComboBox *)GetDlgItem(IDC_PRIORITY_COMBO); + DEBUG_ASSERTCRASH( priorityComboBox != NULL, ("Cannot find sound priority combobox" ) ); - if ( priorityComboBox != NULL ) - { - Int i; - for ( i = 0; i <= AP_CRITICAL; i++ ) - { - Int index = priorityComboBox->InsertString( i,theAudioPriorityNames[i] ); - DEBUG_ASSERTCRASH( index == i, ("insert string returned %d, expected %d", index, i ) ); - } - } + if ( priorityComboBox != NULL ) + { + Int i; + for ( i = 0; i <= AP_CRITICAL; i++ ) + { + Int index = priorityComboBox->InsertString( i,theAudioPriorityNames[i] ); + DEBUG_ASSERTCRASH( index == i, ("insert string returned %d, expected %d", index, i ) ); + } + } - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - DEBUG_ASSERTCRASH( soundComboBox != NULL, ("Cannot find sound combobox" ) ); - m_defaultEntryIndex = 0; - m_defaultIsNone = true; - - // Load up combobox - if ( soundComboBox != NULL ) - { - // Add all the sound names in order. Since the combobox has the SORTED style, - // we can just add the strings in and let the combo box sort them - const AudioEventInfoHash & audioEventHash = TheAudio->getAllAudioEvents(); - - AudioEventInfoHash::const_iterator it; - for ( it = audioEventHash.begin(); it != audioEventHash.end(); it++ ) - { - if ( it->second->m_soundType == AT_SoundEffect ) - { - // Hmm, should we be filtering the list in any other way? Oh well. - soundComboBox->AddString( it->second->m_audioName.str() ); - } - } + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + DEBUG_ASSERTCRASH( soundComboBox != NULL, ("Cannot find sound combobox" ) ); + m_defaultEntryIndex = 0; + m_defaultIsNone = true; + + // Load up combobox + if ( soundComboBox != NULL ) + { + // Add all the sound names in order. Since the combobox has the SORTED style, + // we can just add the strings in and let the combo box sort them + const AudioEventInfoHash & audioEventHash = TheAudio->getAllAudioEvents(); + + AudioEventInfoHash::const_iterator it; + for ( it = audioEventHash.begin(); it != audioEventHash.end(); it++ ) + { + if ( it->second->m_soundType == AT_SoundEffect ) + { + // Hmm, should we be filtering the list in any other way? Oh well. + soundComboBox->AddString( it->second->m_audioName.str() ); + } + } - m_defaultEntryIndex = soundComboBox->InsertString( 0, BASE_DEFAULT_STRING ); - m_defaultEntryName = NO_SOUND_STRING; - m_defaultIsNone = true; - - soundComboBox->InsertString( 1, NO_SOUND_STRING ); - } + m_defaultEntryIndex = soundComboBox->InsertString( 0, BASE_DEFAULT_STRING ); + m_defaultEntryName = NO_SOUND_STRING; + m_defaultIsNone = true; + + soundComboBox->InsertString( 1, NO_SOUND_STRING ); + } } // end InitSound @@ -1746,1043 +1746,1043 @@ void MapObjectProps::InitSound(void) // NOTE: assumes getAllSelectedDicts() has already been called void MapObjectProps::clearCustomizeFlag( CWorldBuilderDoc* pDoc, MultipleUndoable * ownerUndoable ) { - Dict empty; + Dict empty; - DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientCustomized, m_allSelectedDicts.size(), pDoc, true); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientCustomized, m_allSelectedDicts.size(), pDoc, true); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - // Note: we can set all the undoes in between the first and last undo to not invalidate, - // since the first (last for doing) and last invalidate after these changes anyway - pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientMaxRange, m_allSelectedDicts.size(), pDoc, false); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - - pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientMinVolume, m_allSelectedDicts.size(), pDoc, false); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - - pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientVolume, m_allSelectedDicts.size(), pDoc, false); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - - pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientMinRange, m_allSelectedDicts.size(), pDoc, false); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + // Note: we can set all the undoes in between the first and last undo to not invalidate, + // since the first (last for doing) and last invalidate after these changes anyway + pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientMaxRange, m_allSelectedDicts.size(), pDoc, false); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + + pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientMinVolume, m_allSelectedDicts.size(), pDoc, false); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + + pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientVolume, m_allSelectedDicts.size(), pDoc, false); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + + pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientMinRange, m_allSelectedDicts.size(), pDoc, false); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientLooping, m_allSelectedDicts.size(), pDoc, false); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientLooping, m_allSelectedDicts.size(), pDoc, false); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientLoopCount, m_allSelectedDicts.size(), pDoc, false); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientLoopCount, m_allSelectedDicts.size(), pDoc, false); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. - pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientPriority, m_allSelectedDicts.size(), pDoc, true); - ownerUndoable->addUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. + pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), empty, TheKey_objectSoundAmbientPriority, m_allSelectedDicts.size(), pDoc, true); + ownerUndoable->addUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to ownerUndoable now. } /// Move data from dialog controls to object(s) void MapObjectProps::attachedSoundToDict(void) { - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) - return; + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == NULL ) + return; - getAllSelectedDicts(); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) - { - MultipleUndoable *pUndo = new MultipleUndoable; + getAllSelectedDicts(); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != NULL ) + { + MultipleUndoable *pUndo = new MultipleUndoable; - Dict newDict; + Dict newDict; - // For the default, erase the objectSoundAmbient key - if ( soundComboBox->GetCurSel() != m_defaultEntryIndex ) - { - CString selectionText; - soundComboBox->GetLBText( soundComboBox->GetCurSel(), selectionText ); - if ( selectionText == NO_SOUND_STRING ) - { - newDict.setAsciiString(TheKey_objectSoundAmbient, ""); - // Can't customize the null sound - clearCustomizeFlag( pDoc, pUndo ); - } - else - { - newDict.setAsciiString(TheKey_objectSoundAmbient, static_cast< const char * >( selectionText) ); - } - } - else if ( m_defaultIsNone ) - { - // Can't customize the null sound - clearCustomizeFlag( pDoc, pUndo ); - } + // For the default, erase the objectSoundAmbient key + if ( soundComboBox->GetCurSel() != m_defaultEntryIndex ) + { + CString selectionText; + soundComboBox->GetLBText( soundComboBox->GetCurSel(), selectionText ); + if ( selectionText == NO_SOUND_STRING ) + { + newDict.setAsciiString(TheKey_objectSoundAmbient, ""); + // Can't customize the null sound + clearCustomizeFlag( pDoc, pUndo ); + } + else + { + newDict.setAsciiString(TheKey_objectSoundAmbient, static_cast< const char * >( selectionText) ); + } + } + else if ( m_defaultIsNone ) + { + // Can't customize the null sound + clearCustomizeFlag( pDoc, pUndo ); + } - DictItemUndoable *pDictUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, TheKey_objectSoundAmbient, m_allSelectedDicts.size(), pDoc, true); - pUndo->addUndoable( pDictUndo ); - pDoc->AddAndDoUndoable( pUndo ); - REF_PTR_RELEASE( pDictUndo ); // belongs to pUndo - REF_PTR_RELEASE( pUndo ); // belongs to pDoc now. - // Update is called by Doc - } + DictItemUndoable *pDictUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, TheKey_objectSoundAmbient, m_allSelectedDicts.size(), pDoc, true); + pUndo->addUndoable( pDictUndo ); + pDoc->AddAndDoUndoable( pUndo ); + REF_PTR_RELEASE( pDictUndo ); // belongs to pUndo + REF_PTR_RELEASE( pUndo ); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::customizeToDict(void) { - CButton * customizeCheckbox = (CButton *)GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL ) - return; - - getAllSelectedDicts(); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) - { - Dict newDict; + CButton * customizeCheckbox = (CButton *)GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == NULL ) + return; + + getAllSelectedDicts(); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != NULL ) + { + Dict newDict; - // For space reasons, erase key instead of added "false" key. Should be treated the same - if ( customizeCheckbox->GetCheck() == 1 ) - { - newDict.setBool( TheKey_objectSoundAmbientCustomized, true ); - DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, TheKey_objectSoundAmbientCustomized, m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } - else - { - MultipleUndoable *pUndo = new MultipleUndoable; - clearCustomizeFlag( pDoc, pUndo ); - pDoc->AddAndDoUndoable( pUndo ); - REF_PTR_RELEASE( pUndo ); // belongs to pDoc now. - // Update is called by Doc - } - } + // For space reasons, erase key instead of added "false" key. Should be treated the same + if ( customizeCheckbox->GetCheck() == 1 ) + { + newDict.setBool( TheKey_objectSoundAmbientCustomized, true ); + DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, TheKey_objectSoundAmbientCustomized, m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } + else + { + MultipleUndoable *pUndo = new MultipleUndoable; + clearCustomizeFlag( pDoc, pUndo ); + pDoc->AddAndDoUndoable( pUndo ); + REF_PTR_RELEASE( pUndo ); // belongs to pDoc now. + // Update is called by Doc + } + } } /// Move data from dialog controls to object(s) void MapObjectProps::enabledToDict(void) { - CButton * enabledCheckbox = (CButton *)GetDlgItem(IDC_ENABLED_CHECKBOX); - if ( enabledCheckbox == NULL ) - return; - - getAllSelectedDicts(); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) - { - Dict newDict; - - newDict.setBool( TheKey_objectSoundAmbientEnabled, enabledCheckbox->GetCheck() != 0 ); - - DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + CButton * enabledCheckbox = (CButton *)GetDlgItem(IDC_ENABLED_CHECKBOX); + if ( enabledCheckbox == NULL ) + return; + + getAllSelectedDicts(); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != NULL ) + { + Dict newDict; + + newDict.setBool( TheKey_objectSoundAmbientEnabled, enabledCheckbox->GetCheck() != 0 ); + + DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::loopingToDict(void) { - CButton * loopingCheckbox = (CButton *)GetDlgItem(IDC_LOOPING_CHECKBOX); - if ( loopingCheckbox == NULL ) - return; - - getAllSelectedDicts(); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) - { - Dict newDict; - - newDict.setBool( TheKey_objectSoundAmbientLooping, loopingCheckbox->GetCheck() != 0 ); - - DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + CButton * loopingCheckbox = (CButton *)GetDlgItem(IDC_LOOPING_CHECKBOX); + if ( loopingCheckbox == NULL ) + return; + + getAllSelectedDicts(); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != NULL ) + { + Dict newDict; + + newDict.setBool( TheKey_objectSoundAmbientLooping, loopingCheckbox->GetCheck() != 0 ); + + DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::loopCountToDict(void) { - CEdit * loopCountEdit = (CEdit *)GetDlgItem(IDC_LOOPCOUNT_EDIT); - if ( loopCountEdit == NULL ) - return; - - getAllSelectedDicts(); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) - { - Dict newDict; - - CString loopCountString; - loopCountEdit->GetWindowText(loopCountString); - - newDict.setInt( TheKey_objectSoundAmbientLoopCount, atoi( loopCountString ) ); - - DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + CEdit * loopCountEdit = (CEdit *)GetDlgItem(IDC_LOOPCOUNT_EDIT); + if ( loopCountEdit == NULL ) + return; + + getAllSelectedDicts(); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != NULL ) + { + Dict newDict; + + CString loopCountString; + loopCountEdit->GetWindowText(loopCountString); + + newDict.setInt( TheKey_objectSoundAmbientLoopCount, atoi( loopCountString ) ); + + DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::minVolumeToDict(void) { - CEdit * minVolumeEdit = (CEdit *)GetDlgItem(IDC_MIN_VOLUME_EDIT); - if ( minVolumeEdit == NULL ) - return; - - getAllSelectedDicts(); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) - { - Dict newDict; - - CString minVolumeString; - minVolumeEdit->GetWindowText(minVolumeString); - - // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 - newDict.setReal( TheKey_objectSoundAmbientMinVolume, INT_TO_REAL( atoi( minVolumeString ) ) / 100.0f ); - - DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + CEdit * minVolumeEdit = (CEdit *)GetDlgItem(IDC_MIN_VOLUME_EDIT); + if ( minVolumeEdit == NULL ) + return; + + getAllSelectedDicts(); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != NULL ) + { + Dict newDict; + + CString minVolumeString; + minVolumeEdit->GetWindowText(minVolumeString); + + // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 + newDict.setReal( TheKey_objectSoundAmbientMinVolume, INT_TO_REAL( atoi( minVolumeString ) ) / 100.0f ); + + DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::volumeToDict(void) { - CEdit * volumeEdit = (CEdit *)GetDlgItem(IDC_VOLUME_EDIT); - if ( volumeEdit == NULL ) - return; - - getAllSelectedDicts(); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) - { - Dict newDict; - - CString volumeString; - volumeEdit->GetWindowText(volumeString); - - // Note: volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 - newDict.setReal( TheKey_objectSoundAmbientVolume, INT_TO_REAL( atoi( volumeString ) ) / 100.0f ); - - DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + CEdit * volumeEdit = (CEdit *)GetDlgItem(IDC_VOLUME_EDIT); + if ( volumeEdit == NULL ) + return; + + getAllSelectedDicts(); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != NULL ) + { + Dict newDict; + + CString volumeString; + volumeEdit->GetWindowText(volumeString); + + // Note: volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 + newDict.setReal( TheKey_objectSoundAmbientVolume, INT_TO_REAL( atoi( volumeString ) ) / 100.0f ); + + DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::minRangeToDict(void) { - CEdit * minRangeEdit = (CEdit *)GetDlgItem(IDC_MIN_RANGE_EDIT); - if ( minRangeEdit == NULL ) - return; - - getAllSelectedDicts(); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) - { - Dict newDict; - - CString minRangeString; - minRangeEdit->GetWindowText(minRangeString); - - newDict.setReal( TheKey_objectSoundAmbientMinRange, INT_TO_REAL( atoi( minRangeString ) ) ); - - DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + CEdit * minRangeEdit = (CEdit *)GetDlgItem(IDC_MIN_RANGE_EDIT); + if ( minRangeEdit == NULL ) + return; + + getAllSelectedDicts(); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != NULL ) + { + Dict newDict; + + CString minRangeString; + minRangeEdit->GetWindowText(minRangeString); + + newDict.setReal( TheKey_objectSoundAmbientMinRange, INT_TO_REAL( atoi( minRangeString ) ) ); + + DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::maxRangeToDict(void) { - CEdit * maxRangeEdit = (CEdit *)GetDlgItem(IDC_MAX_RANGE_EDIT); - if ( maxRangeEdit == NULL ) - return; - - getAllSelectedDicts(); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) - { - Dict newDict; - - CString maxRangeString; - maxRangeEdit->GetWindowText(maxRangeString); - - newDict.setReal( TheKey_objectSoundAmbientMaxRange, INT_TO_REAL( atoi( maxRangeString ) ) ); - - DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + CEdit * maxRangeEdit = (CEdit *)GetDlgItem(IDC_MAX_RANGE_EDIT); + if ( maxRangeEdit == NULL ) + return; + + getAllSelectedDicts(); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != NULL ) + { + Dict newDict; + + CString maxRangeString; + maxRangeEdit->GetWindowText(maxRangeString); + + newDict.setReal( TheKey_objectSoundAmbientMaxRange, INT_TO_REAL( atoi( maxRangeString ) ) ); + + DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from dialog controls to object(s) void MapObjectProps::priorityToDict(void) { - CComboBox * priorityComboBox = (CComboBox *)GetDlgItem(IDC_PRIORITY_COMBO); - if ( priorityComboBox == NULL ) - return; - - getAllSelectedDicts(); - - CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); - if ( pDoc != NULL ) - { - Dict newDict; - - newDict.setInt( TheKey_objectSoundAmbientPriority, priorityComboBox->GetCurSel() ); - - DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); - pDoc->AddAndDoUndoable(pUndo); - REF_PTR_RELEASE(pUndo); // belongs to pDoc now. - // Update is called by Doc - } + CComboBox * priorityComboBox = (CComboBox *)GetDlgItem(IDC_PRIORITY_COMBO); + if ( priorityComboBox == NULL ) + return; + + getAllSelectedDicts(); + + CWorldBuilderDoc* pDoc = CWorldBuilderDoc::GetActiveDoc(); + if ( pDoc != NULL ) + { + Dict newDict; + + newDict.setInt( TheKey_objectSoundAmbientPriority, priorityComboBox->GetCurSel() ); + + DictItemUndoable *pUndo = new DictItemUndoable(&m_allSelectedDicts.front(), newDict, newDict.getNthKey(0), m_allSelectedDicts.size(), pDoc, true); + pDoc->AddAndDoUndoable(pUndo); + REF_PTR_RELEASE(pUndo); // belongs to pDoc now. + // Update is called by Doc + } } /// Move data from object to dialog controls void MapObjectProps::dictToAttachedSound() { - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) - return; - - // Update the string for the "default" entry - m_defaultIsNone = true; - m_defaultEntryName = NO_SOUND_STRING; - soundComboBox->DeleteString(m_defaultEntryIndex); - const ThingTemplate * thingTemplate = NULL; - if (m_dictSource) - { - thingTemplate = m_dictSource->getThingTemplate(); - } + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == NULL ) + return; + + // Update the string for the "default" entry + m_defaultIsNone = true; + m_defaultEntryName = NO_SOUND_STRING; + soundComboBox->DeleteString(m_defaultEntryIndex); + const ThingTemplate * thingTemplate = NULL; + if (m_dictSource) + { + thingTemplate = m_dictSource->getThingTemplate(); + } - if ( thingTemplate ) - { - AsciiString string( BASE_DEFAULT_STRING ); + if ( thingTemplate ) + { + AsciiString string( BASE_DEFAULT_STRING ); - const AudioEventRTS * defaultAudioEvent; - - // Note: getSoundAmbient will return a non-NULL pointer even if there is no real sound attached to the object - if ( thingTemplate->hasSoundAmbient() ) - { - defaultAudioEvent = thingTemplate->getSoundAmbient(); - } - else - { - defaultAudioEvent = NULL; - } + const AudioEventRTS * defaultAudioEvent; + + // Note: getSoundAmbient will return a non-NULL pointer even if there is no real sound attached to the object + if ( thingTemplate->hasSoundAmbient() ) + { + defaultAudioEvent = thingTemplate->getSoundAmbient(); + } + else + { + defaultAudioEvent = NULL; + } - if ( defaultAudioEvent == NULL || defaultAudioEvent == TheAudio->getValidSilentAudioEvent() ) - { - string.concat( " " ); - } - else - { - string.concat( " <" ); - string.concat( defaultAudioEvent->getEventName() ); - string.concat( '>' ); - m_defaultEntryName = defaultAudioEvent->getEventName(); - m_defaultIsNone = false; - } - m_defaultEntryIndex = soundComboBox->InsertString(0, string.str()); - } - else - { - m_defaultEntryIndex = soundComboBox->InsertString(0, BASE_DEFAULT_STRING); - } + if ( defaultAudioEvent == NULL || defaultAudioEvent == TheAudio->getValidSilentAudioEvent() ) + { + string.concat( " " ); + } + else + { + string.concat( " <" ); + string.concat( defaultAudioEvent->getEventName() ); + string.concat( '>' ); + m_defaultEntryName = defaultAudioEvent->getEventName(); + m_defaultIsNone = false; + } + m_defaultEntryIndex = soundComboBox->InsertString(0, string.str()); + } + else + { + m_defaultEntryIndex = soundComboBox->InsertString(0, BASE_DEFAULT_STRING); + } - // Now select the correct entry in the list box - AsciiString sound; - Bool exists = false; - if (m_dictToEdit) - { - sound = m_dictToEdit->getAsciiString(TheKey_objectSoundAmbient, &exists); - } + // Now select the correct entry in the list box + AsciiString sound; + Bool exists = false; + if (m_dictToEdit) + { + sound = m_dictToEdit->getAsciiString(TheKey_objectSoundAmbient, &exists); + } - if ( !exists ) - { - // Use the "default" entry - soundComboBox->SetCurSel( m_defaultEntryIndex ); - return; - } + if ( !exists ) + { + // Use the "default" entry + soundComboBox->SetCurSel( m_defaultEntryIndex ); + return; + } - if ( sound.isEmpty() ) - { - // Use the entry "(None)" - sound = NO_SOUND_STRING; - } + if ( sound.isEmpty() ) + { + // Use the entry "(None)" + sound = NO_SOUND_STRING; + } - // Note: better than SelectString because we want the exact string not a prefix - Int index = soundComboBox->FindStringExact( -1, sound.str() ); - if ( index > -1 ) - { - soundComboBox->SetCurSel( index ); - } - else - { - DEBUG_CRASH( ("Could not find existing sound's name %s in combo box", sound.str() ) ); - soundComboBox->SetCurSel( m_defaultEntryIndex ); - } + // Note: better than SelectString because we want the exact string not a prefix + Int index = soundComboBox->FindStringExact( -1, sound.str() ); + if ( index > -1 ) + { + soundComboBox->SetCurSel( index ); + } + else + { + DEBUG_CRASH( ("Could not find existing sound's name %s in combo box", sound.str() ) ); + soundComboBox->SetCurSel( m_defaultEntryIndex ); + } } /// Move data from object to dialog controls void MapObjectProps::dictToCustomize() { - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL ) - return; + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == NULL ) + return; - // If the current sound is "none", disable the customize button - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) - return; + // If the current sound is "none", disable the customize button + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == NULL ) + return; - int index = soundComboBox->GetCurSel(); - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || - ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - customizeCheckbox->SetCheck( 0 ); - customizeCheckbox->EnableWindow( false ); - return; - } + int index = soundComboBox->GetCurSel(); + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || + ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + customizeCheckbox->SetCheck( 0 ); + customizeCheckbox->EnableWindow( false ); + return; + } - // Sound is not "none", so we can customize if we wish - customizeCheckbox->EnableWindow( true ); + // Sound is not "none", so we can customize if we wish + customizeCheckbox->EnableWindow( true ); - Bool exists = false; - Bool customized = false; - if (m_dictToEdit) - { - customized = m_dictToEdit->getBool(TheKey_objectSoundAmbientCustomized, &exists); - } + Bool exists = false; + Bool customized = false; + if (m_dictToEdit) + { + customized = m_dictToEdit->getBool(TheKey_objectSoundAmbientCustomized, &exists); + } - customizeCheckbox->SetCheck( exists && customized ? 1 : 0 ); + customizeCheckbox->SetCheck( exists && customized ? 1 : 0 ); } /// Move data from object to dialog controls void MapObjectProps::dictToLooping() { - CButton * loopingCheckbox = ( CButton * )GetDlgItem(IDC_LOOPING_CHECKBOX); - if ( loopingCheckbox == NULL ) - return; + CButton * loopingCheckbox = ( CButton * )GetDlgItem(IDC_LOOPING_CHECKBOX); + if ( loopingCheckbox == NULL ) + return; - // If the customized checkbox is off, all customization controls are disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) - { - loopingCheckbox->EnableWindow( false ); - } - else - { - loopingCheckbox->EnableWindow( true ); - - // If customization is enabled, look to see if the looping flag has already been - // customized - Bool exists = false; - Bool looping = false; - if (m_dictToEdit) - { - looping = m_dictToEdit->getBool(TheKey_objectSoundAmbientLooping, &exists); - } - - if ( exists ) - { - loopingCheckbox->SetCheck( looping ? 1 : 0 ); - - // Don't use defaults, just return - return; - } - } + // If the customized checkbox is off, all customization controls are disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) + { + loopingCheckbox->EnableWindow( false ); + } + else + { + loopingCheckbox->EnableWindow( true ); + + // If customization is enabled, look to see if the looping flag has already been + // customized + Bool exists = false; + Bool looping = false; + if (m_dictToEdit) + { + looping = m_dictToEdit->getBool(TheKey_objectSoundAmbientLooping, &exists); + } + + if ( exists ) + { + loopingCheckbox->SetCheck( looping ? 1 : 0 ); + + // Don't use defaults, just return + return; + } + } - // If we get here, we need the default for the looping checkbox - - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) - { - loopingCheckbox->SetCheck( 0 ); - return; - } - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - loopingCheckbox->SetCheck( 0 ); - return; - } + // If we get here, we need the default for the looping checkbox + + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == NULL ) + { + loopingCheckbox->SetCheck( 0 ); + return; + } + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + loopingCheckbox->SetCheck( 0 ); + return; + } - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - loopingCheckbox->SetCheck( ( audioEventInfo && ( audioEventInfo->m_control & AC_LOOP ) ) ? 1 : 0 ); + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + loopingCheckbox->SetCheck( ( audioEventInfo && ( audioEventInfo->m_control & AC_LOOP ) ) ? 1 : 0 ); } /// Move data from object to dialog controls void MapObjectProps::dictToLoopCount() { - CEdit * loopCountEdit = ( CEdit * )GetDlgItem(IDC_LOOPCOUNT_EDIT); - if ( loopCountEdit == NULL ) - return; - - // If the customized checkbox is off, all customization controls are disabled - // If the looping checkbox is off, the loop count control is disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - CButton * loopingCheckbox = ( CButton * )GetDlgItem(IDC_LOOPING_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 || - loopingCheckbox == NULL || loopingCheckbox->GetCheck() == 0 ) - { - loopCountEdit->EnableWindow( false ); - } - else - { - loopCountEdit->EnableWindow( true ); - - // If customization is enabled, look to see if the loop count has already been - // customized - Bool exists = false; - Int loopCount = 0; - if (m_dictToEdit) - { - loopCount = m_dictToEdit->getInt(TheKey_objectSoundAmbientLoopCount, &exists); - } - - if ( exists ) - { - CString loopCountText; - loopCountText.Format( "%d", loopCount ); - loopCountEdit->SetWindowText( loopCountText ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the loop count - - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) - { - loopCountEdit->SetWindowText( "0" ); - return; - } + CEdit * loopCountEdit = ( CEdit * )GetDlgItem(IDC_LOOPCOUNT_EDIT); + if ( loopCountEdit == NULL ) + return; + + // If the customized checkbox is off, all customization controls are disabled + // If the looping checkbox is off, the loop count control is disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + CButton * loopingCheckbox = ( CButton * )GetDlgItem(IDC_LOOPING_CHECKBOX); + if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 || + loopingCheckbox == NULL || loopingCheckbox->GetCheck() == 0 ) + { + loopCountEdit->EnableWindow( false ); + } + else + { + loopCountEdit->EnableWindow( true ); + + // If customization is enabled, look to see if the loop count has already been + // customized + Bool exists = false; + Int loopCount = 0; + if (m_dictToEdit) + { + loopCount = m_dictToEdit->getInt(TheKey_objectSoundAmbientLoopCount, &exists); + } + + if ( exists ) + { + CString loopCountText; + loopCountText.Format( "%d", loopCount ); + loopCountEdit->SetWindowText( loopCountText ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the loop count + + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == NULL ) + { + loopCountEdit->SetWindowText( "0" ); + return; + } - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - loopCountEdit->SetWindowText( "0" ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + loopCountEdit->SetWindowText( "0" ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - if ( audioEventInfo == NULL ) - { - loopCountEdit->SetWindowText( "0" ); - return; - } - - CString loopCountText; - loopCountText.Format( "%d", audioEventInfo->m_loopCount ); - loopCountEdit->SetWindowText( loopCountText ); + if ( audioEventInfo == NULL ) + { + loopCountEdit->SetWindowText( "0" ); + return; + } + + CString loopCountText; + loopCountText.Format( "%d", audioEventInfo->m_loopCount ); + loopCountEdit->SetWindowText( loopCountText ); } /// Move data from object to dialog controls void MapObjectProps::dictToEnabled() { - CButton * enableCheckbox = ( CButton * )GetDlgItem(IDC_ENABLED_CHECKBOX); - if ( enableCheckbox == NULL ) - return; - - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + CButton * enableCheckbox = ( CButton * )GetDlgItem(IDC_ENABLED_CHECKBOX); + if ( enableCheckbox == NULL ) + return; - // If we don't have a sound, we can't enable it - CString currentString; - if ( soundComboBox == NULL ) - { - enableCheckbox->EnableWindow( false ); - enableCheckbox->SetCheck( 0 ); - return; - } + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - Int soundIndex = soundComboBox->GetCurSel(); - soundComboBox->GetLBText( soundIndex, currentString ); - if ( currentString == NO_SOUND_STRING || - ( soundIndex == m_defaultEntryIndex && m_defaultIsNone ) ) - { - enableCheckbox->SetCheck( 0 ); - enableCheckbox->EnableWindow( false ); - return; - } - else - { - enableCheckbox->EnableWindow( true ); + // If we don't have a sound, we can't enable it + CString currentString; + if ( soundComboBox == NULL ) + { + enableCheckbox->EnableWindow( false ); + enableCheckbox->SetCheck( 0 ); + return; + } - // Look to see if the enabled flag has already been customized - Bool exists = false; - Bool enabled = false; - if (m_dictToEdit) - { - enabled = m_dictToEdit->getBool(TheKey_objectSoundAmbientEnabled, &exists); - } + Int soundIndex = soundComboBox->GetCurSel(); + soundComboBox->GetLBText( soundIndex, currentString ); + if ( currentString == NO_SOUND_STRING || + ( soundIndex == m_defaultEntryIndex && m_defaultIsNone ) ) + { + enableCheckbox->SetCheck( 0 ); + enableCheckbox->EnableWindow( false ); + return; + } + else + { + enableCheckbox->EnableWindow( true ); - if ( exists ) - { - enableCheckbox->SetCheck( enabled ? 1 : 0 ); + // Look to see if the enabled flag has already been customized + Bool exists = false; + Bool enabled = false; + if (m_dictToEdit) + { + enabled = m_dictToEdit->getBool(TheKey_objectSoundAmbientEnabled, &exists); + } - // Don't use defaults, just return - return; - } - } + if ( exists ) + { + enableCheckbox->SetCheck( enabled ? 1 : 0 ); - // If we get here, we need the default for the enabled checkbox - - // Look up sound and see if it's looping. Looping-forever sounds start enabled; - // non-looping ones don't. - // Actually, by now, dictToLooping and dictToLoopCount will have looked up the - // info we need for us - // NOTE: This test should match the tests done in Object::updateObjValuesFromMapProperties() - // when it decided whether or not to enable a customized sound - CButton * loopingCheckbox = (CButton *)GetDlgItem(IDC_LOOPING_CHECKBOX); - CEdit * loopCountEdit = (CEdit *)GetDlgItem(IDC_LOOPCOUNT_EDIT); - if ( loopingCheckbox && loopCountEdit && loopingCheckbox->GetCheck() == 1 ) - { - CString loopCount; - loopCountEdit->GetWindowText( loopCount ); + // Don't use defaults, just return + return; + } + } - if ( atoi(loopCount) == 0 ) - { - enableCheckbox->SetCheck( 1 ); - return; - } - } + // If we get here, we need the default for the enabled checkbox + + // Look up sound and see if it's looping. Looping-forever sounds start enabled; + // non-looping ones don't. + // Actually, by now, dictToLooping and dictToLoopCount will have looked up the + // info we need for us + // NOTE: This test should match the tests done in Object::updateObjValuesFromMapProperties() + // when it decided whether or not to enable a customized sound + CButton * loopingCheckbox = (CButton *)GetDlgItem(IDC_LOOPING_CHECKBOX); + CEdit * loopCountEdit = (CEdit *)GetDlgItem(IDC_LOOPCOUNT_EDIT); + if ( loopingCheckbox && loopCountEdit && loopingCheckbox->GetCheck() == 1 ) + { + CString loopCount; + loopCountEdit->GetWindowText( loopCount ); - enableCheckbox->SetCheck( 0 ); + if ( atoi(loopCount) == 0 ) + { + enableCheckbox->SetCheck( 1 ); + return; + } + } + + enableCheckbox->SetCheck( 0 ); } /// Move data from object to dialog controls void MapObjectProps::dictToMinVolume() { - CEdit * minVolumeEdit = ( CEdit * )GetDlgItem(IDC_MIN_VOLUME_EDIT); - if ( minVolumeEdit == NULL ) - return; - - // If the customized checkbox is off, all customization controls are disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) - { - minVolumeEdit->EnableWindow( false ); - } - else - { - minVolumeEdit->EnableWindow( true ); - - // If customization is enabled, look to see if the minimum volume has already been - // customized - Bool exists = false; - Real minVolume = 0.0f; - if (m_dictToEdit) - { - minVolume = m_dictToEdit->getReal(TheKey_objectSoundAmbientMinVolume, &exists); - } - - if ( exists ) - { - // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 - CString minVolumeText; - minVolumeText.Format( "%d", REAL_TO_INT( ( minVolume * 100.0f ) + 0.5 ) ); - minVolumeEdit->SetWindowText( minVolumeText ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the minimum volume - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) - { - minVolumeEdit->SetWindowText( "40" ); - return; - } - - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - minVolumeEdit->SetWindowText( "40" ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - if ( audioEventInfo == NULL ) - { - minVolumeEdit->SetWindowText( "40" ); - return; - } - - // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 - CString minVolumeText; - minVolumeText.Format( "%d", REAL_TO_INT( ( audioEventInfo->m_minVolume * 100.0f ) + 0.5 ) ); - minVolumeEdit->SetWindowText( minVolumeText ); + CEdit * minVolumeEdit = ( CEdit * )GetDlgItem(IDC_MIN_VOLUME_EDIT); + if ( minVolumeEdit == NULL ) + return; + + // If the customized checkbox is off, all customization controls are disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) + { + minVolumeEdit->EnableWindow( false ); + } + else + { + minVolumeEdit->EnableWindow( true ); + + // If customization is enabled, look to see if the minimum volume has already been + // customized + Bool exists = false; + Real minVolume = 0.0f; + if (m_dictToEdit) + { + minVolume = m_dictToEdit->getReal(TheKey_objectSoundAmbientMinVolume, &exists); + } + + if ( exists ) + { + // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 + CString minVolumeText; + minVolumeText.Format( "%d", REAL_TO_INT( ( minVolume * 100.0f ) + 0.5 ) ); + minVolumeEdit->SetWindowText( minVolumeText ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the minimum volume + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == NULL ) + { + minVolumeEdit->SetWindowText( "40" ); + return; + } + + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + minVolumeEdit->SetWindowText( "40" ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + if ( audioEventInfo == NULL ) + { + minVolumeEdit->SetWindowText( "40" ); + return; + } + + // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 + CString minVolumeText; + minVolumeText.Format( "%d", REAL_TO_INT( ( audioEventInfo->m_minVolume * 100.0f ) + 0.5 ) ); + minVolumeEdit->SetWindowText( minVolumeText ); } /// Move data from object to dialog controls void MapObjectProps::dictToVolume() { - CEdit * volumeEdit = ( CEdit * )GetDlgItem(IDC_VOLUME_EDIT); - if ( volumeEdit == NULL ) - return; - - // If the customized checkbox is off, all customization controls are disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) - { - volumeEdit->EnableWindow( false ); - } - else - { - volumeEdit->EnableWindow( true ); - - // If customization is enabled, look to see if the volume has already been - // customized - Bool exists = false; - Real volume = 0.0f; - if (m_dictToEdit) - { - volume = m_dictToEdit->getReal(TheKey_objectSoundAmbientVolume, &exists); - } - - if ( exists ) - { - // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 - CString volumeText; - volumeText.Format( "%d", REAL_TO_INT( ( volume * 100.0f ) + 0.5 ) ); - volumeEdit->SetWindowText( volumeText ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the volume - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) - { - volumeEdit->SetWindowText( "100" ); - return; - } - - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - volumeEdit->SetWindowText( "100" ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } + CEdit * volumeEdit = ( CEdit * )GetDlgItem(IDC_VOLUME_EDIT); + if ( volumeEdit == NULL ) + return; + + // If the customized checkbox is off, all customization controls are disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) + { + volumeEdit->EnableWindow( false ); + } + else + { + volumeEdit->EnableWindow( true ); + + // If customization is enabled, look to see if the volume has already been + // customized + Bool exists = false; + Real volume = 0.0f; + if (m_dictToEdit) + { + volume = m_dictToEdit->getReal(TheKey_objectSoundAmbientVolume, &exists); + } + + if ( exists ) + { + // Note: min volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 + CString volumeText; + volumeText.Format( "%d", REAL_TO_INT( ( volume * 100.0f ) + 0.5 ) ); + volumeEdit->SetWindowText( volumeText ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the volume + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == NULL ) + { + volumeEdit->SetWindowText( "100" ); + return; + } + + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + volumeEdit->SetWindowText( "100" ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - if ( audioEventInfo == NULL ) - { - volumeEdit->SetWindowText( "100" ); - return; - } - - // Note: volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 - CString volumeText; - volumeText.Format( "%d", REAL_TO_INT( ( audioEventInfo->m_volume * 100.0f ) + 0.5 ) ); - volumeEdit->SetWindowText( volumeText ); + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + if ( audioEventInfo == NULL ) + { + volumeEdit->SetWindowText( "100" ); + return; + } + + // Note: volume is stored as Real between 0.0 and 1.0, but displayed as a percentage from 0 to 100 + CString volumeText; + volumeText.Format( "%d", REAL_TO_INT( ( audioEventInfo->m_volume * 100.0f ) + 0.5 ) ); + volumeEdit->SetWindowText( volumeText ); } /// Move data from object to dialog controls void MapObjectProps::dictToMinRange() { - CEdit * minRangeEdit = ( CEdit * )GetDlgItem(IDC_MIN_RANGE_EDIT); - if ( minRangeEdit == NULL ) - return; - - // If the customized checkbox is off, all customization controls are disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) - { - minRangeEdit->EnableWindow( false ); - } - else - { - minRangeEdit->EnableWindow( true ); - - // If customization is enabled, look to see if the minimum range has already been - // customized - Bool exists = false; - Real minRange = 0.0f; - if (m_dictToEdit) - { - minRange = m_dictToEdit->getReal(TheKey_objectSoundAmbientMinRange, &exists); - } - - if ( exists ) - { - CString minRangeText; - minRangeText.Format( "%d", REAL_TO_INT(minRange) ); - minRangeEdit->SetWindowText( minRangeText ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the minimum range - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) - { - minRangeEdit->SetWindowText( "175" ); - return; - } - - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - minRangeEdit->SetWindowText( "175" ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - if ( audioEventInfo == NULL ) - { - minRangeEdit->SetWindowText( "175" ); - return; - } - - CString minRangeText; - minRangeText.Format( "%d", REAL_TO_INT( audioEventInfo->m_minDistance ) ); - minRangeEdit->SetWindowText( minRangeText ); + CEdit * minRangeEdit = ( CEdit * )GetDlgItem(IDC_MIN_RANGE_EDIT); + if ( minRangeEdit == NULL ) + return; + + // If the customized checkbox is off, all customization controls are disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) + { + minRangeEdit->EnableWindow( false ); + } + else + { + minRangeEdit->EnableWindow( true ); + + // If customization is enabled, look to see if the minimum range has already been + // customized + Bool exists = false; + Real minRange = 0.0f; + if (m_dictToEdit) + { + minRange = m_dictToEdit->getReal(TheKey_objectSoundAmbientMinRange, &exists); + } + + if ( exists ) + { + CString minRangeText; + minRangeText.Format( "%d", REAL_TO_INT(minRange) ); + minRangeEdit->SetWindowText( minRangeText ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the minimum range + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == NULL ) + { + minRangeEdit->SetWindowText( "175" ); + return; + } + + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + minRangeEdit->SetWindowText( "175" ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + if ( audioEventInfo == NULL ) + { + minRangeEdit->SetWindowText( "175" ); + return; + } + + CString minRangeText; + minRangeText.Format( "%d", REAL_TO_INT( audioEventInfo->m_minDistance ) ); + minRangeEdit->SetWindowText( minRangeText ); } /// Move data from object to dialog controls void MapObjectProps::dictToMaxRange() { - CEdit * maxRangeEdit = ( CEdit * )GetDlgItem(IDC_MAX_RANGE_EDIT); - if ( maxRangeEdit == NULL ) - return; - - // If the customized checkbox is off, all customization controls are disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) - { - maxRangeEdit->EnableWindow( false ); - } - else - { - maxRangeEdit->EnableWindow( true ); - - // If customization is enabled, look to see if the maximum range has already been - // customized - Bool exists = false; - Real maxRange = 0.0f; - if (m_dictToEdit) - { - maxRange = m_dictToEdit->getReal(TheKey_objectSoundAmbientMaxRange, &exists); - } - - if ( exists ) - { - CString maxRangeText; - maxRangeText.Format( "%d", REAL_TO_INT( maxRange ) ); - maxRangeEdit->SetWindowText( maxRangeText ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the minimum range - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) - { - maxRangeEdit->SetWindowText( "600" ); - return; - } - - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - maxRangeEdit->SetWindowText( "600" ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - if ( audioEventInfo == NULL ) - { - maxRangeEdit->SetWindowText( "600" ); - return; - } - - CString maxRangeText; - maxRangeText.Format( "%d", REAL_TO_INT( audioEventInfo->m_maxDistance ) ); - maxRangeEdit->SetWindowText( maxRangeText ); + CEdit * maxRangeEdit = ( CEdit * )GetDlgItem(IDC_MAX_RANGE_EDIT); + if ( maxRangeEdit == NULL ) + return; + + // If the customized checkbox is off, all customization controls are disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) + { + maxRangeEdit->EnableWindow( false ); + } + else + { + maxRangeEdit->EnableWindow( true ); + + // If customization is enabled, look to see if the maximum range has already been + // customized + Bool exists = false; + Real maxRange = 0.0f; + if (m_dictToEdit) + { + maxRange = m_dictToEdit->getReal(TheKey_objectSoundAmbientMaxRange, &exists); + } + + if ( exists ) + { + CString maxRangeText; + maxRangeText.Format( "%d", REAL_TO_INT( maxRange ) ); + maxRangeEdit->SetWindowText( maxRangeText ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the minimum range + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == NULL ) + { + maxRangeEdit->SetWindowText( "600" ); + return; + } + + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + maxRangeEdit->SetWindowText( "600" ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + if ( audioEventInfo == NULL ) + { + maxRangeEdit->SetWindowText( "600" ); + return; + } + + CString maxRangeText; + maxRangeText.Format( "%d", REAL_TO_INT( audioEventInfo->m_maxDistance ) ); + maxRangeEdit->SetWindowText( maxRangeText ); } /// Move data from object to dialog controls void MapObjectProps::dictToPriority() { - CComboBox * priorityComboBox = ( CComboBox * )GetDlgItem(IDC_PRIORITY_COMBO); - if ( priorityComboBox == NULL ) - return; - - // If the customized checkbox is off, all customization controls are disabled - CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); - if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) - { - priorityComboBox->EnableWindow( false ); - } - else - { - priorityComboBox->EnableWindow( true ); - - // If customization is enabled, look to see if the maximum range has already been - // customized - Bool exists = false; - Int priorityEnum = AP_LOWEST; - if (m_dictToEdit) - { - priorityEnum = m_dictToEdit->getInt(TheKey_objectSoundAmbientPriority, &exists); - } - - if ( exists ) - { - if ( priorityEnum < 0 || priorityEnum > AP_CRITICAL ) - { - DEBUG_CRASH( ("Bad soundAmbientPriority key %d", priorityEnum ) ); - priorityEnum = AP_LOWEST; - } + CComboBox * priorityComboBox = ( CComboBox * )GetDlgItem(IDC_PRIORITY_COMBO); + if ( priorityComboBox == NULL ) + return; + + // If the customized checkbox is off, all customization controls are disabled + CButton * customizeCheckbox = ( CButton * )GetDlgItem(IDC_CUSTOMIZE_CHECKBOX); + if ( customizeCheckbox == NULL || customizeCheckbox->GetCheck() == 0 ) + { + priorityComboBox->EnableWindow( false ); + } + else + { + priorityComboBox->EnableWindow( true ); + + // If customization is enabled, look to see if the maximum range has already been + // customized + Bool exists = false; + Int priorityEnum = AP_LOWEST; + if (m_dictToEdit) + { + priorityEnum = m_dictToEdit->getInt(TheKey_objectSoundAmbientPriority, &exists); + } + + if ( exists ) + { + if ( priorityEnum < 0 || priorityEnum > AP_CRITICAL ) + { + DEBUG_CRASH( ("Bad soundAmbientPriority key %d", priorityEnum ) ); + priorityEnum = AP_LOWEST; + } - // Note: indexes of priority combobox map to priority enum - priorityComboBox->SetCurSel( priorityEnum ); - - // Don't use defaults, just return - return; - } - } - - // If we get here, we need the default for the priority - CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); - if ( soundComboBox == NULL ) - { - priorityComboBox->SetCurSel( AP_LOWEST ); - return; - } - - Int index = soundComboBox->GetCurSel(); - - CString currentString; - soundComboBox->GetLBText( index, currentString ); - if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) - { - priorityComboBox->SetCurSel( AP_LOWEST ); - return; - } - - if ( index == m_defaultEntryIndex ) - { - // Correct the current string e.g. remove "Default <" and ">" - currentString = m_defaultEntryName.str(); - } - - AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); - - if ( audioEventInfo == NULL ) - { - priorityComboBox->SetCurSel( AP_LOWEST ); - return; - } - - priorityComboBox->SetCurSel( audioEventInfo->m_priority ); + // Note: indexes of priority combobox map to priority enum + priorityComboBox->SetCurSel( priorityEnum ); + + // Don't use defaults, just return + return; + } + } + + // If we get here, we need the default for the priority + CComboBox * soundComboBox = (CComboBox *)GetDlgItem(IDC_SOUND_COMBO); + if ( soundComboBox == NULL ) + { + priorityComboBox->SetCurSel( AP_LOWEST ); + return; + } + + Int index = soundComboBox->GetCurSel(); + + CString currentString; + soundComboBox->GetLBText( index, currentString ); + if ( currentString == NO_SOUND_STRING || ( index == m_defaultEntryIndex && m_defaultIsNone ) ) + { + priorityComboBox->SetCurSel( AP_LOWEST ); + return; + } + + if ( index == m_defaultEntryIndex ) + { + // Correct the current string e.g. remove "Default <" and ">" + currentString = m_defaultEntryName.str(); + } + + AudioEventInfo * audioEventInfo = TheAudio->findAudioEventInfo(static_cast< const char * >( currentString ) ); + + if ( audioEventInfo == NULL ) + { + priorityComboBox->SetCurSel( AP_LOWEST ); + return; + } + + priorityComboBox->SetCurSel( audioEventInfo->m_priority ); } diff --git a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp index 6ae830f5ec..3f9a898663 100644 --- a/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp +++ b/GeneralsMD/Code/Tools/WorldBuilder/src/wbview3d.cpp @@ -2367,42 +2367,42 @@ void WbView3d::OnPaint() /// Draw a (not very good) circle into the hdc void WbView3d::drawCircle( HDC hdc, const Coord3D & centerPoint, Real radius, COLORREF color ) { - CPoint rulerPoints[2]; - Coord3D pnt; - Real angle = 0.0f; - Real inc = PI/4.0f; - - // Create and select a correctly colored pen. Remember the old one so that it can be restored. - HPEN pen = CreatePen(PS_SOLID, 2, color); - HPEN penOld = (HPEN)SelectObject(hdc, pen); - - - // Get the starting point on the circumference of the circle. - pnt.x = centerPoint.x + radius * (Real)cosf(angle); - pnt.y = centerPoint.y + radius * (Real)sinf(angle); - pnt.z = centerPoint.z; - docToViewCoords(pnt, &rulerPoints[0]); - - angle += inc; - for(; angle <= 2.0f * PI; angle += inc) { + CPoint rulerPoints[2]; + Coord3D pnt; + Real angle = 0.0f; + Real inc = PI/4.0f; + + // Create and select a correctly colored pen. Remember the old one so that it can be restored. + HPEN pen = CreatePen(PS_SOLID, 2, color); + HPEN penOld = (HPEN)SelectObject(hdc, pen); + + + // Get the starting point on the circumference of the circle. + pnt.x = centerPoint.x + radius * (Real)cosf(angle); + pnt.y = centerPoint.y + radius * (Real)sinf(angle); + pnt.z = centerPoint.z; + docToViewCoords(pnt, &rulerPoints[0]); + + angle += inc; + for(; angle <= 2.0f * PI; angle += inc) { // Get a new point on the circumference of the circle. pnt.x = centerPoint.x + radius * (Real)cosf(angle); - pnt.y = centerPoint.y + radius * (Real)sinf(angle); - pnt.z = centerPoint.z; - - docToViewCoords(pnt, &rulerPoints[1]); - - ::Polyline(hdc, rulerPoints, 2); - - // Remember the last point to use as the starting point for the next line. - rulerPoints[0].x = rulerPoints[1].x; - rulerPoints[0].y = rulerPoints[1].y; - } + pnt.y = centerPoint.y + radius * (Real)sinf(angle); + pnt.z = centerPoint.z; + + docToViewCoords(pnt, &rulerPoints[1]); + + ::Polyline(hdc, rulerPoints, 2); + + // Remember the last point to use as the starting point for the next line. + rulerPoints[0].x = rulerPoints[1].x; + rulerPoints[0].y = rulerPoints[1].y; + } - // Restore previous pen. - SelectObject(hdc, penOld); - // Delete new pen. - DeleteObject(pen); + // Restore previous pen. + SelectObject(hdc, penOld); + // Delete new pen. + DeleteObject(pen); } @@ -2538,24 +2538,24 @@ void WbView3d::drawLabels(HDC hdc) if (hdc && m_doRulerFeedback) { if (m_doRulerFeedback == RULER_LINE) { - // Change world coords to screen viewport coords. - CPoint rulerPoints[2]; - docToViewCoords(m_rulerPoints[0], &rulerPoints[0]); - docToViewCoords(m_rulerPoints[1], &rulerPoints[1]); - - // Create and select a green pen. Remember the old one so that it can be restored. - HPEN pen = CreatePen(PS_SOLID, 2, RGB(0,255,0)); - HPEN penOld = (HPEN)SelectObject(hdc, pen); - // Draw the line ruler. + // Change world coords to screen viewport coords. + CPoint rulerPoints[2]; + docToViewCoords(m_rulerPoints[0], &rulerPoints[0]); + docToViewCoords(m_rulerPoints[1], &rulerPoints[1]); + + // Create and select a green pen. Remember the old one so that it can be restored. + HPEN pen = CreatePen(PS_SOLID, 2, RGB(0,255,0)); + HPEN penOld = (HPEN)SelectObject(hdc, pen); + // Draw the line ruler. ::Polyline(hdc, rulerPoints, 2); - // Restore previous pen. - SelectObject(hdc, penOld); - // Delete new pen. - DeleteObject(pen); + // Restore previous pen. + SelectObject(hdc, penOld); + // Delete new pen. + DeleteObject(pen); } else if (m_doRulerFeedback == RULER_CIRCLE) { - drawCircle( hdc, m_rulerPoints[0], m_rulerLength, RGB( 0, 255, 0 ) ); - } + drawCircle( hdc, m_rulerPoints[0], m_rulerLength, RGB( 0, 255, 0 ) ); + } } if (hdc && m_doLightFeedback)