int dx_lattice_get_color(unsigned char *status,unsigned char *r,unsigned char *g,unsigned char *b,unsigned char mode)
{
*g=0;
- if(!mode)
+ if((!mode)||mode==3)
{
if((*status)&RED)
{
return 1;
}
-int d3_lattice_draw(d3_lattice *d3_l,int x,int y,int z,int arg_c,char **arg_v,unsigned char mode,int max_extra)
+int d3_lattice_draw(d3_lattice *d3_l,int x,int y,int z,int arg_c,char **arg_v,unsigned char mode,int max_extra,u32 *p1,u32 max1,u32 *p2,u32 max2)
{
int x_c,y_c,z_c;
int i;
{
for(z_c=0;z_c<d3_l->max_z;z_c++)
{
- if(!mode) dx_lattice_get_color((*d3_l).status+x_c+y_c*d3_l->max_x+z_c*d3_l->max_x*d3_l->max_y,&r,&g,&b,mode);
+ if((!mode)||mode==3) dx_lattice_get_color((*d3_l).status+x_c+y_c*d3_l->max_x+z_c*d3_l->max_x*d3_l->max_y,&r,&g,&b,mode);
+ if(mode==3)
+ {
+ if(d3_l->max_x*p1[z_c]/max1==x_c)
+ {
+ r=0xff;
+ g=0xff;
+ b=0xff;
+ }
+ }
if(mode==1)
{
foobar=(unsigned char)(*(d3_l->extra+x_c+y_c*d3_l->max_x+z_c*d3_l->max_x*d3_l->max_y)*255/max_extra);
{
for(z_c=0;z_c<d3_l->max_z;z_c++)
{
- if(!mode) dx_lattice_get_color((*d3_l).status+x_c+y_c*d3_l->max_x+z_c*d3_l->max_x*d3_l->max_y,&r,&g,&b,mode);
+ if((!mode)||mode==3) dx_lattice_get_color((*d3_l).status+x_c+y_c*d3_l->max_x+z_c*d3_l->max_x*d3_l->max_y,&r,&g,&b,mode);
+ if(mode==3)
+ {
+ if(d3_l->max_y*p1[z_c]/max2==y_c)
+ {
+ r=0xff;
+ g=0xff;
+ b=0xff;
+ }
+ }
if(mode==1)
{
foobar=(unsigned char)(*(d3_l->extra+x_c+y_c*d3_l->max_x+z_c*d3_l->max_x*d3_l->max_y)*255/max_extra);
{
for(y_c=0;y_c<d3_l->max_y;y_c++)
{
- if(!mode) dx_lattice_get_color((*d3_l).status+x_c+y_c*d3_l->max_x+z_c*d3_l->max_x*d3_l->max_y,&r,&g,&b,mode);
+ if((!mode)||mode==3) dx_lattice_get_color((*d3_l).status+x_c+y_c*d3_l->max_x+z_c*d3_l->max_x*d3_l->max_y,&r,&g,&b,mode);
if(mode==1)
{
foobar=(unsigned char)(*(d3_l->extra+x_c+y_c*d3_l->max_x+z_c*d3_l->max_x*d3_l->max_y)*255/max_extra);
d3_l->p_surface->DrawRectangle(d3_l->p_surface,
d3_l->info_x,d3_l->info_y,
d3_l->info_w,d3_l->info_h);
- /* old style
- d3_l->p_surface->DrawLine(d3_l->p_surface,
- d3_l->info_x+d3_l->info_w/2,
- d3_l->info_y,
- d3_l->info_x+d3_l->info_w/2,
- d3_l->info_y+d3_l->info_h);
- */
d3_l->p_surface->SetColor(d3_l->p_surface,0x80,0x80,0xff,0xff);
for(i=1;i<=arg_c;i++)
- {
- // if(i<13)
- // {
d3_l->p_surface->DrawString(d3_l->p_surface,arg_v[i],-1,
d3_l->info_x+d3_l->fakt_x,
d3_l->info_y+2*d3_l->fakt_y+d3_l->font_h+(i-1)*d3_l->font_h,
DSTF_LEFT);
- // } else
- // {
- /* old style
- d3_l->p_surface->DrawString(d3_l->p_surface,arg_v[i],-1,
- d3_l->info_x+d3_l->info_w/2+d3_l->fakt_x,
- d3_l->info_y+2*d3_l->fakt_y+d3_l->font_h+(i%13-1)*d3_l->font_h,
- DSTF_LEFT);
- */
- // }
- }
/* now we flip all to surface */
d3_l->p_surface->Flip(d3_l->p_surface,NULL,0);
if(ke.key_id==DIKI_PAGE_DOWN && *z!=d3_l->max_z-1) *z+=1;
if(ke.key_id==DIKI_Q) *q=1;
if(ke.key_id==DIKI_ESCAPE) *esc=1;
- if(ke.key_id==DIKI_M) *switchmode=(*switchmode+1)%3;
+ if(ke.key_id==DIKI_M) *switchmode=(*switchmode+1)%4;
if(ke.key_id==DIKI_1) *bmp=1;
if(ke.key_id==DIKI_2) *bmp=2;
if(ke.key_id==DIKI_3) *bmp=3;
#define Y_GAP X_GAP
#define RED 1
+#ifndef _U32
+#define _U32
+typedef unsigned int u32;
+#endif
+
typedef struct __d2_lattice
{
int max_x,max_y;
int d2_lattice_draw(d2_lattice *d2_l,int x,int y,int arg_c,char **arg_v,unsigned char mode,int max_extra);
int d3_lattice_init(int *argc,char **argv,d3_lattice *d3_l);
int d3_lattice_release(d3_lattice *d3_l);
-int d3_lattice_draw(d3_lattice *d3_l,int x,int y,int z,int arg_c,char **arg_v,unsigned char mode,int max_extra);
+int d3_lattice_draw(d3_lattice *d3_l,int x,int y,int z,int arg_c,char **arg_v,unsigned char mode,int max_extra,u32 *p1,u32 max1,u32 *p2,u32 max2);
int d2_event_init(d2_lattice *d2_l);
int d3_event_init(d3_lattice *d3_l);
int scan_event(d3_lattice *d3_l,int *x,int *y,int *z,int *q,int *esc,int *switchmode,int *bmp,int *ac_distr);
arg_v[25]=NULL;
#endif
+ /* compute graphs for random number rejection method */
+ if((c_profile=(u32 *)malloc(d3_l.max_z*sizeof(unsigned int)))==NULL)
+ {
+ puts("failed allocating memory for carbon profile graph");
+ return -1;
+ }
+ if((n_e_loss=(u32 *)malloc(d3_l.max_z*sizeof(unsigned int)))==NULL)
+ {
+ puts("failed allocating memory for nuclear energy loss graph");
+ return -1;
+ }
+ ip_max=get_reject_graph(&my_info,&d3_l,p_file,c_profile);
+ ne_max=get_reject_graph(&my_info,&d3_l,n_e_file,n_e_loss);
+
if((!strcmp(l_file,""))||(c_step))
{
/* calculate ratio of c_simwindow / c_total */
puts("failed calculating ratio");
return -1;
}
- /* compute graphs for random number rejection method */
- if((c_profile=(u32 *)malloc(d3_l.max_z*sizeof(unsigned int)))==NULL)
- {
- puts("failed allocating memory for carbon profile graph");
- return -1;
- }
- if((n_e_loss=(u32 *)malloc(d3_l.max_z*sizeof(unsigned int)))==NULL)
- {
- puts("failed allocating memory for nuclear energy loss graph");
- return -1;
- }
- ip_max=get_reject_graph(&my_info,&d3_l,p_file,c_profile);
- ne_max=get_reject_graph(&my_info,&d3_l,n_e_file,n_e_loss);
#ifdef DEBUG_RAND
i=0;
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);
sprintf(cc_txt,"total c: %d",my_info.cc);
- d3_lattice_draw(&d3_l,x,y,z,25,arg_v,mode,0);
+ d3_lattice_draw(&d3_l,x,y,z,25,arg_v,mode,0,NULL,0,NULL,0);
}
#endif
if(i%resave==0 && strcmp(s_file,"") && resave!=0 && i!=0)
if(switchmode==0) mode=0;
if(switchmode==1) mode=1;
if(switchmode==2) mode=2;
+ if(switchmode==3) mode=3;
/* end of bahh! */
sprintf(xyz_txt,"x: %d y: %d z: %d",x+1,y+1,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');
if(switchmode==0) strcpy(mode_txt,"view: a/c mode");
if(switchmode==1) strcpy(mode_txt,"view: c conc mode");
if(switchmode==2) strcpy(mode_txt,"view: a pressure mode");
- d3_lattice_draw(&d3_l,x,y,z,25,arg_v,mode,max_extra);
+ if(switchmode==3) strcpy(mode_txt,"view: a/c + profiles mode");
+ d3_lattice_draw(&d3_l,x,y,z,25,arg_v,mode,max_extra,c_profile,ip_max,n_e_loss,ne_max);
bmp=0;
ac_distr=0;
scan_event(&d3_l,&x,&y,&z,&quit,&escape,&switchmode,&bmp,&ac_distr);
#ifndef NLSOP_H
#define NLSOP_H
+#ifndef _U32
+#define _U32
typedef unsigned int u32;
+#endif
typedef struct __info
{