diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt
index 2db4f80a741..30079b0410f 100644
--- a/Generals/Code/GameEngine/CMakeLists.txt
+++ b/Generals/Code/GameEngine/CMakeLists.txt
@@ -12,7 +12,6 @@ set(GAMEENGINE_SRC
Source/Common/System/AsciiString.cpp
Source/Common/System/BuildAssistant.cpp
Source/Common/System/CDManager.cpp
- Source/Common/System/Compression.cpp
Source/Common/System/CopyProtection.cpp
Source/Common/System/CriticalSection.cpp
Source/Common/System/DataChunk.cpp
@@ -33,7 +32,6 @@ set(GAMEENGINE_SRC
Source/Common/System/LocalFileSystem.cpp
#Source/Common/System/MemoryInit.cpp
Source/Common/System/ObjectStatusTypes.cpp
- Source/Common/System/QuickTrig.cpp
Source/Common/System/QuotedPrintable.cpp
Source/Common/System/Radar.cpp
Source/Common/System/RAMFile.cpp
@@ -41,7 +39,6 @@ set(GAMEENGINE_SRC
Source/Common/System/Snapshot.cpp
Source/Common/System/StackDump.cpp
Source/Common/System/StreamingArchiveFile.cpp
- Source/Common/System/String.cpp
Source/Common/System/SubsystemInterface.cpp
Source/Common/System/Trig.cpp
Source/Common/System/UnicodeString.cpp
@@ -365,7 +362,6 @@ set(GAMEENGINE_SRC
Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp
Source/GameLogic/Object/Update/LaserUpdate.cpp
Source/GameClient/Drawable/Update/SwayClientUpdate.cpp
- Source/GameClient/Drawable/DrawableManager.cpp
"Source/GameClient/System/Debug Displayers/AudioDebugDisplay.cpp"
Source/GameClient/System/Anim2D.cpp
Source/GameClient/System/CampaignManager.cpp
@@ -630,7 +626,6 @@ set(GAMEENGINE_SRC
Include/Common/PlayerTemplate.h
Include/Common/ProductionPrerequisite.h
Include/Common/QuickmatchPreferences.h
- Include/Common/QuickTrig.h
Include/Common/QuotedPrintable.h
Include/Common/Radar.h
Include/Common/RAMFile.h
@@ -652,7 +647,6 @@ set(GAMEENGINE_SRC
Include/Common/StatsCollector.h
Include/Common/STLTypedefs.h
Include/Common/StreamingArchiveFile.h
- Include/Common/string.h
Include/Common/SubsystemInterface.h
Include/Common/SystemInfo.h
Include/Common/Team.h
@@ -932,7 +926,6 @@ set(GAMEENGINE_SRC
Include/GameClient/DisplayStringManager.h
Include/GameClient/Drawable.h
Include/GameClient/DrawableInfo.h
- Include/GameClient/DrawableManager.h
Include/GameClient/DrawGroupInfo.h
Include/GameClient/EstablishConnectionsMenu.h
Include/GameClient/Eva.h
diff --git a/Generals/Code/GameEngine/Include/Common/QuickTrig.h b/Generals/Code/GameEngine/Include/Common/QuickTrig.h
deleted file mode 100644
index ef643faff4d..00000000000
--- a/Generals/Code/GameEngine/Include/Common/QuickTrig.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-** 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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-// FILE: QuickTrig.h ////////////////////////////////////////////////////////////////////////////////
-// Author: Mark Lorenzen (adapted by srj)
-// Desc: fast trig
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-
-#pragma once
-
-#ifndef __QUICKTRIG_H_
-#define __QUICKTRIG_H_
-
-// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------------
-
-extern Real TheQuickSinTable[];
-extern Real TheQuickTanTable[];
-
-// yes, Real. No, really.
-extern Real TheQuickSinTableCount;
-extern Real TheQuickTanTableCount;
-
-//-----------------------------------------------------------------------------
-
-#define QUARTER_CIRCLE (PI/2)
-
-//-----------------------------------------------------------------------------
-// quick magnitude estimation, without the square root
-// NOTE, this is a very rough estimate, and may be off by 10% or more, so
-// use it only when you don't need accuracy
-//-----------------------------------------------------------------------------
-inline Real QMag(Real x, Real y, Real z)
-{
- Real sTempV;
-
- Real sMaxV = fabs(x);
- Real sMedV = fabs(y);
- Real sMinV = fabs(z);
-
- if (sMaxV < sMedV)
- {
- sTempV = sMaxV;
- sMaxV = sMedV;
- sMedV = sTempV;
- }
-
- if (sMaxV < sMinV)
- {
- sTempV = sMaxV;
- sMaxV = sMinV;
- sMinV = sTempV;
- }
-
- sMedV += sMinV;
- sMaxV += (sMedV*0.25f);
-
- return sMaxV;
-}
-
-//-----------------------------------------------------------------------------
-// table based trig functions
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-inline Real QSin(Real a)
-{
- register Real angle = a;
- register long sgn = 1;
-
- if (angle < 0) // DO POSITIVE MATH AND PRESERVE SIGN
- {
- sgn = -1;
- angle = -angle;
- }
-
- while ( angle > (PI)) // MODULATE ANGLE INTO RANGE OF PI
- {
- angle -= PI;
- sgn = -sgn;
- }
-
- if (angle > PI/2)
- {
- angle = PI - angle; // FLIP
- }
-
- register int index = REAL_TO_INT((angle/QUARTER_CIRCLE) * TheQuickTanTableCount);
- register Real x = TheQuickSinTable[index];
-
- return x * sgn;
-
- /*
- Real remainder = node - index;
- Real next = TheQuickSinTable[index + 1];
- Real range = next - x;
- Real scalar = remainder / SIN_TABLE_BRACKET;
- Real finetune = scalar * range;
- x += finetune;
- */
-
-}
-
-//-----------------------------------------------------------------------------
-inline Real QCos(Real angle)
-{
- return QSin((QUARTER_CIRCLE) - angle);
-}
-
-//-----------------------------------------------------------------------------
-inline Real QTan(Real angle)
-{
- return TheQuickTanTable[REAL_TO_INT(angle * TheQuickSinTableCount)];
-}
-
-//-----------------------------------------------------------------------------
-inline Real QCsc(Real angle)
-{
- return 1.0f / QSin(angle);
-}
-
-//-----------------------------------------------------------------------------
-inline Real QSec(Real angle)
-{
- return 1.0f / QCos(angle);
-}
-
-//-----------------------------------------------------------------------------
-inline Real QCot(Real angle)
-{
- return 1.0f / QTan(angle);
-}
-
-#endif
-
diff --git a/Generals/Code/GameEngine/Include/Common/string.h b/Generals/Code/GameEngine/Include/Common/string.h
deleted file mode 100644
index 544ff295400..00000000000
--- a/Generals/Code/GameEngine/Include/Common/string.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-** 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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-//----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: String
-//
-// File name: wsys/string.h
-//
-// Created: 11/02/01
-//
-//----------------------------------------------------------------------------
-
-#pragma once
-
-#ifndef __WSYS_STRING_H
-#define __WSYS_STRING_H
-
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include "Lib/BaseType.h"
-
-//----------------------------------------------------------------------------
-// Forward References
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Type Defines
-//----------------------------------------------------------------------------
-
-
-class WSYS_String
-{
- protected:
-
- Char *m_data; ///< actual string data
-
- public:
-
- explicit WSYS_String(const Char *string = NULL);
- ~WSYS_String();
-
- // operators
- Bool operator== (const char *rvalue) const;
- Bool operator!= (const char *rvalue) const;
- const WSYS_String& operator= (const WSYS_String &string);
- const WSYS_String& operator= (const Char *string);
- const WSYS_String& operator+= (const WSYS_String &string);
- const WSYS_String& operator+= (const Char *string);
- friend WSYS_String operator+ (const WSYS_String &string1, const WSYS_String &string2);
- friend WSYS_String operator+ (const Char *string1, const WSYS_String &string2);
- friend WSYS_String operator+ (const WSYS_String &string1, const Char *string2);
- const Char & operator[] (Int index) const;
- Char & operator[] (Int index);
- operator const Char * (void) const;
- operator Char * (void) const ;
-
- // methods
- void makeUpperCase( void );
- void makeLowerCase( void );
- Int length(void) const;
- Bool isEmpty(void) const;
- Int _cdecl format(const Char *format, ...);
- void set( const Char *string );
- Char* get( void ) const;
-};
-
-
-
-//----------------------------------------------------------------------------
-// Inlining
-//----------------------------------------------------------------------------
-
-inline Char* WSYS_String::get( void ) const { return m_data;};
-inline const Char& WSYS_String::operator[] (Int index) const{ return m_data[index];};
-inline Char& WSYS_String::operator[] (Int index) { return m_data[index];};
-inline WSYS_String::operator const Char * (void) const { return m_data;};
-inline WSYS_String::operator Char * (void) const {return m_data;};
-
-
-#endif // __WSYS_STRING_H
diff --git a/Generals/Code/GameEngine/Include/GameClient/DrawableManager.h b/Generals/Code/GameEngine/Include/GameClient/DrawableManager.h
deleted file mode 100644
index 97b56c58e3e..00000000000
--- a/Generals/Code/GameEngine/Include/GameClient/DrawableManager.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-** 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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
diff --git a/Generals/Code/GameEngine/Source/Common/System/Compression.cpp b/Generals/Code/GameEngine/Source/Common/System/Compression.cpp
deleted file mode 100644
index 6d563364c65..00000000000
--- a/Generals/Code/GameEngine/Source/Common/System/Compression.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
-** 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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-// FILE: Compression.cpp /////////////////////////////////////////////////////
-// Author: Matthew D. Campbell
-//////////////////////////////////////////////////////////////////////////////
-
-#include "PreRTS.h"
-#include "Compression.h"
-
-#ifdef _INTERNAL
-// for occasional debugging...
-//#pragma optimize("", off)
-//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes")
-#endif
-
-
-///////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////
-///// Performance Testing ///////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////
-
-//#define TEST_COMPRESSION
-#ifdef TEST_COMPRESSION
-
-#include "GameClient/MapUtil.h"
-#include "Common/FileSystem.h"
-#include "Common/file.h"
-
-#include "Common/PerfTimer.h"
-enum { NUM_TIMES = 1 };
-
-struct CompData
-{
-public:
- Int origSize;
- Int compressedSize[COMPRESSION_MAX+1];
-};
-
-#define TEST_COMPRESSION_MIN COMPRESSION_BTREE
-#define TEST_COMPRESSION_MAX COMPRESSION_MAX
-
-void DoCompressTest( void )
-{
-
- Int i;
-
- /*
- PerfGather *s_compressGathers[TEST_COMPRESSION_MAX+1];
- PerfGather *s_decompressGathers[TEST_COMPRESSION_MAX+1];
- for (i = TEST_COMPRESSION_MIN; i < TEST_COMPRESSION_MAX+1; ++i)
- {
- s_compressGathers[i] = new PerfGather(CompressionManager::getCompressionNameByType((CompressionType)i));
- s_decompressGathers[i] = new PerfGather(CompressionManager::getDecompressionNameByType((CompressionType)i));
- }
- */
-
- std::map s_sizes;
-
- std::map::const_iterator it = TheMapCache->find("userdata\\maps\\_usa01\\_usa01.map");
- if (it != TheMapCache->end())
- {
- //if (it->second.m_isOfficial)
- //{
- //++it;
- //continue;
- //}
- //static Int count = 0;
- //if (count++ > 2)
- //break;
- File *f = TheFileSystem->openFile(it->first.str());
- if (f)
- {
- DEBUG_LOG(("***************************\nTesting '%s'\n\n", it->first.str()));
- Int origSize = f->size();
- UnsignedByte *buf = (UnsignedByte *)f->readEntireAndClose();
- UnsignedByte *uncompressedBuf = NEW UnsignedByte[origSize];
-
- CompData d = s_sizes[it->first];
- d.origSize = origSize;
- d.compressedSize[COMPRESSION_NONE] = origSize;
-
- for (i=TEST_COMPRESSION_MIN; i<=TEST_COMPRESSION_MAX; ++i)
- {
- DEBUG_LOG(("=================================================\n"));
- DEBUG_LOG(("Compression Test %d\n", i));
-
- Int maxCompressedSize = CompressionManager::getMaxCompressedSize( origSize, (CompressionType)i );
- DEBUG_LOG(("Orig size is %d, max compressed size is %d bytes\n", origSize, maxCompressedSize));
-
- UnsignedByte *compressedBuf = NEW UnsignedByte[maxCompressedSize];
- memset(compressedBuf, 0, maxCompressedSize);
- memset(uncompressedBuf, 0, origSize);
-
- Int compressedLen, decompressedLen;
-
- for (Int j=0; j < NUM_TIMES; ++j)
- {
- //s_compressGathers[i]->startTimer();
- compressedLen = CompressionManager::compressData((CompressionType)i, buf, origSize, compressedBuf, maxCompressedSize);
- //s_compressGathers[i]->stopTimer();
- //s_decompressGathers[i]->startTimer();
- decompressedLen = CompressionManager::decompressData(compressedBuf, compressedLen, uncompressedBuf, origSize);
- //s_decompressGathers[i]->stopTimer();
- }
- d.compressedSize[i] = compressedLen;
- DEBUG_LOG(("Compressed len is %d (%g%% of original size)\n", compressedLen, (double)compressedLen/(double)origSize*100.0));
- DEBUG_ASSERTCRASH(compressedLen, ("Failed to compress\n"));
- DEBUG_LOG(("Decompressed len is %d (%g%% of original size)\n", decompressedLen, (double)decompressedLen/(double)origSize*100.0));
-
- DEBUG_ASSERTCRASH(decompressedLen == origSize, ("orig size does not match compressed+uncompressed output\n"));
- if (decompressedLen == origSize)
- {
- Int ret = memcmp(buf, uncompressedBuf, origSize);
- if (ret != 0)
- {
- DEBUG_CRASH(("orig buffer does not match compressed+uncompressed output - ret was %d\n", ret));
- }
- }
-
- delete compressedBuf;
- compressedBuf = NULL;
- }
-
- DEBUG_LOG(("d = %d -> %d\n", d.origSize, d.compressedSize[i]));
- s_sizes[it->first] = d;
- DEBUG_LOG(("s_sizes[%s] = %d -> %d\n", it->first.str(), s_sizes[it->first].origSize, s_sizes[it->first].compressedSize[i]));
-
- delete[] buf;
- buf = NULL;
-
- delete[] uncompressedBuf;
- uncompressedBuf = NULL;
- }
-
- ++it;
- }
-
- for (i=TEST_COMPRESSION_MIN; i<=TEST_COMPRESSION_MAX; ++i)
- {
- Real maxCompression = 1000.0f;
- Real minCompression = 0.0f;
- Int totalUncompressedBytes = 0;
- Int totalCompressedBytes = 0;
- for (std::map::iterator cd = s_sizes.begin(); cd != s_sizes.end(); ++cd)
- {
- CompData d = cd->second;
-
- Real ratio = d.compressedSize[i]/(Real)d.origSize;
- maxCompression = min(maxCompression, ratio);
- minCompression = max(minCompression, ratio);
-
- totalUncompressedBytes += d.origSize;
- totalCompressedBytes += d.compressedSize[i];
- }
- DEBUG_LOG(("***************************************************\n"));
- DEBUG_LOG(("Compression method %s:\n", CompressionManager::getCompressionNameByType((CompressionType)i)));
- DEBUG_LOG(("%d bytes compressed to %d (%g%%)\n", totalUncompressedBytes, totalCompressedBytes,
- totalCompressedBytes/(Real)totalUncompressedBytes*100.0f));
- DEBUG_LOG(("Min ratio: %g%%, Max ratio: %g%%\n",
- minCompression*100.0f, maxCompression*100.0f));
- DEBUG_LOG(("\n"));
- }
-
- /*
- PerfGather::dumpAll(10000);
- PerfGather::resetAll();
- CopyFile( "AAAPerfStats.csv", "AAACompressPerfStats.csv", FALSE );
-
- for (i = TEST_COMPRESSION_MIN; i < TEST_COMPRESSION_MAX+1; ++i)
- {
- delete s_compressGathers[i];
- s_compressGathers[i] = NULL;
-
- delete s_decompressGathers[i];
- s_decompressGathers[i] = NULL;
- }
- */
-
-}
-
-#endif // TEST_COMPRESSION
diff --git a/Generals/Code/GameEngine/Source/Common/System/QuickTrig.cpp b/Generals/Code/GameEngine/Source/Common/System/QuickTrig.cpp
deleted file mode 100644
index c333f19145f..00000000000
--- a/Generals/Code/GameEngine/Source/Common/System/QuickTrig.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-** 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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-// FILE: QuickTrig.cpp ////////////////////////////////////////////////////////////////////////////////
-// Author: Mark Lorenzen (adapted by srj)
-// Desc: fast trig
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
-#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
-
-#include "Common/QuickTrig.h"
-
-// GLOBALS ////////////////////////////////////////////////////////////////////////////////////////
-
-Real TheQuickSinTable[] =
-{
- 0.00000f, 0.01237f, 0.02473f, 0.03710f, 0.04945f, 0.06180f, 0.07414f, 0.08647f,
- 0.09879f, 0.11109f, 0.12337f, 0.13563f, 0.14788f, 0.16010f, 0.17229f, 0.18446f,
- 0.19661f, 0.20872f, 0.22080f, 0.23284f, 0.24485f, 0.25683f, 0.26876f, 0.28065f,
- 0.29250f, 0.30431f, 0.31607f, 0.32778f, 0.33944f, 0.35104f, 0.36260f, 0.37410f,
- 0.38554f, 0.39692f, 0.40824f, 0.41950f, 0.43070f, 0.44183f, 0.45289f, 0.46388f,
- 0.47480f, 0.48565f, 0.49643f, 0.50712f, 0.51774f, 0.52829f, 0.53875f, 0.54913f,
- 0.55942f, 0.56963f, 0.57975f, 0.58978f, 0.59973f, 0.60958f, 0.61934f, 0.62900f,
- 0.63857f, 0.64804f, 0.65741f, 0.66668f, 0.67584f, 0.68491f, 0.69387f, 0.70272f,
- 0.71147f, 0.72010f, 0.72863f, 0.73705f, 0.74535f, 0.75354f, 0.76161f, 0.76957f,
- 0.77741f, 0.78513f, 0.79273f, 0.80020f, 0.80756f, 0.81479f, 0.82190f, 0.82888f,
- 0.83574f, 0.84247f, 0.84907f, 0.85554f, 0.86187f, 0.86808f, 0.87415f, 0.88009f,
- 0.88590f, 0.89157f, 0.89710f, 0.90250f, 0.90775f, 0.91287f, 0.91785f, 0.92269f,
- 0.92739f, 0.93195f, 0.93636f, 0.94063f, 0.94476f, 0.94874f, 0.95257f, 0.95626f,
- 0.95981f, 0.96321f, 0.96646f, 0.96956f, 0.97251f, 0.97532f, 0.97798f, 0.98048f,
- 0.98284f, 0.98505f, 0.98710f, 0.98901f, 0.99076f, 0.99236f, 0.99381f, 0.99511f,
- 0.99625f, 0.99725f, 0.99809f, 0.99878f, 0.99931f, 0.99969f, 0.99992f, 1.00000f,
- 0.99992f
-};
-
-Real TheQuickTanTable[] =
-{
- 0.00000f, 0.00787f, 0.01575f, 0.02363f, 0.03151f, 0.03939f, 0.04728f, 0.05517f,
- 0.06308f, 0.07099f, 0.07890f, 0.08683f, 0.09477f, 0.10272f, 0.11068f, 0.11866f,
- 0.12666f, 0.13466f, 0.14269f, 0.15073f, 0.15880f, 0.16688f, 0.17498f, 0.18311f,
- 0.19126f, 0.19943f, 0.20763f, 0.21586f, 0.22412f, 0.23240f, 0.24071f, 0.24906f,
- 0.25744f, 0.26585f, 0.27430f, 0.28279f, 0.29131f, 0.29987f, 0.30847f, 0.31712f,
- 0.32581f, 0.33454f, 0.34332f, 0.35214f, 0.36102f, 0.36994f, 0.37892f, 0.38795f,
- 0.39704f, 0.40618f, 0.41539f, 0.42465f, 0.43398f, 0.44337f, 0.45282f, 0.46234f,
- 0.47194f, 0.48160f, 0.49134f, 0.50115f, 0.51104f, 0.52101f, 0.53106f, 0.54120f,
- 0.55143f, 0.56174f, 0.57214f, 0.58264f, 0.59324f, 0.60393f, 0.61473f, 0.62563f,
- 0.63664f, 0.64777f, 0.65900f, 0.67035f, 0.68183f, 0.69342f, 0.70515f, 0.71700f,
- 0.72899f, 0.74112f, 0.75339f, 0.76581f, 0.77838f, 0.79110f, 0.80398f, 0.81703f,
- 0.83025f, 0.84363f, 0.85720f, 0.87096f, 0.88490f, 0.89904f, 0.91338f, 0.92793f,
- 0.94269f, 0.95767f, 0.97288f, 0.98833f, 1.00401f, 1.01995f, 1.03615f, 1.05261f,
- 1.06935f, 1.08637f, 1.10368f, 1.12130f, 1.13924f, 1.15749f, 1.17609f, 1.19503f,
- 1.21433f, 1.23400f, 1.25406f, 1.27452f, 1.29540f, 1.31670f, 1.33845f, 1.36067f,
- 1.38336f, 1.40656f, 1.43027f, 1.45453f, 1.47935f, 1.50475f, 1.53076f, 1.55741f,
- 1.58471f
-};
-
-// yes, Real. No, really.
-Real TheQuickSinTableCount = sizeof(TheQuickSinTable) / sizeof(Real);
-Real TheQuickTanTableCount = sizeof(TheQuickTanTable) / sizeof(Real);
-
diff --git a/Generals/Code/GameEngine/Source/Common/System/String.cpp b/Generals/Code/GameEngine/Source/Common/System/String.cpp
deleted file mode 100644
index 8b9d37879ef..00000000000
--- a/Generals/Code/GameEngine/Source/Common/System/String.cpp
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
-** 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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-//----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright (C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: String
-//
-// File name: WSYS_String.cpp
-//
-// Created: 11/5/01 TR
-//
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include "PreRTS.h"
-#include
-#include
-#include
-#include
-
-#include "Common/string.h"
-
-// 'assignment within condition expression'.
-#pragma warning(disable : 4706)
-
-//----------------------------------------------------------------------------
-// Externals
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Defines
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Types
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Public Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Prototypes
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Functions
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Public Functions
-//----------------------------------------------------------------------------
-
-
-//============================================================================
-// WSYS_String::WSYS_String
-//============================================================================
-
-WSYS_String::WSYS_String(const Char *string)
-: m_data(NULL)
-{
- set(string);
-}
-
-//============================================================================
-// WSYS_String::~WSYS_String
-//============================================================================
-
-WSYS_String::~WSYS_String()
-{
- delete [] m_data;
-}
-
-//============================================================================
-// WSYS_String::operator==
-//============================================================================
-
-Bool WSYS_String::operator== (const char *rvalue) const
-{
- return strcmp( get(), rvalue) == 0;
-}
-
-//============================================================================
-// WSYS_String::operator!=
-//============================================================================
-
-Bool WSYS_String::operator!= (const char *rvalue) const
-{
- return strcmp( get(), rvalue) != 0;
-}
-
-//============================================================================
-// WSYS_String::operator=
-//============================================================================
-
-const WSYS_String& WSYS_String::operator= (const WSYS_String &string)
-{
- set( string.get());
- return (*this);
-}
-
-//============================================================================
-// WSYS_String::operator=
-//============================================================================
-
-const WSYS_String& WSYS_String::operator= (const Char *string)
-{
- set( string );
- return (*this);
-}
-
-//============================================================================
-// WSYS_String::operator+=
-//============================================================================
-
-const WSYS_String& WSYS_String::operator+= (const WSYS_String &string)
-{
- Char *buffer = MSGNEW("WSYS_String") Char [ length() + string.length() + 1 ]; // pool[]ify
-
- if ( buffer != NULL )
- {
- strcpy( buffer, m_data );
- strcat( buffer, string.get() );
- delete [] m_data;
- m_data = buffer;
- }
-
- return (*this);
-}
-
-//============================================================================
-// WSYS_String::operator+=
-//============================================================================
-
-const WSYS_String& WSYS_String::operator+= (const Char *string)
-{
- if ( string != NULL )
- {
- Char *buffer = MSGNEW("WSYS_String") Char [ length() + strlen( string ) + 1 ];
-
- if ( buffer != NULL )
- {
- strcpy( buffer, m_data );
- strcat( buffer, string );
- delete [] m_data;
- m_data = buffer;
- }
- }
-
- return (*this);
-}
-
-//============================================================================
-// operator+ (const WSYS_String &string1, const WSYS_String &string2)
-//============================================================================
-
-WSYS_String operator+ (const WSYS_String &string1, const WSYS_String &string2)
-{
- WSYS_String temp(string1);
- temp += string2;
- return temp;
-
-}
-
-//============================================================================
-// operator+ (const Char *string1, const WSYS_String &string2)
-//============================================================================
-
-WSYS_String operator+ (const Char *string1, const WSYS_String &string2)
-{
- WSYS_String temp(string1);
- temp += string2;
- return temp;
-}
-
-//============================================================================
-// operator+ (const WSYS_String &string1, const Char *string2)
-//============================================================================
-
-WSYS_String operator+ (const WSYS_String &string1, const Char *string2)
-{
- WSYS_String temp(string1);
- temp += string2;
- return temp;
-}
-
-//============================================================================
-// WSYS_String::length
-//============================================================================
-
-Int WSYS_String::length(void) const
-{
- return strlen( m_data );
-}
-
-//============================================================================
-// WSYS_String::isEmpty
-//============================================================================
-
-Bool WSYS_String::isEmpty(void) const
-{
- return m_data[0] == 0;
-}
-
-//============================================================================
-// WSYS_String::format
-//============================================================================
-
-Int _cdecl WSYS_String::format(const Char *format, ...)
-{
- Int result = 0;
- char *buffer = MSGNEW("WSYS_String") char[100*1024];
-
- if ( buffer )
- {
- va_list args;
- va_start( args, format ); /* Initialize variable arguments. */
- result = vsprintf ( buffer, format, args );
- va_end( args );
- set( buffer );
- delete [] buffer;
- }
- else
- {
- set("");
- }
-
- return result;
-}
-
-//============================================================================
-// WSYS_String::set
-//============================================================================
-
-void WSYS_String::set( const Char *string )
-{
- delete [] m_data;
-
- if ( string == NULL )
- {
- string = "";
- }
-
- m_data = MSGNEW("WSYS_String") Char [ strlen(string) + 1];
- strcpy ( m_data, string );
-}
-
-
-//============================================================================
-// WSYS_String::makeUpperCase
-//============================================================================
-
-void WSYS_String::makeUpperCase( void )
-{
- Char *chr = m_data;
- Char ch;
-
- while( (ch = *chr) )
- {
- *chr++ = (Char) toupper( ch );
- }
-}
-
-//============================================================================
-// WSYS_String::makeLowerCase
-//============================================================================
-
-void WSYS_String::makeLowerCase( void )
-{
- Char *chr = m_data;
- Char ch;
-
- while( (ch = *chr) )
- {
- *chr++ = (Char) tolower( ch );
- }
-}
diff --git a/Generals/Code/GameEngine/Source/GameClient/Drawable/DrawableManager.cpp b/Generals/Code/GameEngine/Source/GameClient/Drawable/DrawableManager.cpp
deleted file mode 100644
index 38588cf8381..00000000000
--- a/Generals/Code/GameEngine/Source/GameClient/Drawable/DrawableManager.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-** 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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
-
diff --git a/Generals/Code/GameEngine/Source/GameClient/DrawableManager.cpp b/Generals/Code/GameEngine/Source/GameClient/DrawableManager.cpp
deleted file mode 100644
index 32814b7cf52..00000000000
--- a/Generals/Code/GameEngine/Source/GameClient/DrawableManager.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-** 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 .
-*/
-
-// DrawableManager.cpp
-// Message stream translator
-// Author: Michael S. Booth, March 2001
-
diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp
index 4b97b35c65a..64fa09084b9 100644
--- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp
+++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp
@@ -31,7 +31,6 @@
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/Xfer.h"
-#include "Common/QuickTrig.h"
#include "Common/AudioEventRTS.h"
#include "GameLogic/Object.h"
diff --git a/Generals/Code/GameEngineDevice/CMakeLists.txt b/Generals/Code/GameEngineDevice/CMakeLists.txt
index 626197d0654..5ccd96c7f0d 100644
--- a/Generals/Code/GameEngineDevice/CMakeLists.txt
+++ b/Generals/Code/GameEngineDevice/CMakeLists.txt
@@ -71,7 +71,6 @@ set(GAMEENGINEDEVICE_SRC
Source/W3DDevice/GameClient/W3DDynamicLight.cpp
Source/W3DDevice/GameClient/W3DFileSystem.cpp
Source/W3DDevice/GameClient/W3DGameClient.cpp
- Source/W3DDevice/GameClient/W3DGranny.cpp
Source/W3DDevice/GameClient/W3DInGameUI.cpp
Source/W3DDevice/GameClient/W3DMouse.cpp
Source/W3DDevice/GameClient/W3DParticleSys.cpp
@@ -145,7 +144,6 @@ set(GAMEENGINEDEVICE_SRC
Include/W3DDevice/GameClient/W3DGameFont.h
Include/W3DDevice/GameClient/W3DGameWindow.h
Include/W3DDevice/GameClient/W3DGameWindowManager.h
- Include/W3DDevice/GameClient/W3DGranny.h
Include/W3DDevice/GameClient/W3DGUICallbacks.h
Include/W3DDevice/GameClient/W3DInGameUI.h
Include/W3DDevice/GameClient/W3DMirror.h
diff --git a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGranny.h b/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGranny.h
deleted file mode 100644
index 6b18a0c04ab..00000000000
--- a/Generals/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGranny.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
-** 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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-#include "always.h"
-#include "hanim.h"
-#include "proto.h"
-#include "rendobj.h"
-#include "lightenvironment.h"
-#include "w3d_file.h"
-#include "dx8vertexbuffer.h"
-#include "dx8indexbuffer.h"
-#include "shader.h"
-#include "vertmaterial.h"
-#include "Lib/BaseType.h"
-
-#pragma once
-
-#ifndef __W3DGRANNY_H_
-#define __W3DGRANNY_H_
-
-#ifdef INCLUDE_GRANNY_IN_BUILD
-
-#include "granny.h"
-
-class GrannyRenderObjSystem; ///Set_Shininess(0.0);
- m_vertexMaterial->Set_Specular(0,0,0);
- m_vertexMaterial->Set_Lighting(true);
- }
-
- struct grannyMeshDesc
- {
- const UnsignedInt *index; ///< pointer to pool of face indices
- Int indexCount; ///< number of face indices in this mesh
- const granny_pnt332_vertex *vertex; ///< pointer to pool of mesh vertices
- Int vertexCount; ///< number of vertices in this mesh.
- };
-
- virtual ~GrannyPrototypeClass(void) { if (m_vertexMaterial) REF_PTR_RELEASE (m_vertexMaterial); if (m_file) GrannyFreeFile(m_file); }
- virtual const char * Get_Name(void) const { return m_name; }
- virtual int Get_Class_ID(void) const { return RenderObjClass::CLASSID_UNKNOWN; }
- virtual RenderObjClass * Create(void) { return NEW_REF( GrannyRenderObjClass, (*this) ); }
- void Set_Name(char *name) {strcpy(m_name,name);}
- void setBoundingBox(AABoxClass & box) {m_boundingBox=box;}
- void setBoundingSphere(SphereClass & sphere) {m_boundingSphere=sphere;}
- void setVertexCount(Int vertexCount) {m_vertexCount=vertexCount;}
- void setIndexCount(Int indexCount) {m_indexCount=indexCount;}
- void setMeshCount(Int meshCount) {m_meshCount=meshCount;}
- void setMeshData(grannyMeshDesc &meshdesc, Int index) {m_meshData[index]=meshdesc;}
- const UnsignedInt *getMeshIndexList(int index) const { if (index < m_meshCount) return m_meshData[0].index; else return NULL;}
- const granny_pnt332_vertex *getMeshVertexList(int index) const { if (index < m_meshCount) return m_meshData[0].vertex; else return NULL;}
- const Int getIndexCount(void) const {return m_indexCount;} //return total number of indices in model
-
-private:
- granny_file *m_file; ///
-#include "W3DDevice/GameClient/W3DGranny.h"
#include "Common/PerfTimer.h"
#include "Common/GlobalData.h"
diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGranny.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGranny.cpp
deleted file mode 100644
index 86c78b5250a..00000000000
--- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGranny.cpp
+++ /dev/null
@@ -1,1124 +0,0 @@
-/*
-** 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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-// FILE: W3DGranny.cpp ////////////////////////////////////////////////
-//-----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright (C) 2001 - All Rights Reserved
-//
-//-----------------------------------------------------------------------------
-//
-// Project: RTS3
-//
-// File name: W3DGranny.cpp
-//
-// Created: Mark Wilczynski, Sep 2001
-//
-// Desc: Methods for using Granny models within the W3D engine.
-//-----------------------------------------------------------------------------
-
-#ifdef INCLUDE_GRANNY_IN_BUILD
-
-#include "W3DDevice/GameClient/W3DGranny.h"
-#include "Common/GlobalData.h"
-#include "texture.h"
-#include "colmath.h"
-#include "coltest.h"
-#include "rinfo.h"
-#include "camera.h"
-#include "assetmgr.h"
-#include "WW3D2/dx8wrapper.h"
-#include "WW3D2/scene.h"
-
-static granny_pnt332_vertex g_blendingBuffer[4096]; ///TrackGroupCount;
- ++TrackGroupIndex)
- {
- if(strcmp(Animation->TrackGroups[TrackGroupIndex]->Name,
- GrannyGetSourceModel(ModelInstance)->Name) == 0)
- {
- return(TrackGroupIndex);
- }
- }}
- }
-
- return(-1);
-}
-
-/** Local function used to modify the original granny data - flip coordintes, scale, etc. */
-static void TransformFile(granny_file_info *FileInfo)
-{
- float Origin[] = {0, 0, 0};
- float RightVector[] = {1, 0, 0}; //x
- float UpVector[] = {0, 0, 1}; //y
- float BackVector[] = {0, -1, 0};//z
-
- return;
-
- float Affine3[3];
- float Linear3x3[3][3];
- float InverseLinear3x3[3][3];
- GrannyAutoComputeBasisConversion(FileInfo, 1.0f,
- Origin,
- RightVector,
- UpVector,
- BackVector,
- Affine3, (float *)Linear3x3,
- (float *)InverseLinear3x3);
-
- GrannyAutoTransformFile(FileInfo, Affine3,
- (float *)Linear3x3,
- (float *)InverseLinear3x3);
-}
-
-//=============================================================================
-// GrannyRenderObjClass::~GrannyRenderObjClass
-//=============================================================================
-/** Destructor. Releases w3d/granny assets. */
-//=============================================================================
-GrannyRenderObjClass::~GrannyRenderObjClass(void)
-{
- if (m_animationControl)
- GrannyFreeControl(m_animationControl);
- if (m_modelInstance)
- GrannyFreeModelInstance(m_modelInstance);
- freeResources();
-}
-
-//=============================================================================
-// GrannyRenderObjClass::GrannyRenderObjClass
-//=============================================================================
-/** Constructor. Creates an instance of the prototype. */
-//=============================================================================
-GrannyRenderObjClass::GrannyRenderObjClass(const GrannyPrototypeClass &proto)
-:m_prototype(proto)
-{
- granny_file_info *fileInfo = GrannyGetFileInfo((granny_file *)proto.m_file);
- m_boundingBox = proto.m_boundingBox;
- m_boundingSphere = proto.m_boundingSphere;
- m_vertexCount = proto.m_vertexCount;
- m_animationControl = NULL; //no animation playing by default
-
- if (fileInfo)
- {
- //Find the skinned model
- for (Int modelIndex=0; modelIndexModelCount; modelIndex++)
- {
- granny_model *sourceModel = fileInfo->Models[modelIndex];
- //ignore bounding boxes since they are never rendered
- if (stricmp(sourceModel->Name,"AABOX") != 0)
- m_modelInstance = GrannyInstantiateModel(fileInfo->Models[modelIndex]);
- }
-
- if(m_modelInstance)
- {
- //assign textures to the model
- GrannyAutoBindModel(m_modelInstance, _GrannyLoader.Get_Material_Library(), 1);
- // GrannyAddModelToScene(Global.Scene, ModelInstance); ///@todo: Create a granny scene for quicker updates.
-
- float *RootTransform = GrannyGetModelRootTransform(m_modelInstance);
-
- RootTransform[12] = 0;//x
- RootTransform[13] = 0;//y
- RootTransform[14] = 0;//z
- }//modelinstance*/
- }
-}
-
-/** Set scaling factor applied to prototype during rendering */
-void GrannyRenderObjClass::Set_ObjectScale(float scale)
-{
- ObjectScale=scale;
-
- //adjust bounding volumes we copied from non-scaled prototype.
-
- m_boundingBox.Center *= scale;
- m_boundingBox.Extent *= scale;
-
- ///@todo: Remove earlier hacks in W3D to get instance matrix scaling!
- ///After the W3D hacks are gone, we should also scale the radius here.
- m_boundingSphere.Center *= scale;
-}
-
-//=============================================================================
-// GrannyRenderObjClass::Get_Obj_Space_Bounding_Sphere
-//=============================================================================
-/** WW3D method that returns object bounding sphere used in frustum culling*/
-//=============================================================================
-void GrannyRenderObjClass::Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const
-{ sphere=m_boundingSphere;
-}
-
-//=============================================================================
-// GrannyRenderObjClass::Get_Obj_Space_Bounding_Box
-//=============================================================================
-/** WW3D method that returns object bounding box used in collision detection*/
-//=============================================================================
-void GrannyRenderObjClass::Get_Obj_Space_Bounding_Box(AABoxClass & box) const
-{
- box=m_boundingBox;
-}
-
-//=============================================================================
-// GrannyRenderObjClass::Cast_Ray
-//=============================================================================
-/** WW3D method that returns intersection point between ray and model.
- We will only return results of a simple 'pick box' - not full triangle level
- detail.
-*/
-//=============================================================================
-Bool GrannyRenderObjClass::Cast_Ray(RayCollisionTestClass & raytest)
-{
-
- if ((Get_Collision_Type() & raytest.CollisionType) == 0) return false;
-
- AABoxClass hbox=m_boundingBox;
-
- hbox.Transform(Get_Transform());
-
- if (CollisionMath::Collide(raytest.Ray,hbox,raytest.Result)) {
- raytest.CollidedRenderObj = this;
- return true;
- }
- return false;
-}
-
-//=============================================================================
-// GrannyRenderObjClass::Class_ID
-//=============================================================================
-/** returns the class id, so the scene can tell what kind of render object it has. */
-//=============================================================================
-Int GrannyRenderObjClass::Class_ID(void) const
-{
- return RenderObjClass::CLASSID_UNKNOWN;
-}
-
-//=============================================================================
-// GrannyRenderObjClass::Clone
-//=============================================================================
-/** Not used, but required virtual method. */
-//=============================================================================
-RenderObjClass * GrannyRenderObjClass::Clone(void) const
-{
- assert(false);
- return NULL;
-}
-
-//=============================================================================
-// GrannyRenderObjClass::freeResources
-//=============================================================================
-/** Free any W3D resources associated with this object */
-//=============================================================================
-Int GrannyRenderObjClass::freeResources(void)
-{
-// REF_PTR_RELEASE(m_stageZeroTexture);
-
- return 0;
-}
-
-/** W3D Method used to control the animation assocated with this render object. */
-void GrannyRenderObjClass::Set_Animation( HAnimClass * motion, float frame, int anim_mode)
-{
- GrannyAnimClass *gAnim=(GrannyAnimClass*)motion;
-
- granny_animation *Animation=gAnim->Animation;
-
- if(Animation)
- {
- Int trackIndex=-1;
- //Check if this animation works with this model
- trackIndex=FindTrackGroupFor(Animation,m_modelInstance);
-
- if(trackIndex != -1)
- {
- //stop previous animations
- if (m_animationControl)
- { GrannyFreeControl(m_animationControl);
- m_animationControl=NULL;
- }
-
- m_animationControl = GrannyPlayControlledAnimation(frame / gAnim->FrameRate, Animation, trackIndex, m_modelInstance, 0);
- if (m_animationControl)
- {
- GrannySetControlSpeed(m_animationControl, 1.0f); //play at normal speed
- if (anim_mode == ANIM_MODE_LOOP)
- GrannySetControlLooping(m_animationControl, true);
- else
- GrannySetControlLooping(m_animationControl, false);
- }
- }
- }
-}
-
-//=============================================================================
-// GrannyRenderObjClass::Render
-//=============================================================================
-/** Draws this render object to the screen.
-*/
-//=============================================================================
-void GrannyRenderObjClass::Render(RenderInfoClass & rinfo)
-{
- TheGrannyRenderObjSystem->AddRenderObject(rinfo, this);
- return;
-
- //update the model
- GrannySetModelClock(m_modelInstance, LastSyncTime);
- LastSyncTime = WW3D::Get_Sync_Time()*0.001f; //convert to seconds
-
- GrannySampleModelAnimations(m_modelInstance, 0, GrannyGetModelBoneCount(m_modelInstance),
- GrannyGetModelLocalPose(m_modelInstance));
- GrannyBuildModelWorldTransforms(m_modelInstance, 0,
- GrannyGetModelBoneCount(m_modelInstance),
- GrannyGetModelLocalPose(m_modelInstance),
- GrannyGetModelRootTransform(m_modelInstance),
- GrannyGetModelWorldPose(m_modelInstance));
-
- Real *RootTransform = GrannyGetModelRootTransform(m_modelInstance);
-
- RootTransform[12] = 0; //X
- RootTransform[13] = 0; //Y
- RootTransform[13] = 0; //Z
- RootTransform[0] = ObjectScale;
- RootTransform[5] = ObjectScale;
- RootTransform[10] = ObjectScale;
-
- Int MeshCount = GrannyGetModelMeshCount(m_modelInstance);
- for(Int MeshIndex = 0; MeshIndex < MeshCount; ++MeshIndex)
- {
- granny_mesh_instance *Mesh = (granny_mesh_instance *)GrannyGetModelMeshCookie(m_modelInstance, MeshIndex);
- granny_mesh_model_binding *Binding = GrannyGetMeshModelBinding(Mesh);
-
- granny_pnt332_vertex *Vertices = 0;
- if(GrannyMeshIsRigid(Mesh))
- { assert(0); //have not coded support for rigid meshes yet - only soft skinned supported.
-// granny_matrix_4x4 TempBuffer;
-// glMultMatrixf(GrannyGetRigidMeshTransform(
-// Binding, GrannyGetModelWorldPose(m_modelInstance),
-// (granny_real32 *)TempBuffer));
- Vertices = (granny_pnt332_vertex *)GrannyGetMeshVertices(Mesh);
- }
- else
- {
- GrannyDeformMesh(Binding, GrannyGetModelWorldPose(m_modelInstance),
- 0, g_blendingBuffer);
- Vertices = g_blendingBuffer;
- }
-
- int GroupCount = GrannyGetMeshTriangleGroupCount(Mesh);
- {for(Int GroupIndex = 0;
- GroupIndex < GroupCount;
- ++GroupIndex)
- {
- granny_material_instance *Material = (granny_material_instance *)
- GrannyGetMeshMaterialCookie(
- Mesh, GrannyGetMeshTriangleGroupMaterialIndex(
- Mesh, GroupIndex));
- if(Material)
- {
- Int TextureIndex;
- if(GrannyGetMaterialTextureIndexByType(
- Material, GrannyDiffuseColorTexture, &TextureIndex))
- {
- granny_texture_instance *TextureInstance =
- (granny_texture_instance *)GrannyGetMaterialTextureCookie(
- Material, TextureIndex);
-
- if(TextureInstance)
- {
- DX8Wrapper::Set_Texture(0, (TextureClass *)GrannyGetTextureCookie(TextureInstance));
- }
- else
- DX8Wrapper::Set_Texture(0, NULL);
- }
- }
-
- DynamicVBAccessClass vb_access(BUFFER_TYPE_DYNAMIC_DX8,dynamic_fvf_type,m_vertexCount);
- {
- DynamicVBAccessClass::WriteLockClass lock(&vb_access);
- VertexFormatXYZNDUV2* vb=lock.Get_Formatted_Vertex_Array();
- if(vb)
- {
- for (Int i=0; ix=Vertices->Position[0];
- vb->y=Vertices->Position[1];
- vb->z=Vertices->Position[2];
- vb->nx=Vertices->Normal[0];
- vb->ny=Vertices->Normal[1];
- vb->nz=Vertices->Normal[2];
- vb->diffuse=0xffffffff;
- vb->u1=Vertices->UV[0];
- vb->v1=Vertices->UV[1];
- vb++;
- Vertices++;
- }
- }
- }
-
- Int indexCount=GrannyGetMeshTriangleGroupIndexCount(Mesh, GroupIndex);
- UnsignedInt *indices=(UnsignedInt*)GrannyGetMeshTriangleGroupIndices(Mesh, GroupIndex);
-
- DynamicIBAccessClass ib_access(BUFFER_TYPE_DYNAMIC_DX8,indexCount);
- {
- DynamicIBAccessClass::WriteLockClass lock(&ib_access);
- unsigned short* ib=lock.Get_Index_Array();
-
- if(ib)
- {
- for (Int i=0; iTextureCount; ++TextureIndex)
- {
- _splitpath(fileInfo->Textures[TextureIndex]->FromFileName, drive, dir, fname, ext );
- TextureClass *TextureHandle=WW3DAssetManager::Get_Instance()->Get_Texture(strncat(fname,".tga",4));
- granny_texture_instance *TextureInstance = GrannyInstantiateTexture(fileInfo->Textures[TextureIndex]);
- GrannySetTextureCookie(TextureInstance, (granny_uint32)TextureHandle);
- GrannyAddTextureToLibrary(TextureLibrary,TextureInstance);
- }
-
- //Calculate bounding box and find maximum number of vertices needed to render mesh.
- for (Int modelIndex=0; modelIndexModelCount; modelIndex++)
- {
- granny_model *sourceModel = fileInfo->Models[modelIndex];
- if (stricmp(sourceModel->Name,"AABOX") == 0)
- { //found a collision box, copy out data
- int MeshCount = sourceModel->MeshBindingCount;
- if (MeshCount==1)
- {
- granny_mesh *sourceMesh = sourceModel->MeshBindings[0].Mesh;
- granny_pn33_vertex *Vertices = (granny_pn33_vertex *)sourceMesh->PrimaryVertexData->Vertices;
- Vector3 points[24];
-
- assert (sourceMesh->PrimaryVertexData->VertexCount <= 24);
-
- for (Int boxVertex=0; boxVertexPrimaryVertexData->VertexCount; boxVertex++)
- { points[boxVertex].Set(Vertices[boxVertex].Position[0],
- Vertices[boxVertex].Position[1],
- Vertices[boxVertex].Position[2]);
- }
- box.Init(points,sourceMesh->PrimaryVertexData->VertexCount);
- }
- }
- else
- { //mesh is part of model
- meshCount = sourceModel->MeshBindingCount;
-
- for (Int meshIndex=0; meshIndexMeshBindings[meshIndex].Mesh;
- meshData[meshIndex].vertex=NULL;
- meshData[meshIndex].vertexCount=0;
- if (sourceMesh->PrimaryVertexData)
- { vertexCount+=sourceMesh->PrimaryVertexData->VertexCount;
- meshData[meshIndex].vertex=(granny_pnt332_vertex *)sourceMesh->PrimaryVertexData->Vertices;
- meshData[meshIndex].vertexCount=sourceMesh->PrimaryVertexData->VertexCount;
- }
- meshData[meshIndex].index=NULL;
- meshData[meshIndex].indexCount=NULL;
- if (sourceMesh->PrimaryTopology)
- {
- assert (sourceMesh->PrimaryTopology->GroupCount == 1); //should only have 1 material per mesh!
- granny_tri_material_group &sourceGroup = sourceMesh->PrimaryTopology->Groups[0];
-
- // This is the texture index (relative to the array we just
- // built) for this group of triangles
- // SourceGroup.MaterialIndex;
-
- // This is the number of indices
- if(sourceMesh->PrimaryTopology->IndexCount)
- {
- meshData[meshIndex].index=(const UnsignedInt*)&sourceMesh->PrimaryTopology->Indices[3*sourceGroup.TriFirst];
- // These are the indices for this group
- meshData[meshIndex].indexCount=3*sourceGroup.TriCount;
- indexCount += meshData[meshIndex].indexCount; //keep track of total indices in this model
- }
- }
- }
- }
- }
- ///@todo: Convert granny materials into W3D/D3D materials - now using default.
-// for(int MaterialIndex = 0; MaterialIndex < fileInfo->MaterialCount; ++MaterialIndex)
-// {
-// granny_material_instance *MaterialInstance = GrannyInstantiateMaterial(fileInfo->Materials[MaterialIndex]);
-// GrannyAutoBindAllMaterialTextures(MaterialInstance,TextureLibrary);
-// GrannyAddMaterialToLibrary(MaterialLibrary,MaterialInstance);
-// }
-
-
- GrannyAutoBindAllMaterials(MaterialLibrary, fileInfo,TextureLibrary);
-
- } //fileInfo
-
- if (fileInfo == NULL) {
- return NULL;
- }
-
- // ok, accept this model!
- GrannyPrototypeClass * hproto = NEW GrannyPrototypeClass(File);
- _splitpath(filename, drive, dir, fname, ext );
- hproto->Set_Name(strcat(fname,ext));
- hproto->setBoundingBox(box);
- hproto->setBoundingSphere(SphereClass(box.Center,box.Extent.Length()));
- hproto->setVertexCount(vertexCount);
- hproto->setIndexCount(indexCount);
- hproto->setMeshCount(meshCount);
- for (Int i=0; isetMeshData(meshData[i],i);
- return hproto;
- }//FILE
-
- return NULL;
-}
-
-GrannyLoaderClass::GrannyLoaderClass(void)
-{
- TextureLibrary = GrannyNewTextureLibrary(1 << 12);
- MaterialLibrary = GrannyNewMaterialLibrary(1 << 12);
-}
-
-GrannyLoaderClass::~GrannyLoaderClass(void)
-{
- GrannyFreeTextureLibrary(TextureLibrary);
- GrannyFreeMaterialLibrary(MaterialLibrary);
-
- TextureLibrary=NULL;
- MaterialLibrary=NULL;
-}
-
-GrannyAnimManagerClass::GrannyAnimManagerClass(void)
-{
- // Create the hash tables
- AnimPtrTable = NEW HashTableClass( 2048 );
- MissingAnimTable = NEW HashTableClass( 2048 );
-}
-
-GrannyAnimManagerClass::~GrannyAnimManagerClass(void)
-{
- Free_All_Anims();
-
- delete AnimPtrTable;
- AnimPtrTable = NULL;
-
- delete MissingAnimTable;
- MissingAnimTable = NULL;
-}
-
-/** Release all loaded animations */
-void GrannyAnimManagerClass::Free_All_Anims(void)
-{
- // Make an iterator, and release all ptrs
- GrannyAnimManagerIterator it( *this );
- for( it.First(); !it.Is_Done(); it.Next() ) {
- GrannyAnimClass *anim = it.Get_Current_Anim();
- anim->Release_Ref();
- }
-
- // Then clear the table
- AnimPtrTable->Reset();
-}
-
-/** Find animation in cache */
-GrannyAnimClass * GrannyAnimManagerClass::Peek_Anim(const char * name)
-{
- return (GrannyAnimClass*)AnimPtrTable->Find( name );
-}
-
-/** Get animation from cache and increment its reference count */
-GrannyAnimClass * GrannyAnimManagerClass::Get_Anim(const char * name)
-{
- GrannyAnimClass * anim = Peek_Anim( name );
- if ( anim != NULL ) {
- anim->Add_Ref();
- }
- return anim;
-}
-
-/** Add animation to cache */
-Bool GrannyAnimManagerClass::Add_Anim(GrannyAnimClass *new_anim)
-{
- WWASSERT (new_anim != NULL);
-
- // Increment the refcount on the new animation and add it to our table.
- new_anim->Add_Ref ();
- AnimPtrTable->Add( new_anim );
-
- return true;
-}
-
-/*
-** Missing Anims
-**
-** The idea here, allow the system to register which anims are determined to be missing
-** so that if they are asked for again, we can quickly return NULL, without searching the
-** disk again.
-*/
-void GrannyAnimManagerClass::Register_Missing( const char * name )
-{
- MissingAnimTable->Add( NEW MissingAnimClass( name ) );
-}
-
-Bool GrannyAnimManagerClass::Is_Missing( const char * name )
-{
- return ( MissingAnimTable->Find( name ) != NULL );
-}
-
-/** Load an animation from disk and add to cache */
-int GrannyAnimManagerClass::Load_Anim(const char * name)
-{
- GrannyAnimClass * newanim = NEW GrannyAnimClass;
-
- if (newanim == NULL) {
- goto Error;
- }
-
- SET_REF_OWNER( newanim );
-
- if (newanim->Load_W3D(name) != GrannyAnimClass::OK)
- { // load failed!
- newanim->Release_Ref();
- goto Error;
- } else if (Peek_Anim(newanim->Get_Name()) != NULL)
- { // duplicate exists!
- newanim->Release_Ref(); // Release the one we just loaded
- goto Error;
- } else
- { Add_Anim( newanim );
- newanim->Release_Ref();
- }
-
- return 0;
-
-Error:
- return 1;
-}
-
-/*
-** Iterator converter from HashableClass to GrannyAnimClass
-*/
-GrannyAnimClass * GrannyAnimManagerIterator::Get_Current_Anim( void )
-{
- return (GrannyAnimClass *)Get_Current();
-}
-
-
-GrannyAnimClass::GrannyAnimClass(void) :
- NumFrames(0),
- FrameRate(0),
- File(0),
- Animation(0)
-{
- Name[0]='\0';
-}
-
-
-/** GrannyAnimClass::~GrannyAnimClass -- Destructor */
-GrannyAnimClass::~GrannyAnimClass(void)
-{
- GrannyFreeFile(File);
-}
-
-/** Read granny data from disk */
-int GrannyAnimClass::Load_W3D(const char *name)
-{
- granny_file *file=NULL;
-
- file = GrannyReadEntireFile(name);
-
- if (file)
- {
- granny_file_info *fileInfo;
- fileInfo = GrannyGetFileInfo(file);
- if (fileInfo && fileInfo->AnimationCount)
- { Animation = fileInfo->Animations[0];
- File = file;
- strcpy(Name,name);
- FrameRate = 1.0f/Animation->TimeStep;
- NumFrames = Animation->Duration / Animation->TimeStep;
- return OK;
- }
- else
- GrannyFreeFile(File); //no animations found
- }
- return LOAD_ERROR;
-}
-
-GrannyLoaderClass _GrannyLoader;
-GrannyRenderObjSystem *TheGrannyRenderObjSystem=NULL;
-
-/** Adds render object to a queue with other objects using the same material. These queues will be
- flushed at the end of the frame.
-*/
-void GrannyRenderObjSystem::AddRenderObject(RenderInfoClass & rinfo, GrannyRenderObjClass *robj)
-{
- if (m_renderObjectCount >= MAX_VISIBLE_GRANNY_MODELS)
- { assert (m_renderObjectCount < MAX_VISIBLE_GRANNY_MODELS);
- return; //can't add any more granny models this frame.
- }
-
- for (Int i=0; im_prototype.m_file == robj->m_prototype.m_file)
- { //found model with same prototype. Add new model to same list.
- robj->m_nextSystem=m_renderStateModelList[i].list;
- m_renderStateModelList[i].list=robj;
- if (rinfo.light_environment)
- m_renderLocalLightEnv[m_renderObjectCount]=*rinfo.light_environment;
- m_renderObjectCount++;
- return;
- }
- }
-
- //Found a new render state
-
- assert (m_renderStateCount < MAX_GRANNY_RENDERSTATES);
-
- if (m_renderStateCount > MAX_GRANNY_RENDERSTATES)
- return; //reached maximum number of render states
-
- //store this objects lighting information for use later during drawing.
- if (rinfo.light_environment)
- m_renderLocalLightEnv[m_renderObjectCount]=*rinfo.light_environment;
-
- m_renderStateModelList[m_renderStateCount++].list=robj;
- robj->m_nextSystem=NULL;
-
- m_renderObjectCount++;
-}
-
-/** Draws all the granny render objects that were rendered in the last frame.
- Drawing is done in render state order to reduce overhead.
-*/
-void GrannyRenderObjSystem::Flush(void)
-{
- GrannyRenderObjClass *robj;
- granny_model_instance *modelInstance;
- Bool setMaterial;
- Int modelCount=0;
- Int indexCount; //per model index count
-
- for (Int i=0; im_modelInstance;
-
- //update the model
- GrannySetModelClock(modelInstance,robj->LastSyncTime);
- robj->LastSyncTime = WW3D::Get_Sync_Time()*0.001f; //convert to seconds
-
- GrannySampleModelAnimations(modelInstance, 0, GrannyGetModelBoneCount(modelInstance),
- GrannyGetModelLocalPose(modelInstance));
- GrannyBuildModelWorldTransforms(modelInstance, 0,
- GrannyGetModelBoneCount(modelInstance),
- GrannyGetModelLocalPose(modelInstance),
- GrannyGetModelRootTransform(modelInstance),
- GrannyGetModelWorldPose(modelInstance));
-
- Real *RootTransform = GrannyGetModelRootTransform(modelInstance);
-
- RootTransform[12] = 0; //X
- RootTransform[13] = 0; //Y
- RootTransform[13] = 0; //Z
- RootTransform[0] = robj->ObjectScale;
- RootTransform[5] = robj->ObjectScale;
- RootTransform[10] = robj->ObjectScale;
-
- Int MeshCount = GrannyGetModelMeshCount(modelInstance);
- for(Int MeshIndex = 0; MeshIndex < MeshCount; ++MeshIndex)
- {
- granny_mesh_instance *Mesh = (granny_mesh_instance *)GrannyGetModelMeshCookie(modelInstance, MeshIndex);
- granny_mesh_model_binding *Binding = GrannyGetMeshModelBinding(Mesh);
-
- granny_pnt332_vertex *Vertices = 0;
- if(GrannyMeshIsRigid(Mesh))
- { assert(0); //have not coded support for rigid meshes yet - only soft skinned supported.
- // granny_matrix_4x4 TempBuffer;
- // glMultMatrixf(GrannyGetRigidMeshTransform(
- // Binding, GrannyGetModelWorldPose(modelInstance),
- // (granny_real32 *)TempBuffer));
- Vertices = (granny_pnt332_vertex *)GrannyGetMeshVertices(Mesh);
- }
- else
- {
- GrannyDeformMesh(Binding, GrannyGetModelWorldPose(modelInstance),
- 0, g_blendingBuffer);
- Vertices = g_blendingBuffer;
- }
-
- int GroupCount = GrannyGetMeshTriangleGroupCount(Mesh);
- for(Int GroupIndex = 0; GroupIndex < GroupCount; ++GroupIndex)
- {
- granny_material_instance *Material = (granny_material_instance *)
- GrannyGetMeshMaterialCookie(
- Mesh, GrannyGetMeshTriangleGroupMaterialIndex(
- Mesh, GroupIndex));
- if(setMaterial && Material)
- {
- Int TextureIndex;
- if(GrannyGetMaterialTextureIndexByType(
- Material, GrannyDiffuseColorTexture, &TextureIndex))
- {
- granny_texture_instance *TextureInstance =
- (granny_texture_instance *)GrannyGetMaterialTextureCookie(
- Material, TextureIndex);
-
- if(TextureInstance)
- {
- DX8Wrapper::Set_Texture(0, (TextureClass *)GrannyGetTextureCookie(TextureInstance));
- }
- else
- DX8Wrapper::Set_Texture(0, NULL);
- }
- }
-
- DynamicVBAccessClass vb_access(BUFFER_TYPE_DYNAMIC_DX8,dynamic_fvf_type,robj->m_vertexCount);
- {
- DynamicVBAccessClass::WriteLockClass lock(&vb_access);
- VertexFormatXYZNDUV2* vb=lock.Get_Formatted_Vertex_Array();
- if(vb)
- {
- for (Int i=0; im_vertexCount; i++)
- {
- vb->x=Vertices->Position[0];
- vb->y=Vertices->Position[1];
- vb->z=Vertices->Position[2];
- vb->nx=Vertices->Normal[0];
- vb->ny=Vertices->Normal[1];
- vb->nz=Vertices->Normal[2];
- vb->diffuse=0xffffffff;
- vb->u1=Vertices->UV[0];
- vb->v1=Vertices->UV[1];
- vb++;
- Vertices++;
- }
- }
- }
-
- if (setMaterial)
- { //we started using a new material queue - really a new model prototype
- //so reset all relevant data.
- indexCount=GrannyGetMeshTriangleGroupIndexCount(Mesh, GroupIndex);
- UnsignedInt *indices=(UnsignedInt*)GrannyGetMeshTriangleGroupIndices(Mesh, GroupIndex);
-
- DynamicIBAccessClass ib_access(BUFFER_TYPE_DYNAMIC_DX8,indexCount);
- {
- DynamicIBAccessClass::WriteLockClass lock(&ib_access);
- unsigned short* ib=lock.Get_Index_Array();
-
- if(ib)
- {
- for (Int i=0; im_prototype.m_vertexMaterial);
- DX8Wrapper::Set_Shader(ShaderClass::_PresetOpaqueShader);
- setMaterial=false; //don't set material again unless it changes.
- DX8Wrapper::Set_Index_Buffer(ib_access,0);
- }
-
- Matrix3D tm(robj->Transform);
- DX8Wrapper::Set_Light_Environment(&m_renderLocalLightEnv[modelCount]);
- DX8Wrapper::Set_Transform(D3DTS_WORLD,tm);
- DX8Wrapper::Set_Vertex_Buffer(vb_access);
- DX8Wrapper::Draw_Triangles( 0,indexCount/3, 0, robj->m_vertexCount); //draw a quad, 2 triangles, 4 verts
- }
- }
- robj=robj->m_nextSystem; //move to next object using this material
- modelCount++;
- }//while
-
- }
-
- //reset for next frame
- m_renderObjectCount=0;
- m_renderStateCount=0;
-}
-
-#if 0 ///@todo: Will have to implement an optimized granny rendering system
-//=============================================================================
-// GrannyRenderObjClassSystem::GrannyRenderObjClassSystem
-//=============================================================================
-/** Constructor. Just nulls out some variables. */
-//=============================================================================
-GrannyRenderObjClassSystem::GrannyRenderObjClassSystem()
-{
- m_usedModules = NULL;
- m_freeModules = NULL;
- m_indexBuffer = NULL;
- m_vertexMaterialClass = NULL;
- m_vertexBuffer = NULL;
-}
-
-//=============================================================================
-// GrannyRenderObjClassSystem::~GrannyRenderObjClassSystem
-//=============================================================================
-/** Destructor. Free all pre-allocated track laying render objects*/
-//=============================================================================
-GrannyRenderObjClassSystem::~GrannyRenderObjClassSystem( void )
-{
-
- // free all data
- shutdown();
-
- m_vertexMaterialClass=NULL;
-
-}
-
-//=============================================================================
-// GrannyRenderObjClassSystem::ReAcquireResources
-//=============================================================================
-/** (Re)allocates all W3D assets after a reset.. */
-//=============================================================================
-void GrannyRenderObjClassSystem::ReAcquireResources(void)
-{
- // just for paranoia's sake.
- REF_PTR_RELEASE(m_indexBuffer);
- REF_PTR_RELEASE(m_vertexBuffer);
-
- //Create static index buffers. These will index the vertex buffers holding the map.
- m_indexBuffer=NEW_REF(DX8IndexBufferClass,(32*6));
-
- // Fill up the IB
- {
- DX8IndexBufferClass::WriteLockClass lockIdxBuffer(m_indexBuffer);
- UnsignedShort *ib=lockIdxBuffer.Get_Index_Array();
- }
-
- ///@todo: Allocating double sized buffer than really needed... but things go bad otherwise. Figure out why!
-
- m_vertexBuffer=NEW_REF(DX8VertexBufferClass,(DX8_FVF_XYZDUV1,1*2,DX8VertexBufferClass::USAGE_DYNAMIC));
-
-}
-
-//=============================================================================
-// GrannyRenderObjClassSystem::ReleaseResources
-//=============================================================================
-/** (Re)allocates all W3D assets after a reset.. */
-//=============================================================================
-void GrannyRenderObjClassSystem::ReleaseResources(void)
-{
- REF_PTR_RELEASE(m_indexBuffer);
- REF_PTR_RELEASE(m_vertexBuffer);
- // Note - it is ok to not release the material, as it is a w3d object that
- // has no dx8 resources. jba.
-}
-
-//=============================================================================
-// GrannyRenderObjClassSystem::init
-//=============================================================================
-/** initialize the system, allocate all the render objects we will need */
-//=============================================================================
-void GrannyRenderObjClassSystem::init()
-{
- const Int numModules=TheGlobalData->m_maxTerrainTracks;
-
- Int i;
- GrannyRenderObjClass *mod;
-
- ReAcquireResources();
- //go with a preset material for now.
- m_vertexMaterialClass=VertexMaterialClass::Get_Preset(VertexMaterialClass::PRELIT_DIFFUSE);
-
- //use a multi-texture shader: (text1*diffuse)*text2.
- m_shaderClass = ShaderClass::_PresetAlphaShader;//_PresetATestSpriteShader;//_PresetOpaqueShader;
-
- // we cannot initialize a system that is already initialized
- if( m_freeModules || m_usedModules )
- {
-
- // system already online!
- assert( 0 );
- return;
-
- } // end if
-
- // allocate our modules for this system
- for( i = 0; i < numModules; i++ )
- {
-
- mod = NEW_REF( GrannyRenderObjClass, () );
-
- if( mod == NULL )
- {
-
- // unable to allocate modules needed
- assert( 0 );
- return;
-
- } // end if
-
- mod->m_prevSystem = NULL;
- mod->m_nextSystem = m_freeModules;
- if( m_freeModules )
- m_freeModules->m_prevSystem = mod;
- m_freeModules = mod;
-
- } // end for i
-
-} // end init
-
-//=============================================================================
-// GrannyRenderObjClassSystem::shutdown
-//=============================================================================
-/** Shutdown and free all memory for this system */
-//=============================================================================
-void GrannyRenderObjClassSystem::shutdown( void )
-{
-
- REF_PTR_RELEASE(m_indexBuffer);
- REF_PTR_RELEASE(m_vertexMaterialClass);
- REF_PTR_RELEASE(m_vertexBuffer);
-
-} // end shutdown
-
-//=============================================================================
-// GrannyRenderObjClassSystem::update
-//=============================================================================
-/** Update the state of all active track marks - fade, expire, etc. */
-//=============================================================================
-void GrannyRenderObjClassSystem::update()
-{
-
- Int iTime=timeGetTime();
-}
-
-
-//=============================================================================
-// GrannyRenderObjClassSystem::flush
-//=============================================================================
-/** Draw all active track marks for this frame */
-//=============================================================================
-void GrannyRenderObjClassSystem::flush()
-{
- Int diffuseLight;
- GrannyRenderObjClass *mod=0;
-
- // adjust shading for time of day.
- Real shadeR, shadeG, shadeB;
- shadeR = TheGlobalData->m_terrainAmbientRed;
- shadeG = TheGlobalData->m_terrainAmbientGreen;
- shadeB = TheGlobalData->m_terrainAmbientBlue;
- shadeR += TheGlobalData->m_terrainDiffuseRed/2;
- shadeG += TheGlobalData->m_terrainDiffuseGreen/2;
- shadeB += TheGlobalData->m_terrainDiffuseBlue/2;
- shadeR*=255.0f;
- shadeG*=255.0f;
- shadeB*=255.0f;
-
- diffuseLight=(int)shadeB | ((int)shadeG << 8) | ((int)shadeR << 16);
-
- //check if there is anything to draw and fill vertex buffer
- {
- DX8VertexBufferClass::WriteLockClass lockVtxBuffer(m_vertexBuffer);
- VertexFormatXYZDUV1 *verts = (VertexFormatXYZDUV1*)lockVtxBuffer.Get_Vertex_Array();
-
- }//edges to flush
-
- //draw the filled vertex buffers
- {
- ShaderClass::Invalidate();
- DX8Wrapper::Set_Material(m_vertexMaterialClass);
- DX8Wrapper::Set_Shader(m_shaderClass);
- DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0);
- DX8Wrapper::Set_Vertex_Buffer(m_vertexBuffer);
-
- Matrix3D tm(mod->Transform);
- DX8Wrapper::Set_Transform(D3DTS_WORLD,tm);
- DX8Wrapper::Set_Index_Buffer_Index_Offset(0);
- DX8Wrapper::Draw_Triangles( 0,2, 0, 1*2);
-
- } //there are some edges to render in pool.
-}
-
-//=============================================================================
-// GrannyRenderObjClassSystem::createRenderObj
-//=============================================================================
-/** Creates an instance of a W3D render object using the specified granny */
-/* model. If the model doesn't exist yet, it will be loaded from disk. */
-//=============================================================================
-RenderObjClass *GrannyRenderObjClassSystem::createRenderObj(const char * name)
-{
-
- return NULL;
-}
-
-GrannyRenderObjClassSystem *TheGrannyRenderObjClassSystem=NULL; ///< singleton for track drawing system.
-
-#endif //end of GrannyRenderObjClassSystem
-
-#endif //INCLUDE_GRANNY_IN_BUILD
\ No newline at end of file
diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp
index 478dd288c61..8e27a31eff6 100644
--- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp
+++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp
@@ -40,7 +40,6 @@
//-------------------------------------------------------------------------------------------------
-#include "Common/QuickTrig.h"
W3DParticleSystemManager::W3DParticleSystemManager()
{
m_pointGroup = NULL;
diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp
index 07b49e6bfa3..ce47b3c99aa 100644
--- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp
+++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp
@@ -49,7 +49,6 @@
#include "W3DDevice/GameClient/HeightMap.h"
#include "W3DDevice/GameClient/W3DScene.h"
#include "W3DDevice/GameClient/W3DDynamicLight.h"
-#include "W3DDevice/GameClient/W3DGranny.h"
#include "W3DDevice/GameClient/W3DShadow.h"
#include "W3DDevice/GameClient/W3DStatusCircle.h"
#include "W3DDevice/GameClient/W3DCustomScene.h"
diff --git a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp
index a19d2f041c9..a1229875079 100644
--- a/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp
+++ b/Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp
@@ -48,7 +48,6 @@
#include "W3DDevice/GameClient/W3DDisplay.h"
#include "W3DDevice/GameClient/W3DDebugIcons.h"
#include "W3DDevice/GameClient/W3DTerrainTracks.h"
-#include "W3DDevice/GameClient/W3DGranny.h"
#include "W3DDevice/GameClient/W3DShadow.h"
#include "W3DDevice/GameClient/HeightMap.h"
#include "WW3D2/light.h"
diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt
index a7da3f3648c..70db34152ed 100644
--- a/GeneralsMD/Code/GameEngine/CMakeLists.txt
+++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt
@@ -89,7 +89,6 @@ set(GAMEENGINE_SRC
Include/Common/PlayerTemplate.h
Include/Common/ProductionPrerequisite.h
Include/Common/QuickmatchPreferences.h
- Include/Common/QuickTrig.h
Include/Common/QuotedPrintable.h
Include/Common/Radar.h
Include/Common/RAMFile.h
@@ -113,7 +112,6 @@ set(GAMEENGINE_SRC
Include/Common/StatsCollector.h
Include/Common/STLTypedefs.h
Include/Common/StreamingArchiveFile.h
- Include/Common/string.h
Include/Common/SubsystemInterface.h
Include/Common/SystemInfo.h
Include/Common/Team.h
@@ -156,7 +154,6 @@ set(GAMEENGINE_SRC
Include/GameClient/DisplayStringManager.h
Include/GameClient/Drawable.h
Include/GameClient/DrawableInfo.h
- Include/GameClient/DrawableManager.h
Include/GameClient/DrawGroupInfo.h
Include/GameClient/EstablishConnectionsMenu.h
Include/GameClient/Eva.h
@@ -633,7 +630,6 @@ set(GAMEENGINE_SRC
Source/Common/System/AsciiString.cpp
Source/Common/System/BuildAssistant.cpp
Source/Common/System/CDManager.cpp
- Source/Common/System/Compression.cpp
Source/Common/System/CopyProtection.cpp
Source/Common/System/CriticalSection.cpp
Source/Common/System/DataChunk.cpp
@@ -654,7 +650,6 @@ set(GAMEENGINE_SRC
Source/Common/System/LocalFileSystem.cpp
#Source/Common/System/MemoryInit.cpp
Source/Common/System/ObjectStatusTypes.cpp
- Source/Common/System/QuickTrig.cpp
Source/Common/System/QuotedPrintable.cpp
Source/Common/System/Radar.cpp
Source/Common/System/RAMFile.cpp
@@ -664,7 +659,6 @@ set(GAMEENGINE_SRC
Source/Common/System/Snapshot.cpp
Source/Common/System/StackDump.cpp
Source/Common/System/StreamingArchiveFile.cpp
- Source/Common/System/String.cpp
Source/Common/System/SubsystemInterface.cpp
Source/Common/System/Trig.cpp
Source/Common/System/UnicodeString.cpp
@@ -687,12 +681,10 @@ set(GAMEENGINE_SRC
Source/GameClient/Display.cpp
Source/GameClient/DisplayString.cpp
Source/GameClient/DisplayStringManager.cpp
- Source/GameClient/Drawable/DrawableManager.cpp
Source/GameClient/Drawable/Update/AnimatedParticleSysBoneClientUpdate.cpp
Source/GameClient/Drawable/Update/BeaconClientUpdate.cpp
Source/GameClient/Drawable/Update/SwayClientUpdate.cpp
Source/GameClient/Drawable.cpp
- Source/GameClient/DrawableManager.cpp
Source/GameClient/DrawGroupInfo.cpp
Source/GameClient/Eva.cpp
Source/GameClient/FXList.cpp
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/QuickTrig.h b/GeneralsMD/Code/GameEngine/Include/Common/QuickTrig.h
deleted file mode 100644
index bf909a2ee90..00000000000
--- a/GeneralsMD/Code/GameEngine/Include/Common/QuickTrig.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
-** Command & Conquer Generals Zero Hour(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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-// FILE: QuickTrig.h ////////////////////////////////////////////////////////////////////////////////
-// Author: Mark Lorenzen (adapted by srj)
-// Desc: fast trig
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-
-#pragma once
-
-#ifndef __QUICKTRIG_H_
-#define __QUICKTRIG_H_
-
-// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
-
-//-----------------------------------------------------------------------------
-
-extern Real TheQuickSinTable[];
-extern Real TheQuickTanTable[];
-
-// yes, Real. No, really.
-extern Real TheQuickSinTableCount;
-extern Real TheQuickTanTableCount;
-
-//-----------------------------------------------------------------------------
-
-#define QUARTER_CIRCLE (PI/2)
-
-//-----------------------------------------------------------------------------
-// quick magnitude estimation, without the square root
-// NOTE, this is a very rough estimate, and may be off by 10% or more, so
-// use it only when you don't need accuracy
-//-----------------------------------------------------------------------------
-inline Real QMag(Real x, Real y, Real z)
-{
- Real sTempV;
-
- Real sMaxV = fabs(x);
- Real sMedV = fabs(y);
- Real sMinV = fabs(z);
-
- if (sMaxV < sMedV)
- {
- sTempV = sMaxV;
- sMaxV = sMedV;
- sMedV = sTempV;
- }
-
- if (sMaxV < sMinV)
- {
- sTempV = sMaxV;
- sMaxV = sMinV;
- sMinV = sTempV;
- }
-
- sMedV += sMinV;
- sMaxV += (sMedV*0.25f);
-
- return sMaxV;
-}
-
-//-----------------------------------------------------------------------------
-// table based trig functions
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-inline Real QSin(Real a)
-{
- register Real angle = a;
- register long sgn = 1;
-
- if (angle < 0) // DO POSITIVE MATH AND PRESERVE SIGN
- {
- sgn = -1;
- angle = -angle;
- }
-
- while ( angle > (PI)) // MODULATE ANGLE INTO RANGE OF PI
- {
- angle -= PI;
- sgn = -sgn;
- }
-
- if (angle > PI/2)
- {
- angle = PI - angle; // FLIP
- }
-
- register int index = REAL_TO_INT((angle/QUARTER_CIRCLE) * TheQuickTanTableCount);
- register Real x = TheQuickSinTable[index];
-
- return x * sgn;
-
- /*
- Real remainder = node - index;
- Real next = TheQuickSinTable[index + 1];
- Real range = next - x;
- Real scalar = remainder / SIN_TABLE_BRACKET;
- Real finetune = scalar * range;
- x += finetune;
- */
-
-}
-
-//-----------------------------------------------------------------------------
-inline Real QCos(Real angle)
-{
- return QSin((QUARTER_CIRCLE) - angle);
-}
-
-//-----------------------------------------------------------------------------
-inline Real QTan(Real angle)
-{
- return TheQuickTanTable[REAL_TO_INT(angle * TheQuickSinTableCount)];
-}
-
-//-----------------------------------------------------------------------------
-inline Real QCsc(Real angle)
-{
- return 1.0f / QSin(angle);
-}
-
-//-----------------------------------------------------------------------------
-inline Real QSec(Real angle)
-{
- return 1.0f / QCos(angle);
-}
-
-//-----------------------------------------------------------------------------
-inline Real QCot(Real angle)
-{
- return 1.0f / QTan(angle);
-}
-
-#endif
-
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/string.h b/GeneralsMD/Code/GameEngine/Include/Common/string.h
deleted file mode 100644
index e6d9c9bce71..00000000000
--- a/GeneralsMD/Code/GameEngine/Include/Common/string.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
-** Command & Conquer Generals Zero Hour(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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-//----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright(C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: String
-//
-// File name: wsys/string.h
-//
-// Created: 11/02/01
-//
-//----------------------------------------------------------------------------
-
-#pragma once
-
-#ifndef __WSYS_STRING_H
-#define __WSYS_STRING_H
-
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include "Lib/BaseType.h"
-
-//----------------------------------------------------------------------------
-// Forward References
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Type Defines
-//----------------------------------------------------------------------------
-
-
-class WSYS_String
-{
- protected:
-
- Char *m_data; ///< actual string data
-
- public:
-
- explicit WSYS_String(const Char *string = NULL);
- ~WSYS_String();
-
- // operators
- Bool operator== (const char *rvalue) const;
- Bool operator!= (const char *rvalue) const;
- const WSYS_String& operator= (const WSYS_String &string);
- const WSYS_String& operator= (const Char *string);
- const WSYS_String& operator+= (const WSYS_String &string);
- const WSYS_String& operator+= (const Char *string);
- friend WSYS_String operator+ (const WSYS_String &string1, const WSYS_String &string2);
- friend WSYS_String operator+ (const Char *string1, const WSYS_String &string2);
- friend WSYS_String operator+ (const WSYS_String &string1, const Char *string2);
- const Char & operator[] (Int index) const;
- Char & operator[] (Int index);
- operator const Char * (void) const;
- operator Char * (void) const ;
-
- // methods
- void makeUpperCase( void );
- void makeLowerCase( void );
- Int length(void) const;
- Bool isEmpty(void) const;
- Int _cdecl format(const Char *format, ...);
- void set( const Char *string );
- Char* get( void ) const;
-};
-
-
-
-//----------------------------------------------------------------------------
-// Inlining
-//----------------------------------------------------------------------------
-
-inline Char* WSYS_String::get( void ) const { return m_data;};
-inline const Char& WSYS_String::operator[] (Int index) const{ return m_data[index];};
-inline Char& WSYS_String::operator[] (Int index) { return m_data[index];};
-inline WSYS_String::operator const Char * (void) const { return m_data;};
-inline WSYS_String::operator Char * (void) const {return m_data;};
-
-
-#endif // __WSYS_STRING_H
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/DrawableManager.h b/GeneralsMD/Code/GameEngine/Include/GameClient/DrawableManager.h
deleted file mode 100644
index 163997f2930..00000000000
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/DrawableManager.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-** Command & Conquer Generals Zero Hour(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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Compression.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Compression.cpp
deleted file mode 100644
index 4281f30a46b..00000000000
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/Compression.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
-** Command & Conquer Generals Zero Hour(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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-// FILE: Compression.cpp /////////////////////////////////////////////////////
-// Author: Matthew D. Campbell
-//////////////////////////////////////////////////////////////////////////////
-
-#include "PreRTS.h"
-#include "Compression.h"
-
-#ifdef _INTERNAL
-// for occasional debugging...
-//#pragma optimize("", off)
-//#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes")
-#endif
-
-
-///////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////
-///// Performance Testing ///////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////////////////////////////////////////////////////////
-
-//#define TEST_COMPRESSION
-#ifdef TEST_COMPRESSION
-
-#include "GameClient/MapUtil.h"
-#include "Common/FileSystem.h"
-#include "Common/file.h"
-
-#include "Common/PerfTimer.h"
-enum { NUM_TIMES = 1 };
-
-struct CompData
-{
-public:
- Int origSize;
- Int compressedSize[COMPRESSION_MAX+1];
-};
-
-#define TEST_COMPRESSION_MIN COMPRESSION_BTREE
-#define TEST_COMPRESSION_MAX COMPRESSION_MAX
-
-void DoCompressTest( void )
-{
-
- Int i;
-
- /*
- PerfGather *s_compressGathers[TEST_COMPRESSION_MAX+1];
- PerfGather *s_decompressGathers[TEST_COMPRESSION_MAX+1];
- for (i = TEST_COMPRESSION_MIN; i < TEST_COMPRESSION_MAX+1; ++i)
- {
- s_compressGathers[i] = new PerfGather(CompressionManager::getCompressionNameByType((CompressionType)i));
- s_decompressGathers[i] = new PerfGather(CompressionManager::getDecompressionNameByType((CompressionType)i));
- }
- */
-
- std::map s_sizes;
-
- std::map::const_iterator it = TheMapCache->find("userdata\\maps\\_usa01\\_usa01.map");
- if (it != TheMapCache->end())
- {
- //if (it->second.m_isOfficial)
- //{
- //++it;
- //continue;
- //}
- //static Int count = 0;
- //if (count++ > 2)
- //break;
- File *f = TheFileSystem->openFile(it->first.str());
- if (f)
- {
- DEBUG_LOG(("***************************\nTesting '%s'\n\n", it->first.str()));
- Int origSize = f->size();
- UnsignedByte *buf = (UnsignedByte *)f->readEntireAndClose();
- UnsignedByte *uncompressedBuf = NEW UnsignedByte[origSize];
-
- CompData d = s_sizes[it->first];
- d.origSize = origSize;
- d.compressedSize[COMPRESSION_NONE] = origSize;
-
- for (i=TEST_COMPRESSION_MIN; i<=TEST_COMPRESSION_MAX; ++i)
- {
- DEBUG_LOG(("=================================================\n"));
- DEBUG_LOG(("Compression Test %d\n", i));
-
- Int maxCompressedSize = CompressionManager::getMaxCompressedSize( origSize, (CompressionType)i );
- DEBUG_LOG(("Orig size is %d, max compressed size is %d bytes\n", origSize, maxCompressedSize));
-
- UnsignedByte *compressedBuf = NEW UnsignedByte[maxCompressedSize];
- memset(compressedBuf, 0, maxCompressedSize);
- memset(uncompressedBuf, 0, origSize);
-
- Int compressedLen, decompressedLen;
-
- for (Int j=0; j < NUM_TIMES; ++j)
- {
- //s_compressGathers[i]->startTimer();
- compressedLen = CompressionManager::compressData((CompressionType)i, buf, origSize, compressedBuf, maxCompressedSize);
- //s_compressGathers[i]->stopTimer();
- //s_decompressGathers[i]->startTimer();
- decompressedLen = CompressionManager::decompressData(compressedBuf, compressedLen, uncompressedBuf, origSize);
- //s_decompressGathers[i]->stopTimer();
- }
- d.compressedSize[i] = compressedLen;
- DEBUG_LOG(("Compressed len is %d (%g%% of original size)\n", compressedLen, (double)compressedLen/(double)origSize*100.0));
- DEBUG_ASSERTCRASH(compressedLen, ("Failed to compress\n"));
- DEBUG_LOG(("Decompressed len is %d (%g%% of original size)\n", decompressedLen, (double)decompressedLen/(double)origSize*100.0));
-
- DEBUG_ASSERTCRASH(decompressedLen == origSize, ("orig size does not match compressed+uncompressed output\n"));
- if (decompressedLen == origSize)
- {
- Int ret = memcmp(buf, uncompressedBuf, origSize);
- if (ret != 0)
- {
- DEBUG_CRASH(("orig buffer does not match compressed+uncompressed output - ret was %d\n", ret));
- }
- }
-
- delete compressedBuf;
- compressedBuf = NULL;
- }
-
- DEBUG_LOG(("d = %d -> %d\n", d.origSize, d.compressedSize[i]));
- s_sizes[it->first] = d;
- DEBUG_LOG(("s_sizes[%s] = %d -> %d\n", it->first.str(), s_sizes[it->first].origSize, s_sizes[it->first].compressedSize[i]));
-
- delete[] buf;
- buf = NULL;
-
- delete[] uncompressedBuf;
- uncompressedBuf = NULL;
- }
-
- ++it;
- }
-
- for (i=TEST_COMPRESSION_MIN; i<=TEST_COMPRESSION_MAX; ++i)
- {
- Real maxCompression = 1000.0f;
- Real minCompression = 0.0f;
- Int totalUncompressedBytes = 0;
- Int totalCompressedBytes = 0;
- for (std::map::iterator cd = s_sizes.begin(); cd != s_sizes.end(); ++cd)
- {
- CompData d = cd->second;
-
- Real ratio = d.compressedSize[i]/(Real)d.origSize;
- maxCompression = min(maxCompression, ratio);
- minCompression = max(minCompression, ratio);
-
- totalUncompressedBytes += d.origSize;
- totalCompressedBytes += d.compressedSize[i];
- }
- DEBUG_LOG(("***************************************************\n"));
- DEBUG_LOG(("Compression method %s:\n", CompressionManager::getCompressionNameByType((CompressionType)i)));
- DEBUG_LOG(("%d bytes compressed to %d (%g%%)\n", totalUncompressedBytes, totalCompressedBytes,
- totalCompressedBytes/(Real)totalUncompressedBytes*100.0f));
- DEBUG_LOG(("Min ratio: %g%%, Max ratio: %g%%\n",
- minCompression*100.0f, maxCompression*100.0f));
- DEBUG_LOG(("\n"));
- }
-
- /*
- PerfGather::dumpAll(10000);
- PerfGather::resetAll();
- CopyFile( "AAAPerfStats.csv", "AAACompressPerfStats.csv", FALSE );
-
- for (i = TEST_COMPRESSION_MIN; i < TEST_COMPRESSION_MAX+1; ++i)
- {
- delete s_compressGathers[i];
- s_compressGathers[i] = NULL;
-
- delete s_decompressGathers[i];
- s_decompressGathers[i] = NULL;
- }
- */
-
-}
-
-#endif // TEST_COMPRESSION
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/QuickTrig.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/QuickTrig.cpp
deleted file mode 100644
index ad0222b5977..00000000000
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/QuickTrig.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-** Command & Conquer Generals Zero Hour(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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-// FILE: QuickTrig.cpp ////////////////////////////////////////////////////////////////////////////////
-// Author: Mark Lorenzen (adapted by srj)
-// Desc: fast trig
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
-#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
-
-#include "Common/QuickTrig.h"
-
-// GLOBALS ////////////////////////////////////////////////////////////////////////////////////////
-
-Real TheQuickSinTable[] =
-{
- 0.00000f, 0.01237f, 0.02473f, 0.03710f, 0.04945f, 0.06180f, 0.07414f, 0.08647f,
- 0.09879f, 0.11109f, 0.12337f, 0.13563f, 0.14788f, 0.16010f, 0.17229f, 0.18446f,
- 0.19661f, 0.20872f, 0.22080f, 0.23284f, 0.24485f, 0.25683f, 0.26876f, 0.28065f,
- 0.29250f, 0.30431f, 0.31607f, 0.32778f, 0.33944f, 0.35104f, 0.36260f, 0.37410f,
- 0.38554f, 0.39692f, 0.40824f, 0.41950f, 0.43070f, 0.44183f, 0.45289f, 0.46388f,
- 0.47480f, 0.48565f, 0.49643f, 0.50712f, 0.51774f, 0.52829f, 0.53875f, 0.54913f,
- 0.55942f, 0.56963f, 0.57975f, 0.58978f, 0.59973f, 0.60958f, 0.61934f, 0.62900f,
- 0.63857f, 0.64804f, 0.65741f, 0.66668f, 0.67584f, 0.68491f, 0.69387f, 0.70272f,
- 0.71147f, 0.72010f, 0.72863f, 0.73705f, 0.74535f, 0.75354f, 0.76161f, 0.76957f,
- 0.77741f, 0.78513f, 0.79273f, 0.80020f, 0.80756f, 0.81479f, 0.82190f, 0.82888f,
- 0.83574f, 0.84247f, 0.84907f, 0.85554f, 0.86187f, 0.86808f, 0.87415f, 0.88009f,
- 0.88590f, 0.89157f, 0.89710f, 0.90250f, 0.90775f, 0.91287f, 0.91785f, 0.92269f,
- 0.92739f, 0.93195f, 0.93636f, 0.94063f, 0.94476f, 0.94874f, 0.95257f, 0.95626f,
- 0.95981f, 0.96321f, 0.96646f, 0.96956f, 0.97251f, 0.97532f, 0.97798f, 0.98048f,
- 0.98284f, 0.98505f, 0.98710f, 0.98901f, 0.99076f, 0.99236f, 0.99381f, 0.99511f,
- 0.99625f, 0.99725f, 0.99809f, 0.99878f, 0.99931f, 0.99969f, 0.99992f, 1.00000f,
- 0.99992f
-};
-
-Real TheQuickTanTable[] =
-{
- 0.00000f, 0.00787f, 0.01575f, 0.02363f, 0.03151f, 0.03939f, 0.04728f, 0.05517f,
- 0.06308f, 0.07099f, 0.07890f, 0.08683f, 0.09477f, 0.10272f, 0.11068f, 0.11866f,
- 0.12666f, 0.13466f, 0.14269f, 0.15073f, 0.15880f, 0.16688f, 0.17498f, 0.18311f,
- 0.19126f, 0.19943f, 0.20763f, 0.21586f, 0.22412f, 0.23240f, 0.24071f, 0.24906f,
- 0.25744f, 0.26585f, 0.27430f, 0.28279f, 0.29131f, 0.29987f, 0.30847f, 0.31712f,
- 0.32581f, 0.33454f, 0.34332f, 0.35214f, 0.36102f, 0.36994f, 0.37892f, 0.38795f,
- 0.39704f, 0.40618f, 0.41539f, 0.42465f, 0.43398f, 0.44337f, 0.45282f, 0.46234f,
- 0.47194f, 0.48160f, 0.49134f, 0.50115f, 0.51104f, 0.52101f, 0.53106f, 0.54120f,
- 0.55143f, 0.56174f, 0.57214f, 0.58264f, 0.59324f, 0.60393f, 0.61473f, 0.62563f,
- 0.63664f, 0.64777f, 0.65900f, 0.67035f, 0.68183f, 0.69342f, 0.70515f, 0.71700f,
- 0.72899f, 0.74112f, 0.75339f, 0.76581f, 0.77838f, 0.79110f, 0.80398f, 0.81703f,
- 0.83025f, 0.84363f, 0.85720f, 0.87096f, 0.88490f, 0.89904f, 0.91338f, 0.92793f,
- 0.94269f, 0.95767f, 0.97288f, 0.98833f, 1.00401f, 1.01995f, 1.03615f, 1.05261f,
- 1.06935f, 1.08637f, 1.10368f, 1.12130f, 1.13924f, 1.15749f, 1.17609f, 1.19503f,
- 1.21433f, 1.23400f, 1.25406f, 1.27452f, 1.29540f, 1.31670f, 1.33845f, 1.36067f,
- 1.38336f, 1.40656f, 1.43027f, 1.45453f, 1.47935f, 1.50475f, 1.53076f, 1.55741f,
- 1.58471f
-};
-
-// yes, Real. No, really.
-Real TheQuickSinTableCount = sizeof(TheQuickSinTable) / sizeof(Real);
-Real TheQuickTanTableCount = sizeof(TheQuickTanTable) / sizeof(Real);
-
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/String.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/String.cpp
deleted file mode 100644
index 4caf71a3aef..00000000000
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/String.cpp
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
-** Command & Conquer Generals Zero Hour(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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-//----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright (C) 2001 - All Rights Reserved
-//
-//----------------------------------------------------------------------------
-//
-// Project: WSYS Library
-//
-// Module: String
-//
-// File name: WSYS_String.cpp
-//
-// Created: 11/5/01 TR
-//
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-// Includes
-//----------------------------------------------------------------------------
-
-#include "PreRTS.h"
-#include
-#include
-#include
-#include
-
-#include "Common/string.h"
-
-// 'assignment within condition expression'.
-#pragma warning(disable : 4706)
-
-//----------------------------------------------------------------------------
-// Externals
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Defines
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Types
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Public Data
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Prototypes
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Private Functions
-//----------------------------------------------------------------------------
-
-
-
-//----------------------------------------------------------------------------
-// Public Functions
-//----------------------------------------------------------------------------
-
-
-//============================================================================
-// WSYS_String::WSYS_String
-//============================================================================
-
-WSYS_String::WSYS_String(const Char *string)
-: m_data(NULL)
-{
- set(string);
-}
-
-//============================================================================
-// WSYS_String::~WSYS_String
-//============================================================================
-
-WSYS_String::~WSYS_String()
-{
- delete [] m_data;
-}
-
-//============================================================================
-// WSYS_String::operator==
-//============================================================================
-
-Bool WSYS_String::operator== (const char *rvalue) const
-{
- return strcmp( get(), rvalue) == 0;
-}
-
-//============================================================================
-// WSYS_String::operator!=
-//============================================================================
-
-Bool WSYS_String::operator!= (const char *rvalue) const
-{
- return strcmp( get(), rvalue) != 0;
-}
-
-//============================================================================
-// WSYS_String::operator=
-//============================================================================
-
-const WSYS_String& WSYS_String::operator= (const WSYS_String &string)
-{
- set( string.get());
- return (*this);
-}
-
-//============================================================================
-// WSYS_String::operator=
-//============================================================================
-
-const WSYS_String& WSYS_String::operator= (const Char *string)
-{
- set( string );
- return (*this);
-}
-
-//============================================================================
-// WSYS_String::operator+=
-//============================================================================
-
-const WSYS_String& WSYS_String::operator+= (const WSYS_String &string)
-{
- Char *buffer = MSGNEW("WSYS_String") Char [ length() + string.length() + 1 ]; // pool[]ify
-
- if ( buffer != NULL )
- {
- strcpy( buffer, m_data );
- strcat( buffer, string.get() );
- delete [] m_data;
- m_data = buffer;
- }
-
- return (*this);
-}
-
-//============================================================================
-// WSYS_String::operator+=
-//============================================================================
-
-const WSYS_String& WSYS_String::operator+= (const Char *string)
-{
- if ( string != NULL )
- {
- Char *buffer = MSGNEW("WSYS_String") Char [ length() + strlen( string ) + 1 ];
-
- if ( buffer != NULL )
- {
- strcpy( buffer, m_data );
- strcat( buffer, string );
- delete [] m_data;
- m_data = buffer;
- }
- }
-
- return (*this);
-}
-
-//============================================================================
-// operator+ (const WSYS_String &string1, const WSYS_String &string2)
-//============================================================================
-
-WSYS_String operator+ (const WSYS_String &string1, const WSYS_String &string2)
-{
- WSYS_String temp(string1);
- temp += string2;
- return temp;
-
-}
-
-//============================================================================
-// operator+ (const Char *string1, const WSYS_String &string2)
-//============================================================================
-
-WSYS_String operator+ (const Char *string1, const WSYS_String &string2)
-{
- WSYS_String temp(string1);
- temp += string2;
- return temp;
-}
-
-//============================================================================
-// operator+ (const WSYS_String &string1, const Char *string2)
-//============================================================================
-
-WSYS_String operator+ (const WSYS_String &string1, const Char *string2)
-{
- WSYS_String temp(string1);
- temp += string2;
- return temp;
-}
-
-//============================================================================
-// WSYS_String::length
-//============================================================================
-
-Int WSYS_String::length(void) const
-{
- return strlen( m_data );
-}
-
-//============================================================================
-// WSYS_String::isEmpty
-//============================================================================
-
-Bool WSYS_String::isEmpty(void) const
-{
- return m_data[0] == 0;
-}
-
-//============================================================================
-// WSYS_String::format
-//============================================================================
-
-Int _cdecl WSYS_String::format(const Char *format, ...)
-{
- Int result = 0;
- char *buffer = MSGNEW("WSYS_String") char[100*1024];
-
- if ( buffer )
- {
- va_list args;
- va_start( args, format ); /* Initialize variable arguments. */
- result = vsprintf ( buffer, format, args );
- va_end( args );
- set( buffer );
- delete [] buffer;
- }
- else
- {
- set("");
- }
-
- return result;
-}
-
-//============================================================================
-// WSYS_String::set
-//============================================================================
-
-void WSYS_String::set( const Char *string )
-{
- delete [] m_data;
-
- if ( string == NULL )
- {
- string = "";
- }
-
- m_data = MSGNEW("WSYS_String") Char [ strlen(string) + 1];
- strcpy ( m_data, string );
-}
-
-
-//============================================================================
-// WSYS_String::makeUpperCase
-//============================================================================
-
-void WSYS_String::makeUpperCase( void )
-{
- Char *chr = m_data;
- Char ch;
-
- while( (ch = *chr) )
- {
- *chr++ = (Char) toupper( ch );
- }
-}
-
-//============================================================================
-// WSYS_String::makeLowerCase
-//============================================================================
-
-void WSYS_String::makeLowerCase( void )
-{
- Char *chr = m_data;
- Char ch;
-
- while( (ch = *chr) )
- {
- *chr++ = (Char) tolower( ch );
- }
-}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/DrawableManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/DrawableManager.cpp
deleted file mode 100644
index 3b3d12850b1..00000000000
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable/DrawableManager.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-** Command & Conquer Generals Zero Hour(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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
-
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/DrawableManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/DrawableManager.cpp
deleted file mode 100644
index 2e59c97790c..00000000000
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/DrawableManager.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-** Command & Conquer Generals Zero Hour(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 .
-*/
-
-// DrawableManager.cpp
-// Message stream translator
-// Author: Michael S. Booth, March 2001
-
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp
index 6cd4d195070..a9574d3e574 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/TensileFormationUpdate.cpp
@@ -31,7 +31,6 @@
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
#include "Common/Xfer.h"
-#include "Common/QuickTrig.h"
#include "Common/AudioEventRTS.h"
#include "GameLogic/Object.h"
diff --git a/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt b/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt
index b8693d33cf6..d68e153a3ad 100644
--- a/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt
+++ b/GeneralsMD/Code/GameEngineDevice/CMakeLists.txt
@@ -50,7 +50,6 @@ set(GAMEENGINEDEVICE_SRC
Include/W3DDevice/GameClient/W3DGameFont.h
Include/W3DDevice/GameClient/W3DGameWindow.h
Include/W3DDevice/GameClient/W3DGameWindowManager.h
- Include/W3DDevice/GameClient/W3DGranny.h
Include/W3DDevice/GameClient/W3DGUICallbacks.h
Include/W3DDevice/GameClient/W3DInGameUI.h
Include/W3DDevice/GameClient/W3DMirror.h
@@ -157,7 +156,6 @@ set(GAMEENGINEDEVICE_SRC
Source/W3DDevice/GameClient/W3DDynamicLight.cpp
Source/W3DDevice/GameClient/W3DFileSystem.cpp
Source/W3DDevice/GameClient/W3DGameClient.cpp
- Source/W3DDevice/GameClient/W3DGranny.cpp
Source/W3DDevice/GameClient/W3DInGameUI.cpp
Source/W3DDevice/GameClient/W3DMouse.cpp
Source/W3DDevice/GameClient/W3DParticleSys.cpp
diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGranny.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGranny.h
deleted file mode 100644
index b5c6677f50f..00000000000
--- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGranny.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
-** Command & Conquer Generals Zero Hour(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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-#include "always.h"
-#include "hanim.h"
-#include "proto.h"
-#include "rendobj.h"
-#include "lightenvironment.h"
-#include "w3d_file.h"
-#include "dx8vertexbuffer.h"
-#include "dx8indexbuffer.h"
-#include "shader.h"
-#include "vertmaterial.h"
-#include "Lib/BaseType.h"
-
-#pragma once
-
-#ifndef __W3DGRANNY_H_
-#define __W3DGRANNY_H_
-
-#ifdef INCLUDE_GRANNY_IN_BUILD
-
-#include "granny.h"
-
-class GrannyRenderObjSystem; ///Set_Shininess(0.0);
- m_vertexMaterial->Set_Specular(0,0,0);
- m_vertexMaterial->Set_Lighting(true);
- }
-
- struct grannyMeshDesc
- {
- const UnsignedInt *index; ///< pointer to pool of face indices
- Int indexCount; ///< number of face indices in this mesh
- const granny_pnt332_vertex *vertex; ///< pointer to pool of mesh vertices
- Int vertexCount; ///< number of vertices in this mesh.
- };
-
- virtual ~GrannyPrototypeClass(void) { if (m_vertexMaterial) REF_PTR_RELEASE (m_vertexMaterial); if (m_file) GrannyFreeFile(m_file); }
- virtual const char * Get_Name(void) const { return m_name; }
- virtual int Get_Class_ID(void) const { return RenderObjClass::CLASSID_UNKNOWN; }
- virtual RenderObjClass * Create(void) { return NEW_REF( GrannyRenderObjClass, (*this) ); }
- void Set_Name(char *name) {strcpy(m_name,name);}
- void setBoundingBox(AABoxClass & box) {m_boundingBox=box;}
- void setBoundingSphere(SphereClass & sphere) {m_boundingSphere=sphere;}
- void setVertexCount(Int vertexCount) {m_vertexCount=vertexCount;}
- void setIndexCount(Int indexCount) {m_indexCount=indexCount;}
- void setMeshCount(Int meshCount) {m_meshCount=meshCount;}
- void setMeshData(grannyMeshDesc &meshdesc, Int index) {m_meshData[index]=meshdesc;}
- const UnsignedInt *getMeshIndexList(int index) const { if (index < m_meshCount) return m_meshData[0].index; else return NULL;}
- const granny_pnt332_vertex *getMeshVertexList(int index) const { if (index < m_meshCount) return m_meshData[0].vertex; else return NULL;}
- const Int getIndexCount(void) const {return m_indexCount;} //return total number of indices in model
-
-private:
- granny_file *m_file; ///
-#include "W3DDevice/GameClient/W3DGranny.h"
#include "Common/PerfTimer.h"
#include "Common/GlobalData.h"
#include "Common/GameCommon.h"
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGranny.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGranny.cpp
deleted file mode 100644
index 4311284a3b3..00000000000
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGranny.cpp
+++ /dev/null
@@ -1,1124 +0,0 @@
-/*
-** Command & Conquer Generals Zero Hour(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 .
-*/
-
-////////////////////////////////////////////////////////////////////////////////
-// //
-// (c) 2001-2003 Electronic Arts Inc. //
-// //
-////////////////////////////////////////////////////////////////////////////////
-
-// FILE: W3DGranny.cpp ////////////////////////////////////////////////
-//-----------------------------------------------------------------------------
-//
-// Westwood Studios Pacific.
-//
-// Confidential Information
-// Copyright (C) 2001 - All Rights Reserved
-//
-//-----------------------------------------------------------------------------
-//
-// Project: RTS3
-//
-// File name: W3DGranny.cpp
-//
-// Created: Mark Wilczynski, Sep 2001
-//
-// Desc: Methods for using Granny models within the W3D engine.
-//-----------------------------------------------------------------------------
-
-#ifdef INCLUDE_GRANNY_IN_BUILD
-
-#include "W3DDevice/GameClient/W3DGranny.h"
-#include "Common/GlobalData.h"
-#include "texture.h"
-#include "colmath.h"
-#include "coltest.h"
-#include "rinfo.h"
-#include "camera.h"
-#include "assetmgr.h"
-#include "WW3D2/dx8wrapper.h"
-#include "WW3D2/scene.h"
-
-static granny_pnt332_vertex g_blendingBuffer[4096]; ///TrackGroupCount;
- ++TrackGroupIndex)
- {
- if(strcmp(Animation->TrackGroups[TrackGroupIndex]->Name,
- GrannyGetSourceModel(ModelInstance)->Name) == 0)
- {
- return(TrackGroupIndex);
- }
- }}
- }
-
- return(-1);
-}
-
-/** Local function used to modify the original granny data - flip coordintes, scale, etc. */
-static void TransformFile(granny_file_info *FileInfo)
-{
- float Origin[] = {0, 0, 0};
- float RightVector[] = {1, 0, 0}; //x
- float UpVector[] = {0, 0, 1}; //y
- float BackVector[] = {0, -1, 0};//z
-
- return;
-
- float Affine3[3];
- float Linear3x3[3][3];
- float InverseLinear3x3[3][3];
- GrannyAutoComputeBasisConversion(FileInfo, 1.0f,
- Origin,
- RightVector,
- UpVector,
- BackVector,
- Affine3, (float *)Linear3x3,
- (float *)InverseLinear3x3);
-
- GrannyAutoTransformFile(FileInfo, Affine3,
- (float *)Linear3x3,
- (float *)InverseLinear3x3);
-}
-
-//=============================================================================
-// GrannyRenderObjClass::~GrannyRenderObjClass
-//=============================================================================
-/** Destructor. Releases w3d/granny assets. */
-//=============================================================================
-GrannyRenderObjClass::~GrannyRenderObjClass(void)
-{
- if (m_animationControl)
- GrannyFreeControl(m_animationControl);
- if (m_modelInstance)
- GrannyFreeModelInstance(m_modelInstance);
- freeResources();
-}
-
-//=============================================================================
-// GrannyRenderObjClass::GrannyRenderObjClass
-//=============================================================================
-/** Constructor. Creates an instance of the prototype. */
-//=============================================================================
-GrannyRenderObjClass::GrannyRenderObjClass(const GrannyPrototypeClass &proto)
-:m_prototype(proto)
-{
- granny_file_info *fileInfo = GrannyGetFileInfo((granny_file *)proto.m_file);
- m_boundingBox = proto.m_boundingBox;
- m_boundingSphere = proto.m_boundingSphere;
- m_vertexCount = proto.m_vertexCount;
- m_animationControl = NULL; //no animation playing by default
-
- if (fileInfo)
- {
- //Find the skinned model
- for (Int modelIndex=0; modelIndexModelCount; modelIndex++)
- {
- granny_model *sourceModel = fileInfo->Models[modelIndex];
- //ignore bounding boxes since they are never rendered
- if (stricmp(sourceModel->Name,"AABOX") != 0)
- m_modelInstance = GrannyInstantiateModel(fileInfo->Models[modelIndex]);
- }
-
- if(m_modelInstance)
- {
- //assign textures to the model
- GrannyAutoBindModel(m_modelInstance, _GrannyLoader.Get_Material_Library(), 1);
- // GrannyAddModelToScene(Global.Scene, ModelInstance); ///@todo: Create a granny scene for quicker updates.
-
- float *RootTransform = GrannyGetModelRootTransform(m_modelInstance);
-
- RootTransform[12] = 0;//x
- RootTransform[13] = 0;//y
- RootTransform[14] = 0;//z
- }//modelinstance*/
- }
-}
-
-/** Set scaling factor applied to prototype during rendering */
-void GrannyRenderObjClass::Set_ObjectScale(float scale)
-{
- ObjectScale=scale;
-
- //adjust bounding volumes we copied from non-scaled prototype.
-
- m_boundingBox.Center *= scale;
- m_boundingBox.Extent *= scale;
-
- ///@todo: Remove earlier hacks in W3D to get instance matrix scaling!
- ///After the W3D hacks are gone, we should also scale the radius here.
- m_boundingSphere.Center *= scale;
-}
-
-//=============================================================================
-// GrannyRenderObjClass::Get_Obj_Space_Bounding_Sphere
-//=============================================================================
-/** WW3D method that returns object bounding sphere used in frustum culling*/
-//=============================================================================
-void GrannyRenderObjClass::Get_Obj_Space_Bounding_Sphere(SphereClass & sphere) const
-{ sphere=m_boundingSphere;
-}
-
-//=============================================================================
-// GrannyRenderObjClass::Get_Obj_Space_Bounding_Box
-//=============================================================================
-/** WW3D method that returns object bounding box used in collision detection*/
-//=============================================================================
-void GrannyRenderObjClass::Get_Obj_Space_Bounding_Box(AABoxClass & box) const
-{
- box=m_boundingBox;
-}
-
-//=============================================================================
-// GrannyRenderObjClass::Cast_Ray
-//=============================================================================
-/** WW3D method that returns intersection point between ray and model.
- We will only return results of a simple 'pick box' - not full triangle level
- detail.
-*/
-//=============================================================================
-Bool GrannyRenderObjClass::Cast_Ray(RayCollisionTestClass & raytest)
-{
-
- if ((Get_Collision_Type() & raytest.CollisionType) == 0) return false;
-
- AABoxClass hbox=m_boundingBox;
-
- hbox.Transform(Get_Transform());
-
- if (CollisionMath::Collide(raytest.Ray,hbox,raytest.Result)) {
- raytest.CollidedRenderObj = this;
- return true;
- }
- return false;
-}
-
-//=============================================================================
-// GrannyRenderObjClass::Class_ID
-//=============================================================================
-/** returns the class id, so the scene can tell what kind of render object it has. */
-//=============================================================================
-Int GrannyRenderObjClass::Class_ID(void) const
-{
- return RenderObjClass::CLASSID_UNKNOWN;
-}
-
-//=============================================================================
-// GrannyRenderObjClass::Clone
-//=============================================================================
-/** Not used, but required virtual method. */
-//=============================================================================
-RenderObjClass * GrannyRenderObjClass::Clone(void) const
-{
- assert(false);
- return NULL;
-}
-
-//=============================================================================
-// GrannyRenderObjClass::freeResources
-//=============================================================================
-/** Free any W3D resources associated with this object */
-//=============================================================================
-Int GrannyRenderObjClass::freeResources(void)
-{
-// REF_PTR_RELEASE(m_stageZeroTexture);
-
- return 0;
-}
-
-/** W3D Method used to control the animation assocated with this render object. */
-void GrannyRenderObjClass::Set_Animation( HAnimClass * motion, float frame, int anim_mode)
-{
- GrannyAnimClass *gAnim=(GrannyAnimClass*)motion;
-
- granny_animation *Animation=gAnim->Animation;
-
- if(Animation)
- {
- Int trackIndex=-1;
- //Check if this animation works with this model
- trackIndex=FindTrackGroupFor(Animation,m_modelInstance);
-
- if(trackIndex != -1)
- {
- //stop previous animations
- if (m_animationControl)
- { GrannyFreeControl(m_animationControl);
- m_animationControl=NULL;
- }
-
- m_animationControl = GrannyPlayControlledAnimation(frame / gAnim->FrameRate, Animation, trackIndex, m_modelInstance, 0);
- if (m_animationControl)
- {
- GrannySetControlSpeed(m_animationControl, 1.0f); //play at normal speed
- if (anim_mode == ANIM_MODE_LOOP)
- GrannySetControlLooping(m_animationControl, true);
- else
- GrannySetControlLooping(m_animationControl, false);
- }
- }
- }
-}
-
-//=============================================================================
-// GrannyRenderObjClass::Render
-//=============================================================================
-/** Draws this render object to the screen.
-*/
-//=============================================================================
-void GrannyRenderObjClass::Render(RenderInfoClass & rinfo)
-{
- TheGrannyRenderObjSystem->AddRenderObject(rinfo, this);
- return;
-
- //update the model
- GrannySetModelClock(m_modelInstance, LastSyncTime);
- LastSyncTime = WW3D::Get_Sync_Time()*0.001f; //convert to seconds
-
- GrannySampleModelAnimations(m_modelInstance, 0, GrannyGetModelBoneCount(m_modelInstance),
- GrannyGetModelLocalPose(m_modelInstance));
- GrannyBuildModelWorldTransforms(m_modelInstance, 0,
- GrannyGetModelBoneCount(m_modelInstance),
- GrannyGetModelLocalPose(m_modelInstance),
- GrannyGetModelRootTransform(m_modelInstance),
- GrannyGetModelWorldPose(m_modelInstance));
-
- Real *RootTransform = GrannyGetModelRootTransform(m_modelInstance);
-
- RootTransform[12] = 0; //X
- RootTransform[13] = 0; //Y
- RootTransform[13] = 0; //Z
- RootTransform[0] = ObjectScale;
- RootTransform[5] = ObjectScale;
- RootTransform[10] = ObjectScale;
-
- Int MeshCount = GrannyGetModelMeshCount(m_modelInstance);
- for(Int MeshIndex = 0; MeshIndex < MeshCount; ++MeshIndex)
- {
- granny_mesh_instance *Mesh = (granny_mesh_instance *)GrannyGetModelMeshCookie(m_modelInstance, MeshIndex);
- granny_mesh_model_binding *Binding = GrannyGetMeshModelBinding(Mesh);
-
- granny_pnt332_vertex *Vertices = 0;
- if(GrannyMeshIsRigid(Mesh))
- { assert(0); //have not coded support for rigid meshes yet - only soft skinned supported.
-// granny_matrix_4x4 TempBuffer;
-// glMultMatrixf(GrannyGetRigidMeshTransform(
-// Binding, GrannyGetModelWorldPose(m_modelInstance),
-// (granny_real32 *)TempBuffer));
- Vertices = (granny_pnt332_vertex *)GrannyGetMeshVertices(Mesh);
- }
- else
- {
- GrannyDeformMesh(Binding, GrannyGetModelWorldPose(m_modelInstance),
- 0, g_blendingBuffer);
- Vertices = g_blendingBuffer;
- }
-
- int GroupCount = GrannyGetMeshTriangleGroupCount(Mesh);
- {for(Int GroupIndex = 0;
- GroupIndex < GroupCount;
- ++GroupIndex)
- {
- granny_material_instance *Material = (granny_material_instance *)
- GrannyGetMeshMaterialCookie(
- Mesh, GrannyGetMeshTriangleGroupMaterialIndex(
- Mesh, GroupIndex));
- if(Material)
- {
- Int TextureIndex;
- if(GrannyGetMaterialTextureIndexByType(
- Material, GrannyDiffuseColorTexture, &TextureIndex))
- {
- granny_texture_instance *TextureInstance =
- (granny_texture_instance *)GrannyGetMaterialTextureCookie(
- Material, TextureIndex);
-
- if(TextureInstance)
- {
- DX8Wrapper::Set_Texture(0, (TextureClass *)GrannyGetTextureCookie(TextureInstance));
- }
- else
- DX8Wrapper::Set_Texture(0, NULL);
- }
- }
-
- DynamicVBAccessClass vb_access(BUFFER_TYPE_DYNAMIC_DX8,dynamic_fvf_type,m_vertexCount);
- {
- DynamicVBAccessClass::WriteLockClass lock(&vb_access);
- VertexFormatXYZNDUV2* vb=lock.Get_Formatted_Vertex_Array();
- if(vb)
- {
- for (Int i=0; ix=Vertices->Position[0];
- vb->y=Vertices->Position[1];
- vb->z=Vertices->Position[2];
- vb->nx=Vertices->Normal[0];
- vb->ny=Vertices->Normal[1];
- vb->nz=Vertices->Normal[2];
- vb->diffuse=0xffffffff;
- vb->u1=Vertices->UV[0];
- vb->v1=Vertices->UV[1];
- vb++;
- Vertices++;
- }
- }
- }
-
- Int indexCount=GrannyGetMeshTriangleGroupIndexCount(Mesh, GroupIndex);
- UnsignedInt *indices=(UnsignedInt*)GrannyGetMeshTriangleGroupIndices(Mesh, GroupIndex);
-
- DynamicIBAccessClass ib_access(BUFFER_TYPE_DYNAMIC_DX8,indexCount);
- {
- DynamicIBAccessClass::WriteLockClass lock(&ib_access);
- unsigned short* ib=lock.Get_Index_Array();
-
- if(ib)
- {
- for (Int i=0; iTextureCount; ++TextureIndex)
- {
- _splitpath(fileInfo->Textures[TextureIndex]->FromFileName, drive, dir, fname, ext );
- TextureClass *TextureHandle=WW3DAssetManager::Get_Instance()->Get_Texture(strncat(fname,".tga",4));
- granny_texture_instance *TextureInstance = GrannyInstantiateTexture(fileInfo->Textures[TextureIndex]);
- GrannySetTextureCookie(TextureInstance, (granny_uint32)TextureHandle);
- GrannyAddTextureToLibrary(TextureLibrary,TextureInstance);
- }
-
- //Calculate bounding box and find maximum number of vertices needed to render mesh.
- for (Int modelIndex=0; modelIndexModelCount; modelIndex++)
- {
- granny_model *sourceModel = fileInfo->Models[modelIndex];
- if (stricmp(sourceModel->Name,"AABOX") == 0)
- { //found a collision box, copy out data
- int MeshCount = sourceModel->MeshBindingCount;
- if (MeshCount==1)
- {
- granny_mesh *sourceMesh = sourceModel->MeshBindings[0].Mesh;
- granny_pn33_vertex *Vertices = (granny_pn33_vertex *)sourceMesh->PrimaryVertexData->Vertices;
- Vector3 points[24];
-
- assert (sourceMesh->PrimaryVertexData->VertexCount <= 24);
-
- for (Int boxVertex=0; boxVertexPrimaryVertexData->VertexCount; boxVertex++)
- { points[boxVertex].Set(Vertices[boxVertex].Position[0],
- Vertices[boxVertex].Position[1],
- Vertices[boxVertex].Position[2]);
- }
- box.Init(points,sourceMesh->PrimaryVertexData->VertexCount);
- }
- }
- else
- { //mesh is part of model
- meshCount = sourceModel->MeshBindingCount;
-
- for (Int meshIndex=0; meshIndexMeshBindings[meshIndex].Mesh;
- meshData[meshIndex].vertex=NULL;
- meshData[meshIndex].vertexCount=0;
- if (sourceMesh->PrimaryVertexData)
- { vertexCount+=sourceMesh->PrimaryVertexData->VertexCount;
- meshData[meshIndex].vertex=(granny_pnt332_vertex *)sourceMesh->PrimaryVertexData->Vertices;
- meshData[meshIndex].vertexCount=sourceMesh->PrimaryVertexData->VertexCount;
- }
- meshData[meshIndex].index=NULL;
- meshData[meshIndex].indexCount=NULL;
- if (sourceMesh->PrimaryTopology)
- {
- assert (sourceMesh->PrimaryTopology->GroupCount == 1); //should only have 1 material per mesh!
- granny_tri_material_group &sourceGroup = sourceMesh->PrimaryTopology->Groups[0];
-
- // This is the texture index (relative to the array we just
- // built) for this group of triangles
- // SourceGroup.MaterialIndex;
-
- // This is the number of indices
- if(sourceMesh->PrimaryTopology->IndexCount)
- {
- meshData[meshIndex].index=(const UnsignedInt*)&sourceMesh->PrimaryTopology->Indices[3*sourceGroup.TriFirst];
- // These are the indices for this group
- meshData[meshIndex].indexCount=3*sourceGroup.TriCount;
- indexCount += meshData[meshIndex].indexCount; //keep track of total indices in this model
- }
- }
- }
- }
- }
- ///@todo: Convert granny materials into W3D/D3D materials - now using default.
-// for(int MaterialIndex = 0; MaterialIndex < fileInfo->MaterialCount; ++MaterialIndex)
-// {
-// granny_material_instance *MaterialInstance = GrannyInstantiateMaterial(fileInfo->Materials[MaterialIndex]);
-// GrannyAutoBindAllMaterialTextures(MaterialInstance,TextureLibrary);
-// GrannyAddMaterialToLibrary(MaterialLibrary,MaterialInstance);
-// }
-
-
- GrannyAutoBindAllMaterials(MaterialLibrary, fileInfo,TextureLibrary);
-
- } //fileInfo
-
- if (fileInfo == NULL) {
- return NULL;
- }
-
- // ok, accept this model!
- GrannyPrototypeClass * hproto = NEW GrannyPrototypeClass(File);
- _splitpath(filename, drive, dir, fname, ext );
- hproto->Set_Name(strcat(fname,ext));
- hproto->setBoundingBox(box);
- hproto->setBoundingSphere(SphereClass(box.Center,box.Extent.Length()));
- hproto->setVertexCount(vertexCount);
- hproto->setIndexCount(indexCount);
- hproto->setMeshCount(meshCount);
- for (Int i=0; isetMeshData(meshData[i],i);
- return hproto;
- }//FILE
-
- return NULL;
-}
-
-GrannyLoaderClass::GrannyLoaderClass(void)
-{
- TextureLibrary = GrannyNewTextureLibrary(1 << 12);
- MaterialLibrary = GrannyNewMaterialLibrary(1 << 12);
-}
-
-GrannyLoaderClass::~GrannyLoaderClass(void)
-{
- GrannyFreeTextureLibrary(TextureLibrary);
- GrannyFreeMaterialLibrary(MaterialLibrary);
-
- TextureLibrary=NULL;
- MaterialLibrary=NULL;
-}
-
-GrannyAnimManagerClass::GrannyAnimManagerClass(void)
-{
- // Create the hash tables
- AnimPtrTable = NEW HashTableClass( 2048 );
- MissingAnimTable = NEW HashTableClass( 2048 );
-}
-
-GrannyAnimManagerClass::~GrannyAnimManagerClass(void)
-{
- Free_All_Anims();
-
- delete AnimPtrTable;
- AnimPtrTable = NULL;
-
- delete MissingAnimTable;
- MissingAnimTable = NULL;
-}
-
-/** Release all loaded animations */
-void GrannyAnimManagerClass::Free_All_Anims(void)
-{
- // Make an iterator, and release all ptrs
- GrannyAnimManagerIterator it( *this );
- for( it.First(); !it.Is_Done(); it.Next() ) {
- GrannyAnimClass *anim = it.Get_Current_Anim();
- anim->Release_Ref();
- }
-
- // Then clear the table
- AnimPtrTable->Reset();
-}
-
-/** Find animation in cache */
-GrannyAnimClass * GrannyAnimManagerClass::Peek_Anim(const char * name)
-{
- return (GrannyAnimClass*)AnimPtrTable->Find( name );
-}
-
-/** Get animation from cache and increment its reference count */
-GrannyAnimClass * GrannyAnimManagerClass::Get_Anim(const char * name)
-{
- GrannyAnimClass * anim = Peek_Anim( name );
- if ( anim != NULL ) {
- anim->Add_Ref();
- }
- return anim;
-}
-
-/** Add animation to cache */
-Bool GrannyAnimManagerClass::Add_Anim(GrannyAnimClass *new_anim)
-{
- WWASSERT (new_anim != NULL);
-
- // Increment the refcount on the new animation and add it to our table.
- new_anim->Add_Ref ();
- AnimPtrTable->Add( new_anim );
-
- return true;
-}
-
-/*
-** Missing Anims
-**
-** The idea here, allow the system to register which anims are determined to be missing
-** so that if they are asked for again, we can quickly return NULL, without searching the
-** disk again.
-*/
-void GrannyAnimManagerClass::Register_Missing( const char * name )
-{
- MissingAnimTable->Add( NEW MissingAnimClass( name ) );
-}
-
-Bool GrannyAnimManagerClass::Is_Missing( const char * name )
-{
- return ( MissingAnimTable->Find( name ) != NULL );
-}
-
-/** Load an animation from disk and add to cache */
-int GrannyAnimManagerClass::Load_Anim(const char * name)
-{
- GrannyAnimClass * newanim = NEW GrannyAnimClass;
-
- if (newanim == NULL) {
- goto Error;
- }
-
- SET_REF_OWNER( newanim );
-
- if (newanim->Load_W3D(name) != GrannyAnimClass::OK)
- { // load failed!
- newanim->Release_Ref();
- goto Error;
- } else if (Peek_Anim(newanim->Get_Name()) != NULL)
- { // duplicate exists!
- newanim->Release_Ref(); // Release the one we just loaded
- goto Error;
- } else
- { Add_Anim( newanim );
- newanim->Release_Ref();
- }
-
- return 0;
-
-Error:
- return 1;
-}
-
-/*
-** Iterator converter from HashableClass to GrannyAnimClass
-*/
-GrannyAnimClass * GrannyAnimManagerIterator::Get_Current_Anim( void )
-{
- return (GrannyAnimClass *)Get_Current();
-}
-
-
-GrannyAnimClass::GrannyAnimClass(void) :
- NumFrames(0),
- FrameRate(0),
- File(0),
- Animation(0)
-{
- Name[0]='\0';
-}
-
-
-/** GrannyAnimClass::~GrannyAnimClass -- Destructor */
-GrannyAnimClass::~GrannyAnimClass(void)
-{
- GrannyFreeFile(File);
-}
-
-/** Read granny data from disk */
-int GrannyAnimClass::Load_W3D(const char *name)
-{
- granny_file *file=NULL;
-
- file = GrannyReadEntireFile(name);
-
- if (file)
- {
- granny_file_info *fileInfo;
- fileInfo = GrannyGetFileInfo(file);
- if (fileInfo && fileInfo->AnimationCount)
- { Animation = fileInfo->Animations[0];
- File = file;
- strcpy(Name,name);
- FrameRate = 1.0f/Animation->TimeStep;
- NumFrames = Animation->Duration / Animation->TimeStep;
- return OK;
- }
- else
- GrannyFreeFile(File); //no animations found
- }
- return LOAD_ERROR;
-}
-
-GrannyLoaderClass _GrannyLoader;
-GrannyRenderObjSystem *TheGrannyRenderObjSystem=NULL;
-
-/** Adds render object to a queue with other objects using the same material. These queues will be
- flushed at the end of the frame.
-*/
-void GrannyRenderObjSystem::AddRenderObject(RenderInfoClass & rinfo, GrannyRenderObjClass *robj)
-{
- if (m_renderObjectCount >= MAX_VISIBLE_GRANNY_MODELS)
- { assert (m_renderObjectCount < MAX_VISIBLE_GRANNY_MODELS);
- return; //can't add any more granny models this frame.
- }
-
- for (Int i=0; im_prototype.m_file == robj->m_prototype.m_file)
- { //found model with same prototype. Add new model to same list.
- robj->m_nextSystem=m_renderStateModelList[i].list;
- m_renderStateModelList[i].list=robj;
- if (rinfo.light_environment)
- m_renderLocalLightEnv[m_renderObjectCount]=*rinfo.light_environment;
- m_renderObjectCount++;
- return;
- }
- }
-
- //Found a new render state
-
- assert (m_renderStateCount < MAX_GRANNY_RENDERSTATES);
-
- if (m_renderStateCount > MAX_GRANNY_RENDERSTATES)
- return; //reached maximum number of render states
-
- //store this objects lighting information for use later during drawing.
- if (rinfo.light_environment)
- m_renderLocalLightEnv[m_renderObjectCount]=*rinfo.light_environment;
-
- m_renderStateModelList[m_renderStateCount++].list=robj;
- robj->m_nextSystem=NULL;
-
- m_renderObjectCount++;
-}
-
-/** Draws all the granny render objects that were rendered in the last frame.
- Drawing is done in render state order to reduce overhead.
-*/
-void GrannyRenderObjSystem::Flush(void)
-{
- GrannyRenderObjClass *robj;
- granny_model_instance *modelInstance;
- Bool setMaterial;
- Int modelCount=0;
- Int indexCount; //per model index count
-
- for (Int i=0; im_modelInstance;
-
- //update the model
- GrannySetModelClock(modelInstance,robj->LastSyncTime);
- robj->LastSyncTime = WW3D::Get_Sync_Time()*0.001f; //convert to seconds
-
- GrannySampleModelAnimations(modelInstance, 0, GrannyGetModelBoneCount(modelInstance),
- GrannyGetModelLocalPose(modelInstance));
- GrannyBuildModelWorldTransforms(modelInstance, 0,
- GrannyGetModelBoneCount(modelInstance),
- GrannyGetModelLocalPose(modelInstance),
- GrannyGetModelRootTransform(modelInstance),
- GrannyGetModelWorldPose(modelInstance));
-
- Real *RootTransform = GrannyGetModelRootTransform(modelInstance);
-
- RootTransform[12] = 0; //X
- RootTransform[13] = 0; //Y
- RootTransform[13] = 0; //Z
- RootTransform[0] = robj->ObjectScale;
- RootTransform[5] = robj->ObjectScale;
- RootTransform[10] = robj->ObjectScale;
-
- Int MeshCount = GrannyGetModelMeshCount(modelInstance);
- for(Int MeshIndex = 0; MeshIndex < MeshCount; ++MeshIndex)
- {
- granny_mesh_instance *Mesh = (granny_mesh_instance *)GrannyGetModelMeshCookie(modelInstance, MeshIndex);
- granny_mesh_model_binding *Binding = GrannyGetMeshModelBinding(Mesh);
-
- granny_pnt332_vertex *Vertices = 0;
- if(GrannyMeshIsRigid(Mesh))
- { assert(0); //have not coded support for rigid meshes yet - only soft skinned supported.
- // granny_matrix_4x4 TempBuffer;
- // glMultMatrixf(GrannyGetRigidMeshTransform(
- // Binding, GrannyGetModelWorldPose(modelInstance),
- // (granny_real32 *)TempBuffer));
- Vertices = (granny_pnt332_vertex *)GrannyGetMeshVertices(Mesh);
- }
- else
- {
- GrannyDeformMesh(Binding, GrannyGetModelWorldPose(modelInstance),
- 0, g_blendingBuffer);
- Vertices = g_blendingBuffer;
- }
-
- int GroupCount = GrannyGetMeshTriangleGroupCount(Mesh);
- for(Int GroupIndex = 0; GroupIndex < GroupCount; ++GroupIndex)
- {
- granny_material_instance *Material = (granny_material_instance *)
- GrannyGetMeshMaterialCookie(
- Mesh, GrannyGetMeshTriangleGroupMaterialIndex(
- Mesh, GroupIndex));
- if(setMaterial && Material)
- {
- Int TextureIndex;
- if(GrannyGetMaterialTextureIndexByType(
- Material, GrannyDiffuseColorTexture, &TextureIndex))
- {
- granny_texture_instance *TextureInstance =
- (granny_texture_instance *)GrannyGetMaterialTextureCookie(
- Material, TextureIndex);
-
- if(TextureInstance)
- {
- DX8Wrapper::Set_Texture(0, (TextureClass *)GrannyGetTextureCookie(TextureInstance));
- }
- else
- DX8Wrapper::Set_Texture(0, NULL);
- }
- }
-
- DynamicVBAccessClass vb_access(BUFFER_TYPE_DYNAMIC_DX8,dynamic_fvf_type,robj->m_vertexCount);
- {
- DynamicVBAccessClass::WriteLockClass lock(&vb_access);
- VertexFormatXYZNDUV2* vb=lock.Get_Formatted_Vertex_Array();
- if(vb)
- {
- for (Int i=0; im_vertexCount; i++)
- {
- vb->x=Vertices->Position[0];
- vb->y=Vertices->Position[1];
- vb->z=Vertices->Position[2];
- vb->nx=Vertices->Normal[0];
- vb->ny=Vertices->Normal[1];
- vb->nz=Vertices->Normal[2];
- vb->diffuse=0xffffffff;
- vb->u1=Vertices->UV[0];
- vb->v1=Vertices->UV[1];
- vb++;
- Vertices++;
- }
- }
- }
-
- if (setMaterial)
- { //we started using a new material queue - really a new model prototype
- //so reset all relevant data.
- indexCount=GrannyGetMeshTriangleGroupIndexCount(Mesh, GroupIndex);
- UnsignedInt *indices=(UnsignedInt*)GrannyGetMeshTriangleGroupIndices(Mesh, GroupIndex);
-
- DynamicIBAccessClass ib_access(BUFFER_TYPE_DYNAMIC_DX8,indexCount);
- {
- DynamicIBAccessClass::WriteLockClass lock(&ib_access);
- unsigned short* ib=lock.Get_Index_Array();
-
- if(ib)
- {
- for (Int i=0; im_prototype.m_vertexMaterial);
- DX8Wrapper::Set_Shader(ShaderClass::_PresetOpaqueShader);
- setMaterial=false; //don't set material again unless it changes.
- DX8Wrapper::Set_Index_Buffer(ib_access,0);
- }
-
- Matrix3D tm(robj->Transform);
- DX8Wrapper::Set_Light_Environment(&m_renderLocalLightEnv[modelCount]);
- DX8Wrapper::Set_Transform(D3DTS_WORLD,tm);
- DX8Wrapper::Set_Vertex_Buffer(vb_access);
- DX8Wrapper::Draw_Triangles( 0,indexCount/3, 0, robj->m_vertexCount); //draw a quad, 2 triangles, 4 verts
- }
- }
- robj=robj->m_nextSystem; //move to next object using this material
- modelCount++;
- }//while
-
- }
-
- //reset for next frame
- m_renderObjectCount=0;
- m_renderStateCount=0;
-}
-
-#if 0 ///@todo: Will have to implement an optimized granny rendering system
-//=============================================================================
-// GrannyRenderObjClassSystem::GrannyRenderObjClassSystem
-//=============================================================================
-/** Constructor. Just nulls out some variables. */
-//=============================================================================
-GrannyRenderObjClassSystem::GrannyRenderObjClassSystem()
-{
- m_usedModules = NULL;
- m_freeModules = NULL;
- m_indexBuffer = NULL;
- m_vertexMaterialClass = NULL;
- m_vertexBuffer = NULL;
-}
-
-//=============================================================================
-// GrannyRenderObjClassSystem::~GrannyRenderObjClassSystem
-//=============================================================================
-/** Destructor. Free all pre-allocated track laying render objects*/
-//=============================================================================
-GrannyRenderObjClassSystem::~GrannyRenderObjClassSystem( void )
-{
-
- // free all data
- shutdown();
-
- m_vertexMaterialClass=NULL;
-
-}
-
-//=============================================================================
-// GrannyRenderObjClassSystem::ReAcquireResources
-//=============================================================================
-/** (Re)allocates all W3D assets after a reset.. */
-//=============================================================================
-void GrannyRenderObjClassSystem::ReAcquireResources(void)
-{
- // just for paranoia's sake.
- REF_PTR_RELEASE(m_indexBuffer);
- REF_PTR_RELEASE(m_vertexBuffer);
-
- //Create static index buffers. These will index the vertex buffers holding the map.
- m_indexBuffer=NEW_REF(DX8IndexBufferClass,(32*6));
-
- // Fill up the IB
- {
- DX8IndexBufferClass::WriteLockClass lockIdxBuffer(m_indexBuffer);
- UnsignedShort *ib=lockIdxBuffer.Get_Index_Array();
- }
-
- ///@todo: Allocating double sized buffer than really needed... but things go bad otherwise. Figure out why!
-
- m_vertexBuffer=NEW_REF(DX8VertexBufferClass,(DX8_FVF_XYZDUV1,1*2,DX8VertexBufferClass::USAGE_DYNAMIC));
-
-}
-
-//=============================================================================
-// GrannyRenderObjClassSystem::ReleaseResources
-//=============================================================================
-/** (Re)allocates all W3D assets after a reset.. */
-//=============================================================================
-void GrannyRenderObjClassSystem::ReleaseResources(void)
-{
- REF_PTR_RELEASE(m_indexBuffer);
- REF_PTR_RELEASE(m_vertexBuffer);
- // Note - it is ok to not release the material, as it is a w3d object that
- // has no dx8 resources. jba.
-}
-
-//=============================================================================
-// GrannyRenderObjClassSystem::init
-//=============================================================================
-/** initialize the system, allocate all the render objects we will need */
-//=============================================================================
-void GrannyRenderObjClassSystem::init()
-{
- const Int numModules=TheGlobalData->m_maxTerrainTracks;
-
- Int i;
- GrannyRenderObjClass *mod;
-
- ReAcquireResources();
- //go with a preset material for now.
- m_vertexMaterialClass=VertexMaterialClass::Get_Preset(VertexMaterialClass::PRELIT_DIFFUSE);
-
- //use a multi-texture shader: (text1*diffuse)*text2.
- m_shaderClass = ShaderClass::_PresetAlphaShader;//_PresetATestSpriteShader;//_PresetOpaqueShader;
-
- // we cannot initialize a system that is already initialized
- if( m_freeModules || m_usedModules )
- {
-
- // system already online!
- assert( 0 );
- return;
-
- } // end if
-
- // allocate our modules for this system
- for( i = 0; i < numModules; i++ )
- {
-
- mod = NEW_REF( GrannyRenderObjClass, () );
-
- if( mod == NULL )
- {
-
- // unable to allocate modules needed
- assert( 0 );
- return;
-
- } // end if
-
- mod->m_prevSystem = NULL;
- mod->m_nextSystem = m_freeModules;
- if( m_freeModules )
- m_freeModules->m_prevSystem = mod;
- m_freeModules = mod;
-
- } // end for i
-
-} // end init
-
-//=============================================================================
-// GrannyRenderObjClassSystem::shutdown
-//=============================================================================
-/** Shutdown and free all memory for this system */
-//=============================================================================
-void GrannyRenderObjClassSystem::shutdown( void )
-{
-
- REF_PTR_RELEASE(m_indexBuffer);
- REF_PTR_RELEASE(m_vertexMaterialClass);
- REF_PTR_RELEASE(m_vertexBuffer);
-
-} // end shutdown
-
-//=============================================================================
-// GrannyRenderObjClassSystem::update
-//=============================================================================
-/** Update the state of all active track marks - fade, expire, etc. */
-//=============================================================================
-void GrannyRenderObjClassSystem::update()
-{
-
- Int iTime=timeGetTime();
-}
-
-
-//=============================================================================
-// GrannyRenderObjClassSystem::flush
-//=============================================================================
-/** Draw all active track marks for this frame */
-//=============================================================================
-void GrannyRenderObjClassSystem::flush()
-{
- Int diffuseLight;
- GrannyRenderObjClass *mod=0;
-
- // adjust shading for time of day.
- Real shadeR, shadeG, shadeB;
- shadeR = TheGlobalData->m_terrainAmbientRed;
- shadeG = TheGlobalData->m_terrainAmbientGreen;
- shadeB = TheGlobalData->m_terrainAmbientBlue;
- shadeR += TheGlobalData->m_terrainDiffuseRed/2;
- shadeG += TheGlobalData->m_terrainDiffuseGreen/2;
- shadeB += TheGlobalData->m_terrainDiffuseBlue/2;
- shadeR*=255.0f;
- shadeG*=255.0f;
- shadeB*=255.0f;
-
- diffuseLight=(int)shadeB | ((int)shadeG << 8) | ((int)shadeR << 16);
-
- //check if there is anything to draw and fill vertex buffer
- {
- DX8VertexBufferClass::WriteLockClass lockVtxBuffer(m_vertexBuffer);
- VertexFormatXYZDUV1 *verts = (VertexFormatXYZDUV1*)lockVtxBuffer.Get_Vertex_Array();
-
- }//edges to flush
-
- //draw the filled vertex buffers
- {
- ShaderClass::Invalidate();
- DX8Wrapper::Set_Material(m_vertexMaterialClass);
- DX8Wrapper::Set_Shader(m_shaderClass);
- DX8Wrapper::Set_Index_Buffer(m_indexBuffer,0);
- DX8Wrapper::Set_Vertex_Buffer(m_vertexBuffer);
-
- Matrix3D tm(mod->Transform);
- DX8Wrapper::Set_Transform(D3DTS_WORLD,tm);
- DX8Wrapper::Set_Index_Buffer_Index_Offset(0);
- DX8Wrapper::Draw_Triangles( 0,2, 0, 1*2);
-
- } //there are some edges to render in pool.
-}
-
-//=============================================================================
-// GrannyRenderObjClassSystem::createRenderObj
-//=============================================================================
-/** Creates an instance of a W3D render object using the specified granny */
-/* model. If the model doesn't exist yet, it will be loaded from disk. */
-//=============================================================================
-RenderObjClass *GrannyRenderObjClassSystem::createRenderObj(const char * name)
-{
-
- return NULL;
-}
-
-GrannyRenderObjClassSystem *TheGrannyRenderObjClassSystem=NULL; ///< singleton for track drawing system.
-
-#endif //end of GrannyRenderObjClassSystem
-
-#endif //INCLUDE_GRANNY_IN_BUILD
\ No newline at end of file
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp
index 91a45122e49..98d67104ad7 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp
@@ -49,7 +49,6 @@
//-------------------------------------------------------------------------------------------------
-#include "Common/QuickTrig.h"
W3DParticleSystemManager::W3DParticleSystemManager()
{
m_pointGroup = NULL;
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp
index a1980bff2d9..315df93aefe 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DScene.cpp
@@ -49,7 +49,6 @@
#include "W3DDevice/GameClient/HeightMap.h"
#include "W3DDevice/GameClient/W3DScene.h"
#include "W3DDevice/GameClient/W3DDynamicLight.h"
-#include "W3DDevice/GameClient/W3DGranny.h"
#include "W3DDevice/GameClient/W3DShadow.h"
#include "W3DDevice/GameClient/W3DStatusCircle.h"
#include "W3DDevice/GameClient/W3DCustomScene.h"
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp
index 907d5e6dcba..ec2be7658ef 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainVisual.cpp
@@ -40,7 +40,6 @@
#include "Common/TerrainTypes.h"
#include "Common/Xfer.h"
#include "Common/UnitTimings.h" //Contains the DO_UNIT_TIMINGS define jba.
-#include "Common/QuickTrig.h"
#include "GameClient/Drawable.h"
#include "GameClient/ClientRandomValue.h"
@@ -55,7 +54,6 @@
#include "W3DDevice/GameClient/W3DDisplay.h"
#include "W3DDevice/GameClient/W3DDebugIcons.h"
#include "W3DDevice/GameClient/W3DTerrainTracks.h"
-#include "W3DDevice/GameClient/W3DGranny.h"
#include "W3DDevice/GameClient/W3DShadow.h"
#include "W3DDevice/GameClient/HeightMap.h"
#include "W3DDevice/GameClient/FlatHeightMap.h"