Skip to content

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.

merge: turkiye units, side-styled huds, water reflections, path queue

Olcay Seygan236cf2814bce
diff --cc GeneralsMD/Code/BuildFingerprint.manifest
index 0e3aa9bbd,bf8fed92a..9cfcc2b8e
--- a/GeneralsMD/Code/BuildFingerprint.manifest
+++ b/GeneralsMD/Code/BuildFingerprint.manifest
@@@ -81,6 -223,6 +223,7 @@@ Data/Cinema/geproto_oasis.tx
Data/Cinema/gpu1m_battle.txt
Data/Cinema/gunfx.txt
Data/Cinema/headlights.txt
++Data/Cinema/heathaze.txt
Data/Cinema/hero_loop.txt
Data/Cinema/hero_loop_01.txt
Data/Cinema/hero_loop_02.txt
@@@ -156,6 -302,6 +303,7 @@@ Data/Cinema/rf_thumb_fa.tx
Data/Cinema/rf_thumb_fe.txt
Data/Cinema/rf_town.txt
Data/Cinema/rf_watch.txt
++Data/Cinema/rocketfx.txt
Data/Cinema/s240_beach.txt
Data/Cinema/s240_bridge.txt
Data/Cinema/s240_heli.txt
@@@ -170,6 -316,6 +318,8 @@@ Data/Cinema/scudlaunch_film.tx
Data/Cinema/shadowfar.txt
Data/Cinema/shadowpan.txt
Data/Cinema/spectre_reshoot.txt
++Data/Cinema/summary_close.txt
++Data/Cinema/summary_fire.txt
Data/Cinema/swpair_nuke.txt
Data/Cinema/swpair_scud.txt
Data/Cinema/thumb_chaos_a.txt
@@@ -182,6 -328,6 +332,8 @@@ Data/Cinema/tr_oasis.tx
Data/Cinema/tr_open.txt
Data/Cinema/tr_palms.txt
Data/Cinema/tr_watch.txt
++Data/Cinema/tracers_desert.txt
++Data/Cinema/tracers_snow.txt
Data/Cinema/v240_heli.txt
Data/Cinema/v240_hook.txt
Data/Cinema/v240_hook2.txt
@@@ -289,8 -448,10 +454,11 @@@ Data/Scenarios/glowbase.tx
Data/Scenarios/glowfight.txt
Data/Scenarios/glowmicrowave.txt
Data/Scenarios/gpu1m_battle.txt
+ Data/Scenarios/guardair.txt
Data/Scenarios/guardradius.txt
+ Data/Scenarios/guardshields.txt
Data/Scenarios/gunfx.txt
++Data/Scenarios/gunsnow.txt
Data/Scenarios/handicap.txt
Data/Scenarios/headlights.txt
Data/Scenarios/helislide.txt
@@@ -321,6 -484,7 +491,8 @@@ Data/Scenarios/jetrunway.tx
Data/Scenarios/jetsturn.txt
Data/Scenarios/jetturn.txt
Data/Scenarios/kargu.txt
+ Data/Scenarios/laserdefense.txt
++Data/Scenarios/laserflow.txt
Data/Scenarios/laserglow.txt
Data/Scenarios/laserlook.txt
Data/Scenarios/leadinfantry.txt
@@@ -391,6 -555,6 +563,7 @@@ Data/Scenarios/rf_t2_wall.tx
Data/Scenarios/rf_t2_wolf.txt
Data/Scenarios/rf_thumb_fa.txt
Data/Scenarios/rf_thumb_fe.txt
++Data/Scenarios/rocketfx.txt
Data/Scenarios/rocketglow.txt
Data/Scenarios/s240_beach.txt
Data/Scenarios/s240_bridge.txt
@@@ -420,6 -584,6 +593,7 @@@ Data/Scenarios/strikeair_nuke.tx
Data/Scenarios/strikeair_nukehelix.txt
Data/Scenarios/strikeair_particle.txt
Data/Scenarios/strikeair_scud.txt
++Data/Scenarios/summaryclose.txt
Data/Scenarios/sun_cloak.txt
Data/Scenarios/sun_trees.txt
Data/Scenarios/swhole.txt
diff --cc GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp
index 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, Rea
return 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( void
W3DDisplay::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();
}
}