static SANE_Status snap_pic (int fd) { char f[] = "snap_pic"; /* make sure camera is set to our settings state */ if (change_res (Camera.fd, dc210_opt_lowres) == -1) { DBG (1, "%s: Failed to set resolution\n", f); return SANE_STATUS_INVAL; } /* take the picture */ if (send_pck (fd, shoot_pck) == -1) { DBG (4, "%s: error: send_pck returned -1\n", f); return SANE_STATUS_INVAL; } else { if (end_of_data (Camera.fd) == -1) { DBG (2, "%s: error: end_of_data returned -1\n", f); return SANE_STATUS_INVAL; } } Camera.pic_taken++; Camera.pic_left--; Camera.current_picture_number = Camera.pic_taken; image_range.max++; sod[DC210_OPT_IMAGE_NUMBER].cap &= ~SANE_CAP_INACTIVE; /* add this one to the Pictures array */ if ((Camera.Pictures = (PictureInfo *) realloc (Camera.Pictures, Camera.pic_taken * sizeof (PictureInfo))) == NULL) { DBG (4, "%s: error: allocate memory for pictures array\n", f); return SANE_STATUS_INVAL; } if (get_picture_info (Camera.Pictures + Camera.pic_taken, Camera.pic_taken) == -1) { DBG (1, "%s: Failed to get new picture info\n", f); /* XXX - I guess we should try to erase the image here */ return SANE_STATUS_INVAL; } return SANE_STATUS_GOOD; }
void d1x_options_menu() { newmenu_item m[14]; int i=0; int opt=0; int inputs,checks,commands; char smaxfps[4]; char shudmaxnumdisp[4]; char thogdir[64]; extern int gr_message_color_level; sprintf(thogdir,AltHogDir); sprintf(smaxfps,"%d",maxfps); sprintf(shudmaxnumdisp,"%d",HUD_max_num_disp); m[opt].type = NM_TYPE_MENU; m[opt].text = "Primary autoselect ordering..."; opt++; m[opt].type = NM_TYPE_MENU; m[opt].text = "Secondary autoselect ordering..."; opt++; //added on 2/4/99 by Victor Rachels for new key menu m[opt].type = NM_TYPE_MENU; m[opt].text = "D1X Keys"; opt++; //end this section addition - VR //enabled 3/24/99 - Owen Evans m[opt].type = NM_TYPE_MENU; m[opt].text = "Change Screen Resolution"; opt++; //end enabled stuff - OE commands=opt; //added on 2/2/99 by Victor Rachels for bans #ifdef NETWORK m[opt].type = NM_TYPE_MENU; m[opt].text = "Save bans now"; opt++; #endif //end this section addition - VR m[opt].type = NM_TYPE_TEXT; m[opt].text = "Maximum Framerate (1-80):"; opt++; inputs=opt; m[opt].type = NM_TYPE_INPUT; m[opt].text = smaxfps; m[opt].text_len=3; opt++; m[opt].type = NM_TYPE_TEXT; m[opt].text = "Mission Directory"; opt++; m[opt].type = NM_TYPE_INPUT; m[opt].text = thogdir; m[opt].text_len=64; opt++; m[opt].type = NM_TYPE_TEXT; m[opt].text = "Hud Messages lines (1-80):"; opt++; m[opt].type = NM_TYPE_INPUT; m[opt].text = shudmaxnumdisp; m[opt].text_len=3; opt++; m[opt].type = NM_TYPE_SLIDER; m[opt].text = "Message colorization level"; m[opt].value=gr_message_color_level;m[opt].min_value=0;m[opt].max_value=3; opt++; checks=opt; #ifdef __MSDOS__ m[opt].type = NM_TYPE_CHECK; m[opt].text = "Joy is sidewinder"; m[opt].value=Joy_is_Sidewinder; opt++; #endif #ifdef SUPPORTS_NICEFPS m[opt].type = NM_TYPE_CHECK; m[opt].text = "Nice FPS (free cpu cycles)"; m[opt].value = use_nice_fps; opt++; #endif for(;;) { i=newmenu_do1( NULL, "D1X options", opt, m, &d1x_options_menu_poll, i); if(i>-1) { if(i<commands) { switch(i) { case 0: reorder_primary(); break; case 1: reorder_secondary(); break; //added on 2/4/99 by Victor Rachels for new key menu case 2: kconfig(3,"D1X Keys"); break; //end this section addition - VR //enabled 3/24/99 - Owen Evans case 3: change_res(); break; //end enabled stuff - OE } } //added on 2/4/99 by Victor Rachels for bans #ifdef NETWORK if(i==commands+0) { nm_messagebox(NULL,1,TXT_OK, "%i Bans saved",writebans()); } #endif //end this section addition - VR if(i==inputs+0) { maxfps = atoi(smaxfps); if(maxfps < 1||maxfps>80) { nm_messagebox(TXT_ERROR, 1, TXT_OK, "Invalid value for maximum framerate"); maxfps=80; i=(inputs+0); } } else if(i==inputs+2) cfile_use_alternate_hogdir(thogdir); else if(i==inputs+4) { HUD_max_num_disp = atoi(shudmaxnumdisp); if(HUD_max_num_disp < 1||HUD_max_num_disp>HUD_MAX_NUM) { nm_messagebox(TXT_ERROR, 1, TXT_OK, "Invalid value for hud lines"); HUD_max_num_disp=4; // i=(inputs+4);//??? } } gr_message_color_level=m[inputs+5].value; sprintf(shudmaxnumdisp,"%d",HUD_max_num_disp); sprintf(smaxfps,"%d",maxfps); // m[inputs+0].text=smaxfps;//redundant.. its not going anywhere sprintf(thogdir,AltHogDir); // m[inputs+2].text=thogdir;//redundant } else break; } write_player_file(); #ifdef __MSDOS__ Joy_is_Sidewinder=m[(checks+0)].value; #endif #ifdef __LINUX__ Joy_is_Sidewinder=0; #endif #ifdef SUPPORTS_NICEFPS use_nice_fps=m[(checks+0)].value; #else use_nice_fps=0; #endif }