d3_l->p_surface->SetColor(d3_l->p_surface,r,g,b,a);
d3_l->p_surface->DrawRectangle(d3_l->p_surface,
x_c*d3_l->fakt_x+X_GAP,
- y_c*d3_l->fakt_x+d3_l->info_x,
+ y_c*d3_l->fakt_y+d3_l->info_y,
d3_l->fakt_x,d3_l->fakt_y);
}
}
}
}
+ /* now we flip all to surface */
+ d3_l->p_surface->Flip(d3_l->p_surface,NULL,0);
+
return 1;
}
int distrib_c(d3_lattice *d3_l,int t_c,double a,double b)
{
- int i,j,k,total,area,sum;
+ int i,j,k,total,area;
+ double sum;
int temp,left;
int *area_h;
u32 x,y,z;
area_h=(int *)malloc(d3_l->max_z*sizeof(int));
total=0;
- sum=0;
+ sum=b*d3_l->max_z+a*d3_l->max_z*(d3_l->max_z+1)/2;
for(i=0;i<d3_l->max_z;i++)
{
area_h[i]=0;
{
if(!(*(d3_l->status+(i*area)+j)&AMORPH))
{
- sum+=(i+1)*a+b;
area_h[i]+=1;
}
}
- }
- for(i=0;i<d3_l->max_z;i++)
- {
- temp=((i+1)*a+b)*t_c/(sum+area_h[i]);
- if(temp>1)
+ temp=(int)((i+1)*a+b)*t_c/(sum*area_h[i]);
+ if(temp)
{
for(j=0;j<area;j++)
{
{
x=get_rand(d3_l->max_x);
y=get_rand(d3_l->max_y);
- if(!(*(d3_l->status+(i*area)+x+y*d3_l->max_x)&AMORPH))
+ if(!(*(d3_l->status+(i*area)+j)&AMORPH))
{
*(d3_l->extra+(i*area)+x+y*d3_l->max_x)+=1;
total+=1;
{
*(d3_l->extra+x+y*d3_l->max_x+z*d3_l->max_x*d3_l->max_y)+=1;
left-=1;
- total+=1;
}
}
+ free(area_h);
return 1;
}
char conc_txt[MAX_TXT];
char steps_txt[MAX_TXT];
char cc_txt[MAX_TXT];
- char **arg_v;
+ char *arg_v[MAX_ARGV];
d3_lattice d3_l;
max_x=X;
if(!strcmp(l_file,""))
{
+ i=0;
while((i<steps) && (quit==0) && (escape==0))
{
x_c=get_rand(d3_l.max_x);
process_cell(&d3_l,x_c,y_c,z_c,range,a_ap,b_ap,&cc);
if(i%refresh==0)
{
- sprintf(x_txt,"x: %d",x);
- sprintf(y_txt,"y: %d",y);
- sprintf(z_txt,"z: %d",z);
+ sprintf(x_txt,"x: %d",x+1);
+ sprintf(y_txt,"y: %d",y+1);
+ sprintf(z_txt,"z: %d",z+1);
sprintf(status_txt,"status: %c",(*(d3_l.status+x+y*d3_l.max_x+z*d3_l.max_x*d3_l.max_y)&AMORPH)?'a':'c');
sprintf(conc_txt,"conc: %d",*(d3_l.extra+x+y*d3_l.max_x+z*d3_l.max_x*d3_l.max_y));
sprintf(steps_txt,"step: %d",i);