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.

3.1 KB
Raw Blame
/*
**	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 <http://www.gnu.org/licenses/>.
*/
// Modified 2025-2026 by Olcay Seygan for Zero Hour Reforged; see the git history.

// FILE: W3DSnow.h /////////////////////////////////////////////////////////

#ifndef _W3DSNOW_H_
#define _W3DSNOW_H_

#include "GameClient/Snow.h"

class DX8IndexBufferClass;
class RenderInfoClass;
class TextureClass;
struct IDirect3DVertexBuffer9;

class W3DSnowManager : public SnowManager
{
  public :

	W3DSnowManager(void);
	~W3DSnowManager(void);

	virtual void init( void );
	virtual void reset( void );
	virtual void update ( void);
	virtual void updateIniSettings(void);
	
	void	render(RenderInfoClass &rinfo);
	void	renderAsQuads(RenderInfoClass &rinfo, Int cubeOriginX, Int cubeOriginY, Int cubeDimX, Int cubeDimY);
	void	renderSubBox(RenderInfoClass &rinfo, Int originX, Int originY, Int cubeDimX, Int cubeDimY );
	void	ReleaseResources(void);
	Bool	ReAcquireResources(void);

 private:
	void	updateWeather(void);
	void	renderWeather(RenderInfoClass &rinfo);
	void	drawWeatherLayer(RenderInfoClass &rinfo, Int layer, Real light);

	// The Weather option.  None of it is allocated, loaded or read while the option is off.
	struct WeatherDrop { Real x, y, phase; };	///< a drop's place in its tile and in its fall, 0 to 1
	WeatherDrop *m_weatherDrops;
	TextureClass *m_weatherTextures[2];
	double m_weatherTime;			///< seconds; double, because it is multiplied by a speed and wrapped by the tile
	const void *m_weatherMap;		///< the map m_weatherSandCells was counted on, with its samples: see W3DShaderManager's haze
	const void *m_weatherMapData;
	Int m_weatherMapWidth;
	Int m_weatherSandCells;
	Int m_weatherCells;

	DX8IndexBufferClass	*m_indexBuffer;
	TextureClass *m_snowTexture;
	IDirect3DVertexBuffer9*  m_VertexBufferD3D;
	Int m_dwBase;	///<index to beginning of unused vertex buffer space.
    Int m_dwFlush;	///<maximum amount of vertices to sumbit before rendering.
	Int m_dwDiscard;	///<maximum index allowed before needing to discard the buffer.
	Int m_leafDim;		///<horizontal dimensions of leaf nodes that are always rendered without visibility checks.
	Real m_snowCeiling;	///<height at the top of the cube with camera at center.
	Real m_heightTraveled;	///<height that snow flake traveled this frame.
	Int m_totalRendered;	///<total number of snow particles rendered this frame - only for profiling.
	Real m_cullOverscan;	///<how much extra padding to put on the sides of AABoxes when view culling.
};

#endif // _W3DSNOW_H_