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,68 @@
/*
** 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.h
//
// Created: Colin Day, April 2001
//
//=============================================================================
#pragma once
#ifndef __W3DCONVERT_H_
#define __W3DCONVERT_H_
//=============================================================================
// Includes
//=============================================================================
#include "Lib/BaseType.h"
//=============================================================================
// Forward References
//=============================================================================
extern void W3DLogicalScreenToPixelScreen( Real logX, Real logY,
Int *screenX, Int *screenY,
Int screenWidth, Int screenHeight );
extern void PixelScreenToW3DLogicalScreen( Int screenX, Int screenY,
Real *logX, Real *logY,
Int screenWidth, Int screenHeight );
//=============================================================================
// Type Defines
//=============================================================================
#endif // _W3DCONVERT_H_

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: W3DFunctionLexicon.h /////////////////////////////////////////////////////////////////////
// Created: Colin Day, September 2001
// Desc: Function lexicon for w3d specific funtion pointers
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __W3DFUNCTIONLEXICON_H_
#define __W3DFUNCTIONLEXICON_H_
#include "Common/FunctionLexicon.h"
//-------------------------------------------------------------------------------------------------
/** The function lexicon that can also contain w3d device methods */
//-------------------------------------------------------------------------------------------------
class W3DFunctionLexicon : public FunctionLexicon
{
public:
W3DFunctionLexicon( void );
virtual ~W3DFunctionLexicon( void );
virtual void init( void );
virtual void reset( void );
virtual void update( void );
protected:
};
#endif // __W3DFUNCTIONLEXICON_H_

View file

@ -0,0 +1,53 @@
/*
** 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.h ///////////////////////////////////////////////////////////////////////
// Author: Steven Johnson, September 2001
// Colin Day, November 2001
// Desc: W3D game logic class, there shouldn't be a lot of new functionality
// in this class, but there are certain things that need to have close
// knowledge of each other like ther logical and visual terrain
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __W3DMODULEFACTORY_H_
#define __W3DMODULEFACTORY_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "Common/ModuleFactory.h"
//-------------------------------------------------------------------------------------------------
/** W3D specific functionality for the module factory */
//-------------------------------------------------------------------------------------------------
class W3DModuleFactory : public ModuleFactory
{
public:
virtual void init( void );
};
#endif // __W3DMODULEFACTORY_H_

View file

@ -0,0 +1,125 @@
/*
** 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: W3DRadar.h ///////////////////////////////////////////////////////////////////////////////
// Author: Colin Day, January 2002
// Desc: W3D radar implementation, this has the necessary device dependent drawing
// necessary for the radar
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __W3DRADAR_H_
#define __W3DRADAR_H_
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include "Common/Radar.h"
#include "WW3D2/WW3DFormat.h"
// FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
class TextureClass;
class TerrainLogic;
// PROTOTYPES /////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------
/** W3D radar class. This has the device specific implementation of the radar such as
* the drawing routines */
//-------------------------------------------------------------------------------------------------
class W3DRadar : public Radar
{
public:
W3DRadar( void );
~W3DRadar( void );
virtual void init( void ); ///< subsystem init
virtual void update( void ); ///< subsystem update
virtual void reset( void ); ///< subsystem reset
virtual void newMap( TerrainLogic *terrain ); ///< reset radar for new map
void draw( Int pixelX, Int pixelY, Int width, Int height ); ///< draw the radar
virtual void clearShroud();
virtual void setShroudLevel(Int x, Int y, CellShroudStatus setting);
virtual void refreshTerrain( TerrainLogic *terrain );
protected:
void drawSingleBeaconEvent( Int pixelX, Int pixelY, Int width, Int height, Int index );
void drawSingleGenericEvent( Int pixelX, Int pixelY, Int width, Int height, Int index );
void initializeTextureFormats( void ); ///< find format to use for the radar texture
void deleteResources( void ); ///< delete resources used
void drawEvents( Int pixelX, Int pixelY, Int width, Int height); ///< draw all of the radar events
void drawHeroIcon( Int pixelX, Int pixelY, Int width, Int height, const Coord3D *pos ); //< draw a hero icon
void drawViewBox( Int pixelX, Int pixelY, Int width, Int height ); ///< draw view box
void buildTerrainTexture( TerrainLogic *terrain ); ///< create the terrain texture of the radar
void drawIcons( Int pixelX, Int pixelY, Int width, Int height ); ///< draw all of the radar icons
void renderObjectList( const RadarObject *listHead, TextureClass *texture, Bool calcHero = FALSE ); ///< render an object list to the texture
void interpolateColorForHeight( RGBColor *color,
Real height,
Real hiZ,
Real midZ,
Real loZ ); ///< "shade" color according to height value
void reconstructViewBox( void ); ///< remake the view box
void radarToPixel( const ICoord2D *radar, ICoord2D *pixel,
Int radarUpperLeftX, Int radarUpperLeftY,
Int radarWidth, Int radarHeight ); ///< convert radar coord to pixel location
WW3DFormat m_terrainTextureFormat; ///< format to use for terrain texture
Image *m_terrainImage; ///< terrain image abstraction for drawing
TextureClass *m_terrainTexture; ///< terrain background texture
WW3DFormat m_overlayTextureFormat; ///< format to use for overlay texture
Image *m_overlayImage; ///< overlay image abstraction for drawing
TextureClass *m_overlayTexture; ///< overlay texture
WW3DFormat m_shroudTextureFormat; ///< format to use for shroud texture
Image *m_shroudImage; ///< shroud image abstraction for drawing
TextureClass *m_shroudTexture; ///< shroud texture
Int m_textureWidth; ///< width for all radar textures
Int m_textureHeight; ///< height for all radar textures
//
// we want to keep a flag that tells us when to reconstruct the view box, we want
// to reconstruct the box on map change, and when the camera changes height
// or orientation. We want to avoid making the view box every frame because
// the 4 points visible on the edge of the screen will "jitter" unevenly as we
// translate real world coords to integer radar spots
//
Bool m_reconstructViewBox; ///< true when we need to reconstruct the box
Real m_viewAngle; ///< camera angle used for the view box we have
Real m_viewZoom; ///< camera zoom used for the view box we have
ICoord2D m_viewBox[ 4 ]; ///< radar cell points for the 4 corners of view box
std::list<const Coord3D *> m_cachedHeroPosList; //< cache of hero positions for drawing icons in radar overlay
};
#endif // __W3DRADAR_H_

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: W3DThingFactory.h ////////////////////////////////////////////////////////////////////////
// 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
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __W3DTHINGFACTORY_H_
#define __W3DTHINGFACTORY_H_
// USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
#include "Common/ThingFactory.h"
//-------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------
class W3DThingFactory : public ThingFactory
{
public:
W3DThingFactory( void );
virtual ~W3DThingFactory( void );
}; // end W3DThingFactory
#endif // __W3DTHINGFACTORY_H_