int cmd_modify_count(int mode, ibp_connect_context_t *cc, char **argv, int argc) { ibp_cap_t *cap; ibp_op_t op; int captype; int err, timeout; if (argc < 3) { printf("cmd_modify_count: Not enough parameters. Received %d need 3\n", argc); return(0); } cap = argv[0]; captype = scan_map(argv[1], _ibp_captype_map, table_len(_ibp_captype_map)); timeout = atoi(argv[2]); if (captype < 0) { printf("cmd_modify_count: Bad captype: %s\n", argv[1]); exit(1); } set_ibp_modify_count_op(&op, cap, mode, captype, timeout, NULL, cc); err = ibp_sync_command(&op); if (err != IBP_OK) { printf("cmd_modify_count: Error %s(%d)\n", _ibp_error_map[-err], err); return(0); } return(0); }
void ppm_output() { compute_positions(); scan_map(); do_dots(); ppm_setup(stdout); render(ppm_row); }
void gif_output() { compute_positions(); scan_map(); do_dots(); gif_setup(stdout); render(gif_row); gif_cleanup(); }
void store_attr(ibp_attributes_t *attr, char **argv) { int type, rel, duration; rel = scan_map(argv[0], _ibp_rel_map, table_len(_ibp_rel_map)); type = scan_map(argv[1], _ibp_type_map, table_len(_ibp_type_map)); duration = atoi(argv[2]); if (rel < 0) { printf("store_attr: Bad rel type: %s\n", argv[0]); exit(1); } if (type < 0) { printf("store_attr: Bad type type: %s\n", argv[1]); exit(1); } set_ibp_attributes(attr, time(NULL) + duration, rel, type); }
void png_output () { compute_positions (); scan_map (); do_dots (); if (num_colors > 256) { png_truecolor_setup (); render (png_truecolor_row); png_truecolor_cleanup (stdout); } else { png_setup (); render (png_row); png_cleanup (stdout); } }
void bmp_output() { compute_positions(); scan_map(); do_dots(); if (num_colors > 256) { bmp_truecolor_setup(); render(bmp_truecolor_row); bmp_truecolor_cleanup(); } else { bmp_setup(); render(bmp_row); bmp_cleanup(); } }
int cmd_modify_alloc(ibp_connect_context_t *cc, char **argv, int argc) { ibp_cap_t *cap; ibp_op_t op; int rel; size_t size; time_t duration; int err, timeout; if (argc < 5) { printf("cmd_modify_alloc: Not enough parameters. Received %d need 5\n", argc); return(0); } cap = argv[0]; size = atol(argv[1]); duration = atol(argv[2]); rel = scan_map(argv[3], _ibp_rel_map, table_len(_ibp_rel_map)); timeout = atoi(argv[4]); if (rel < 0) { printf("cmd_modify_alloc: Bad reliability: %s\n", argv[3]); exit(1); } timeout = atoi(argv[4]); set_ibp_modify_alloc_op(&op, cap, size, duration, rel, timeout, NULL, cc); err = ibp_sync_command(&op); if (err != IBP_OK) { printf("cmd_modify_alloc: Error %s(%d)\n", _ibp_error_map[-err], err); return(0); } return(0); }
void main_menu() { image *Earth=cash.img(earth); image *Emap=cash.img(earth_mask); char name[20]; ico_button *buts[MENU_TICONS]; long maxx=0,maxy=0; int i=0; for (;i<MENU_TICONS;i++) { sprintf(name,"icon%04d.pcx",i*3+1); menu_icons[i*3]=cash.reg("art/icons.spe",name,SPEC_IMAGE,1); sprintf(name,"icon%04d.pcx",i*3+2); menu_icons[i*3+1]=cash.reg("art/icons.spe",name,SPEC_IMAGE,1); sprintf(name,"icon%04d.pcx",i*3+2); menu_icons[i*3+2]=cash.reg("art/icons.spe",name,SPEC_IMAGE,1); long x=WINDOW_FRAME_LEFT+(i%9)*cash.img(menu_icons[0])->width(); long y=WINDOW_FRAME_TOP+(i/9)*cash.img(menu_icons[0])->height(); if (x>maxx) maxx=x; if (y>maxy) maxy=y; buts[i]=new ico_button(x,y,menu_icons_ids[i], menu_icons[i*3],menu_icons[i*3], menu_icons[i*3+1],menu_icons[i*3+2],NULL); } buts[0]->next=buts[1]; int b1,b2,b3,b4; if (DEFINEDP(symbol_value)) { if (symbol_value(l_difficulty)==l_extreme) { b1=18; b2=10; b3=12; b4=14; } else if (symbol_value(l_difficulty)==l_hard) { b1=14; b2=18; b3=10; b4=12; } else if (symbol_value(l_difficulty)==l_easy) { b1=10; b2=12; b3=14; b4=18; } else { b1=12; b2=14; b3=18; b4=10; } } else { b1=12; b2=14; b3=18; b4=10; } buts[b1]->next=buts[b2]; buts[b2]->next=buts[b3]; buts[b3]->next=buts[b4]; buts[1]->next=new ico_switch_button(buts[0]->X(), buts[0]->Y()+cash.img(menu_icons[0])->height()*2, ID_NULL, buts[b1],buts[17]); buts[17]->next=buts[8]; buts[1]->set_xy(buts[0]->X(), buts[0]->Y()+cash.img(menu_icons[0])->height()*1); buts[12]->set_xy(buts[0]->X(), buts[0]->Y()+cash.img(menu_icons[0])->height()*2); buts[17]->set_xy(buts[0]->X(), buts[0]->Y()+cash.img(menu_icons[0])->height()*3); buts[8]->set_xy(buts[0]->X(), buts[0]->Y()+cash.img(menu_icons[0])->height()*4); ico_win=eh->new_window(-1,yres/2-80,-1,-1,buts[0],"Menu"); // pmenu *main_pm=new pmenu(0,0,game_sub,screen,eh); time_marker old_time; screen->add_dirty(0,0,319,199); // create sphere map mask_line *p=make_mask_lines(Emap,Earth->width()); int eoff=0,coff=0; event ev; // main_pm->draw(screen,eh,1); long x=84,y=60; Cell *v=find_symbol("earth_x"); if (v && DEFINEDP(v)) x=lnumber_value(symbol_value(v)); v=find_symbol("earth_y"); if (v && DEFINEDP(v)) y=lnumber_value(symbol_value(v)); int state=0,stop_menu=0; time_marker start; do { time_marker new_time; if (state || new_time.diff_time(&old_time)>0.15) { old_time.get_time(); scan_map(screen,x,y,Earth,NULL,p,Emap->height(),eoff,coff); if (state) { eoff+=8; coff+=4; } else { eoff+=2; coff+=1; } if (eoff>=320) eoff-=320; if (coff>=320) coff-=320; eh->flush_screen(); } if (eh->event_waiting()) { eh->get_event(ev); start.get_time(); // reset time till demo starts up menu_handler(ev,ico_win); if (ev.type==EV_MOUSE_BUTTON && ev.mouse_button && ev.mouse_move.x>=x && ev.mouse_move.y>=y && ev.mouse_move.x<=x+Emap->width() && ev.mouse_move.y<=y+Emap->height()) { state=1; } else if (ev.type==EV_MOUSE_BUTTON && !ev.mouse_button) state=0; eh->flush_screen(); } if (new_time.diff_time(&start)>10) { if (!current_demo) { void *d=make_find_symbol("demos"); if (DEFINEDP(d)) current_demo=symbol_value(d); } if (current_demo) { if (set_demo_mode(DEMO_PLAY,lstring_value(CAR(current_demo)),eh)) stop_menu=1; current_demo=CDR(current_demo); } } } while (!stop_menu && (ev.type!=EV_MESSAGE || (ev.message.id!=ID_START_GAME && ev.message.id!=ID_QUIT))); for (i=0;i<MENU_TICONS;i++) { ifield *ic=ico_win->inm->unlink(menu_icons_ids[i]); if (i) delete ic; else delete buts[i]; } eh->close_window(ico_win); for (int xx=0;xx<Emap->height();xx++) jfree(p[xx].remap); jfree(p); if (ev.message.id==ID_QUIT) // propogate the quit message the_game->end_session(); // delete main_pm; }