Skip to content

Commit a611744

Browse files
committed
fix: Revert 10 files dependent on GameCommon.h
GameCommon.h has code differences between Generals/Zero Hour and cannot be unified yet. Reverted dependent files.
1 parent 9b88588 commit a611744

File tree

23 files changed

+2012
-30
lines changed

23 files changed

+2012
-30
lines changed

Core/GameEngine/CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ set(GAMEENGINE_SRC
2525
Include/Common/CRCDebug.h
2626
# Include/Common/CriticalSection.h
2727
# Include/Common/CustomMatchPreferences.h
28-
Include/Common/DamageFX.h
28+
#Include/Common/DamageFX.h
2929
Include/Common/DataChunk.h
3030
Include/Common/Debug.h
3131
Include/Common/Dict.h
@@ -73,7 +73,7 @@ set(GAMEENGINE_SRC
7373
# Include/Common/MessageStream.h
7474
Include/Common/MiniLog.h
7575
Include/Common/MiscAudio.h
76-
Include/Common/MissionStats.h
76+
#Include/Common/MissionStats.h
7777
# Include/Common/ModelState.h
7878
# Include/Common/Module.h
7979
Include/Common/ModuleFactory.h
@@ -88,9 +88,9 @@ set(GAMEENGINE_SRC
8888
Include/Common/PerfMetrics.h
8989
# Include/Common/PerfTimer.h
9090
# Include/Common/Player.h
91-
Include/Common/PlayerList.h
91+
#Include/Common/PlayerList.h
9292
# Include/Common/PlayerTemplate.h
93-
Include/Common/ProductionPrerequisite.h
93+
#Include/Common/ProductionPrerequisite.h
9494
Include/Common/QuickmatchPreferences.h
9595
Include/Common/QuotedPrintable.h
9696
Include/Common/Radar.h
@@ -114,7 +114,7 @@ set(GAMEENGINE_SRC
114114
Include/Common/StackDump.h
115115
# Include/Common/StateMachine.h
116116
Include/Common/StatsCollector.h
117-
Include/Common/STLTypedefs.h
117+
#Include/Common/STLTypedefs.h
118118
Include/Common/StreamingArchiveFile.h
119119
# Include/Common/SubsystemInterface.h
120120
Include/Common/SystemInfo.h
@@ -123,7 +123,7 @@ set(GAMEENGINE_SRC
123123
# Include/Common/TerrainTypes.h
124124
Include/Common/Thing.h
125125
# Include/Common/ThingFactory.h
126-
Include/Common/ThingSort.h
126+
#Include/Common/ThingSort.h
127127
# Include/Common/ThingTemplate.h
128128
Include/Common/TunnelTracker.h
129129
Include/Common/UnicodeString.h
@@ -586,7 +586,7 @@ set(GAMEENGINE_SRC
586586
Source/Common/INI/INICommandSet.cpp
587587
Source/Common/INI/INIControlBarScheme.cpp
588588
Source/Common/INI/INICrate.cpp
589-
Source/Common/INI/INIDamageFX.cpp
589+
#Source/Common/INI/INIDamageFX.cpp
590590
Source/Common/INI/INIDrawGroupInfo.cpp
591591
Source/Common/INI/INIGameData.cpp
592592
# Source/Common/INI/INIMapCache.cpp
@@ -620,10 +620,10 @@ set(GAMEENGINE_SRC
620620
# Source/Common/RTS/ActionManager.cpp
621621
# Source/Common/RTS/Energy.cpp
622622
Source/Common/RTS/Handicap.cpp
623-
Source/Common/RTS/MissionStats.cpp
623+
#Source/Common/RTS/MissionStats.cpp
624624
# Source/Common/RTS/Money.cpp
625625
# Source/Common/RTS/Player.cpp
626-
Source/Common/RTS/PlayerList.cpp
626+
#Source/Common/RTS/PlayerList.cpp
627627
# Source/Common/RTS/PlayerTemplate.cpp
628628
# Source/Common/RTS/ProductionPrerequisite.cpp
629629
Source/Common/RTS/ResourceGatheringManager.cpp
@@ -680,7 +680,7 @@ set(GAMEENGINE_SRC
680680
Source/Common/Thing/DrawModule.cpp
681681
# Source/Common/Thing/Module.cpp
682682
# Source/Common/Thing/ModuleFactory.cpp
683-
Source/Common/Thing/Thing.cpp
683+
#Source/Common/Thing/Thing.cpp
684684
# Source/Common/Thing/ThingFactory.cpp
685685
# Source/Common/Thing/ThingTemplate.cpp
686686
# Source/Common/UserPreferences.cpp

Generals/Code/GameEngine/CMakeLists.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ set(GAMEENGINE_SRC
2323
# Include/Common/CRCDebug.h
2424
Include/Common/CriticalSection.h
2525
Include/Common/CustomMatchPreferences.h
26-
#Include/Common/DamageFX.h
26+
Include/Common/DamageFX.h
2727
#Include/Common/DataChunk.h
2828
# Include/Common/Debug.h
2929
#Include/Common/Dict.h
@@ -67,7 +67,7 @@ set(GAMEENGINE_SRC
6767
Include/Common/MessageStream.h
6868
#Include/Common/MiniLog.h
6969
# Include/Common/MiscAudio.h
70-
#Include/Common/MissionStats.h
70+
Include/Common/MissionStats.h
7171
Include/Common/ModelState.h
7272
Include/Common/Module.h
7373
#Include/Common/ModuleFactory.h
@@ -82,9 +82,9 @@ set(GAMEENGINE_SRC
8282
#Include/Common/PerfMetrics.h
8383
Include/Common/PerfTimer.h
8484
Include/Common/Player.h
85-
#Include/Common/PlayerList.h
85+
Include/Common/PlayerList.h
8686
Include/Common/PlayerTemplate.h
87-
#Include/Common/ProductionPrerequisite.h
87+
Include/Common/ProductionPrerequisite.h
8888
#Include/Common/QuickmatchPreferences.h
8989
#Include/Common/QuotedPrintable.h
9090
#Include/Common/Radar.h
@@ -106,7 +106,7 @@ set(GAMEENGINE_SRC
106106
#Include/Common/StackDump.h
107107
Include/Common/StateMachine.h
108108
#Include/Common/StatsCollector.h
109-
#Include/Common/STLTypedefs.h
109+
Include/Common/STLTypedefs.h
110110
# Include/Common/StreamingArchiveFile.h
111111
Include/Common/SubsystemInterface.h
112112
#Include/Common/SystemInfo.h
@@ -115,7 +115,7 @@ set(GAMEENGINE_SRC
115115
Include/Common/TerrainTypes.h
116116
#Include/Common/Thing.h
117117
Include/Common/ThingFactory.h
118-
#Include/Common/ThingSort.h
118+
Include/Common/ThingSort.h
119119
Include/Common/ThingTemplate.h
120120
#Include/Common/TunnelTracker.h
121121
# Include/Common/UnicodeString.h
@@ -540,7 +540,7 @@ set(GAMEENGINE_SRC
540540
#Source/Common/INI/INICommandSet.cpp
541541
#Source/Common/INI/INIControlBarScheme.cpp
542542
#Source/Common/INI/INICrate.cpp
543-
#Source/Common/INI/INIDamageFX.cpp
543+
Source/Common/INI/INIDamageFX.cpp
544544
#Source/Common/INI/INIDrawGroupInfo.cpp
545545
#Source/Common/INI/INIGameData.cpp
546546
Source/Common/INI/INIMapCache.cpp
@@ -572,10 +572,10 @@ set(GAMEENGINE_SRC
572572
Source/Common/RTS/ActionManager.cpp
573573
Source/Common/RTS/Energy.cpp
574574
#Source/Common/RTS/Handicap.cpp
575-
#Source/Common/RTS/MissionStats.cpp
575+
Source/Common/RTS/MissionStats.cpp
576576
Source/Common/RTS/Money.cpp
577577
Source/Common/RTS/Player.cpp
578-
#Source/Common/RTS/PlayerList.cpp
578+
Source/Common/RTS/PlayerList.cpp
579579
Source/Common/RTS/PlayerTemplate.cpp
580580
Source/Common/RTS/ProductionPrerequisite.cpp
581581
#Source/Common/RTS/ResourceGatheringManager.cpp
@@ -632,7 +632,7 @@ set(GAMEENGINE_SRC
632632
#Source/Common/Thing/DrawModule.cpp
633633
Source/Common/Thing/Module.cpp
634634
Source/Common/Thing/ModuleFactory.cpp
635-
#Source/Common/Thing/Thing.cpp
635+
Source/Common/Thing/Thing.cpp
636636
Source/Common/Thing/ThingFactory.cpp
637637
Source/Common/Thing/ThingTemplate.cpp
638638
Source/Common/UserPreferences.cpp
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
/*
2+
** Command & Conquer Generals(tm)
3+
** Copyright 2025 Electronic Arts Inc.
4+
**
5+
** This program is free software: you can redistribute it and/or modify
6+
** it under the terms of the GNU General Public License as published by
7+
** the Free Software Foundation, either version 3 of the License, or
8+
** (at your option) any later version.
9+
**
10+
** This program is distributed in the hope that it will be useful,
11+
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
** GNU General Public License for more details.
14+
**
15+
** You should have received a copy of the GNU General Public License
16+
** along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
19+
////////////////////////////////////////////////////////////////////////////////
20+
// //
21+
// (c) 2001-2003 Electronic Arts Inc. //
22+
// //
23+
////////////////////////////////////////////////////////////////////////////////
24+
25+
// FILE: DamageFX.h /////////////////////////////////////////////////////////////////////////////////
26+
// Author: Steven Johnson, November 2001
27+
// Desc: Damage Effects Descriptions
28+
///////////////////////////////////////////////////////////////////////////////////////////////////
29+
30+
#pragma once
31+
32+
#ifndef _DamageFX_H_
33+
#define _DamageFX_H_
34+
35+
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
36+
#include "Common/GameCommon.h"
37+
#include "Common/NameKeyGenerator.h"
38+
#include "Common/STLTypedefs.h"
39+
#include "GameLogic/Damage.h"
40+
41+
// FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
42+
class DamageFXStore;
43+
class FXList;
44+
class INI;
45+
46+
//-------------------------------------------------------------------------------------------------
47+
typedef const FXList* ConstFXListPtr;
48+
49+
//-------------------------------------------------------------------------------------------------
50+
/**
51+
A DamageFX is an object used to describe how an object reacts to taking a particular type
52+
of damage. (Note that "reacts" here implies only audio-video effects, not logic effects,
53+
damage modifiers, etc.)
54+
55+
Conceptually speaking, every unit with a Body module has a DamageFX object. When it receives damage,
56+
it asks its DamageFX module to produce an appropriate a/v effect, which can vary by type of damage
57+
(eg, explosion, armor-piercing, flame, etc) and amount ("minor" or "major").
58+
59+
Notes:
60+
61+
-- Every particular damage-type within a DamageFX can have a "minor" and/or "major" effect;
62+
basically, if the damage done exceeds a specified threshold (or if there isn't a "minor"
63+
effect), the major effect is used.
64+
65+
-- DamageFX is shared between multiple units; there should generally only be one instance
66+
of any particular class. The implication is that it should not require private data storage
67+
to do what it needs to do, aside from stuff initialized at object instantiation time. To help
68+
enforce this, all it's methods are declared 'const'. If you can't implement the damage you
69+
need within this framework, please *don't* simply de-const things, because it could lead to very
70+
strange side-effects. Instead, the system will have to be enhanced to allow for multiple instances
71+
of each DamageFX.
72+
*/
73+
//-------------------------------------------------------------------------------------------------
74+
class DamageFX
75+
{
76+
public:
77+
78+
DamageFX();
79+
80+
void clear();
81+
82+
/**
83+
This is the main public access point to the system: when you want to execute the
84+
a/v fx used for a specific damage type, call this method. (It is OK for source and/or
85+
victim to be null, but you should pass them when available.)
86+
*/
87+
void doDamageFX(DamageType t, Real damageAmount, const Object* source, const Object* victim) const;
88+
89+
UnsignedInt getDamageFXThrottleTime(DamageType t, const Object* source) const;
90+
91+
const FieldParse* getFieldParse() const;
92+
93+
private:
94+
95+
ConstFXListPtr getDamageFXList(DamageType t, Real damageAmount, const Object* source) const;
96+
97+
static void parseAmount( INI* ini, void *instance, void*, const void* );
98+
static void parseMajorFXList( INI* ini, void *instance, void*, const void* );
99+
static void parseMinorFXList( INI* ini, void *instance, void*, const void* );
100+
static void parseTime( INI* ini, void *instance, void*, const void* );
101+
102+
/*
103+
this isn't terribly efficient since this is pretty sparsely populated
104+
and with lots of redundancy, but since we allocate very few of these,
105+
it's not worth more effort at this time...
106+
*/
107+
struct DFX
108+
{
109+
Real m_amountForMajorFX; ///< if damage done is >= this, use major fx
110+
ConstFXListPtr m_majorDamageFXList; ///< fx to make
111+
ConstFXListPtr m_minorDamageFXList; ///< fx to make
112+
UnsignedInt m_damageFXThrottleTime;
113+
114+
DFX()
115+
{
116+
clear();
117+
}
118+
119+
void clear()
120+
{
121+
m_amountForMajorFX = 0.0f;
122+
m_majorDamageFXList = NULL;
123+
m_minorDamageFXList = NULL;
124+
m_damageFXThrottleTime = 0;
125+
}
126+
};
127+
128+
DFX m_dfx[DAMAGE_NUM_TYPES][LEVEL_COUNT];
129+
};
130+
131+
//-------------------------------------------------------------------------------------------------
132+
/**
133+
The "store" used to hold all the DamageFXs in existence. This is usually used when creating
134+
an Object (actually, a Body module), but can be used at any time after that. (It is explicitly
135+
OK to swap an Object's DamageFX out at any given time.)
136+
*/
137+
//-------------------------------------------------------------------------------------------------
138+
class DamageFXStore : public SubsystemInterface
139+
{
140+
141+
public:
142+
143+
DamageFXStore();
144+
~DamageFXStore();
145+
146+
void init();
147+
void reset();
148+
void update();
149+
150+
/**
151+
Find the DamageFX with the given name. If no such DamageFX exists, return null.
152+
*/
153+
const DamageFX *findDamageFX( AsciiString name ) const;
154+
155+
static void parseDamageFXDefinition(INI* ini);
156+
157+
158+
private:
159+
160+
typedef std::hash_map< NameKeyType, DamageFX, rts::hash<NameKeyType>, rts::equal_to<NameKeyType> > DamageFXMap;
161+
DamageFXMap m_dfxmap;
162+
163+
};
164+
165+
// EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
166+
extern DamageFXStore *TheDamageFXStore;
167+
168+
#endif // _DamageFX_H_
169+

0 commit comments

Comments
 (0)