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

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: W3DFunctionLexicon.cpp ///////////////////////////////////////////////////////////////////
// Created: Colin Day, September 2001
// Desc: Function lexicon for w3d specific function pointers
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <stdlib.h>
#include "GameClient/GameWindow.h"
#include "W3DDevice/Common/W3DFunctionLexicon.h"
#include "W3DDevice/GameClient/W3DGUICallbacks.h"
#include "W3DDevice/GameClient/W3DGameWindow.h"
#include "W3DDevice/GameClient/W3DGadget.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
// PRIVATE DATA
///////////////////////////////////////////////////////////////////////////////////////////////////
// Game Window draw methods -----------------------------------------------------------------------
static FunctionLexicon::TableEntry gameWinDrawTable [] =
{
{ NAMEKEY_INVALID, "GameWinDefaultDraw", GameWinDefaultDraw },
{ NAMEKEY_INVALID, "W3DGameWinDefaultDraw", W3DGameWinDefaultDraw },
{ NAMEKEY_INVALID, "W3DGadgetPushButtonDraw", W3DGadgetPushButtonDraw },
{ NAMEKEY_INVALID, "W3DGadgetPushButtonImageDraw", W3DGadgetPushButtonImageDraw },
{ NAMEKEY_INVALID, "W3DGadgetCheckBoxDraw", W3DGadgetCheckBoxDraw },
{ NAMEKEY_INVALID, "W3DGadgetCheckBoxImageDraw", W3DGadgetCheckBoxImageDraw },
{ NAMEKEY_INVALID, "W3DGadgetRadioButtonDraw", W3DGadgetRadioButtonDraw },
{ NAMEKEY_INVALID, "W3DGadgetRadioButtonImageDraw", W3DGadgetRadioButtonImageDraw },
{ NAMEKEY_INVALID, "W3DGadgetTabControlDraw", W3DGadgetTabControlDraw },
{ NAMEKEY_INVALID, "W3DGadgetTabControlImageDraw", W3DGadgetTabControlImageDraw },
{ NAMEKEY_INVALID, "W3DGadgetListBoxDraw", W3DGadgetListBoxDraw },
{ NAMEKEY_INVALID, "W3DGadgetListBoxImageDraw", W3DGadgetListBoxImageDraw },
{ NAMEKEY_INVALID, "W3DGadgetComboBoxDraw", W3DGadgetComboBoxDraw },
{ NAMEKEY_INVALID, "W3DGadgetComboBoxImageDraw", W3DGadgetComboBoxImageDraw },
{ NAMEKEY_INVALID, "W3DGadgetHorizontalSliderDraw", W3DGadgetHorizontalSliderDraw },
{ NAMEKEY_INVALID, "W3DGadgetHorizontalSliderImageDraw", W3DGadgetHorizontalSliderImageDraw },
{ NAMEKEY_INVALID, "W3DGadgetVerticalSliderDraw", W3DGadgetVerticalSliderDraw },
{ NAMEKEY_INVALID, "W3DGadgetVerticalSliderImageDraw", W3DGadgetVerticalSliderImageDraw },
{ NAMEKEY_INVALID, "W3DGadgetProgressBarDraw", W3DGadgetProgressBarDraw },
{ NAMEKEY_INVALID, "W3DGadgetProgressBarImageDraw", W3DGadgetProgressBarImageDraw },
{ NAMEKEY_INVALID, "W3DGadgetStaticTextDraw", W3DGadgetStaticTextDraw },
{ NAMEKEY_INVALID, "W3DGadgetStaticTextImageDraw", W3DGadgetStaticTextImageDraw },
{ NAMEKEY_INVALID, "W3DGadgetTextEntryDraw", W3DGadgetTextEntryDraw },
{ NAMEKEY_INVALID, "W3DGadgetTextEntryImageDraw", W3DGadgetTextEntryImageDraw },
{ NAMEKEY_INVALID, "W3DLeftHUDDraw", W3DLeftHUDDraw },
{ NAMEKEY_INVALID, "W3DCameoMovieDraw", W3DCameoMovieDraw },
{ NAMEKEY_INVALID, "W3DRightHUDDraw", W3DRightHUDDraw },
{ NAMEKEY_INVALID, "W3DPowerDraw", W3DPowerDraw },
{ NAMEKEY_INVALID, "W3DMainMenuDraw", W3DMainMenuDraw },
{ NAMEKEY_INVALID, "W3DMainMenuFourDraw", W3DMainMenuFourDraw },
{ NAMEKEY_INVALID, "W3DMetalBarMenuDraw", W3DMetalBarMenuDraw },
{ NAMEKEY_INVALID, "W3DCreditsMenuDraw", W3DCreditsMenuDraw },
{ NAMEKEY_INVALID, "W3DClockDraw", W3DClockDraw },
{ NAMEKEY_INVALID, "W3DMainMenuMapBorder", W3DMainMenuMapBorder },
{ NAMEKEY_INVALID, "W3DMainMenuButtonDropShadowDraw", W3DMainMenuButtonDropShadowDraw },
{ NAMEKEY_INVALID, "W3DMainMenuRandomTextDraw", W3DMainMenuRandomTextDraw },
{ NAMEKEY_INVALID, "W3DThinBorderDraw", W3DThinBorderDraw },
{ NAMEKEY_INVALID, "W3DShellMenuSchemeDraw", W3DShellMenuSchemeDraw },
{ NAMEKEY_INVALID, "W3DCommandBarBackgroundDraw", W3DCommandBarBackgroundDraw },
{ NAMEKEY_INVALID, "W3DCommandBarTopDraw", W3DCommandBarTopDraw },
{ NAMEKEY_INVALID, "W3DCommandBarGenExpDraw", W3DCommandBarGenExpDraw },
{ NAMEKEY_INVALID, "W3DCommandBarHelpPopupDraw", W3DCommandBarHelpPopupDraw },
{ NAMEKEY_INVALID, "W3DCommandBarGridDraw", W3DCommandBarGridDraw },
{ NAMEKEY_INVALID, "W3DCommandBarForegroundDraw", W3DCommandBarForegroundDraw },
{ NAMEKEY_INVALID, "W3DNoDraw", W3DNoDraw },
{ NAMEKEY_INVALID, "W3DDrawMapPreview", W3DDrawMapPreview },
{ NAMEKEY_INVALID, NULL, NULL },
};
// Game Window init methods -----------------------------------------------------------------------
static FunctionLexicon::TableEntry layoutInitTable [] =
{
{ NAMEKEY_INVALID, "W3DMainMenuInit", W3DMainMenuInit },
{ NAMEKEY_INVALID, NULL, NULL },
};
///////////////////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS
///////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
W3DFunctionLexicon::W3DFunctionLexicon( void )
{
} // end W3DFunctionLexicon
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
W3DFunctionLexicon::~W3DFunctionLexicon( void )
{
} // end ~W3DFunctionLexicon
//-------------------------------------------------------------------------------------------------
/** Initialize the function table specific for our implementations of
* the w3d device */
//-------------------------------------------------------------------------------------------------
void W3DFunctionLexicon::init( void )
{
// extend functionality
FunctionLexicon::init();
// load our own tables
loadTable( gameWinDrawTable, TABLE_GAME_WIN_DEVICEDRAW );
loadTable( layoutInitTable, TABLE_WIN_LAYOUT_DEVICEINIT );
} // end init
//-------------------------------------------------------------------------------------------------
/** Reset */
//-------------------------------------------------------------------------------------------------
void W3DFunctionLexicon::reset( void )
{
// Pay attention to the order of what happens in the base class as you reset
// extend
FunctionLexicon::reset();
} // end reset
//-------------------------------------------------------------------------------------------------
/** Update */
//-------------------------------------------------------------------------------------------------
void W3DFunctionLexicon::update( void )
{
// extend?
FunctionLexicon::update();
} // end update

File diff suppressed because it is too large Load diff

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: W3DModuleFactory.cpp /////////////////////////////////////////////////////////////////////
// Author: Colin Day, April 2001
// Desc: W3D specific module
///////////////////////////////////////////////////////////////////////////////////////////////////
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "W3DDevice/Common/W3DModuleFactory.h"
#include "W3DDevice/GameClient/Module/W3DDebrisDraw.h"
#include "W3DDevice/GameClient/Module/W3DDefaultDraw.h"
#include "W3DDevice/GameClient/Module/W3DDependencyModelDraw.h"
#include "W3DDevice/GameClient/Module/W3DModelDraw.h"
#include "W3DDevice/GameClient/Module/W3DLaserDraw.h"
#include "W3DDevice/GameClient/Module/W3DOverlordTankDraw.h"
#include "W3DDevice/GameClient/Module/W3DPoliceCarDraw.h"
#include "W3DDevice/GameClient/Module/W3DProjectileStreamDraw.h"
#include "W3DDevice/GameClient/Module/W3DRopeDraw.h"
#include "W3DDevice/GameClient/Module/W3DSupplyDraw.h"
#include "W3DDevice/GameClient/Module/W3DScienceModelDraw.h"
#include "W3DDevice/GameClient/Module/W3DTankDraw.h"
#include "W3DDevice/GameClient/Module/W3DTruckDraw.h"
#include "W3DDevice/GameClient/Module/W3DTankTruckDraw.h"
#include "W3DDevice/GameClient/Module/W3DTracerDraw.h"
//-------------------------------------------------------------------------------------------------
/** Initialize method */
//-------------------------------------------------------------------------------------------------
void W3DModuleFactory::init( void )
{
// extending functionality
ModuleFactory::init();
// add the specific module templates we need for the draw methods
addModule( W3DDefaultDraw );
addModule( W3DDebrisDraw );
addModule( W3DModelDraw );
addModule( W3DLaserDraw );
addModule( W3DOverlordTankDraw );
addModule( W3DProjectileStreamDraw );
addModule( W3DPoliceCarDraw );
addModule( W3DRopeDraw );
addModule( W3DScienceModelDraw );
addModule( W3DSupplyDraw );
addModule( W3DDependencyModelDraw );
addModule( W3DTankDraw );
addModule( W3DTruckDraw );
addModule( W3DTracerDraw );
addModule( W3DTankTruckDraw );
} // end init

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: W3DThingFactory.cpp //////////////////////////////////////////////////////////////////////
// Author: Colin Day, February 2002
// Desc: Device dependent thing factory access, for things like post processing the
// Thing database where we might want to look at device dependent stuff like
// model info and such
///////////////////////////////////////////////////////////////////////////////////////////////////
// USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
#include "W3DDevice/Common/W3DThingFactory.h"
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
W3DThingFactory::W3DThingFactory( void )
{
} // end W3DThingFactory
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
W3DThingFactory::~W3DThingFactory( void )
{
} // end ~W3DThingFactory

View file

@ -0,0 +1,110 @@
/*
** 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. //
// //
////////////////////////////////////////////////////////////////////////////////
//=============================================================================
//
// Westwood Studios Pacific.
//
// Confidential Information
// Copyright (C) 2001 - All Rights Reserved
//
//=============================================================================
//
// Project: RTS3
//
// File name: W3DConvert.cpp
//
// Created: Colin Day, April 2001
//
//=============================================================================
//=============================================================================
// Includes
//=============================================================================
#include "W3DDevice/Common/W3DConvert.h"
//=============================================================================
// Externals
//=============================================================================
//=============================================================================
// Defines
//=============================================================================
//=============================================================================
// Private Types
//=============================================================================
//=============================================================================
// Private Data
//=============================================================================
//=============================================================================
// Public Data
//=============================================================================
//=============================================================================
// Private Prototypes
//=============================================================================
//=============================================================================
// Private Functions
//=============================================================================
//=============================================================================
// Public Functions
//=============================================================================
//=============================================================================
// W3DLogicalScreenToPixelScreen
//=============================================================================
/** Translate a W3D logical pixel coord with (-1,-1) at the lower left and
* (1,1) at the upper right to a pixel screen coord with (0,0) at the
* upper left */
//=============================================================================
void W3DLogicalScreenToPixelScreen( Real logX, Real logY,
Int *screenX, Int *screenY,
Int screenWidth, Int screenHeight )
{
*screenX = REAL_TO_INT((screenWidth * (logX + 1.0f)) / 2.0f);
*screenY = REAL_TO_INT((screenHeight * (-logY + 1.0f)) / 2.0f);
} // end W3DLogicalScreenToPixelScreen
//=============================================================================
// PixelScreenToW3DLogicalScreen
//=============================================================================
/** Translate a pixel coord with (0,0) at the upper left to the W3D logical
* coord system used with (-1,-1) in the lower left corner and (1,1) the
* upper right corner */
//=============================================================================
void PixelScreenToW3DLogicalScreen( Int screenX, Int screenY,
Real *logX, Real *logY,
Int screenWidth, Int screenHeight )
{
*logX = ((2.0f * screenX) / (Real)screenWidth) - 1.0f;
*logY = -(((2.0f * screenY) / (Real)screenHeight) - 1.0f);
} // end PixelScreenToW3DLogicalScreen