#include <acknex.h>
#include <default.c>
var dest[20][20];
var source[20][20];
ENTITY* waterent;
PANEL* skeletonpan =
{
pos_x = 0; pos_y = 0;
digits( 0, 0, "nexus: %f", "Arial#18b", 1, nexus);
digits( 0, 20, "tempv: %f", "Arial#18b", 1, tempv);
flags = VISIBLE;
}
action fluid_action()
{
CONTACT* c;
var tempv, iloop, eloop;
//
// Initialise arrays
for(iloop=0; iloop<20; iloop++)
{
for(eloop=0; eloop<20; eloop++)
{
dest[iloop][eloop] = 0;
source[iloop][eloop] = 0;
}
}
//
//
while(1)
{
for(iloop=1; iloop<19; iloop++)
{
for(eloop=1; eloop<19; eloop++)
{
//perform simulation
dest[iloop][eloop] = (source[iloop-1][eloop]+source[iloop+1][eloop]+source[iloop][eloop-1]+source[iloop][eloop+1])*(time_step*0.8)-dest[iloop][eloop];
dest[iloop][eloop] *= 1*(1.1-time_step*1.1);
vec_to_mesh(vector(0,0,dest[iloop][eloop]), my, iloop*20+eloop+1);
//debugging
tempv = source[iloop+1][eloop+1];
}
}
wait(1);
for(iloop=1; iloop<19; iloop++)
{
for(eloop=1; eloop<19; eloop++)
{
//perform simulation
source[iloop][eloop] = (dest[iloop-1][eloop]+dest[iloop+1][eloop]+dest[iloop][eloop-1]+dest[iloop][eloop+1])*(time_step*0.8)-source[iloop][eloop];
source[iloop][eloop] *= 1*(1.1-time_step*1.1);
vec_to_mesh (vector(0,0,source[iloop][eloop]), my, iloop*20+eloop+1);
//debugging
//tempv = source[iloop+1][eloop+1];
}
}
wait(1);
}
}
function main()
{
video_mode = 10;
video_screen = 1;
fps_max = 100;
fps_min = 25;
level_load("");
vec_set(camera.x, vector(0,50,50));
vec_set(camera.pan, vector(270,-45,0));
waterent = ent_create("waterent.hmp", nullvector, fluid_action);
//
while(1)
{
if(key_cuu)
{
source[10][10]+=20;
while(key_cuu) wait(1);
}
wait(1);
}
}