The amount of memory you can allocate on the fly like this
int Bwater[1000][500];
is limited, especially with recursive functions you have to take special care. Let's say you have a function like this:
void manipulate_array(int i)
{
var local_array[1024];
... do something with the array
if(i < 256) manipulate_array(i+1);
}
...
manipulate_array(0);
This will work a few times and it does not look like a lot of memory but at some level the statement "var local_array[1024];" will not allocate an array successfully and your game will crash after some array manipulation or do weird and seemingly unreasonable things.
The solution is too use sys_malloc and sys_free manually.