Initial commit of Command & Conquer Generals and Command & Conquer Generals Zero Hour source code.

This commit is contained in:
LFeenanEA 2025-02-27 17:34:39 +00:00
parent 2e338c00cb
commit 3d0ee53a05
No known key found for this signature in database
GPG key ID: C6EBE8C2EA08F7E0
6072 changed files with 2283311 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,52 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIAiData.cpp //////////////////////////////////////////////////////////////////////////
// Author: John Ahlquist, March 2002
// Desc: Parsing AIData INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameLogic/AI.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
// PRIVATE DATA ///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------
/** Parse GameData entry */
//-------------------------------------------------------------------------------------------------
void INI::parseAIDataDefinition( INI* ini )
{
AI::parseAiDataDefinition(ini);
}

View file

@ -0,0 +1,88 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIAnimation.cpp /////////////////////////////////////////////////////////////////////////
// Author: Colin Day, July 2002
// Desc: Parsing animation INI entries for 2D image animations
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameClient/Anim2D.h"
//-------------------------------------------------------------------------------------------------
/** Parse animation entry */
//-------------------------------------------------------------------------------------------------
void INI::parseAnim2DDefinition( INI* ini )
{
AsciiString name;
Anim2DTemplate *animTemplate;
// read the name
const char* c = ini->getNextToken();
name.set( c );
//
// find existing item if present, note that we do not support overrides
// in the animations like we do in systems that are more "design" oriented, images
// are assets as they are
//
if( !TheAnim2DCollection )
{
//We don't need it if we're in the builder... which doesn't have this.
return;
} // end if
// find existing animation template if present
animTemplate = TheAnim2DCollection->findTemplate( name );
if( animTemplate == NULL )
{
// item not found, create a new one
animTemplate = TheAnim2DCollection->newTemplate( name );
DEBUG_ASSERTCRASH( animTemplate, ("INI""parseAnim2DDefinition - unable to allocate animation template for '%s'\n",
name.str()) );
} // end if
else
{
// we're loading over an existing animation template ... something is probably wrong
DEBUG_CRASH(( "INI::parseAnim2DDefinition - Animation template '%s' already exists\n",
animTemplate->getName().str() ));
return;
} // end else
// parse the ini definition
ini->initFromINI( animTemplate, animTemplate->getFieldParse() );
} // end parseAnim2DDefinition

View file

@ -0,0 +1,215 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIAudioEventInfo.cpp ////////////////////////////////////////////////////////////////////////
// Author: Colin Day, July 2002
// Desc: Parsing AudioEvent, MusicTrack and DialogEvent INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "Common/GameAudio.h"
#include "Common/AudioEventInfo.h"
AudioEventInfo::~AudioEventInfo()
{
}
// @todo: Get these functions unified.
//-------------------------------------------------------------------------------------------------
void INI::parseMusicTrackDefinition( INI* ini )
{
AsciiString name;
AudioEventInfo *track;
// read the name
const char* c = ini->getNextToken();
name.set( c );
track = TheAudio->newAudioEventInfo( name );
if (!track) {
return;
}
AudioEventInfo *defaultInfo = TheAudio->findAudioEventInfo("DefaultMusicTrack");
if (defaultInfo) {
(*track) = (*defaultInfo);
TheAudio->addTrackName( name );
}
track->m_audioName = name;
track->m_soundType = AT_Music;
// parse the ini definition
ini->initFromINI( track, track->getFieldParse() );
} // end parseMusicTrackDefinition
//-------------------------------------------------------------------------------------------------
void INI::parseAudioEventDefinition( INI* ini )
{
AsciiString name;
AudioEventInfo *track;
// read the name
const char* c = ini->getNextToken();
name.set( c );
track = TheAudio->newAudioEventInfo( name );
if (!track) {
return;
}
AudioEventInfo *defaultInfo = TheAudio->findAudioEventInfo("DefaultSoundEffect");
if (defaultInfo) {
(*track) = (*defaultInfo);
}
track->m_audioName = name;
track->m_soundType = AT_SoundEffect;
// parse the ini definition
ini->initFromINI( track, track->getFieldParse() );
} // end parseAudioEventDefinition
//-------------------------------------------------------------------------------------------------
void INI::parseDialogDefinition( INI* ini )
{
AsciiString name;
AudioEventInfo *track;
// read the name
const char* c = ini->getNextToken();
name.set( c );
track = TheAudio->newAudioEventInfo( name );
if (!track) {
return;
}
AudioEventInfo *defaultInfo = TheAudio->findAudioEventInfo("DefaultDialog");
if (defaultInfo) {
(*track) = (*defaultInfo);
}
track->m_audioName = name;
track->m_soundType = AT_Streaming;
// parse the ini definition
ini->initFromINI( track, track->getFieldParse() );
} // end parseAudioEventDefinition
//-------------------------------------------------------------------------------------------------
static void parseDelay( INI* ini, void *instance, void *store, const void* /*userData*/ );
static void parsePitchShift( INI* ini, void *instance, void *store, const void* /*userData*/ );
//-------------------------------------------------------------------------------------------------
const FieldParse AudioEventInfo::m_audioEventInfo[] =
{
{ "Filename", INI::parseAsciiString, NULL, offsetof( AudioEventInfo, m_filename) },
{ "Volume", INI::parsePercentToReal, NULL, offsetof( AudioEventInfo, m_volume ) },
{ "VolumeShift", INI::parsePercentToReal, NULL, offsetof( AudioEventInfo, m_volumeShift ) },
{ "MinVolume", INI::parsePercentToReal, NULL, offsetof( AudioEventInfo, m_minVolume ) },
{ "PitchShift", parsePitchShift, NULL, 0 },
{ "Delay", parseDelay, NULL, 0 },
{ "Limit", INI::parseInt, NULL, offsetof( AudioEventInfo, m_limit ) },
{ "LoopCount", INI::parseInt, NULL, offsetof( AudioEventInfo, m_loopCount ) },
{ "Priority", INI::parseIndexList, theAudioPriorityNames, offsetof( AudioEventInfo, m_priority ) },
{ "Type", INI::parseBitString32, theSoundTypeNames, offsetof( AudioEventInfo, m_type ) },
{ "Control", INI::parseBitString32, theAudioControlNames, offsetof( AudioEventInfo, m_control ) },
{ "Sounds", INI::parseSoundsList, NULL, offsetof( AudioEventInfo, m_sounds ) },
{ "SoundsNight", INI::parseSoundsList, NULL, offsetof( AudioEventInfo, m_soundsNight ) },
{ "SoundsEvening", INI::parseSoundsList, NULL, offsetof( AudioEventInfo, m_soundsEvening ) },
{ "SoundsMorning", INI::parseSoundsList, NULL, offsetof( AudioEventInfo, m_soundsMorning ) },
{ "Attack", INI::parseSoundsList, NULL, offsetof( AudioEventInfo, m_attackSounds ) },
{ "Decay", INI::parseSoundsList, NULL, offsetof( AudioEventInfo, m_decaySounds ) },
{ "MinRange", INI::parseReal, NULL, offsetof( AudioEventInfo, m_minDistance) },
{ "MaxRange", INI::parseReal, NULL, offsetof( AudioEventInfo, m_maxDistance) },
{ "LowPassCutoff", INI::parsePercentToReal, NULL, offsetof( AudioEventInfo, m_lowPassFreq) },
};
//-------------------------------------------------------------------------------------------------
static void parseDelay( INI* ini, void *instance, void *store, const void* /*userData*/ )
{
AudioEventInfo *attribs = (AudioEventInfo*) store;
Int min = ini->scanInt(ini->getNextToken());
Int max = ini->scanInt(ini->getNextToken());
DEBUG_ASSERTCRASH( min >= 0 && max >= min, ("Bad delay values for audio event %s", attribs->m_audioName.str()));
attribs->m_delayMax = max;
attribs->m_delayMin = min;
}
//-------------------------------------------------------------------------------------------------
static void parsePitchShift( INI* ini, void *instance, void *store, const void* /*userData*/ )
{
AudioEventInfo *attribs = (AudioEventInfo*) store;
Real min = ini->scanReal(ini->getNextToken());
Real max = ini->scanReal(ini->getNextToken());
DEBUG_ASSERTCRASH( min > -100 && max >= min, ("Bad pitch shift values for audio event %s", attribs->m_audioName.str()));
attribs->m_pitchShiftMin = 1.0f + min/100;
attribs->m_pitchShiftMax = 1.0f + max/100;
}
// STATIC DEFINIITIONS ////////////////////////////////////////////////////////////////////////////
char *theAudioPriorityNames[] =
{
"LOWEST",
"LOW",
"NORMAL",
"HIGH",
"CRITICAL",
NULL
};
char *theSoundTypeNames[] =
{
"UI",
"WORLD",
"SHROUDED",
"GLOBAL",
"VOICE",
"PLAYER",
"ALLIES",
"ENEMIES",
"EVERYONE",
NULL
};
char *theAudioControlNames[] =
{
"LOOP",
"RANDOM",
"ALL",
"POSTDELAY",
"INTERRUPT",
NULL
};

View file

@ -0,0 +1,78 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INICommandButton.cpp /////////////////////////////////////////////////////////////////////
// Author: Colin Day, March 2002
// Desc: Command buttons are the atomic units we can configure into command sets to then
// display in the context sensitive user interface
///////////////////////////////////////////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameClient/ControlBar.h"
//-------------------------------------------------------------------------------------------------
/** Parse a command button */
//-------------------------------------------------------------------------------------------------
void INI::parseCommandButtonDefinition( INI *ini )
{
ControlBar::parseCommandButtonDefinition(ini);
}
//-------------------------------------------------------------------------------------------------
/** Parse a command button */
//-------------------------------------------------------------------------------------------------
void ControlBar::parseCommandButtonDefinition( INI *ini )
{
// read the name
AsciiString name = ini->getNextToken();
// find existing item if present
CommandButton *button = TheControlBar->findNonConstCommandButton( name );
if( button == NULL )
{
// allocate a new item
button = TheControlBar->newCommandButton( name );
if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES)
{
button->markAsOverride();
}
} // end if
else if( ini->getLoadType() != INI_LOAD_CREATE_OVERRIDES )
{
DEBUG_CRASH(( "[LINE: %d in '%s'] Duplicate commandbutton %s found!", ini->getLineNum(), ini->getFilename().str(), name.str() ));
}
else
{
button = TheControlBar->newCommandButtonOverride( button );
}
// parse the ini definition
ini->initFromINI( button, button->getFieldParse() );
} // end parseCommandButtonDefinition

View file

@ -0,0 +1,43 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INICommandSet.cpp ////////////////////////////////////////////////////////////////////////
// Author: Colin Day, March 2002
// Desc: Command sets are a configurable set of CommandButtons, we will use the sets as
// part of the context sensitive user interface
///////////////////////////////////////////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameClient/ControlBar.h"
//-------------------------------------------------------------------------------------------------
/** Parse a command set */
//-------------------------------------------------------------------------------------------------
void INI::parseCommandSetDefinition( INI *ini )
{
ControlBar::parseCommandSetDefinition(ini);
} // end parseCommandSetDefinition

View file

@ -0,0 +1,101 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIControlBarScheme.cpp /////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//
// Electronic Arts Pacific.
//
// Confidential Information
// Copyright (C) 2002 - All Rights Reserved
//
//-----------------------------------------------------------------------------
//
// created: Apr 2002
//
// Filename: INIControlBarScheme.cpp
//
// author: Chris Huybregts
//
// purpose: Parse a control Bar Scheme
//
//-----------------------------------------------------------------------------
///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// USER INCLUDES //////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameClient/ControlBar.h"
#include "GameClient/ControlBarScheme.h"
//-----------------------------------------------------------------------------
// DEFINES ////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
/** Parse a ControlBarScheme button */
//-------------------------------------------------------------------------------------------------
void INI::parseControlBarSchemeDefinition( INI *ini )
{
AsciiString name;
ControlBarSchemeManager *CBSchemeManager;
ControlBarScheme *CBScheme;
// read the name
const char* c = ini->getNextToken();
name.set( c );
// find existing item if present
CBSchemeManager = TheControlBar->getControlBarSchemeManager();
DEBUG_ASSERTCRASH( CBSchemeManager, ("parseControlBarSchemeDefinition: Unable to Get CBSchemeManager\n") );
if( !CBSchemeManager )
return;
// If we have a previously allocated control bar, this will return a cleared out pointer to it so we
// can overwrite it
CBScheme = CBSchemeManager->newControlBarScheme( name );
// sanity
DEBUG_ASSERTCRASH( CBScheme, ("parseControlBarSchemeDefinition: Unable to allocate Scheme '%s'\n", name.str()) );
// parse the ini definition
ini->initFromINI( CBScheme, CBSchemeManager->getFieldParse() );
} // end parseCommandButtonDefinition

View file

@ -0,0 +1,46 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INICrate.cpp /////////////////////////////////////////////////////////////////////////////////
// Author: Graham Smallwood Feb 2002
// Desc: Just passes the parse to the CrateSystem
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameLogic/CrateSystem.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------
/** Parse Weapon entry */
//-------------------------------------------------------------------------------------------------
void INI::parseCrateTemplateDefinition( INI* ini )
{
CrateSystem::parseCrateTemplateDefinition(ini);
}

View file

@ -0,0 +1,44 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIDamageFX.cpp ////////////////////////////////////////////////////////////////////////////
// Author: Steven Johnson, November 2001
// Desc: Parsing DamageFX INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "Common/DamageFX.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
/*static */ void INI::parseDamageFXDefinition(INI* ini)
{
DamageFXStore::parseDamageFXDefinition(ini);
}

View file

@ -0,0 +1,91 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIDrawGroupInfo.cpp /////////////////////////////////////////////////////////////////////
// Author: John McDonald, October 2002
// Desc: Parsing DrawGroupInfo INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameClient/DrawGroupInfo.h"
void parseInt( INI* ini, void * /*instance*/, void *store, const void* userData )
{
DrawGroupInfo *dgi = (DrawGroupInfo*) store;
if (userData == 0) {
store = &dgi->m_pixelOffsetX;
dgi->m_usingPixelOffsetX = TRUE;
} else {
store = &dgi->m_pixelOffsetY;
dgi->m_usingPixelOffsetY = TRUE;
}
INI::parseInt(ini, NULL, store, NULL);
}
void parsePercentToReal( INI* ini, void * /*instance*/, void *store, const void* userData )
{
DrawGroupInfo *dgi = (DrawGroupInfo*) store;
if (userData == 0) {
store = &dgi->m_pixelOffsetX;
dgi->m_usingPixelOffsetX = FALSE;
} else {
store = &dgi->m_pixelOffsetY;
dgi->m_usingPixelOffsetY = FALSE;
}
INI::parsePercentToReal(ini, NULL, store, NULL);
}
const FieldParse DrawGroupInfo::s_fieldParseTable[] =
{
{ "UsePlayerColor", INI::parseBool, NULL, offsetof( DrawGroupInfo, m_usePlayerColor) },
{ "ColorForText", INI::parseColorInt, NULL, offsetof( DrawGroupInfo, m_colorForText ) },
{ "ColorForTextDropShadow", INI::parseColorInt, NULL, offsetof( DrawGroupInfo, m_colorForTextDropShadow ) },
{ "FontName", INI::parseQuotedAsciiString, NULL, offsetof( DrawGroupInfo, m_fontName ) },
{ "FontSize", INI::parseInt, NULL, offsetof( DrawGroupInfo, m_fontSize ) },
{ "FontIsBold", INI::parseBool, NULL, offsetof( DrawGroupInfo, m_fontIsBold ) },
{ "DropShadowOffsetX", INI::parseInt, NULL, offsetof( DrawGroupInfo, m_dropShadowOffsetX) },
{ "DropShadowOffsetY", INI::parseInt, NULL, offsetof( DrawGroupInfo, m_dropShadowOffsetY) },
{ "DrawPositionXPixel", parseInt, (void*)0, 0 },
{ "DrawPositionXPercent", parsePercentToReal, (void*)0, 0 },
{ "DrawPositionYPixel", parseInt, (void*)1, 0 },
{ "DrawPositionYPercent", parsePercentToReal, (void*)1, 0 },
{ 0, 0, 0, 0 }
};
/*static */ void INI::parseDrawGroupNumberDefinition(INI* ini)
{
if (!TheDrawGroupInfo) {
throw INI_UNKNOWN_ERROR;
}
ini->initFromINI(TheDrawGroupInfo, TheDrawGroupInfo->getFieldParse());
}

View file

@ -0,0 +1,52 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIGameData.cpp //////////////////////////////////////////////////////////////////////////
// Author: Colin Day, November 2001
// Desc: Parsing GameData INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "Common/GlobalData.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
// PRIVATE DATA ///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------
/** Parse GameData entry */
//-------------------------------------------------------------------------------------------------
void INI::parseGameDataDefinition( INI* ini )
{
GlobalData::parseGameDataDefinition(ini);
}

View file

@ -0,0 +1,170 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIMapCache.cpp ///////////////////////////////////////////////////////////////////////////
// Author: Matthew D. Campbell, February 2002
// Desc: Parsing MapCache INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Lib/BaseType.h"
#include "Common/INI.h"
#include "GameClient/MapUtil.h"
#include "GameNetwork/NetworkDefs.h"
#include "Common/NameKeyGenerator.h"
#include "Common/WellKnownKeys.h"
#include "Common/QuotedPrintable.h"
class MapMetaDataReader
{
public:
Region3D m_extent;
Int m_numPlayers;
Bool m_isMultiplayer;
AsciiString m_asciiDisplayName;
Bool m_isOfficial;
WinTimeStamp m_timestamp;
UnsignedInt m_filesize;
UnsignedInt m_CRC;
Coord3D m_waypoints[MAX_SLOTS];
Coord3D m_initialCameraPosition;
Coord3DList m_supplyPositions;
Coord3DList m_techPositions;
static const FieldParse m_mapFieldParseTable[]; ///< the parse table for INI definition
const FieldParse *getFieldParse( void ) const { return m_mapFieldParseTable; }
};
void parseSupplyPositionCoord3D( INI* ini, void * instance, void * /*store*/, const void* /*userData*/ )
{
MapMetaDataReader *mmdr = (MapMetaDataReader *)instance;
Coord3D coord3d;
INI::parseCoord3D(ini, NULL, &coord3d,NULL );
mmdr->m_supplyPositions.push_front(coord3d);
}
void parseTechPositionsCoord3D( INI* ini, void * instance, void * /*store*/, const void* /*userData*/ )
{
MapMetaDataReader *mmdr = (MapMetaDataReader *)instance;
Coord3D coord3d;
INI::parseCoord3D(ini, NULL, &coord3d,NULL );
mmdr->m_techPositions.push_front(coord3d);
}
const FieldParse MapMetaDataReader::m_mapFieldParseTable[] =
{
{ "isOfficial", INI::parseBool, NULL, offsetof( MapMetaDataReader, m_isOfficial ) },
{ "isMultiplayer", INI::parseBool, NULL, offsetof( MapMetaDataReader, m_isMultiplayer ) },
{ "extentMin", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_extent.lo ) },
{ "extentMax", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_extent.hi ) },
{ "numPlayers", INI::parseInt, NULL, offsetof( MapMetaDataReader, m_numPlayers ) },
{ "fileSize", INI::parseUnsignedInt, NULL, offsetof( MapMetaDataReader, m_filesize ) },
{ "fileCRC", INI::parseUnsignedInt, NULL, offsetof( MapMetaDataReader, m_CRC ) },
{ "timestampLo", INI::parseInt, NULL, offsetof( MapMetaDataReader, m_timestamp.m_lowTimeStamp ) },
{ "timestampHi", INI::parseInt, NULL, offsetof( MapMetaDataReader, m_timestamp.m_highTimeStamp ) },
{ "displayName", INI::parseAsciiString, NULL, offsetof( MapMetaDataReader, m_asciiDisplayName ) },
{ "supplyPosition", parseSupplyPositionCoord3D, NULL, NULL },
{ "techPosition", parseTechPositionsCoord3D, NULL, NULL },
{ "Player_1_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) },
{ "Player_2_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 1 },
{ "Player_3_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 2 },
{ "Player_4_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 3 },
{ "Player_5_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 4 },
{ "Player_6_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 5 },
{ "Player_7_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 6 },
{ "Player_8_Start", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_waypoints ) + sizeof(Coord3D) * 7 },
{ "InitialCameraPosition", INI::parseCoord3D, NULL, offsetof( MapMetaDataReader, m_initialCameraPosition ) },
{ NULL, NULL, NULL, 0 } // keep this last
};
void INI::parseMapCacheDefinition( INI* ini )
{
const char *c;
AsciiString name;
MapMetaDataReader mdr;
MapMetaData md;
// read the name
c = ini->getNextToken(" \n\r\t");
name.set( c );
name = QuotedPrintableToAsciiString(name);
md.m_waypoints.clear();
ini->initFromINI( &mdr, mdr.getFieldParse() );
md.m_extent = mdr.m_extent;
md.m_isOfficial = mdr.m_isOfficial != 0;
md.m_isMultiplayer = mdr.m_isMultiplayer != 0;
md.m_numPlayers = mdr.m_numPlayers;
md.m_filesize = mdr.m_filesize;
md.m_CRC = mdr.m_CRC;
md.m_timestamp = mdr.m_timestamp;
md.m_waypoints[TheNameKeyGenerator->keyToName(TheKey_InitialCameraPosition)] = mdr.m_initialCameraPosition;
md.m_displayName = QuotedPrintableToUnicodeString(mdr.m_asciiDisplayName);
AsciiString startingCamName;
for (Int i=0; i<md.m_numPlayers; ++i)
{
startingCamName.format("Player_%d_Start", i+1); // start pos waypoints are 1-based
md.m_waypoints[startingCamName] = mdr.m_waypoints[i];
}
Coord3DList::iterator it = mdr.m_supplyPositions.begin();
while( it != mdr.m_supplyPositions.end())
{
md.m_supplyPositions.push_front(*it);
it++;
}
it = mdr.m_techPositions.begin();
while( it != mdr.m_techPositions.end())
{
md.m_techPositions.push_front(*it);
it++;
}
if(TheMapCache && !md.m_displayName.isEmpty())
{
AsciiString lowerName = name;
lowerName.toLower();
md.m_fileName = lowerName;
// DEBUG_LOG(("INI::parseMapCacheDefinition - adding %s to map cache\n", lowerName.str()));
(*TheMapCache)[lowerName] = md;
}
}

View file

@ -0,0 +1,50 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIMapData.cpp ///////////////////////////////////////////////////////////////////////////
// Author: Colin Day, November 2001
// Desc: Parsing MapData INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
// PRIVATE DATA ///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------
/** Parse MapData entry */
//-------------------------------------------------------------------------------------------------
void INI::parseMapDataDefinition( INI* ini )
{
} // end parseMapData

View file

@ -0,0 +1,79 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIMappedImage.cpp ///////////////////////////////////////////////////////////////////////
// Author: Colin Day, December 2001
// Desc: Mapped image INI parsing
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameClient/Image.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------
/** Parse mapped image entry */
//-------------------------------------------------------------------------------------------------
void INI::parseMappedImageDefinition( INI* ini )
{
AsciiString name;
// read the name
const char* c = ini->getNextToken();
name.set( c );
//
// find existing item if present, note that we do not support overrides
// in the images like we do in systems that are more "design" oriented, images
// are assets as they are
//
if( !TheMappedImageCollection )
{
//We don't need it if we're in the builder... which doesn't have this.
return;
}
Image *image = const_cast<Image*>(TheMappedImageCollection->findImageByName( name ));
if(image)
DEBUG_ASSERTCRASH(!image->getRawTextureData(), ("We are trying to parse over an existing image that contains a non-null rawTextureData, you should fix that"));
if( image == NULL )
{
// image not found, create a new one
image = TheMappedImageCollection->newImage();
image->setName( name );
DEBUG_ASSERTCRASH( image, ("parseMappedImage: unable to allocate image for '%s'\n",
name.str()) );
} // end if
// parse the ini definition
ini->initFromINI( image, image->getFieldParse());
} // end parseMappedImage

View file

@ -0,0 +1,76 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/MiscAudio.h"
#include "Common/INI.h"
const FieldParse MiscAudio::m_fieldParseTable[] =
{
{ "RadarNotifyUnitUnderAttackSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarUnitUnderAttackSound ) },
{ "RadarNotifyHarvesterUnderAttackSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarHarvesterUnderAttackSound ) },
{ "RadarNotifyStructureUnderAttackSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarStructureUnderAttackSound ) },
{ "RadarNotifyUnderAttackSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarUnderAttackSound ) },
{ "RadarNotifyInfiltrationSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarInfiltrationSound ) },
{ "RadarNotifyOnlineSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarOnlineSound ) },
{ "RadarNotifyOfflineSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_radarOfflineSound ) },
{ "DefectorTimerTickSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_defectorTimerTickSound ) },
{ "DefectorTimerDingSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_defectorTimerDingSound ) },
{ "LockonTickSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_lockonTickSound ) },
{ "AllCheerSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_allCheerSound ) },
{ "BattleCrySound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_battleCrySound ) },
{ "GUIClickSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_guiClickSound ) },
{ "NoCanDoSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_noCanDoSound ) },
{ "StealthDiscoveredSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_stealthDiscoveredSound ) },
{ "StealthNeutralizedSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_stealthNeutralizedSound ) },
{ "MoneyDepositSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_moneyDepositSound ) },
{ "MoneyWithdrawSound", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_moneyWithdrawSound ) },
{ "BuildingDisabled", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_buildingDisabled ) },
{ "BuildingReenabled", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_buildingReenabled ) },
{ "VehicleDisabled", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_vehicleDisabled ) },
{ "VehicleReenabled", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_vehicleReenabled ) },
{ "SplatterVehiclePilotsBrain", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_splatterVehiclePilotsBrain ) },
{ "TerroristInCarMoveVoice", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_terroristInCarMoveVoice ) },
{ "TerroristInCarAttackVoice", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_terroristInCarAttackVoice ) },
{ "TerroristInCarSelectVoice", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_terroristInCarSelectVoice ) },
{ "CrateHeal", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_crateHeal ) },
{ "CrateShroud", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_crateShroud ) },
{ "CrateSalvage", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_crateSalvage ) },
{ "CrateFreeUnit", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_crateFreeUnit ) },
{ "CrateMoney", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_crateMoney ) },
{ "UnitPromoted", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_unitPromoted ) },
{ "RepairSparks", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_repairSparks ) },
{ "AircraftWheelScreech", INI::parseAudioEventRTS, NULL, offsetof( MiscAudio, m_aircraftWheelScreech ) },
{ 0, 0, 0, 0 }
};
//-------------------------------------------------------------------------------------------------
void INI::parseMiscAudio( INI *ini )
{
ini->initFromINI(TheAudio->friend_getMiscAudio(), MiscAudio::m_fieldParseTable);
}

View file

@ -0,0 +1,42 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIModel.cpp /////////////////////////////////////////////////////////////////////////////
// Author: Colin Day, November 2001
// Desc: Parsing Model INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
// PRIVATE DATA ///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -0,0 +1,80 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIMultiplayer.cpp ///////////////////////////////////////////////////////////////////////////
// Author: Matthew D. Campbell, January 2002
// Desc: Parsing MultiplayerSettings and MultiplayerColor INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "Common/MultiplayerSettings.h"
void INI::parseMultiplayerSettingsDefinition( INI* ini )
{
if( TheMultiplayerSettings )
{
//
// if the type of loading we're doing creates override data, we need to
// be loading into a new override item
//
if( ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES )
{
DEBUG_ASSERTCRASH(false, ("Creating an override of MultiplayerSettings!"));
}
} // end if
else
{
// we don't have any multiplayer settings instance at all yet, create one
TheMultiplayerSettings = NEW MultiplayerSettings;
} // end else
// parse the ini definition
ini->initFromINI( TheMultiplayerSettings, TheMultiplayerSettings->getFieldParse() );
}
void INI::parseMultiplayerColorDefinition( INI* ini )
{
const char *c;
AsciiString name;
MultiplayerColorDefinition *multiplayerColorDefinition;
// read the name
c = ini->getNextToken();
name.set( c );
// find existing item if present, but this type does not allow overrides,
//so if it exists just overwrite it.
multiplayerColorDefinition = TheMultiplayerSettings->findMultiplayerColorDefinitionByName( name );
if( multiplayerColorDefinition == NULL )
multiplayerColorDefinition = TheMultiplayerSettings->newMultiplayerColorDefinition( name );
ini->initFromINI( multiplayerColorDefinition, multiplayerColorDefinition->getFieldParse() );
multiplayerColorDefinition->setColor(multiplayerColorDefinition->getRGBValue());
multiplayerColorDefinition->setNightColor(multiplayerColorDefinition->getRGBNightValue());
}

View file

@ -0,0 +1,61 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIObject.cpp ////////////////////////////////////////////////////////////////////////////
// Author: Colin Day, November 2001
// Desc: Parsing Object INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "Common/ThingTemplate.h"
#include "Common/ThingFactory.h"
#include "GameLogic/Module/OpenContain.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------
/** Parse Object entry */
//-------------------------------------------------------------------------------------------------
void INI::parseObjectDefinition( INI* ini )
{
AsciiString name = ini->getNextToken();
ThingFactory::parseObjectDefinition(ini, name, AsciiString::TheEmptyString);
}
//-------------------------------------------------------------------------------------------------
/** Parse Object entry */
//-------------------------------------------------------------------------------------------------
void INI::parseObjectReskinDefinition( INI* ini )
{
AsciiString name = ini->getNextToken();
AsciiString reskinFrom = ini->getNextToken();
ThingFactory::parseObjectDefinition(ini, name, reskinFrom);
}

View file

@ -0,0 +1,57 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIParticleSys.cpp ///////////////////////////////////////////////////////////////////////////
// Author: Michael S. Booth, November 2001
// Desc: Parsing Particle System INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameClient/ParticleSys.h"
/**
* Parse entry
*/
void INI::parseParticleSystemDefinition( INI* ini )
{
AsciiString name;
// read the name
const char* c = ini->getNextToken();
name.set( c );
// find existing item if present
ParticleSystemTemplate *sysTemplate = const_cast<ParticleSystemTemplate*>(TheParticleSystemManager->findTemplate( name ));
if (sysTemplate == NULL)
{
// no item is present, create a new one
sysTemplate = TheParticleSystemManager->newTemplate( name );
}
// parse the ini definition
ini->initFromINI( sysTemplate, sysTemplate->getFieldParse() );
}

View file

@ -0,0 +1,44 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INISpecialPower.cpp //////////////////////////////////////////////////////////////////////
// Author: Colin Day, April 2002
// Desc: Special Power INI database
///////////////////////////////////////////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "Common/SpecialPower.h"
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
void INI::parseSpecialPowerDefinition( INI *ini )
{
SpecialPowerStore::parseSpecialPowerDefinition(ini);
}

View file

@ -0,0 +1,62 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INITerrain.cpp ///////////////////////////////////////////////////////////////////////////
// Author: Colin Day, December 2001
// Desc: Terrain type INI loading
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "Common/TerrainTypes.h"
//-------------------------------------------------------------------------------------------------
/** Parse Terrain type entry */
//-------------------------------------------------------------------------------------------------
void INI::parseTerrainDefinition( INI* ini )
{
AsciiString name;
TerrainType *terrainType;
// read the name
const char* c = ini->getNextToken();
name.set( c );
// find existing item if present
terrainType = TheTerrainTypes->findTerrain( name );
if( terrainType == NULL )
terrainType = TheTerrainTypes->newTerrain( name );
// sanity
DEBUG_ASSERTCRASH( terrainType, ("Unable to allocate terrain type '%s'\n", name.str()) );
// parse the ini definition
ini->initFromINI( terrainType, terrainType->getFieldParse() );
} // end parseTerrain

View file

@ -0,0 +1,74 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INITerrainBridge.cpp /////////////////////////////////////////////////////////////////////
// Author: Colin Day, December 2001
// Desc: Terrain bridge INI loading
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameClient/TerrainRoads.h"
//-------------------------------------------------------------------------------------------------
/** Parse Terrain Bridge entry */
//-------------------------------------------------------------------------------------------------
void INI::parseTerrainBridgeDefinition( INI* ini )
{
AsciiString name;
TerrainRoadType *bridge;
// read the name
const char* c = ini->getNextToken();
name.set( c );
// find existing item if present or allocate new one
bridge = TheTerrainRoads->findBridge( name );
// if item is found it better already be a bridge
if( bridge )
{
// sanity
DEBUG_ASSERTCRASH( bridge->isBridge(), ("Redefining road '%s' as a bridge!\n",
bridge->getName().str()) );
throw INI_INVALID_DATA;
} // end if
if( bridge == NULL )
bridge = TheTerrainRoads->newBridge( name );
DEBUG_ASSERTCRASH( bridge, ("Unable to allcoate bridge '%s'\n", name.str()) );
// parse the ini definition
ini->initFromINI( bridge, bridge->getBridgeFieldParse() );
} // end parseTerrainBridge

View file

@ -0,0 +1,74 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INITerrainRoad.cpp ///////////////////////////////////////////////////////////////////////
// Author: Colin Day, December 2001
// Desc: Terrain road INI loading
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameClient/TerrainRoads.h"
//-------------------------------------------------------------------------------------------------
/** Parse Terrain Road entry */
//-------------------------------------------------------------------------------------------------
void INI::parseTerrainRoadDefinition( INI* ini )
{
AsciiString name;
TerrainRoadType *road;
// read the name
const char* c = ini->getNextToken();
name.set( c );
// find existing item if present or allocate new one
road = TheTerrainRoads->findRoad( name );
// if item is found it better not already be a bridge
if( road )
{
// sanity
DEBUG_ASSERTCRASH( road->isBridge() == FALSE, ("Redefining bridge '%s' as a road!\n",
road->getName().str()) );
throw INI_INVALID_DATA;
} // end if
if( road == NULL )
road = TheTerrainRoads->newRoad( name );
DEBUG_ASSERTCRASH( road, ("Unable to allocate road '%s'\n", name.str()) );
// parse the ini definition
ini->initFromINI( road, road->getRoadFieldParse() );
} // end parseTerrainRoad

View file

@ -0,0 +1,45 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIUpgrade.cpp ///////////////////////////////////////////////////////////////////////////
// Author: Colin Day, March 2002
// Desc: Upgrade database
///////////////////////////////////////////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "Common/Upgrade.h"
//-------------------------------------------------------------------------------------------------
/** Parse an upgrade definition */
//-------------------------------------------------------------------------------------------------
void INI::parseUpgradeDefinition( INI *ini )
{
UpgradeCenter::parseUpgradeDefinition(ini);
}

View file

@ -0,0 +1,61 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIVideo.cpp /////////////////////////////////////////////////////////////////////////////
// Author: John McDonald, February 2002
// Desc: Parsing Video INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameClient/VideoPlayer.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
// PRIVATE DATA ///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------
/** Parse Music entry */
//-------------------------------------------------------------------------------------------------
void INI::parseVideoDefinition( INI* ini )
{
// read the name
const char* c = ini->getNextToken();
Video video;
video.m_internalName.set( c );
ini->initFromINI(&video, TheVideoPlayer->getFieldParse() );
TheVideoPlayer->addVideo(&video);
} // end parseVideoDefinition

View file

@ -0,0 +1,144 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIWater.cpp /////////////////////////////////////////////////////////////////////////////
// Author: Colin Day, December 2001
// Desc: Water settings
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#define DEFINE_TIME_OF_DAY_NAMES
#include "Common/INI.h"
#include "Common/GameType.h"
#include "GameClient/TerrainVisual.h"
#include "GameClient/Water.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------
/** Water setting, note that this does not support override situations. As the water
* system becomes more complex we may want to change this */
//-------------------------------------------------------------------------------------------------
void INI::parseWaterSettingDefinition( INI* ini )
{
AsciiString name;
WaterSetting *waterSetting = NULL;
// read the name
const char* token = ini->getNextToken();
name.set( token );
// get the water setting we want to load based on name
char **timeOfDayName = TimeOfDayNames;
Int timeOfDayIndex = 0; // TIME_OF_DAY_INVALID
while( timeOfDayName && *timeOfDayName )
{
if( stricmp( *timeOfDayName, name.str() ) == 0 )
{
waterSetting = &WaterSettings[ timeOfDayIndex ];
break;
} // end if
// next name
timeOfDayName++;
timeOfDayIndex++;
} // end while
// check for no time of day match
if( waterSetting == NULL )
throw INI_INVALID_DATA;
// parse the data
ini->initFromINI( waterSetting, waterSetting->getFieldParse() );
} // end parseWaterSetting
//-------------------------------------------------------------------------------------------------
void INI::parseWaterTransparencyDefinition( INI *ini )
{
if (TheWaterTransparency == NULL) {
TheWaterTransparency = newInstance(WaterTransparencySetting);
} else if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) {
WaterTransparencySetting* wt = (WaterTransparencySetting*) (TheWaterTransparency.getNonOverloadedPointer());
WaterTransparencySetting* wtOverride = newInstance(WaterTransparencySetting);
*wtOverride = *wt;
// Mark that it is an override.
wtOverride->markAsOverride();
wt->friend_getFinalOverride()->setNextOverride(wtOverride);
} else {
throw INI_INVALID_DATA;
}
WaterTransparencySetting* waterTrans = (WaterTransparencySetting*) (TheWaterTransparency.getNonOverloadedPointer());
waterTrans = (WaterTransparencySetting*) (waterTrans->friend_getFinalOverride());
// parse the data
ini->initFromINI( waterTrans, TheWaterTransparency->getFieldParse() );
// If we overrode any skybox textures, then call the W3D Water stuff.
if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) {
// Check to see if we overrode any skybox textures.
// If we did, then we need to replace them in the model.
// Copy/Paste monkeys PLEASE TAKE NOTE. This technique only works for the skybox because we
// know that there will never be more than one sky box. If you were to use this technique for
// technicals, for instance, it would make all technicals in the level have the same new
// texture.
const WaterTransparencySetting* wtOriginal = TheWaterTransparency.getNonOverloadedPointer();
OVERRIDE<WaterTransparencySetting> wtOverride = TheWaterTransparency;
if (wtOriginal == wtOverride)
return;
const AsciiString *oldTextures[5],*newTextures[5];
//Copy current texture names into arrays
oldTextures[0]=&wtOriginal->m_skyboxTextureN;
newTextures[0]=&wtOverride->m_skyboxTextureN;
oldTextures[1]=&wtOriginal->m_skyboxTextureE;
newTextures[1]=&wtOverride->m_skyboxTextureE;
oldTextures[2]=&wtOriginal->m_skyboxTextureS;
newTextures[2]=&wtOverride->m_skyboxTextureS;
oldTextures[3]=&wtOriginal->m_skyboxTextureW;
newTextures[3]=&wtOverride->m_skyboxTextureW;
oldTextures[4]=&wtOriginal->m_skyboxTextureT;
newTextures[4]=&wtOverride->m_skyboxTextureT;
TheTerrainVisual->replaceSkyboxTextures(oldTextures, newTextures);
}
}

View file

@ -0,0 +1,48 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIWeapon.cpp ////////////////////////////////////////////////////////////////////////////
// Author: Colin Day, November 2001
// Desc: Parsing Weapon INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "GameLogic/Weapon.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------
/** Parse Weapon entry */
//-------------------------------------------------------------------------------------------------
void INI::parseWeaponTemplateDefinition( INI* ini )
{
WeaponStore::parseWeaponTemplateDefinition(ini);
}

View file

@ -0,0 +1,128 @@
/*
** Command & Conquer Generals(tm)
** Copyright 2025 Electronic Arts Inc.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////////
// //
// (c) 2001-2003 Electronic Arts Inc. //
// //
////////////////////////////////////////////////////////////////////////////////
// FILE: INIWebpageURL.cpp /////////////////////////////////////////////////////////////////////////////
// Author: Bryan Cleveland, November 2001
// Desc: Parsing Webpage URL INI entries
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/INI.h"
#include "Common/Registry.h"
#include "GameNetwork/WOLBrowser/WebBrowser.h"
#ifdef _INTERNAL
// for occasional debugging...
//#pragma optimize("", off)
//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes")
#endif
///////////////////////////////////////////////////////////////////////////////////////////////////
// PRIVATE DATA ///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
AsciiString encodeURL(AsciiString source)
{
if (source.isEmpty())
{
return AsciiString::TheEmptyString;
}
AsciiString target;
AsciiString allowedChars = "$-_.+!*'(),\\";
const char *ptr = source.str();
while (*ptr)
{
if (isalnum(*ptr) || allowedChars.find(*ptr))
{
target.concat(*ptr);
}
else
{
AsciiString tmp;
target.concat('%');
tmp.format("%2.2x", ((int)*ptr));
target.concat(tmp);
}
++ptr;
}
return target;
}
//-------------------------------------------------------------------------------------------------
/** Parse Music entry */
//-------------------------------------------------------------------------------------------------
void INI::parseWebpageURLDefinition( INI* ini )
{
AsciiString tag;
WebBrowserURL *url;
// read the name
const char* c = ini->getNextToken();
tag.set( c );
if (TheWebBrowser != NULL)
{
url = TheWebBrowser->findURL(tag);
if (url == NULL)
{
url = TheWebBrowser->makeNewURL(tag);
}
}
// find existing item if present
// track = TheAudio->Music->getTrack( name );
// if( track == NULL )
// {
// allocate a new track
// track = TheAudio->Music->newMusicTrack( name );
// } // end if
// DEBUG_ASSERTCRASH( track, ("parseMusicTrackDefinition: Unable to allocate track '%s'\n",
// name.str()) );
// parse the ini definition
ini->initFromINI( url, url->getFieldParse() );
if (url->m_url.startsWith("file://"))
{
char cwd[_MAX_PATH] = "\\";
getcwd(cwd, _MAX_PATH);
url->m_url.format("file://%s\\Data\\%s\\%s", encodeURL(cwd).str(), GetRegistryLanguage().str(), url->m_url.str()+7);
DEBUG_LOG(("INI::parseWebpageURLDefinition() - converted URL to [%s]\n", url->m_url.str()));
}
} // end parseMusicTrackDefinition