Skip to content

Commit 0a19df8

Browse files
committed
Merge branch 'main' of https://github.com/Andreas-W/GeneralsGameCode_Modding into anim_blending_fixes
2 parents 0acda66 + eb89f67 commit 0a19df8

50 files changed

Lines changed: 3004 additions & 260 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Core/GameEngine/Include/GameClient/TerrainRoads.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class TerrainRoadType : public MemoryPoolObject
9797
AsciiString getRepairedToFXString( BodyDamageType state, Int index ) { return m_repairedToFXString[ state ][ index ]; }
9898
Real getTransitionEffectsHeight( void ) { return m_transitionEffectsHeight; }
9999
Int getNumFXPerType( void ) { return m_numFXPerType; }
100+
Real getBridgeHoleAreaPercentage( void ) { return m_bridgeHoleAreaPercentage; }
100101

101102
// friend access methods to be used by the road collection only!
102103
void friend_setName( AsciiString name ) { m_name = name; }
@@ -188,6 +189,7 @@ class TerrainRoadType : public MemoryPoolObject
188189
Real m_transitionEffectsHeight;
189190
Int m_numFXPerType; ///< for *each* fx/ocl we will make this many of them on the bridge area
190191

192+
Real m_bridgeHoleAreaPercentage; ///< if bridge is openable/destroyable, how much % of length becomes open
191193
};
192194

193195
//-------------------------------------------------------------------------------------------------

Core/GameEngine/Source/Common/System/GameMemoryInitPools_GeneralsMD.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ static PoolSizeRec PoolSizes[] =
135135
{ "MissileAIUpdate", 512, 32 },
136136
{ "DumbProjectileBehavior", 64, 32 },
137137
{ "FreeFallProjectileBehavior", 32, 32 },
138+
{ "JumpjetMissileAIUpdate", 16, 16 },
138139
{ "DestroyDie", 1024, 32 },
139140
{ "UpgradeDie", 128, 32 },
140141
{ "KeepObjectDie", 128, 32 },
@@ -278,6 +279,7 @@ static PoolSizeRec PoolSizes[] =
278279
{ "TransitionDamageFX", 384, 128 },
279280
{ "TransportAIUpdate", 64, 32 },
280281
{ "TransportContain", 128, 32 },
282+
{ "JumpjetContain", 16, 16 },
281283
{ "RiderChangeContain", 128, 32 },
282284
{ "InternetHackContain", 16, 16 },
283285
{ "TunnelContain", 8, 8 },
@@ -697,5 +699,8 @@ static PoolSizeRec PoolSizes[] =
697699
{ "DroneCarrierContain", 8, 8 },
698700
{ "W3DDependencyCarrierDraw", 16, 16 },
699701
{ "CarrierDroneAIUpdate", 16, 16 },
702+
{ "DrawBridgeTowerUpdate", 8, 8 },
703+
{ "DrawBridgeUpdate", 4, 4 },
704+
{ "CrateApplyUpgrade", 64, 32 },
700705
{ 0, 0, 0 }
701706
};

Core/GameEngine/Source/GameClient/Terrain/TerrainRoads.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const FieldParse TerrainRoadType::m_terrainBridgeFieldParseTable[] =
8484
{ "RepairedToSound", INI::parseAsciiString, nullptr, offsetof( TerrainRoadType, m_repairedToSoundString[ BODY_DAMAGED ] ) },
8585
{ "TransitionToOCL", parseTransitionToOCL, nullptr, 0 },
8686
{ "TransitionToFX", parseTransitionToFX, nullptr, 0 },
87+
{ "BridgeHoleAreaPercentage", INI::parsePercentToReal, nullptr, offsetof( TerrainRoadType, m_bridgeHoleAreaPercentage) },
8788

8889

8990
{ nullptr, nullptr, nullptr, 0 },

GeneralsMD/Code/GameEngine/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ set(GAMEENGINE_SRC
371371
Include/GameLogic/Module/MaxHealthUpgrade.h
372372
Include/GameLogic/Module/MinefieldBehavior.h
373373
Include/GameLogic/Module/MissileAIUpdate.h
374+
Include/GameLogic/Module/JumpjetMissileAIUpdate.h
374375
Include/GameLogic/Module/MissileLauncherBuildingUpdate.h
375376
Include/GameLogic/Module/MobMemberSlavedUpdate.h
376377
Include/GameLogic/Module/MobNexusContain.h
@@ -483,6 +484,7 @@ set(GAMEENGINE_SRC
483484
Include/GameLogic/Module/TransportAIUpdate.h
484485
Include/GameLogic/Module/TransportContain.h
485486
Include/GameLogic/Module/TunnelContain.h
487+
Include/GameLogic/Module/JumpjetContain.h
486488
Include/GameLogic/Module/UndeadBody.h
487489
Include/GameLogic/Module/UnitCrateCollide.h
488490
Include/GameLogic/Module/UnpauseSpecialPowerUpgrade.h
@@ -506,6 +508,9 @@ set(GAMEENGINE_SRC
506508
Include/GameLogic/Module/DroneCarrierContain.h
507509
Include/GameLogic/Module/CarrierDroneAIUpdate.h
508510
Include/GameLogic/Module/BridgeTowerBody.h
511+
Include/GameLogic/Module/DrawBridgeTowerUpdate.h
512+
Include/GameLogic/Module/DrawBridgeUpdate.h
513+
Include/GameLogic/Module/CrateApplyUpgrade.h
509514
Include/GameLogic/Object.h
510515
Include/GameLogic/ObjectCreationList.h
511516
Include/GameLogic/BuffSystem.h
@@ -958,6 +963,7 @@ set(GAMEENGINE_SRC
958963
Source/GameLogic/Object/Contain/RiderChangeContain.cpp
959964
Source/GameLogic/Object/Contain/TransportContain.cpp
960965
Source/GameLogic/Object/Contain/TunnelContain.cpp
966+
Source/GameLogic/Object/Contain/JumpjetContain.cpp
961967
Source/GameLogic/Object/Contain/DroneCarrierContain.cpp
962968
Source/GameLogic/Object/Create/CreateModule.cpp
963969
Source/GameLogic/Object/Create/GrantUpgradeCreate.cpp
@@ -1024,6 +1030,7 @@ set(GAMEENGINE_SRC
10241030
Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp
10251031
Source/GameLogic/Object/Update/AIUpdate/JetAIUpdate.cpp
10261032
Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp
1033+
Source/GameLogic/Object/Update/AIUpdate/JumpjetMissileAIUpdate.cpp
10271034
Source/GameLogic/Object/Update/AIUpdate/POWTruckAIUpdate.cpp
10281035
Source/GameLogic/Object/Update/AIUpdate/RailedTransportAIUpdate.cpp
10291036
Source/GameLogic/Object/Update/AIUpdate/RailroadGuideAIUpdate.cpp
@@ -1116,6 +1123,8 @@ set(GAMEENGINE_SRC
11161123
Source/GameLogic/Object/Update/KodiakDeploymentUpdate.cpp
11171124
Source/GameLogic/Object/Update/KodiakUpdate.cpp
11181125
Source/GameLogic/Object/Update/DroneCarrierSlavedUpdate.cpp
1126+
Source/GameLogic/Object/Update/DrawBridgeTowerUpdate.cpp
1127+
Source/GameLogic/Object/Update/DrawBridgeUpdate.cpp
11191128
Source/GameLogic/Object/Upgrade/ActiveShroudUpgrade.cpp
11201129
Source/GameLogic/Object/Upgrade/ArmorUpgrade.cpp
11211130
Source/GameLogic/Object/Upgrade/CommandSetUpgrade.cpp
@@ -1139,6 +1148,7 @@ set(GAMEENGINE_SRC
11391148
Source/GameLogic/Object/Upgrade/UpgradeModule.cpp
11401149
Source/GameLogic/Object/Upgrade/WeaponBonusUpgrade.cpp
11411150
Source/GameLogic/Object/Upgrade/WeaponSetUpgrade.cpp
1151+
Source/GameLogic/Object/Upgrade/CrateApplyUpgrade.cpp
11421152
Source/GameLogic/Object/Weapon.cpp
11431153
Source/GameLogic/Object/WeaponSet.cpp
11441154
Source/GameLogic/ScriptEngine/ScriptActions.cpp

GeneralsMD/Code/GameEngine/Include/Common/SpecialPowerType.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,10 @@ enum SpecialPowerType CPP_11(: Int)
220220
SUPW_SPECIAL_SPECTRE_GUNSHIP,
221221
SUPW_SPECIAL_ORBITAL_STRIKE,
222222

223+
SPECIAL_TOGGLE_DRAWBRIDGE,
224+
225+
SPECIAL_JUMPJET,
226+
223227
SPECIALPOWER_COUNT,
224228
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
225229
// NEW CONSTANTS NEED A BEHAVIORTYPE DEFINED IN THE SPECIALPOWER OR return one in getFallbackBehaviorType in ActionManager.cpp

GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,8 @@ class ThingTemplate : public Overridable
675675

676676
Int getMaxPathFindingCellRadius(void) const { return static_cast<Int>(m_maxPathfindingCellRadius); };
677677

678+
Byte getRequiredBridgeHeight(void) const { return m_requiredBridgeHeight; };
679+
678680
protected:
679681

680682
//
@@ -709,6 +711,8 @@ class ThingTemplate : public Overridable
709711

710712
static void parseMaxSimultaneous(INI *ini, void *instance, void *store, const void *userData);
711713

714+
static void parseRequiredBridgeHeight(INI* ini, void* instance, void* store, const void* userData);
715+
712716
Bool removeModuleInfo(const AsciiString& moduleToRemove, AsciiString& clearedModuleNameOut);
713717

714718
private:
@@ -828,6 +832,7 @@ class ThingTemplate : public Overridable
828832
UnsignedByte m_crushableLevel; ///< Specifies the level of crushability (must be hit by a crusher greater than this to crush me).
829833
Byte m_ammoPipsStyle; ///< How ammo pips are displayed for this thing
830834
UnsignedByte m_maxPathfindingCellRadius; ///< Limit cells radius for pathfinding, defaults to 2, can be increased for large units
835+
Byte m_requiredBridgeHeight; ///< simplified height required to fit under bridge, range: -1 to 15, -1 will use Geometry height, other values to override
831836
};
832837

833838
//-----------------------------------------------------------------------------

GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ enum CommandOption CPP_11(: Int)
9999
USES_MINE_CLEARING_WEAPONSET= 0x00200000, // uses the special mine-clearing weaponset, even if not current
100100
CAN_USE_WAYPOINTS = 0x00400000, // button has option to use a waypoint path
101101
MUST_BE_STOPPED = 0x00800000, // Unit must be stopped in order to be able to use button.
102+
FORMATION_LAUNCH = 0x01000000, // code-only: jumpjet group launch, keep formation offset instead of random scatter.
102103
};
103104

104105
#ifdef DEFINE_COMMAND_OPTION_NAMES
@@ -132,6 +133,7 @@ static const char *const TheCommandOptionNames[] =
132133
"USES_MINE_CLEARING_WEAPONSET",
133134
"CAN_USE_WAYPOINTS",
134135
"MUST_BE_STOPPED",
136+
"FORMATION_LAUNCH",
135137

136138
nullptr
137139
};

GeneralsMD/Code/GameEngine/Include/GameLogic/AIPathfind.h

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,15 @@ class Path : public MemoryPoolObject, public Snapshot
175175
/// Given a location, return closest location on path, and along-path dist to end as function result
176176
void markOptimized(void) {m_isOptimized = true;}
177177

178+
inline Bool needCheckBridges( void ) const { return m_moveUnderBridges != 0U; };
179+
180+
static inline UnsignedShort layerIndexToBitFlag(UnsignedShort layer_index) {
181+
return static_cast<UnsignedShort>(1u << layer_index);
182+
};
183+
184+
inline void setPathBelowBridge(PathfindLayerEnum layer) { BitSet(m_moveUnderBridges, layerIndexToBitFlag(static_cast<UnsignedShort>(layer))); };
185+
inline Bool isPathBelowBridge(UnsignedShort layer_index) { return BitIsSet(m_moveUnderBridges, layerIndexToBitFlag(layer_index)); };
186+
178187
protected:
179188
// snapshot interface
180189
virtual void crc( Xfer *xfer );
@@ -195,6 +204,9 @@ class Path : public MemoryPoolObject, public Snapshot
195204
Coord3D m_cpopIn;
196205
ClosestPointOnPathInfo m_cpopOut;
197206
const PathNode* m_cpopRecentStart;
207+
208+
// Stores opened/destroyed bridges that this path moves below.
209+
UnsignedShort m_moveUnderBridges; // 16bit -> use as bitset for PATHFIND LAYER ENUMS (2-14 for bridges)
198210
};
199211

200212
//----------------------------------------------------------------------------------------------------------
@@ -372,6 +384,11 @@ class PathfindCell
372384
Short getWaterLevel(void) const { return m_waterLevel; }
373385
void setWaterLevel(Short level) { m_waterLevel = level; }
374386

387+
UnsignedByte getBridgeHeight(void) const { return m_bridgeHeight; }
388+
void setBridgeHeight(UnsignedByte height) { m_bridgeHeight = height; }
389+
PathfindLayerEnum getBridgeLayer(void) const { return (PathfindLayerEnum)m_bridgeLayer; }
390+
void setBridgeLayer(PathfindLayerEnum layer) { m_bridgeLayer = (UnsignedByte)layer; }
391+
375392
Bool allocateInfo(const ICoord2D &pos);
376393
void releaseInfo(void);
377394
Bool hasInfo(void) const {return m_info!=nullptr;}
@@ -392,6 +409,9 @@ class PathfindCell
392409
void setConnectLayer( PathfindLayerEnum layer ) { m_connectsToLayer = layer; } ///< set the cell layer connect id
393410
PathfindLayerEnum getConnectLayer( void ) const { return (PathfindLayerEnum)m_connectsToLayer; } ///< get the cell layer connect id
394411

412+
/// Get the layer if this cell under a bridge that is currently destroyed or opened or LAYER_INVALID if not
413+
PathfindLayerEnum getUnderDestroyedBridgeLayer( void ) const;
414+
395415
private:
396416
PathfindCellInfo *m_info;
397417
ObjectID m_obstacleID; ///< the object ID who overlaps this cell
@@ -409,6 +429,9 @@ class PathfindCell
409429
UnsignedByte m_layer : 4; ///< Layer of this cell.
410430
//This is added for ship pathing
411431
Short m_waterLevel:8; ///< how far away is this cell from land (distance transform), capped at 15
432+
//This is added for bridge pathing, determine if unit can go under bridge or not
433+
UnsignedByte m_bridgeHeight : 4; // stored as number 0-15, rounded from 0.0-150.0 float. Space below bridge (to ground or water)
434+
UnsignedByte m_bridgeLayer : 4; // Layer number of bridge above this cell
412435
};
413436

414437
typedef PathfindCell *PathfindCellP;
@@ -660,7 +683,7 @@ class Pathfinder : PathfindServicesInterface, public Snapshot
660683
void xfer( Xfer *xfer );
661684
void loadPostProcess( void );
662685

663-
Bool clientSafeQuickDoesPathExist( const LocomotorSet& locomotorSet, const Coord3D *from, const Coord3D *to ); ///< Can we build any path at all between the locations (terrain & buildings check - fast)
686+
Bool clientSafeQuickDoesPathExist( const LocomotorSet& locomotorSet, Short requiredBridgeHeight, const Coord3D *from, const Coord3D *to ); ///< Can we build any path at all between the locations (terrain & buildings check - fast)
664687
Bool clientSafeQuickDoesPathExistForUI( const LocomotorSet& locomotorSet, const Coord3D *from, const Coord3D *to ); ///< Can we build any path at all between the locations (terrain onlyk - fast)
665688
Bool slowDoesPathExist( Object *obj, const Coord3D *from,
666689
const Coord3D *to, ObjectID ignoreObject=INVALID_ID ); ///< Can we build any path at all between the locations (terrain, buildings & units check - slower)
@@ -709,9 +732,9 @@ class Pathfinder : PathfindServicesInterface, public Snapshot
709732

710733
void setIgnoreObstacleID( ObjectID objID ); ///< if non-zero, the pathfinder will ignore the given obstacle
711734

712-
Bool validMovementPosition( Bool isCrusher, LocomotorSurfaceTypeMask acceptableSurfaces, Int requiredWaterLevel, PathfindCell *toCell, PathfindCell *fromCell = NULL ); ///< Return true if given position is a valid movement location
713-
Bool validMovementPosition( Bool isCrusher, PathfindLayerEnum layer, const LocomotorSet& locomotorSet, Int x, Int y ); ///< Return true if given position is a valid movement location
714-
Bool validMovementPosition( Bool isCrusher, PathfindLayerEnum layer, const LocomotorSet& locomotorSet, const Coord3D *pos ); ///< Return true if given position is a valid movement location
735+
Bool validMovementPosition( Bool isCrusher, LocomotorSurfaceTypeMask acceptableSurfaces, Int requiredWaterLevel, Short requiredBridgeHeight, PathfindCell *toCell, PathfindCell *fromCell = NULL ); ///< Return true if given position is a valid movement location
736+
Bool validMovementPosition( Bool isCrusher, PathfindLayerEnum layer, const LocomotorSet& locomotorSet, Short requiredBridgeHeight, Int x, Int y ); ///< Return true if given position is a valid movement location
737+
Bool validMovementPosition( Bool isCrusher, PathfindLayerEnum layer, const LocomotorSet& locomotorSet, Short requiredBridgeHeight, const Coord3D *pos ); ///< Return true if given position is a valid movement location
715738
Bool validMovementTerrain( PathfindLayerEnum layer, const Locomotor* locomotor, const Coord3D *pos ); ///< Return true if given position is a valid movement location
716739

717740
Locomotor* chooseBestLocomotorForPosition(PathfindLayerEnum layer, LocomotorSet* locomotorSet, const Coord3D* pos );
@@ -760,6 +783,11 @@ class Pathfinder : PathfindServicesInterface, public Snapshot
760783

761784
PathfindLayerEnum addBridge(Bridge *theBridge); // Adds a bridge layer, and returns the layer id.
762785

786+
// return if the passed layer is currently passable (checks for destroyed bridges)
787+
inline Bool isPathfindLayerPassable(PathfindLayerEnum layer) {
788+
return !m_layers[layer].isUnused() && !m_layers[layer].isDestroyed();
789+
}
790+
763791
void addWallPiece(Object *wallPiece); // Adds a wall piece.
764792
void removeWallPiece(Object *wallPiece); // Removes a wall piece.
765793
Real getWallHeight(void) {return m_wallHeight;}
@@ -919,18 +947,18 @@ inline void Pathfinder::worldToGrid( const Coord3D *pos, ICoord2D *cellIndex )
919947
cellIndex->y = REAL_TO_INT(pos->y/PATHFIND_CELL_SIZE);
920948
}
921949

922-
inline Bool Pathfinder::validMovementPosition( Bool isCrusher, PathfindLayerEnum layer, const LocomotorSet& locomotorSet, Int x, Int y )
950+
inline Bool Pathfinder::validMovementPosition( Bool isCrusher, PathfindLayerEnum layer, const LocomotorSet& locomotorSet, Short requiredBridgeHeight, Int x, Int y )
923951
{
924-
return validMovementPosition( isCrusher, locomotorSet.getValidSurfaces(), locomotorSet.getRequiredWaterLevel(), getCell(layer, x, y));
952+
return validMovementPosition( isCrusher, locomotorSet.getValidSurfaces(), locomotorSet.getRequiredWaterLevel(), requiredBridgeHeight, getCell(layer, x, y));
925953
}
926954

927-
inline Bool Pathfinder::validMovementPosition( Bool isCrusher, PathfindLayerEnum layer, const LocomotorSet& locomotorSet, const Coord3D *pos )
955+
inline Bool Pathfinder::validMovementPosition( Bool isCrusher, PathfindLayerEnum layer, const LocomotorSet& locomotorSet, Short requiredBridgeHeight, const Coord3D *pos )
928956
{
929957

930958
Int x = REAL_TO_INT(pos->x/PATHFIND_CELL_SIZE);
931959
Int y = REAL_TO_INT(pos->y/PATHFIND_CELL_SIZE);
932960

933-
return validMovementPosition( isCrusher, layer, locomotorSet, x, y );
961+
return validMovementPosition( isCrusher, layer, locomotorSet, requiredBridgeHeight, x, y );
934962
}
935963

936964
inline const Coord3D *Pathfinder::getDebugPathPosition( void )

GeneralsMD/Code/GameEngine/Include/GameLogic/Locomotor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ class Locomotor : public MemoryPoolObject, public Snapshot
264264

265265
AsciiString getTemplateName() const { return m_template->m_name;}
266266
Real getMinSpeed() const { return m_template->m_minSpeed;}
267+
Real getMinTurnSpeed() const { return m_template->m_minTurnSpeed;} ///< must be going >= this speed to turn (0 = can turn in place)
267268
Real getAccelPitchLimit() const { return m_template->m_accelPitchLimit;} ///< Maximum amount we will pitch up or down under acceleration (including recoil.)
268269
Real getDecelPitchLimit() const { return m_template->m_decelPitchLimit;} ///< Maximum amount we will pitch down under deceleration (including recoil.)
269270
Real getBounceKick() const { return m_template->m_bounceKick;} ///< How much simulating rough terrain "bounces" a wheel up.

GeneralsMD/Code/GameEngine/Include/GameLogic/Module/AIUpdate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ class AIUpdateInterface : public UpdateModule, public AICommandInterface
505505
Bool isBlockedAndStuck(void) const {return m_isBlockedAndStuck;}
506506
Bool canComputeQuickPath(void); ///< Returns true if we can quickly comput a path. Usually missiles & the like that just move straight to the destination.
507507
Bool computeQuickPath(const Coord3D *destination); ///< Computes a quick path to the destination.
508+
Bool arePathLayersStillValid(); ///< Check if the current used layers are still passable
508509

509510
Bool isMoving() const;
510511
Bool isMovingAwayFrom(Object* obj) const;

0 commit comments

Comments
 (0)