Skip to content

Commit b761e8f

Browse files
committed
Merge updates from main
2 parents 1d181e7 + d1adee2 commit b761e8f

10 files changed

Lines changed: 77 additions & 14 deletions

File tree

Core/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DModelDraw.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,10 @@ W3DModelDrawModuleData::W3DModelDrawModuleData() :
10491049

10501050
m_receivesDynamicLights = TRUE;
10511051

1052+
m_ignoreAnimScaling = FALSE;
1053+
m_ignoreRotation = FALSE;
1054+
m_showForOwnerOnly = FALSE;
1055+
10521056
// m_ignoreConditionStates defaults to all zero, which is what we want
10531057
}
10541058

@@ -1438,7 +1442,6 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void
14381442
{ "AltTurretArtAngle", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[1].m_turretArtAngle) },
14391443
{ "AltTurretPitch", parseBoneNameKey, nullptr, offsetof(ModelConditionInfo, m_turrets[1].m_turretPitchNameKey) },
14401444
{ "AltTurretArtPitch", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[1].m_turretArtPitch) },
1441-
{ "ShowSubObject", parseShowHideSubObject, (void*)nullptr, offsetof(ModelConditionInfo, m_hideShowVec) },
14421445
{ "Turret1ArtAngle", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[0].m_turretArtAngle) },
14431446
{ "Turret1Pitch", parseBoneNameKey, nullptr, offsetof(ModelConditionInfo, m_turrets[0].m_turretPitchNameKey) },
14441447
{ "Turret1ArtPitch", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[0].m_turretArtPitch) },
@@ -1470,7 +1473,7 @@ void W3DModelDrawModuleData::parseConditionState(INI* ini, void *instance, void
14701473
{ "Turret8ArtAngle", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[7].m_turretArtAngle) },
14711474
{ "Turret8Pitch", parseBoneNameKey, nullptr, offsetof(ModelConditionInfo, m_turrets[7].m_turretPitchNameKey) },
14721475
{ "Turret8ArtPitch", INI::parseAngleReal, nullptr, offsetof(ModelConditionInfo, m_turrets[7].m_turretArtPitch) },
1473-
{ "ShowSubObject", parseShowHideSubObject, (void*)0, offsetof(ModelConditionInfo, m_hideShowVec) },
1476+
{ "ShowSubObject", parseShowHideSubObject, (void*)nullptr, offsetof(ModelConditionInfo, m_hideShowVec) },
14741477
{ "HideSubObject", parseShowHideSubObject, (void*)1, offsetof(ModelConditionInfo, m_hideShowVec) },
14751478
{ "WeaponFireFXBone", parseWeaponBoneName, nullptr, offsetof(ModelConditionInfo, m_weaponFireFXBoneName[0]) },
14761479
{ "WeaponRecoilBone", parseWeaponBoneName, nullptr, offsetof(ModelConditionInfo, m_weaponRecoilBoneName[0]) },

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class Shadow
8383
m_sizeY = 0.0f;
8484
m_offsetX = 0.0f;
8585
m_offsetY = 0.0f;
86+
m_hasDynamicLength = false;
8687
}
8788

8889
char m_ShadowName[64]; //when set, overrides the default model shadow (used mostly for Decals).

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class DelayedUpgradeBehavior : public UpdateModule, public UpgradeMux
116116

117117
void triggerUpgrade();
118118

119-
virtual Bool resetUpgrade(UpgradeMaskType keyMask); // When this upgrade is removed, we reset our triggers.
119+
virtual Bool resetUpgrade(const UpgradeMaskType& keyMask); // When this upgrade is removed, we reset our triggers.
120120

121121
virtual void upgradeImplementation();
122122

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "WWMath/matrix3d.h"
4040

4141
class ParticleSystem;
42+
enum ParticleSystemID CPP_11(: Int);
4243
class FXList;
4344

4445

@@ -120,11 +121,16 @@ class DumbProjectileBehavior : public UpdateModule, public ProjectileUpdateInter
120121
Int m_currentFlightPathStep; ///< Our current index in the flight path vector. Quicker than popping off.
121122
WeaponBonusConditionFlags m_extraBonusFlags;
122123

124+
const ParticleSystemTemplate* m_exhaustSysTmpl;
125+
ParticleSystemID m_exhaustID;
126+
123127
Bool m_hasDetonated; ///<
124128

125129
Bool calcFlightPath(Bool recalcNumSegments);
126130
#if defined(RTS_DEBUG)
127131
void displayFlightPath(); ///< Uses little debug icons in worldspace to show the path chosen when it is decided upon
128132
#endif
129133

134+
void tossExhaust();
135+
130136
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class HeightDieUpdateModuleData: public UpdateModuleData
5151
Real m_destroyAttachedParticlesAtHeight; ///< HACK, destroy any attached particle system of object when below this height
5252
Bool m_snapToGroundOnDeath; ///< snap to the ground when killed
5353
UnsignedInt m_initialDelay; ///< Don't explode before this time
54-
54+
Bool m_targetHeightIncludesWater; ///< target height considers water height instead of terrain
5555
};
5656

5757
//-------------------------------------------------------------------------------------------------

GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,17 @@ const FieldParse ThingTemplate::s_objectFieldParseTable[] =
228228
{ "GeometryHeight", GeometryInfo::parseGeometryHeight, nullptr, offsetof( ThingTemplate, m_geometryInfo ) },
229229
{ "GeometryIsSmall", GeometryInfo::parseGeometryIsSmall, nullptr, offsetof( ThingTemplate, m_geometryInfo ) },
230230
{ "Shadow", INI::parseBitString8, TheShadowNames, offsetof( ThingTemplate, m_shadowType ) },
231-
{ "ShadowDynamicLengthWhenAirborne", INI::parseBool, NULL, offsetof( ThingTemplate, m_shadowHasDynamicLength) },
231+
{ "ShadowSizeX", INI::parseReal, nullptr, offsetof(ThingTemplate, m_shadowSizeX) },
232+
{ "ShadowSizeY", INI::parseReal, nullptr, offsetof(ThingTemplate, m_shadowSizeY) },
233+
{ "ShadowOffsetX", INI::parseReal, nullptr, offsetof(ThingTemplate, m_shadowOffsetX) },
234+
{ "ShadowOffsetY", INI::parseReal, nullptr, offsetof(ThingTemplate, m_shadowOffsetY) },
235+
{ "ShadowTexture", INI::parseAsciiString, nullptr, offsetof(ThingTemplate, m_shadowTextureName) },
236+
{ "ShadowDynamicLengthWhenAirborne", INI::parseBool, nullptr, offsetof( ThingTemplate, m_shadowHasDynamicLength) },
237+
{ "OcclusionDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( ThingTemplate, m_occlusionDelay ) },
238+
{ "AddModule", ThingTemplate::parseAddModule, nullptr, 0 },
239+
{ "RemoveModule", ThingTemplate::parseRemoveModule, nullptr, 0 },
240+
{ "ReplaceModule", ThingTemplate::parseReplaceModule, nullptr, 0 },
241+
{ "InheritableModule", ThingTemplate::parseInheritableModule, nullptr, 0 },
232242
{ "OcclusionDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( ThingTemplate, m_occlusionDelay ) },
233243
{ "AddModule", ThingTemplate::parseAddModule, nullptr, 0 },
234244
{ "RemoveModule", ThingTemplate::parseRemoveModule, nullptr, 0 },

GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ class ParticleSystemFXNugget : public FXNugget
698698
m_minAllowedHeight = -INFINITY;
699699
// m_createAtWaterHeight = FALSE;
700700
m_allowedSurfaceType = SURFACE_ALL;
701+
m_useSurfaceInfo = FALSE;
701702
}
702703

703704
virtual void doFXPos(const Coord3D *primary, const Matrix3D* primaryMtx, const Real /*primarySpeed*/, const Coord3D * /*secondary*/, const Real overrideRadius, FXSurfaceInfo* surfaceInfo) const
@@ -826,15 +827,15 @@ class ParticleSystemFXNugget : public FXNugget
826827
if (!isValidSurface(primary, &info))
827828
continue;
828829

829-
refHeight = needWaterCheck ? info.m_waterHeight : info.m_groundHeight;
830+
refHeight = surfaceInfo->m_isWater ? info.m_waterHeight : info.m_groundHeight;
830831
}
831832

832833
if (m_createAtGroundHeight) {
833834
if (needExactCheck) {
834835
newPos.z = refHeight + offset.z + m_height.getValue();
835836
}
836837
else {
837-
refHeight = needWaterCheck ? surfaceInfo->m_waterHeight : surfaceInfo->m_groundHeight;
838+
refHeight = surfaceInfo->m_isWater ? surfaceInfo->m_waterHeight : surfaceInfo->m_groundHeight;
838839
newPos.z = refHeight + offset.z + m_height.getValue();
839840
}
840841
}
@@ -1072,11 +1073,13 @@ void FXList::doFXObj(const Object* primary, const Object* secondary) const
10721073
if (primary && primary->getShroudedStatus(playerIndex) > OBJECTSHROUD_PARTIAL_CLEAR)
10731074
return; //the primary object is fogged or shrouded so don't bother with the effect.
10741075

1076+
FXSurfaceInfo surfaceInfo; // Cached water/height
1077+
10751078
for (FXNuggetList::const_iterator it = m_nuggets.begin(); it != m_nuggets.end(); ++it)
10761079
{
10771080

10781081
// HERE THE PRIMARY IS THE GUY RECEIVING THE FX, AND SECONDARY MIGHT BE THE GUY DEALING IT
1079-
(*it)->doFXObj(primary, secondary);
1082+
(*it)->doFXObj(primary, secondary, &surfaceInfo);
10801083
}
10811084
}
10821085

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DelayedUpgradeBehavior.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@ void DelayedUpgradeBehavior::triggerUpgrade(void)
202202

203203
//-------------------------------------------------------------------------------------------------
204204
//-------------------------------------------------------------------------------------------------
205-
Bool DelayedUpgradeBehavior::resetUpgrade(UpgradeMaskType keyMask)
205+
Bool DelayedUpgradeBehavior::resetUpgrade(const UpgradeMaskType& keyMask)
206206
{
207-
// DEBUG_LOG(("DelayedUpgradeBehavior::resetUpgrade()."));
207+
DEBUG_LOG(("DelayedUpgradeBehavior::resetUpgrade()."));
208208
if (UpgradeMux::resetUpgrade(keyMask)) {
209209
m_triggerCompleted = FALSE;
210210
m_triggerFrame = 0;

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "Common/RandomValue.h"
3737
#include "Common/Xfer.h"
3838
#include "GameClient/Drawable.h"
39+
#include "GameClient/ParticleSys.h"
3940
#include "GameClient/FXList.h"
4041
#include "GameLogic/GameLogic.h"
4142
#include "GameLogic/Object.h"
@@ -126,13 +127,16 @@ DumbProjectileBehavior::DumbProjectileBehavior( Thing *thing, const ModuleData*
126127
m_flightPathEnd.zero();
127128
m_currentFlightPathStep = 0;
128129
m_extraBonusFlags = 0;
130+
m_exhaustSysTmpl = nullptr;
131+
m_exhaustID = INVALID_PARTICLE_SYSTEM_ID;
129132

130133
m_hasDetonated = FALSE;
131134
}
132135

133136
//-------------------------------------------------------------------------------------------------
134137
DumbProjectileBehavior::~DumbProjectileBehavior()
135138
{
139+
tossExhaust();
136140
}
137141

138142
//-------------------------------------------------------------------------------------------------
@@ -324,6 +328,16 @@ static Bool calcTrajectory(
324328

325329
#endif // NOT_IN_USE
326330

331+
//-------------------------------------------------------------------------------------------------
332+
void DumbProjectileBehavior::tossExhaust()
333+
{
334+
if (m_exhaustID != INVALID_PARTICLE_SYSTEM_ID)
335+
{
336+
TheParticleSystemManager->destroyParticleSystemByID(m_exhaustID);
337+
m_exhaustID = INVALID_PARTICLE_SYSTEM_ID;
338+
}
339+
}
340+
327341
//-------------------------------------------------------------------------------------------------
328342
// Prepares the missile for launch via proper weapon-system channels.
329343
//-------------------------------------------------------------------------------------------------
@@ -407,6 +421,12 @@ void DumbProjectileBehavior::projectileFireAtObjectOrPosition( const Object *vic
407421
return;
408422
}
409423
m_currentFlightPathStep = 0;// We are at the first point, because the launching put us there
424+
425+
m_exhaustSysTmpl = exhaustSysOverride;
426+
if (m_exhaustSysTmpl != nullptr)
427+
{
428+
m_exhaustID = TheParticleSystemManager->createAttachedParticleSystemID(m_exhaustSysTmpl, getObject());
429+
}
410430
}
411431

412432
//-------------------------------------------------------------------------------------------------
@@ -845,6 +865,18 @@ void DumbProjectileBehavior::xfer( Xfer *xfer )
845865

846866
}
847867

868+
AsciiString exhaustName;
869+
if (m_exhaustSysTmpl)
870+
{
871+
exhaustName = m_exhaustSysTmpl->getName();
872+
}
873+
xfer->xferAsciiString(&exhaustName);
874+
if (exhaustName.isNotEmpty() && m_exhaustSysTmpl == nullptr)
875+
{
876+
m_exhaustSysTmpl = TheParticleSystemManager->findTemplate(exhaustName);
877+
}
878+
879+
848880
// lifespan frame
849881
xfer->xferUnsignedInt( &m_lifespanFrame );
850882

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HeightDieUpdate.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ HeightDieUpdateModuleData::HeightDieUpdateModuleData( void )
5656
m_destroyAttachedParticlesAtHeight = -1.0f;
5757
m_snapToGroundOnDeath = FALSE;
5858
m_initialDelay = 0;
59-
59+
m_targetHeightIncludesWater = false;
6060
}
6161

6262
//-------------------------------------------------------------------------------------------------
@@ -76,6 +76,7 @@ void HeightDieUpdateModuleData::buildFieldParse(MultiIniFieldParse& p)
7676
{ "DestroyAttachedParticlesAtHeight", INI::parseReal, nullptr, offsetof( HeightDieUpdateModuleData, m_destroyAttachedParticlesAtHeight ) },
7777
{ "SnapToGroundOnDeath", INI::parseBool, nullptr, offsetof( HeightDieUpdateModuleData, m_snapToGroundOnDeath ) },
7878
{ "InitialDelay", INI::parseDurationUnsignedInt, nullptr, offsetof( HeightDieUpdateModuleData, m_initialDelay ) },
79+
{ "TargetHeightIncludesWater", INI::parseBool, nullptr, offsetof(HeightDieUpdateModuleData, m_targetHeightIncludesWater) },
7980
{ nullptr, nullptr, nullptr, 0 }
8081

8182
};
@@ -161,7 +162,14 @@ UpdateSleepTime HeightDieUpdate::update( void )
161162
}
162163

163164
// get the terrain height
164-
Real terrainHeightAtPos = TheTerrainLogic->getGroundHeight( pos->x, pos->y );
165+
Real terrainHeightAtPosNoWater = TheTerrainLogic->getGroundHeight(pos->x, pos->y);
166+
Real terrainHeightAtPos{ terrainHeightAtPosNoWater };
167+
if (modData->m_targetHeightIncludesWater) {
168+
Real waterz{ 0 };
169+
if (TheTerrainLogic->isUnderwater(pos->x, pos->y, &waterz)) {
170+
terrainHeightAtPos = waterz;
171+
}
172+
}
165173

166174
// if including structures, check for bridges
167175
if (modData->m_targetHeightIncludesStructures)
@@ -240,13 +248,13 @@ UpdateSleepTime HeightDieUpdate::update( void )
240248

241249
// if we're supposed to snap us to the ground on death do so
242250
// AND: even if we're not snapping to ground, be sure we don't go BELOW ground
243-
if( modData->m_snapToGroundOnDeath || pos->z < terrainHeightAtPos )
251+
if( modData->m_snapToGroundOnDeath || pos->z < terrainHeightAtPosNoWater )
244252
{
245253
Coord3D ground;
246254

247255
ground.x = pos->x;
248256
ground.y = pos->y;
249-
ground.z = terrainHeightAtPos;
257+
ground.z = terrainHeightAtPosNoWater;
250258
getObject()->setPosition( &ground );
251259

252260
}

0 commit comments

Comments
 (0)