Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
merge: turkiye units, side-styled huds, water reflections, path queue
Olcay Seygan236cf2814bce
diff --cc GeneralsMD/Code/BuildFingerprint.manifestindex 0e3aa9bbd,bf8fed92a..9cfcc2b8e--- a/GeneralsMD/Code/BuildFingerprint.manifest+++ b/GeneralsMD/Code/BuildFingerprint.manifest@@@ -81,6 -223,6 +223,7 @@@ Data/Cinema/geproto_oasis.txData/Cinema/gpu1m_battle.txtData/Cinema/gunfx.txtData/Cinema/headlights.txt++Data/Cinema/heathaze.txtData/Cinema/hero_loop.txtData/Cinema/hero_loop_01.txtData/Cinema/hero_loop_02.txt@@@ -156,6 -302,6 +303,7 @@@ Data/Cinema/rf_thumb_fa.txData/Cinema/rf_thumb_fe.txtData/Cinema/rf_town.txtData/Cinema/rf_watch.txt++Data/Cinema/rocketfx.txtData/Cinema/s240_beach.txtData/Cinema/s240_bridge.txtData/Cinema/s240_heli.txt@@@ -170,6 -316,6 +318,8 @@@ Data/Cinema/scudlaunch_film.txData/Cinema/shadowfar.txtData/Cinema/shadowpan.txtData/Cinema/spectre_reshoot.txt++Data/Cinema/summary_close.txt++Data/Cinema/summary_fire.txtData/Cinema/swpair_nuke.txtData/Cinema/swpair_scud.txtData/Cinema/thumb_chaos_a.txt@@@ -182,6 -328,6 +332,8 @@@ Data/Cinema/tr_oasis.txData/Cinema/tr_open.txtData/Cinema/tr_palms.txtData/Cinema/tr_watch.txt++Data/Cinema/tracers_desert.txt++Data/Cinema/tracers_snow.txtData/Cinema/v240_heli.txtData/Cinema/v240_hook.txtData/Cinema/v240_hook2.txt@@@ -289,8 -448,10 +454,11 @@@ Data/Scenarios/glowbase.txData/Scenarios/glowfight.txtData/Scenarios/glowmicrowave.txtData/Scenarios/gpu1m_battle.txt+ Data/Scenarios/guardair.txtData/Scenarios/guardradius.txt+ Data/Scenarios/guardshields.txtData/Scenarios/gunfx.txt++Data/Scenarios/gunsnow.txtData/Scenarios/handicap.txtData/Scenarios/headlights.txtData/Scenarios/helislide.txt@@@ -321,6 -484,7 +491,8 @@@ Data/Scenarios/jetrunway.txData/Scenarios/jetsturn.txtData/Scenarios/jetturn.txtData/Scenarios/kargu.txt+ Data/Scenarios/laserdefense.txt++Data/Scenarios/laserflow.txtData/Scenarios/laserglow.txtData/Scenarios/laserlook.txtData/Scenarios/leadinfantry.txt@@@ -391,6 -555,6 +563,7 @@@ Data/Scenarios/rf_t2_wall.txData/Scenarios/rf_t2_wolf.txtData/Scenarios/rf_thumb_fa.txtData/Scenarios/rf_thumb_fe.txt++Data/Scenarios/rocketfx.txtData/Scenarios/rocketglow.txtData/Scenarios/s240_beach.txtData/Scenarios/s240_bridge.txt@@@ -420,6 -584,6 +593,7 @@@ Data/Scenarios/strikeair_nuke.txData/Scenarios/strikeair_nukehelix.txtData/Scenarios/strikeair_particle.txtData/Scenarios/strikeair_scud.txt++Data/Scenarios/summaryclose.txtData/Scenarios/sun_cloak.txtData/Scenarios/sun_trees.txtData/Scenarios/swhole.txtdiff --cc GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cppindex ff5e317bb,cc1f813e7..933ae1dec--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp@@@ -202,47 -200,45 +200,49 @@@ static Real glowTexel( Real across, Reareturn glowFalloff( across ) * glowFalloff( MAX( cap, 0.0f ) );}- // u is -1..1 across the beam, v 0..1 along it- static TextureClass *acquireGlowTexture()+ // The texture belongs to the asset manager, under a name no file has, which lets it go with the+ // unused textures between maps and with the rest at shutdown. Made and freed with the beams, as it+ // was, a lone turret's beam was gone before its next shot and every shot built a Direct3D 9 texture+ // and its Direct3D 11 copy again: 134 of them in a minute of two Laser Defense turrets firing.+ static const char *GLOW_TEXTURE_NAME = "zhr_laserglow";++ // u is -1..1 across the beam, v 0..1 along it; each line takes its own reference+ static TextureClass *peekGlowTexture(){- if( !s_glowTexture )+ HashTemplateClass<StringClass,TextureClass*> &textures = WW3DAssetManager::Get_Instance()->Texture_Hash();+ TextureClass *texture = textures.Get( GLOW_TEXTURE_NAME );+ if( texture )+ return texture;++ // the one reference it is made with is the asset manager's+ texture = MSGNEW("TextureClass") TextureClass( GLOW_TEXTURE_SIZE, GLOW_TEXTURE_SIZE, WW3D_FORMAT_A8R8G8B8, MIP_LEVELS_1 );+ SurfaceClass *surf = texture->Get_Surface_Level();+ Int pitch;+ UnsignedByte *pData = (UnsignedByte*)surf->Lock( &pitch );+ for( Int y = 0; y < GLOW_TEXTURE_SIZE; y++ ){- s_glowTexture = MSGNEW("TextureClass") TextureClass( GLOW_TEXTURE_SIZE, GLOW_TEXTURE_SIZE, WW3D_FORMAT_A8R8G8B8, MIP_LEVELS_1 );- SurfaceClass *surf = s_glowTexture->Get_Surface_Level();- Int pitch;- UnsignedByte *pData = (UnsignedByte*)surf->Lock( &pitch );- for( Int y = 0; y < GLOW_TEXTURE_SIZE; y++ )+ Real along = ( y + 0.5f ) / GLOW_TEXTURE_SIZE;+ UnsignedInt *row = (UnsignedInt*)( pData + y * pitch );+ for( Int x = 0; x < GLOW_TEXTURE_SIZE; x++ ){- Real along = ( y + 0.5f ) / GLOW_TEXTURE_SIZE;- UnsignedInt *row = (UnsignedInt*)( pData + y * pitch );- for( Int x = 0; x < GLOW_TEXTURE_SIZE; x++ )- {- Real across = ( x + 0.5f ) / GLOW_TEXTURE_SIZE * 2.0f - 1.0f;- UnsignedInt c = (UnsignedInt)( glowTexel( across, along ) * 255.0f + 0.5f );- row[ x ] = ( c << 24 ) | ( c << 16 ) | ( c << 8 ) | c;- }+ Real across = ( x + 0.5f ) / GLOW_TEXTURE_SIZE * 2.0f - 1.0f;+ UnsignedInt c = (UnsignedInt)( glowTexel( across, along ) * 255.0f + 0.5f );+ row[ x ] = ( c << 24 ) | ( c << 16 ) | ( c << 8 ) | c;}- surf->Unlock();- REF_PTR_RELEASE( surf );- s_glowTexture->Get_Filter().Set_U_Addr_Mode( TextureFilterClass::TEXTURE_ADDRESS_CLAMP );- s_glowTexture->Get_Filter().Set_V_Addr_Mode( TextureFilterClass::TEXTURE_ADDRESS_CLAMP );}- s_glowTexture->Add_Ref();- return s_glowTexture;- }-- static void releaseGlowTexture()- {- // the static pointer holds one reference of its own; the last beam takes it with it- s_glowTexture->Release_Ref();- if( s_glowTexture->Num_Refs() == 1 )- REF_PTR_RELEASE( s_glowTexture );+ surf->Unlock();+ REF_PTR_RELEASE( surf );+ texture->Get_Filter().Set_U_Addr_Mode( TextureFilterClass::TEXTURE_ADDRESS_CLAMP );+ texture->Get_Filter().Set_V_Addr_Mode( TextureFilterClass::TEXTURE_ADDRESS_CLAMP );+ texture->Set_Texture_Name( GLOW_TEXTURE_NAME );+ textures.Insert( texture->Get_Texture_Name(), texture );+ return texture;}+// -heathaze: the beams gatherHeat reports, added when their glow is built and taken out with it+// ponytail: a linear erase per beam destroyed; fine for the tens of beams a fight holds+static std::vector<W3DLaserDraw *> s_glowingBeams;+// A flicker of one on average, varying by up to depth: a value per FLICKER_STEP_MS for each seed,// blended into the next, so it shimmers rather than strobes. On the picture's clock, so a -video// recording gets the same flicker every run.@@@ -570,16 -562,6 +570,15 @@@ W3DLaserDraw::~W3DLaserDraw( voidW3DDisplay::m_3DScene->Remove_Render_Object( m_flare3D[ f ] );REF_PTR_RELEASE( m_flare3D[ f ] );}+ for( size_t b = 0; b < s_glowingBeams.size(); b++ )+ {+ if( s_glowingBeams[ b ] == this )+ {+ s_glowingBeams[ b ] = s_glowingBeams.back();+ s_glowingBeams.pop_back();+ break;+ }+ }- releaseGlowTexture();}}