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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Core/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ set(GAMEENGINE_SRC
# Include/GameLogic/Module/HeightDieUpdate.h
# Include/GameLogic/Module/HelicopterSlowDeathUpdate.h
# Include/GameLogic/Module/HelixContain.h
# Include/GameLogic/Module/MultiAddOnContain.h
# Include/GameLogic/Module/HighlanderBody.h
# Include/GameLogic/Module/HijackerUpdate.h
# Include/GameLogic/Module/HiveStructureBody.h
Expand Down Expand Up @@ -905,6 +906,7 @@ set(GAMEENGINE_SRC
# Source/GameLogic/Object/Contain/GarrisonContain.cpp
# Source/GameLogic/Object/Contain/HealContain.cpp
# Source/GameLogic/Object/Contain/HelixContain.cpp
# Source/GameLogic/Object/Contain/MultiAddOnContain.cpp
# Source/GameLogic/Object/Contain/InternetHackContain.cpp
# Source/GameLogic/Object/Contain/MobNexusContain.cpp
# Source/GameLogic/Object/Contain/OpenContain.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ static PoolSizeRec PoolSizes[] =
{ "OverchargeBehavior", 32, 32 },
{ "OverlordContain", 32, 32 },
{ "HelixContain", 32, 32 },
{ "MultiAddOnContain", 64, 32 },
{ "ParachuteContain", 128, 32 },
{ "PhysicsBehavior", 600, 32 },
{ "PoisonedBehavior", 512, 64 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ static PoolSizeRec PoolSizes[] =
{ "OverchargeBehavior", 32, 32 },
{ "OverlordContain", 32, 32 },
{ "HelixContain", 32, 32 },
{ "MultiAddOnContain", 64, 32 },
{ "ParachuteContain", 128, 32 },
{ "PhysicsBehavior", 600, 32 },
{ "PoisonedBehavior", 512, 64 },
Expand Down
50 changes: 26 additions & 24 deletions GeneralsMD/Code/GameEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ set(GAMEENGINE_SRC
Include/Common/CDManager.h
Include/Common/ClientUpdateModule.h
Include/Common/CommandLine.h
# Include/Common/crc.h
# Include/Common/CRCDebug.h
# Include/Common/crc.h
# Include/Common/CRCDebug.h
Include/Common/CriticalSection.h
Include/Common/CustomMatchPreferences.h
Include/Common/DamageFX.h
Include/Common/DataChunk.h
# Include/Common/Debug.h
# Include/Common/Debug.h
Include/Common/Dict.h
Include/Common/Directory.h
Include/Common/DisabledTypes.h
Expand All @@ -45,7 +45,7 @@ set(GAMEENGINE_SRC
# Include/Common/GameDefines.h
Include/Common/GameEngine.h
Include/Common/GameLOD.h
# Include/Common/GameMemory.h
# Include/Common/GameMemory.h
# Include/Common/GameMusic.h
# Include/Common/GameSounds.h
Include/Common/GameSpyMiscPreferences.h
Expand Down Expand Up @@ -92,7 +92,7 @@ set(GAMEENGINE_SRC
Include/Common/QuotedPrintable.h
Include/Common/Radar.h
# Include/Common/RAMFile.h
# Include/Common/RandomValue.h
# Include/Common/RandomValue.h
Include/Common/Recorder.h
# Include/Common/ReplaySimulation.h
Include/Common/Registry.h
Expand Down Expand Up @@ -142,7 +142,7 @@ set(GAMEENGINE_SRC
Include/GameClient/CDCheck.h
Include/GameClient/ChallengeGenerals.h
Include/GameClient/ClientInstance.h
# Include/GameClient/ClientRandomValue.h
# Include/GameClient/ClientRandomValue.h
Include/GameClient/Color.h
Include/GameClient/CommandXlat.h
Include/GameClient/ControlBar.h
Expand Down Expand Up @@ -224,12 +224,12 @@ set(GAMEENGINE_SRC
Include/GameClient/Statistics.h
Include/GameClient/TerrainRoads.h
Include/GameClient/TerrainVisual.h
Include/GameClient/TintStatus.h
# Include/GameClient/VideoPlayer.h
Include/GameClient/TintStatus.h
# Include/GameClient/VideoPlayer.h
Include/GameClient/View.h
Include/GameClient/Water.h
Include/GameClient/WindowLayout.h
# Include/GameClient/WindowVideoManager.h
# Include/GameClient/WindowVideoManager.h
Include/GameClient/WindowXlat.h
Include/GameClient/WinInstanceData.h
Include/GameLogic/AI.h
Expand All @@ -253,7 +253,7 @@ set(GAMEENGINE_SRC
Include/GameLogic/GhostObject.h
Include/GameLogic/Locomotor.h
Include/GameLogic/LocomotorSet.h
# Include/GameLogic/LogicRandomValue.h
# Include/GameLogic/LogicRandomValue.h
Include/GameLogic/Module/ActiveBody.h
Include/GameLogic/Module/ActiveShroudUpgrade.h
Include/GameLogic/Module/AIUpdate.h
Expand Down Expand Up @@ -344,6 +344,7 @@ set(GAMEENGINE_SRC
Include/GameLogic/Module/HeightDieUpdate.h
Include/GameLogic/Module/HelicopterSlowDeathUpdate.h
Include/GameLogic/Module/HelixContain.h
Include/GameLogic/Module/MultiAddOnContain.h
Include/GameLogic/Module/HighlanderBody.h
Include/GameLogic/Module/HijackerUpdate.h
Include/GameLogic/Module/HiveStructureBody.h
Expand Down Expand Up @@ -578,8 +579,8 @@ set(GAMEENGINE_SRC
Source/Common/Bezier/BezierSegment.cpp
Source/Common/BitFlags.cpp
Source/Common/CommandLine.cpp
# Source/Common/crc.cpp
# Source/Common/CRCDebug.cpp
# Source/Common/crc.cpp
# Source/Common/CRCDebug.cpp
Source/Common/DamageFX.cpp
Source/Common/Dict.cpp
Source/Common/DiscreteCircle.cpp
Expand Down Expand Up @@ -611,7 +612,7 @@ set(GAMEENGINE_SRC
Source/Common/INI/INITerrainBridge.cpp
Source/Common/INI/INITerrainRoad.cpp
Source/Common/INI/INIUpgrade.cpp
# Source/Common/INI/INIVideo.cpp
# Source/Common/INI/INIVideo.cpp
Source/Common/INI/INIWater.cpp
Source/Common/INI/INIWeapon.cpp
Source/Common/INI/INIWebpageURL.cpp
Expand All @@ -622,7 +623,7 @@ set(GAMEENGINE_SRC
Source/Common/NameKeyGenerator.cpp
Source/Common/PartitionSolver.cpp
Source/Common/PerfTimer.cpp
# Source/Common/RandomValue.cpp
# Source/Common/RandomValue.cpp
Source/Common/Recorder.cpp
# Source/Common/ReplaySimulation.cpp
Source/Common/RTS/AcademyStats.cpp
Expand Down Expand Up @@ -651,7 +652,7 @@ set(GAMEENGINE_SRC
Source/Common/System/CDManager.cpp
Source/Common/System/CriticalSection.cpp
Source/Common/System/DataChunk.cpp
# Source/Common/System/Debug.cpp
# Source/Common/System/Debug.cpp
Source/Common/System/Directory.cpp
Source/Common/System/DisabledTypes.cpp
Source/Common/System/encrypt.cpp
Expand Down Expand Up @@ -806,7 +807,7 @@ set(GAMEENGINE_SRC
Source/GameClient/GUI/Shell/Shell.cpp
Source/GameClient/GUI/Shell/ShellMenuScheme.cpp
Source/GameClient/GUI/WindowLayout.cpp
# Source/GameClient/GUI/WindowVideoManager.cpp
# Source/GameClient/GUI/WindowVideoManager.cpp
Source/GameClient/GUI/WinInstanceData.cpp
Source/GameClient/InGameUI.cpp
Source/GameClient/Input/Keyboard.cpp
Expand Down Expand Up @@ -838,8 +839,8 @@ set(GAMEENGINE_SRC
Source/GameClient/System/Smudge.cpp
Source/GameClient/Terrain/TerrainRoads.cpp
Source/GameClient/Terrain/TerrainVisual.cpp
# Source/GameClient/VideoPlayer.cpp
# Source/GameClient/VideoStream.cpp
# Source/GameClient/VideoPlayer.cpp
# Source/GameClient/VideoStream.cpp
Source/GameClient/View.cpp
Source/GameClient/Water.cpp
Source/GameLogic/AI/AI.cpp
Expand Down Expand Up @@ -924,6 +925,7 @@ set(GAMEENGINE_SRC
Source/GameLogic/Object/Contain/GarrisonContain.cpp
Source/GameLogic/Object/Contain/HealContain.cpp
Source/GameLogic/Object/Contain/HelixContain.cpp
Source/GameLogic/Object/Contain/MultiAddOnContain.cpp
Source/GameLogic/Object/Contain/InternetHackContain.cpp
Source/GameLogic/Object/Contain/MobNexusContain.cpp
Source/GameLogic/Object/Contain/OpenContain.cpp
Expand Down Expand Up @@ -1167,16 +1169,16 @@ set(GAMEENGINE_SRC
if(RTS_GAMEMEMORY_ENABLE)
# Uses the original Game Memory implementation.
list(APPEND GAMEENGINE_SRC
# Source/Common/System/GameMemory.cpp
# Source/Common/System/GameMemoryInitDMA_GeneralsMD.inl
# Source/Common/System/GameMemoryInitPools_GeneralsMD.inl
# Source/Common/System/MemoryInit.cpp
# Source/Common/System/GameMemory.cpp
# Source/Common/System/GameMemoryInitDMA_GeneralsMD.inl
# Source/Common/System/GameMemoryInitPools_GeneralsMD.inl
# Source/Common/System/MemoryInit.cpp
)
else()
# Uses the null implementation when disabled.
list(APPEND GAMEENGINE_SRC
# Source/Common/System/GameMemoryNull.cpp
# Include/Common/GameMemoryNull.h
# Source/Common/System/GameMemoryNull.cpp
# Include/Common/GameMemoryNull.h
)
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ class ContainModuleInterface

return true;
}

// AW: New additions for MultiAddonContain only
virtual short getRiderSlot(ObjectID riderID) const = 0; // get the slot occupied by the object.
virtual short getPortableSlot(ObjectID portableID) const = 0; // get the slot occupied by the object.
virtual const ContainedItemsList* getAddOnList() const = 0;
};
//-------------------------------------------------------------------------------------------------

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
/*
** Command & Conquer Generals Zero Hour(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////

// FILE: MultiAddOnContain.h ////////////////////////////////////////////////////////////////////////
// Author: Graham Smallwood, September, 2002
// Desc: Contain module that acts as transport normally, but when full it redirects queries to the first passenger
///////////////////////////////////////////////////////////////////////////////////////////////////

#pragma once

#ifndef __MULTIADDON_CONTAIN_H_
#define __MULTIADDON_CONTAIN_H_

// USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
#include "GameLogic/Module/TransportContain.h"
#include "GameLogic/GameLogic.h"


typedef std::vector<AsciiString> TemplateNameList;
typedef std::vector<AsciiString>::const_iterator TemplateNameIterator;

typedef std::vector<ObjectID> VecObjectID;
typedef VecObjectID::iterator VecObjectIDIt;

typedef std::vector<Object*> VecObjectPtr;
typedef VecObjectPtr::iterator VecObjectPtrIt;

typedef std::map< NameKeyType, AsciiString> AddOnEntryMap;

//-------------------------------------------------------------------------------------------------
class MultiAddOnContainModuleData : public TransportContainModuleData
{
public:

MultiAddOnContainModuleData();

TemplateNameList m_payloadTemplateNameData;
Bool m_drawPips; // TODO: Move this to generic transportcontain

AddOnEntryMap m_addOnEntries; ///< allowed passengers and corresponding turrets

AsciiString m_addOnBoneName; ///< positions to place the turrets
AsciiString m_emptySlotSubObjName; ///< sub objects to hide/show when a slot is unmanned
AsciiString m_occupiedSlotSubObjName; ///< sub objects to hide/show when a slot is occupied


static void buildFieldParse(MultiIniFieldParse& p);
static void parseAddOnEntry(INI* ini, void* instance, void* store, const void* /*userData*/);
};

//-------------------------------------------------------------------------------------------------
class MultiAddOnContain : public TransportContain
{

MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(MultiAddOnContain, "MultiAddOnContain")
MAKE_STANDARD_MODULE_MACRO_WITH_MODULE_DATA(MultiAddOnContain, MultiAddOnContainModuleData)

virtual void onBodyDamageStateChange( const DamageInfo* damageInfo,
BodyDamageType oldState,
BodyDamageType newState); ///< state change callback
public:

MultiAddOnContain(Thing* thing, const ModuleData* moduleData);
// virtual destructor prototype provided by memory pool declaration

virtual OpenContain* asOpenContain() { return this; } ///< treat as open container
virtual Bool isHealContain() const { return false; } ///< true when container only contains units while healing (not a transport!)
virtual Bool isTunnelContain() const { return FALSE; }
virtual Bool isImmuneToClearBuildingAttacks() const { return true; }
virtual Bool isSpecialOverlordStyleContainer() const { return TRUE; }

virtual void onDie(const DamageInfo* damageInfo); ///< the die callback
virtual void onDelete(void); ///< Last possible moment cleanup
virtual void onCapture(Player* oldOwner, Player* newOwner);
virtual void onObjectCreated();
virtual void onContaining(Object* obj, Bool wasSelected);
virtual void onRemoving(Object* obj);
//virtual UpdateSleepTime update(); ///< called once per frame

virtual void onSelling();

virtual Bool isValidContainerFor(const Object* obj, Bool checkCapacity) const;
//virtual void addToContain(Object* obj); ///< add 'obj' to contain list
//virtual void addToContainList(Object* obj); ///< The part of AddToContain that inheritors can override (Can't do whole thing because of all the private stuff involved)
//virtual void removeFromContain(Object* obj, Bool exposeStealthUnits = FALSE); ///< remove 'obj' from contain list
//virtual void removeAllContained( Bool exposeStealthUnits = FALSE ); ///< remove all objects on contain list
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?

// Friend for our Draw module only.
//virtual const Object* friend_getRider() const; ///< Damn. The draw order dependency bug for riders means that our draw module needs to cheat to get around it.

///< if my object gets selected, then my visible passengers should, too
///< this gets called from
virtual void clientVisibleContainedFlashAsSelected();

virtual void redeployOccupants();

virtual Bool getContainerPipsToShow(Int& numTotal, Int& numFull)
{
if (getMultiAddOnContainModuleData()->m_drawPips == FALSE)
{
return FALSE;
}

return ContainModuleInterface::getContainerPipsToShow(numTotal, numFull);
}

virtual void createPayload();

virtual short getRiderSlot(ObjectID riderID) const;
virtual short getPortableSlot(ObjectID riderID) const;
virtual const ContainedItemsList* getAddOnList() const { return &m_addOnList; }

private:
void parseAddOnEntry(INI* ini, void* instance, void* store, const void* /*userData*/);

//VecObjectPtr& getPortableStructures(void) const;

struct AddOnSlotData
{
ObjectID occupantID;
ObjectID portableID;
UnsignedShort slot;
};

std::vector<AddOnSlotData> m_addOnSlots;
ContainedItemsList m_addOnList;
//bool m_addOnList_valid;

//std::vector<Matrix3D> m_addOnPoints;
//Bool m_noAddOnPointsInArt;

bool createAddOnForRider(Object* obj);
bool removeAddOnForRider(Object* obj);

void redeployAddOns();
void putObjAtSlot(Object* obj, short slot);

void updateSubObjForSlot(short slot, bool isNowOccupied);

};

#endif

Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ class OpenContain : public UpdateModule,
// exists primarily for TransportContain to override
virtual void killRidersWhoAreNotFreeToExit() { }

virtual short getRiderSlot(ObjectID riderID) const { return -1; }
virtual short getPortableSlot(ObjectID portableID) const { return -1; }
virtual const ContainedItemsList* getAddOnList() const { return NULL; }

void pruneDeadWanters();

ContainedItemsList m_containList; ///< the list of contained objects
Expand Down
2 changes: 1 addition & 1 deletion GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1947,7 +1947,7 @@ void INI::parseDeathTypeFlags(INI* ini, void* /*instance*/, void* store, const v

if (TheGlobalData) {
flags &= ~TheGlobalData->m_defaultExcludedDeathTypes;
DEBUG_LOG(("INI::parseDeathTypeFlags - flags = %X\n", flags));
// DEBUG_LOG(("INI::parseDeathTypeFlags - flags = %X\n", flags));
}
else {
DEBUG_LOG(("INI::parseDeathTypeFlags - TheGlobalData is NULL\n"));
Expand Down
Loading