Skip to content

Commit 921f829

Browse files
committed
[GEN] Backports ZH additions
1 parent 3feb3fc commit 921f829

File tree

82 files changed

+1573
-101
lines changed

Some content is hidden

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

82 files changed

+1573
-101
lines changed

Generals/Code/GameEngine/Include/Common/ArchiveFileSystem.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,10 @@ class ArchiveFileSystem : public SubsystemInterface
172172

173173
// Unprotected this for copy-protection routines
174174
AsciiString getArchiveFilenameForFile(const AsciiString& filename) const;
175-
176175
void loadMods( void );
177176

178177
protected:
179-
virtual void loadIntoDirectoryTree(const ArchiveFile *archiveFile, const AsciiString& archiveFilename, Bool overwrite = FALSE); ///< load the archive file's header information and apply it to the global archive directory tree.
178+
virtual void loadIntoDirectoryTree(const ArchiveFile *archiveFile, const AsciiString& archiveFilename, Bool overwrite = FALSE ); ///< load the archive file's header information and apply it to the global archive directory tree.
180179

181180
ArchiveFileMap m_archiveFileMap;
182181
ArchivedDirectoryInfo m_rootDirectory;

Generals/Code/GameEngine/Include/Common/BitFlagsIO.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,18 @@ template <size_t NUMBITS>
138138
((BitFlags*)store)->parse(ini, NULL);
139139
}
140140

141+
//-------------------------------------------------------------------------------------------------
142+
//-------------------------------------------------------------------------------------------------
143+
template <size_t NUMBITS>
144+
/*static*/ void BitFlags<NUMBITS>::parseSingleBitFromINI(INI* ini, void* /*instance*/, void *store, const void* /*userData*/)
145+
{
146+
const char *token = ini->getNextToken();
147+
Int bitIndex = INI::scanIndexList(token, s_bitNameList); // this throws if the token is not found
148+
149+
Int *storeAsInt = (Int*)store;
150+
*storeAsInt = bitIndex;
151+
}
152+
141153
//-------------------------------------------------------------------------------------------------
142154
/** Xfer method
143155
* Version Info:

Generals/Code/GameEngine/Include/Common/DataChunk.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class DataChunkOutput
136136
void writeUnicodeString(UnicodeString string);
137137
void writeArrayOfBytes(char *ptr, Int len);
138138
void writeDict(const Dict& d);
139+
void writeNameKey(const NameKeyType key);
139140
};
140141

141142
//----------------------------------------------------------------------
@@ -228,6 +229,8 @@ class DataChunkInput
228229
UnicodeString readUnicodeString(void);
229230
Dict readDict(void);
230231
void readArrayOfBytes(char *ptr, Int len);
232+
233+
NameKeyType readNameKey(void);
231234
};
232235

233236

Generals/Code/GameEngine/Include/Common/Energy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Energy : public Snapshot
6666

6767
public:
6868

69-
inline Energy() : m_energyProduction(0), m_energyConsumption(0), m_owner(NULL) { }
69+
Energy();
7070

7171
// reset energy information to base values.
7272
void init( Player *owner)
@@ -77,7 +77,7 @@ class Energy : public Snapshot
7777
}
7878

7979
/// return current energy production in kilowatts
80-
Int getProduction() const { return m_energyProduction; }
80+
Int getProduction() const;
8181

8282
/// return current energy consumption in kilowatts
8383
Int getConsumption() const { return m_energyConsumption; }

Generals/Code/GameEngine/Include/Common/GameAudio.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,6 @@ class AudioManager : public SubsystemInterface
152152
virtual void resumeAudio( AudioAffect which ) = 0;
153153
virtual void pauseAmbient( Bool shouldPause ) = 0;
154154

155-
// device dependent stops.
156-
virtual void stopAllAmbientsBy( Object* obj ) = 0;
157-
virtual void stopAllAmbientsBy( Drawable* draw ) = 0;
158-
159155
// for focus issues
160156
virtual void loseFocus( void );
161157
virtual void regainFocus( void );
@@ -240,6 +236,8 @@ class AudioManager : public SubsystemInterface
240236
// on zoom.
241237
virtual void set3DVolumeAdjustment( Real volumeAdjustment );
242238

239+
virtual Bool has3DSensitiveStreamsPlaying( void ) const = 0;
240+
243241
virtual void *getHandleForBink( void ) = 0;
244242
virtual void releaseHandleForBink( void ) = 0;
245243

@@ -257,6 +255,7 @@ class AudioManager : public SubsystemInterface
257255
virtual void processRequestList( void );
258256

259257
virtual AudioEventInfo *newAudioEventInfo( AsciiString newEventName );
258+
virtual void addAudioEventInfo( AudioEventInfo * newEventInfo );
260259
virtual AudioEventInfo *findAudioEventInfo( AsciiString eventName ) const;
261260

262261
const AudioSettings *getAudioSettings( void ) const;
@@ -298,6 +297,7 @@ class AudioManager : public SubsystemInterface
298297

299298
// For Worldbuilder, to build lists from which to select
300299
virtual void findAllAudioEventsOfType( AudioType audioType, std::vector<AudioEventInfo*>& allEvents );
300+
virtual const AudioEventInfoHash & getAllAudioEvents() const { return m_allAudioEventInfo; }
301301

302302
Real getZoomVolume() const { return m_zoomVolume; }
303303
protected:
@@ -316,7 +316,9 @@ class AudioManager : public SubsystemInterface
316316

317317
// For tracking purposes
318318
virtual AudioHandle allocateNewHandle( void );
319-
319+
320+
void removeAllAudioRequests( void );
321+
320322
protected:
321323
AudioSettings *m_audioSettings;
322324
MiscAudio *m_miscAudio;

Generals/Code/GameEngine/Include/Common/GameType.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ enum FormationID CPP_11(: Int)
5858
FORCE_FORMATIONID_TO_LONG_SIZE = 0x7ffffff
5959
};
6060

61+
#define INVALID_ANGLE -100.0f
62+
6163
class INI;
6264

6365
//-------------------------------------------------------------------------------------------------

Generals/Code/GameEngine/Include/Common/Geometry.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ class GeometryInfo : public Snapshot
179179

180180
/// note that the pt is generated using game logic random, not game client random!
181181
void makeRandomOffsetWithinFootprint(Coord3D& pt) const;
182+
void makeRandomOffsetOnPerimeter(Coord3D& pt) const; //Chooses a random point on the extent border.
182183

183184
void clipPointToFootprint(const Coord3D& geomCenter, Coord3D& ptToClip) const;
184185

Generals/Code/GameEngine/Include/Common/Money.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,15 @@ class Money : public Snapshot
8282

8383
void setPlayerIndex(Int ndx) { m_playerIndex = ndx; }
8484

85-
protected:
85+
static void parseMoneyAmount( INI *ini, void *instance, void *store, const void* userData );
86+
87+
// Does the amount of this == the amount of that (compare everything except m_playerIndex)
88+
Bool amountEqual( const Money & that ) const
89+
{
90+
return m_money == that.m_money;
91+
}
8692

93+
protected:
8794
// snapshot methods
8895
virtual void crc( Xfer *xfer );
8996
virtual void xfer( Xfer *xfer );

Generals/Code/GameEngine/Include/Common/MultiplayerSettings.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ class MultiplayerSettings : public SubsystemInterface
7979

8080
MultiplayerSettings( void );
8181

82-
void init() { }
83-
void update() { }
84-
void reset() { }
82+
virtual void init() { }
83+
virtual void update() { }
84+
virtual void reset() { }
8585

8686
//-----------------------------------------------------------------------------------------------
8787
static const FieldParse m_multiplayerSettingsFieldParseTable[]; ///< the parse table for INI definition

Generals/Code/GameEngine/Include/Common/NameKeyGenerator.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ class NameKeyGenerator : public SubsystemInterface
9696

9797
/// Given a string, convert into a unique integer key.
9898
NameKeyType nameToKey(const AsciiString& name) { return nameToKey(name.str()); }
99+
NameKeyType nameToLowercaseKey(const AsciiString& name) { return nameToLowercaseKey(name.str()); }
99100

100101
/// Given a string, convert into a unique integer key.
101102
NameKeyType nameToKey(const char* name);
103+
NameKeyType nameToLowercaseKey(const char *name);
102104

103105
/**
104106
given a key, return the name. this is almost never needed,
@@ -108,6 +110,9 @@ class NameKeyGenerator : public SubsystemInterface
108110
*/
109111
AsciiString keyToName(NameKeyType key);
110112

113+
// Get a string out of the INI. Store it into a NameKeyType
114+
static void parseStringAsNameKeyType( INI *ini, void *instance, void *store, const void* userData );
115+
111116
private:
112117

113118
enum

0 commit comments

Comments
 (0)