🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Water article

Started by
1 comment, last by HIND-D 24 years, 7 months ago
I wrote a small program that creates the waves in C++. The part for the waves looks like this:

code:
void CalculateWaves (void){	WORD x;	WORD y;	short tmp_value;	for (y = 2; y < 198; y++)	{		for (x = 2; x < 198; x++)		{			tmp_value = ( WaveMap[CT][x-1][y] +				WaveMap[CT][x-2][y] +				WaveMap[CT][x+1][y] +				WaveMap[CT][x+2][y] +				WaveMap[CT][x][y-1] +				WaveMap[CT][x][y-2] +				WaveMap[CT][x][y+1] +				WaveMap[CT][x][y+2] +				WaveMap[CT][x-1][y-1] +				WaveMap[CT][x+1][y-1] +				WaveMap[CT][x-1][y+1] +				WaveMap[CT][x+1][y+1]				) / 6 - WaveMap[NW][x][y];			tmp_value = tmp_value / 1.1;			WaveMap [NW][x][y] = tmp_value;		}	}	char old_ct = CT;	// CT und NW vertauschen	CT = NW;	NW = old_ct;}

[This message has been edited by Melo (edited November 25, 1999).]

Advertisement
Could someone plz "translate" the water article to C/C++? it's written in Pascal (i think) and i dont know that...
I would be gratefull!

Jonatan Hedborg
Thanx! but i still need some help!
How are the wavetable defined?
How do you make it in to a bitmap
(in allegro plz...)
Thanx!
Jonatan Hedborg

This topic is closed to new replies.

Advertisement