Skip to content

Commit 95cc1be

Browse files
authored
Merge branch 'TheSuperHackers:main' into main
2 parents 9b4ae20 + 292c755 commit 95cc1be

File tree

114 files changed

+707
-11268
lines changed

Some content is hidden

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

114 files changed

+707
-11268
lines changed

Core/GameEngine/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ set(GAMEENGINE_SRC
212212
# Include/GameClient/Module/SwayClientUpdate.h
213213
# Include/GameClient/Mouse.h
214214
Include/GameClient/ParabolicEase.h
215-
# Include/GameClient/ParticleSys.h
215+
Include/GameClient/ParticleSys.h
216216
# Include/GameClient/PlaceEventTranslator.h
217217
# Include/GameClient/ProcessAnimateWindow.h
218218
# Include/GameClient/RadiusDecal.h
@@ -828,7 +828,7 @@ set(GAMEENGINE_SRC
828828
Source/GameClient/System/Debug/AudioDebugDisplay.cpp
829829
# Source/GameClient/System/DebugDisplay.cpp
830830
# Source/GameClient/System/Image.cpp
831-
# Source/GameClient/System/ParticleSys.cpp
831+
Source/GameClient/System/ParticleSys.cpp
832832
# Source/GameClient/System/RayEffect.cpp
833833
Source/GameClient/System/Smudge.cpp
834834
Source/GameClient/Terrain/TerrainRoads.cpp

Generals/Code/GameEngine/Include/GameClient/ParticleSys.h renamed to Core/GameEngine/Include/GameClient/ParticleSys.h

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** Command & Conquer Generals(tm)
2+
** Command & Conquer Generals Zero Hour(tm)
33
** Copyright 2025 Electronic Arts Inc.
44
**
55
** This program is free software: you can redistribute it and/or modify
@@ -61,6 +61,10 @@ enum ParticleSystemID CPP_11(: Int)
6161
#define DEFAULT_VOLUME_PARTICLE_DEPTH ( 0 )//The Default is not to do the volume thing!
6262
#define OPTIMUM_VOLUME_PARTICLE_DEPTH ( 6 )
6363

64+
// TheSuperHackers @info The X and Y angles are not necessary for particles because there are only 2 placement modes:
65+
// Billboard (always facing camera) and Ground Aligned, which overwrite any rotations on the X and Y axis by design.
66+
// Therefore particles can only be rotated on the Z axis. Zero Hour never had X and Y angles, but Generals did.
67+
#define PARTICLE_USE_XY_ROTATION (0)
6468

6569
//--------------------------------------------------------------------------------------------------------------
6670

@@ -122,11 +126,15 @@ class ParticleInfo : public Snapshot
122126
Coord3D m_emitterPos; ///< position of the emitter
123127
Real m_velDamping; ///< velocity damping coefficient
124128

129+
#if PARTICLE_USE_XY_ROTATION
125130
Real m_angleX; ///< initial angle around X axis
126131
Real m_angleY; ///< initial angle around Y axis
132+
#endif
127133
Real m_angleZ; ///< initial angle around Z axis
134+
#if PARTICLE_USE_XY_ROTATION
128135
Real m_angularRateX; ///< initial angle around X axis
129136
Real m_angularRateY; ///< initial angle around Y axis
137+
#endif
130138
Real m_angularRateZ; ///< initial angle around Z axis
131139
Real m_angularDamping; ///< angular velocity damping coefficient
132140

@@ -174,7 +182,6 @@ class Particle : public MemoryPoolObject,
174182
void doWindMotion( void ); ///< do wind motion (if present) from particle system
175183

176184
void applyForce( const Coord3D *force ); ///< add the given acceleration
177-
void detachDrawable( void ) { m_drawable = nullptr; } ///< detach the Drawable pointer from this particle
178185

179186
const Coord3D *getPosition( void ) { return &m_pos; }
180187
Real getSize( void ) { return m_size; }
@@ -231,7 +238,6 @@ class Particle : public MemoryPoolObject,
231238
RGBColor m_colorRate; ///< current rate of color change
232239
Int m_colorTargetKey; ///< next index into key array
233240

234-
Drawable * m_drawable; ///< drawable associated with this particle
235241

236242
Bool m_isCulled; ///< status of particle relative to screen bounds
237243
public:
@@ -273,18 +279,22 @@ class ParticleSystemInfo : public Snapshot
273279

274280
enum ParticleType
275281
{
276-
INVALID_TYPE=0, PARTICLE, DRAWABLE, STREAK, VOLUME_PARTICLE, ///< is a particle a 2D-screen-facing particle, or a Drawable, or a Segment in a streak?
282+
INVALID_TYPE=0, PARTICLE, DRAWABLE, STREAK, VOLUME_PARTICLE, SMUDGE, ///< is a particle a 2D-screen-facing particle, or a Drawable, or a Segment in a streak?
277283
PARTICLE_TYPE_COUNT
278284
}
279285
m_particleType;
280286

281287
AsciiString m_particleTypeName; ///< if PARTICLE, texture filename, if DRAWABLE, Drawable name
282288

289+
#if PARTICLE_USE_XY_ROTATION
283290
GameClientRandomVariable m_angleX; ///< initial angle around X axis
284291
GameClientRandomVariable m_angleY; ///< initial angle around Y axis
292+
#endif
285293
GameClientRandomVariable m_angleZ; ///< initial angle around Z axis
294+
#if PARTICLE_USE_XY_ROTATION
286295
GameClientRandomVariable m_angularRateX; ///< initial angle around X axis
287296
GameClientRandomVariable m_angularRateY; ///< initial angle around Y axis
297+
#endif
288298
GameClientRandomVariable m_angularRateZ; ///< initial angle around Z axis
289299
GameClientRandomVariable m_angularDamping; ///< angular velocity damping coefficient
290300

@@ -461,7 +471,7 @@ static_assert(ARRAY_SIZE(ParticleShaderTypeNames) == ParticleSystemInfo::PARTICL
461471

462472
static const char *const ParticleTypeNames[] =
463473
{
464-
"NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE", nullptr
474+
"NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE", "SMUDGE", nullptr
465475
};
466476
static_assert(ARRAY_SIZE(ParticleTypeNames) == ParticleSystemInfo::PARTICLE_TYPE_COUNT + 1, "Incorrect array size");
467477

@@ -559,6 +569,7 @@ class ParticleSystem : public MemoryPoolObject,
559569
void rotateLocalTransformX( Real x ); ///< rotate local transform matrix
560570
void rotateLocalTransformY( Real y ); ///< rotate local transform matrix
561571
void rotateLocalTransformZ( Real z ); ///< rotate local transform matrix
572+
void setSkipParentXfrm(Bool enable) { m_skipParentXfrm = enable; } ///<disable transforming particle system with parent matrix.
562573

563574
const Coord3D *getDriftVelocity( void ) { return &m_driftVelocity; } ///< get the drift velocity of the system
564575

@@ -594,6 +605,7 @@ class ParticleSystem : public MemoryPoolObject,
594605
AsciiString getParticleTypeName( void ) { return m_particleTypeName; } ///< return the name of the particles
595606
Bool isUsingDrawables( void ) { return (m_particleType == DRAWABLE) ? true : false; }
596607
Bool isUsingStreak( void ) { return (m_particleType == STREAK) ? true : false; }
608+
Bool isUsingSmudge( void ) { return (m_particleType == SMUDGE) ? true : false; }
597609
UnsignedInt getVolumeParticleDepth( void ) { return ( m_particleType == VOLUME_PARTICLE ) ? OPTIMUM_VOLUME_PARTICLE_DEPTH : 0; }
598610

599611
Bool shouldBillboard( void ) { return !m_isGroundAligned; }
@@ -711,6 +723,7 @@ class ParticleSystem : public MemoryPoolObject,
711723
Bool m_isDestroyed; ///< are we destroyed and waiting for particles to die
712724
Bool m_isFirstPos; ///< true if this system hasn't been drawn before.
713725
Bool m_isSaveable; ///< true if this system should be saved/loaded
726+
Bool m_skipParentXfrm; ///< true if this system is already in world space.
714727

715728

716729
// the actual particle system data is inherited from ParticleSystemInfo

Core/GameEngine/Include/GameClient/View.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class View : public Snapshot
118118
/** project the 4 corners of this view into the world and return each point as a parameter,
119119
the world points are at the requested Z */
120120
virtual void getScreenCornerWorldPointsAtZ( Coord3D *topLeft, Coord3D *topRight,
121-
Coord3D *bottomLeft, Coord3D *bottomRight,
121+
Coord3D *bottomRight, Coord3D *bottomLeft,
122122
Real z );
123123

124124
virtual void setWidth( Int width ) { m_width = width; }

Core/GameEngine/Include/GameNetwork/ConnectionManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class ConnectionManager
171171

172172
// void doPerFrameMetrics(UnsignedInt frame);
173173
void getMinimumFps(Int &minFps, Int &minFpsPlayer); ///< Returns the smallest FPS in the m_fpsAverages list.
174-
Real getMaximumLatency(); ///< Returns the highest average latency between players.
174+
Real getMaximumLatency(); ///< Returns the average of the two highest average latencies between players.
175175

176176
void requestFrameDataResend(Int playerID, UnsignedInt frame); ///< request of this player that he send the specified frame's data.
177177

0 commit comments

Comments
 (0)