Initial commit of Command & Conquer Generals and Command & Conquer Generals Zero Hour source code.
This commit is contained in:
parent
2e338c00cb
commit
3d0ee53a05
6072 changed files with 2283311 additions and 0 deletions
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
** 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. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/////// Win32BIGFile.h ////////////////////////////////////
|
||||
// Bryan Cleveland, August 2002
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WIN32BIGFILE_H
|
||||
#define __WIN32BIGFILE_H
|
||||
|
||||
#include "Common/ArchiveFile.h"
|
||||
#include "Common/AsciiString.h"
|
||||
#include "Common/List.h"
|
||||
|
||||
class Win32BIGFile : public ArchiveFile
|
||||
{
|
||||
public:
|
||||
Win32BIGFile();
|
||||
virtual ~Win32BIGFile();
|
||||
|
||||
virtual Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo) const; ///< fill in the fileInfo struct with info about the requested file.
|
||||
virtual File* openFile( const Char *filename, Int access = 0 );///< Open the specified file within the BIG file
|
||||
virtual void closeAllFiles( void ); ///< Close all file opened in this BIG file
|
||||
virtual AsciiString getName( void ); ///< Returns the name of the BIG file
|
||||
virtual AsciiString getPath( void ); ///< Returns full path and name of BIG file
|
||||
virtual void setSearchPriority( Int new_priority ); ///< Set this BIG file's search priority
|
||||
virtual void close( void ); ///< Close this BIG file
|
||||
|
||||
protected:
|
||||
|
||||
AsciiString m_name; ///< BIG file name
|
||||
AsciiString m_path; ///< BIG file path
|
||||
};
|
||||
|
||||
#endif // __WIN32BIGFILE_H
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
** 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. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////// Win32BIGFileSystem.h ///////////////////////////
|
||||
// Bryan Cleveland, August 2002
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WIN32BIGFILESYSTEM_H
|
||||
#define __WIN32BIGFILESYSTEM_H
|
||||
|
||||
#include "Common/ArchiveFileSystem.h"
|
||||
|
||||
class Win32BIGFileSystem : public ArchiveFileSystem
|
||||
{
|
||||
public:
|
||||
Win32BIGFileSystem();
|
||||
virtual ~Win32BIGFileSystem();
|
||||
|
||||
virtual void init( void );
|
||||
virtual void update( void );
|
||||
virtual void reset( void );
|
||||
virtual void postProcessLoad( void );
|
||||
|
||||
// ArchiveFile operations
|
||||
virtual void closeAllArchiveFiles( void ); ///< Close all Archivefiles currently open
|
||||
|
||||
// File operations
|
||||
virtual ArchiveFile * openArchiveFile(const Char *filename);
|
||||
virtual void closeArchiveFile(const Char *filename);
|
||||
virtual void closeAllFiles( void ); ///< Close all files associated with ArchiveFiles
|
||||
|
||||
virtual Bool loadBigFilesFromDirectory(AsciiString dir, AsciiString fileMask, Bool overwrite = FALSE);
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
#endif // __WIN32BIGFILESYSTEM_H
|
|
@ -0,0 +1,109 @@
|
|||
/*
|
||||
** 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: Generals
|
||||
//
|
||||
// Module: Game Engine DEvice Win32 Common
|
||||
//
|
||||
// File name: Win32Device/Common/Win32CDManager.h
|
||||
//
|
||||
// Created: 11/26/01 TR
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _WIN32DEVICE_COMMON_WIN32CDMANAGER_H_
|
||||
#define _WIN32DEVICE_COMMON_WIN32CDMANAGER_H_
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Includes
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "Common/CDManager.h"
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Forward References
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Type Defines
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//===============================
|
||||
// Win32CDDrive
|
||||
//===============================
|
||||
|
||||
class Win32CDDrive : public CDDrive
|
||||
{
|
||||
public:
|
||||
|
||||
Win32CDDrive();
|
||||
virtual ~Win32CDDrive();
|
||||
|
||||
virtual void refreshInfo( void ); ///< Update drive with least
|
||||
|
||||
};
|
||||
|
||||
//===============================
|
||||
// Win32CDManager
|
||||
//===============================
|
||||
|
||||
class Win32CDManager : public CDManager
|
||||
{
|
||||
public:
|
||||
|
||||
Win32CDManager();
|
||||
virtual ~Win32CDManager();
|
||||
|
||||
// sub system operations
|
||||
virtual void init( void );
|
||||
virtual void update( void );
|
||||
virtual void reset( void );
|
||||
virtual void refreshDrives( void ); ///< Refresh drive info
|
||||
|
||||
protected:
|
||||
|
||||
virtual CDDriveInterface* createDrive( void );
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Inlining
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
#endif // _WIN32DEVICE_COMMON_WIN32CDMANAGER_H_
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
** 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: Win32GameEngine.h ////////////////////////////////////////////////////////////////////////
|
||||
// Author: Colin Day, April 2001
|
||||
// Description:
|
||||
// Device implementation of the game engine ... this is, of course, the
|
||||
// highest level of the game that creates the necessary interfaces to the
|
||||
// devices we need
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WIN32GAMEENGINE_H_
|
||||
#define __WIN32GAMEENGINE_H_
|
||||
|
||||
#include "Common/GameEngine.h"
|
||||
#include "GameLogic/GameLogic.h"
|
||||
#include "GameNetwork/NetworkInterface.h"
|
||||
#include "MilesAudioDevice/MilesAudioManager.h"
|
||||
#include "Win32Device/Common/Win32BIGFileSystem.h"
|
||||
#include "Win32Device/Common/Win32LocalFileSystem.h"
|
||||
#include "W3DDevice/Common/W3DModuleFactory.h"
|
||||
#include "W3DDevice/GameLogic/W3DGameLogic.h"
|
||||
#include "W3DDevice/GameClient/W3DGameClient.h"
|
||||
#include "W3DDevice/GameClient/W3DWebBrowser.h"
|
||||
#include "W3DDevice/Common/W3DFunctionLexicon.h"
|
||||
#include "W3DDevice/Common/W3DRadar.h"
|
||||
#include "W3DDevice/Common/W3DFunctionLexicon.h"
|
||||
#include "W3DDevice/Common/W3DThingFactory.h"
|
||||
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
/** Class declaration for the Win32 game engine */
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
class Win32GameEngine : public GameEngine
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
Win32GameEngine();
|
||||
virtual ~Win32GameEngine();
|
||||
|
||||
virtual void init( void ); ///< initialization
|
||||
virtual void reset( void ); ///< reset engine
|
||||
virtual void update( void ); ///< update the game engine
|
||||
virtual void serviceWindowsOS( void ); ///< allow windows maintenance in background
|
||||
|
||||
protected:
|
||||
|
||||
virtual GameLogic *createGameLogic( void ); ///< factory for game logic
|
||||
virtual GameClient *createGameClient( void ); ///< factory for game client
|
||||
virtual ModuleFactory *createModuleFactory( void ); ///< factory for creating modules
|
||||
virtual ThingFactory *createThingFactory( void ); ///< factory for the thing factory
|
||||
virtual FunctionLexicon *createFunctionLexicon( void ); ///< factory for function lexicon
|
||||
virtual LocalFileSystem *createLocalFileSystem( void ); ///< factory for local file system
|
||||
virtual ArchiveFileSystem *createArchiveFileSystem( void ); ///< factory for archive file system
|
||||
virtual NetworkInterface *createNetwork( void ); ///< Factory for the network
|
||||
virtual Radar *createRadar( void ); ///< Factory for radar
|
||||
virtual WebBrowser *createWebBrowser( void ); ///< Factory for embedded browser
|
||||
virtual AudioManager *createAudioManager( void ); ///< Factory for audio device
|
||||
virtual ParticleSystemManager* createParticleSystemManager( void );
|
||||
|
||||
|
||||
protected:
|
||||
UINT m_previousErrorMode;
|
||||
}; // end Win32GameEngine
|
||||
|
||||
// INLINE -----------------------------------------------------------------------------------------
|
||||
inline GameLogic *Win32GameEngine::createGameLogic( void ) { return NEW W3DGameLogic; }
|
||||
inline GameClient *Win32GameEngine::createGameClient( void ) { return NEW W3DGameClient; }
|
||||
inline ModuleFactory *Win32GameEngine::createModuleFactory( void ) { return NEW W3DModuleFactory; }
|
||||
inline ThingFactory *Win32GameEngine::createThingFactory( void ) { return NEW W3DThingFactory; }
|
||||
inline FunctionLexicon *Win32GameEngine::createFunctionLexicon( void ) { return NEW W3DFunctionLexicon; }
|
||||
inline LocalFileSystem *Win32GameEngine::createLocalFileSystem( void ) { return NEW Win32LocalFileSystem; }
|
||||
inline ArchiveFileSystem *Win32GameEngine::createArchiveFileSystem( void ) { return NEW Win32BIGFileSystem; }
|
||||
inline ParticleSystemManager* Win32GameEngine::createParticleSystemManager( void ) { return NEW W3DParticleSystemManager; }
|
||||
|
||||
inline NetworkInterface *Win32GameEngine::createNetwork( void ) { return NetworkInterface::createNetwork(); }
|
||||
inline Radar *Win32GameEngine::createRadar( void ) { return NEW W3DRadar; }
|
||||
inline WebBrowser *Win32GameEngine::createWebBrowser( void ) { return NEW CComObject<W3DWebBrowser>; }
|
||||
inline AudioManager *Win32GameEngine::createAudioManager( void ) { return NEW MilesAudioManager; }
|
||||
|
||||
#endif // end __WIN32GAMEENGINE_H_
|
|
@ -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. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///// Win32LocalFile.h ///////////////////////////
|
||||
// Bryan Cleveland, August 2002
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WIN32LOCALFILE_H
|
||||
#define __WIN32LOCALFILE_H
|
||||
|
||||
#include "Common/LocalFile.h"
|
||||
|
||||
class Win32LocalFile : public LocalFile
|
||||
{
|
||||
MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(Win32LocalFile, "Win32LocalFile")
|
||||
public:
|
||||
Win32LocalFile();
|
||||
//virtual ~Win32LocalFile();
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // __WIN32LOCALFILE_H
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
** 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. //
|
||||
// //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///// Win32LocalFileSystem.h //////////////////////////////////
|
||||
// Bryan Cleveland, August 2002
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WIN32LOCALFILESYSTEM_H
|
||||
#define __WIN32LOCALFILESYSTEM_H
|
||||
#include "Common/LocalFileSystem.h"
|
||||
|
||||
class Win32LocalFileSystem : public LocalFileSystem
|
||||
{
|
||||
public:
|
||||
Win32LocalFileSystem();
|
||||
virtual ~Win32LocalFileSystem();
|
||||
|
||||
virtual void init();
|
||||
virtual void reset();
|
||||
virtual void update();
|
||||
|
||||
virtual File * openFile(const Char *filename, Int access = 0); ///< open the given file.
|
||||
virtual Bool doesFileExist(const Char *filename) const; ///< does the given file exist?
|
||||
|
||||
virtual void getFileListInDirectory(const AsciiString& currentDirectory, const AsciiString& originalDirectory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const; ///< search the given directory for files matching the searchName (egs. *.ini, *.rep). Possibly search subdirectories.
|
||||
virtual Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo) const;
|
||||
|
||||
virtual Bool createDirectory(AsciiString directory);
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // __WIN32LOCALFILESYSTEM_H
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
** 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: Win32DIKeyboard.h ////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: RTS3
|
||||
//
|
||||
// File name: Win32DIKeyboard.h
|
||||
//
|
||||
// Created: Colin Day, June 2001
|
||||
//
|
||||
// Desc: Device implementation of the keyboard interface on Win32
|
||||
// using Microsoft Direct Input
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WIN32DIKEYBOARD_H_
|
||||
#define __WIN32DIKEYBOARD_H_
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#ifndef DIRECTINPUT_VERSION
|
||||
# define DIRECTINPUT_VERSION 0x800
|
||||
#endif
|
||||
|
||||
#include <dinput.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GameClient/Keyboard.h"
|
||||
|
||||
// FORWARD REFERENCES /////////////////////////////////////////////////////////
|
||||
|
||||
// TYPE DEFINES ///////////////////////////////////////////////////////////////
|
||||
|
||||
// class DirectInputKeyboard --------------------------------------------------
|
||||
/** Class for interfacing with the keyboard using direct input as the
|
||||
* implementation */
|
||||
//-----------------------------------------------------------------------------
|
||||
class DirectInputKeyboard : public Keyboard
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
DirectInputKeyboard( void );
|
||||
virtual ~DirectInputKeyboard( void );
|
||||
|
||||
// extend methods from the base class
|
||||
virtual void init( void ); ///< initialize the keyboard, extending init functionality
|
||||
virtual void reset( void ); ///< Reset the keybaord system
|
||||
virtual void update( void ); ///< update call, extending update functionality
|
||||
virtual Bool getCapsState( void ); ///< get state of caps lock key, return TRUE if down
|
||||
|
||||
protected:
|
||||
|
||||
// extended methods from the base class
|
||||
virtual void getKey( KeyboardIO *key ); ///< get a single key event
|
||||
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
|
||||
// new methods to this derived class
|
||||
void openKeyboard( void ); ///< create direct input keyboard
|
||||
void closeKeyboard( void ); ///< release direct input keyboard
|
||||
|
||||
// direct input data members
|
||||
LPDIRECTINPUT8 m_pDirectInput; ///< pointer to direct input interface
|
||||
LPDIRECTINPUTDEVICE8 m_pKeyboardDevice; ///< pointer to keyboard device
|
||||
|
||||
}; // end class DirectInputKeyboard
|
||||
|
||||
// INLINING ///////////////////////////////////////////////////////////////////
|
||||
|
||||
// EXTERNALS //////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // __WIN32DIKEYBOARD_H_
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
** 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/>.
|
||||
*/
|
||||
|
||||
// FILE: Win32DIMouse.h ///////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: RTS3
|
||||
//
|
||||
// File name: Win32DIMouse.h
|
||||
//
|
||||
// Created: Colin Day, June 2001
|
||||
//
|
||||
// Desc: Win32 direct input implementation for the mouse
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WIN32DIMOUSE_H_
|
||||
#define __WIN32DIMOUSE_H_
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
#ifndef DIRECTINPUT_VERSION
|
||||
# define DIRECTINPUT_VERSION 0x800
|
||||
#endif
|
||||
|
||||
#include <dinput.h>
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GameClient/Mouse.h"
|
||||
|
||||
// FORWARD REFERENCES /////////////////////////////////////////////////////////
|
||||
|
||||
// TYPE DEFINES ///////////////////////////////////////////////////////////////
|
||||
|
||||
// class DirectInputMouse -----------------------------------------------------
|
||||
/** Direct input implementation for the mouse device */
|
||||
//-----------------------------------------------------------------------------
|
||||
class DirectInputMouse : public Mouse
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
DirectInputMouse( void );
|
||||
virtual ~DirectInputMouse( void );
|
||||
|
||||
// extended methods from base class
|
||||
virtual void init( void ); ///< initialize the direct input mouse, extending functionality
|
||||
virtual void reset( void ); ///< reset system
|
||||
virtual void update( void ); ///< update the mouse data, extending functionality
|
||||
virtual void setPosition( Int x, Int y ); ///< set position for mouse
|
||||
|
||||
virtual void setMouseLimits( void ); ///< update the limit extents the mouse can move in
|
||||
|
||||
virtual void setCursor( MouseCursor cursor ); ///< set mouse cursor
|
||||
|
||||
virtual void capture( void ); ///< capture the mouse
|
||||
virtual void releaseCapture( void ); ///< release mouse capture
|
||||
|
||||
protected:
|
||||
|
||||
/// device implementation to get mouse event
|
||||
virtual UnsignedByte getMouseEvent( MouseIO *result, Bool flush );
|
||||
|
||||
// new internal methods for our direct input implemetation
|
||||
void openMouse( void ); ///< create the direct input mouse
|
||||
void closeMouse( void ); ///< close and release mouse resources
|
||||
/// map direct input mouse data to our own format
|
||||
void mapDirectInputMouse( MouseIO *mouse, DIDEVICEOBJECTDATA *mdat );
|
||||
|
||||
// internal data members for our direct input mouse
|
||||
LPDIRECTINPUT8 m_pDirectInput; ///< pointer to direct input interface
|
||||
LPDIRECTINPUTDEVICE8 m_pMouseDevice; ///< pointer to mouse device
|
||||
|
||||
}; // end class DirectInputMouse
|
||||
|
||||
// INLINING ///////////////////////////////////////////////////////////////////
|
||||
|
||||
// EXTERNALS //////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // __WIN32DIMOUSE_H_
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
** 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: Win32Mouse.h /////////////////////////////////////////////////////////
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Westwood Studios Pacific.
|
||||
//
|
||||
// Confidential Information
|
||||
// Copyright (C) 2001 - All Rights Reserved
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Project: RTS3
|
||||
//
|
||||
// File name: Win32Mouse.h
|
||||
//
|
||||
// Created: Colin Day, July 2001
|
||||
//
|
||||
// Desc: Interface for the mouse using only the Win32 messages
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __WIN32MOUSE_H_
|
||||
#define __WIN32MOUSE_H_
|
||||
|
||||
// SYSTEM INCLUDES ////////////////////////////////////////////////////////////
|
||||
|
||||
// USER INCLUDES //////////////////////////////////////////////////////////////
|
||||
#include "GameClient/Mouse.h"
|
||||
|
||||
// FORWARD REFERENCES /////////////////////////////////////////////////////////
|
||||
|
||||
// TYPE DEFINES ///////////////////////////////////////////////////////////////
|
||||
enum { NO_TIME_FROM_WINDOWS = 0 };
|
||||
// Win32Mouse -----------------------------------------------------------------
|
||||
/** Mouse interface for when using only the Win32 messages */
|
||||
//-----------------------------------------------------------------------------
|
||||
class Win32Mouse : public Mouse
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
Win32Mouse( void );
|
||||
virtual ~Win32Mouse( void );
|
||||
|
||||
virtual void init( void ); ///< init mouse, extend this functionality, do not replace
|
||||
virtual void reset( void ); ///< reset the system
|
||||
virtual void update( void ); ///< update
|
||||
virtual void initCursorResources(void); ///< load windows resources needed for 2d cursors.
|
||||
|
||||
virtual void setCursor( MouseCursor cursor ); ///< set mouse cursor
|
||||
virtual void capture( void ); ///< capture the mouse
|
||||
virtual void releaseCapture( void ); ///< release mouse capture
|
||||
|
||||
virtual void setVisibility(Bool visible);
|
||||
|
||||
/// add an event from a win32 window procedure
|
||||
void addWin32Event( UINT msg, WPARAM wParam, LPARAM lParam, DWORD time );
|
||||
void lostFocus (Bool state) { m_lostFocus = state;}
|
||||
|
||||
protected:
|
||||
|
||||
/// get the next event available in the buffer
|
||||
virtual UnsignedByte getMouseEvent( MouseIO *result, Bool flush );
|
||||
|
||||
/// translate a win32 mouse event to our own info
|
||||
void translateEvent( UnsignedInt eventIndex, MouseIO *result );
|
||||
|
||||
struct Win32MouseEvent
|
||||
{
|
||||
UINT msg; ///< WM_* message
|
||||
WPARAM wParam; ///< WPARAM from the WM_* message
|
||||
LPARAM lParam; ///< LPARAM from the WM_* message
|
||||
DWORD time; ///< TIME from the WM_* message
|
||||
};
|
||||
/// this is our buffer of events that we receive via a WndProc message
|
||||
Win32MouseEvent m_eventBuffer[ Mouse::NUM_MOUSE_EVENTS ];
|
||||
UnsignedInt m_nextFreeIndex; ///< insert new events at this index
|
||||
UnsignedInt m_nextGetIndex; /** events retrieved through getMouseEvent
|
||||
will come from this index, then it will be
|
||||
incremented to the next index */
|
||||
MouseCursor m_currentWin32Cursor; ///< keep track of last cursor image sent to D3D.
|
||||
Int m_directionFrame; ///< current frame of directional cursor (frome 0 points up).
|
||||
Bool m_lostFocus; ///< flag if window has lost focues and mouse should stop being updated.
|
||||
}; // end Win32Mouse
|
||||
|
||||
// INLINING ///////////////////////////////////////////////////////////////////
|
||||
|
||||
// EXTERNALS //////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // __WIN32MOUSE_H_
|
||||
|
Reference in a new issue