int print_image(MFDB *raster, INFO_IMAGE *in_info) { GEM_WINDOW *wprog = NULL ; DLGDATA dlg_data ; DLGPRINTER_USER_DATA dlg_user_data ; GEM_WINDOW *dlg ; MFDB src ; float sizex, sizey ; float ptpx, ptpy ; int pintin[256], pintout[256] ; int xyarray[4] ; int print_handle ; int i, xoffset, yoffset ; int bouton ; int dither_mono, print_color ; char *filename = dlg_user_data.filename ; char *c ; char buffer[200] ; char nom[30] ; if ( !Gdos ) return(PNOGDOS) ; if ( !printer_init ) scan_drivers() ; if ( nb_drivers <= 0 ) return( PNODRIVER ) ; memset( &dlg_user_data, 0, sizeof(DLGPRINTER_USER_DATA) ) ; if ( raster ) memcpy( &dlg_user_data.raster, raster, sizeof(MFDB) ) ; if ( in_info ) memcpy( &dlg_user_data.info, in_info, sizeof(INFO_IMAGE) ) ; while ( dlg_user_data.raster.fd_w == 0 ) { strcpy( buffer, filename ) ; c = strrchr( buffer, '\\' ) ; if ( c ) *c = 0 ; strcat( buffer, "\\*.*" ) ; if ( file_name( buffer, "", buffer ) == 1 ) { INFO_IMAGE inf ; strcpy( dlg_user_data.filename, buffer ) ; if ( img_format(dlg_user_data.filename, &inf) == 0 ) { memcpy(&dlg_user_data.info, &inf, sizeof(INFO_IMAGE)) ; memset(&dlg_user_data.raster, 0, sizeof(MFDB)) ; dlg_user_data.raster.fd_w = inf.largeur ; dlg_user_data.raster.fd_h = inf.hauteur ; dlg_user_data.raster.fd_nplanes = inf.nplans ; dlg_user_data.raster.fd_wdwidth = dlg_user_data.raster.fd_w/16 ; if (dlg_user_data.raster.fd_w % 16) dlg_user_data.raster.fd_wdwidth++ ; } } else return(PCANCEL) ; } memset( &dlg_data, 0, sizeof(DLGDATA) ) ; dlg_data.RsrcId = FORM_PRINT ; dlg_data.UserData = &dlg_user_data ; dlg_data.ExtensionSize = 0 ; /* Sera alloue par OnInitPrinterDialog */ dlg_data.OnInitDialog = OnInitPrinterDialog ; dlg_data.OnObjectNotify = OnObjectNotifyPrinterDialog ; dlg_data.OnCloseDialog = OnClosePrinterDialog ; dlg = GWCreateDialog( &dlg_data ) ; bouton = GWDoModal( dlg, PRINT_XPC ) ; if ( bouton == IDCANCEL ) return( PCANCEL ) ; printer_index = dlg_user_data.printer_index ; type_index = dlg_user_data.type_index ; if ( dlg_user_data.filename[0] ) { INFO_IMAGE inf ; int analyse = img_analyse ; img_analyse = 0 ; if ( img_format( dlg_user_data.filename, &inf ) == 0 ) { memcpy(&dlg_user_data.info, &inf, sizeof(INFO_IMAGE)) ; src.fd_nplanes = -1 ; /* Conserver le nombre de plans */ Force16BitsLoad = 0 ; wprog = DisplayStdProg( msg[MSG_LOADINGIMG], "", dlg_user_data.filename, 0 ) ; if ( load_picture( dlg_user_data.filename, &src, &inf, wprog ) != 0 ) { GWDestroyWindow( wprog ) ; img_analyse = analyse ; return(PCANCEL) ; } StdProgWText( wprog, 1, "" ) ; } else { img_analyse = analyse ; return( PCANCEL ) ; } img_analyse = analyse ; GWDestroyWindow( wprog ) ; wprog = NULL ; } else memcpy( &src, &dlg_user_data.raster, sizeof(MFDB) ) ; pintin[0] = id[dlg_user_data.printer_index] ; if ((pintin[0] < 21) || (pintin[0] > 30)) return( PNOHANDLE ) ; for (i = 1; i < 10; i++) pintin[i] = 1 ; pintin[10] = 2 ; v_opnwk( pintin, &print_handle, pintout ) ; if ( print_handle <= 0 ) return(PNOHANDLE) ; ptpx = (float)pintout[3] ; /* Largeur d'un point imprimante en microns */ ptpy = (float)pintout[4] ; /* Hauteur d'un point imprimante en microns */ wprog = DisplayStdProg( "", "", "", CLOSER ) ; dither_mono = (dlg_user_data.type_index == 1) && (src.fd_nplanes > 1) ; print_color = (dlg_user_data.type_index == 0) ; if ( dither_mono ) /* Mode noir et blanc */ { MFDB virtuel ; int pc_x, pc_y ; StdProgWText( wprog, 0, msg[MSG_DITHER] ) ; virtuel.fd_nplanes = 1 ; if ( dlg_user_data.rotate90 ) pc_x = (int) (dlg_user_data.xpc*(float)dlg_user_data.info.lpix/ptpy) ; else pc_x = (int) (dlg_user_data.xpc*(float)dlg_user_data.info.lpix/ptpx) ; if ( dlg_user_data.rotate90 ) pc_y = (int) (dlg_user_data.ypc*(float)dlg_user_data.info.hpix/ptpx) ; else pc_y = (int) (dlg_user_data.ypc*(float)dlg_user_data.info.hpix/ptpy) ; mouse_busy() ; if ( dither_ratio(&src, &dlg_user_data.info, &virtuel, pc_x, pc_y, wprog ) == -1 ) { if ( dlg_user_data.filename[0] ) { free( src.fd_addr ) ; if ( dlg_user_data.filename[0] && dlg_user_data.info.palette ) free( dlg_user_data.info.palette ) ; } mouse_restore() ; GWDestroyWindow( wprog ) ; v_clswk( print_handle ) ; return( PROTERR ) ; } wprog->ProgPc( wprog, 0, NULL ) ; mouse_restore() ; if ( dlg_user_data.filename[0] ) free( src.fd_addr ) ; memcpy( &src, &virtuel, sizeof(MFDB) ) ; } if ( dlg_user_data.rotate90 ) { MFDB virtuel ; StdProgWText( wprog, 0, msg[MSG_ROTATING] ) ; mouse_busy() ; if ( raster_r90( &src, &virtuel, wprog ) != 0 ) { if ( dither_mono || dlg_user_data.filename[0] ) free( src.fd_addr ) ; if ( dlg_user_data.filename[0] && dlg_user_data.info.palette ) free( dlg_user_data.info.palette ) ; mouse_restore() ; GWDestroyWindow( wprog ) ; v_clswk( print_handle ) ; return( PROTERR ) ; } mouse_restore() ; if ( dither_mono || dlg_user_data.filename[0] ) free(src.fd_addr ) ; memcpy( &src, &virtuel, sizeof(MFDB) ) ; } sizex = (float)src.fd_w*(float)dlg_user_data.info.lpix*dlg_user_data.xpc/100.0 ; sizey = (float)src.fd_h*(float)dlg_user_data.info.hpix*dlg_user_data.ypc/100.0 ; sizex /= 10000.0 ; sizey /= 10000.0 ; if ( !print_color ) { StdProgWText( wprog, 0, msg[MSG_DOGDOSIMG] ) ; strcpy(nom, "VSCRAP.IMG") ; if ( img_sauve( nom, &src, &dlg_user_data.info, wprog ) ) { if ( dither_mono || dlg_user_data.filename[0] || dlg_user_data.rotate90 ) free( src.fd_addr ) ; if ( dlg_user_data.filename[0] && dlg_user_data.info.palette ) free( dlg_user_data.info.palette ) ; GWDestroyWindow( wprog ) ; v_clswk( print_handle ) ; return( PWRITERR ) ; } } else { INFO_IMAGE new_info ; MFDB new_img ; memcpy( &new_info, &dlg_user_data.info, sizeof(INFO_IMAGE) ) ; memcpy( &new_img, &src, sizeof(MFDB) ) ; if ( new_img.fd_nplanes <= 8 ) { new_info.nb_cpal = 0 ; new_info.palette = NULL ; new_info.nplans = 16 ; new_img.fd_addr = NULL ; new_img.fd_nplanes = 16 ; StdProgWText( wprog, 0, msg[MSG_DOGDOSIMG] ) ; if ( index2truecolor( &src, &dlg_user_data.info, &new_img, wprog ) != 0 ) { if ( dither_mono || dlg_user_data.filename[0] || dlg_user_data.rotate90 ) free( src.fd_addr ) ; if ( dlg_user_data.filename[0] && dlg_user_data.info.palette ) free( dlg_user_data.info.palette ) ; v_clswk( print_handle ) ; GWDestroyWindow( wprog ) ; return( PWRITERR ) ; } } strcpy( nom, "VSCRAP.TGA" ) ; if ( targa_sauve( nom, &new_img, &new_info, wprog ) ) { if ( dither_mono || dlg_user_data.filename[0] || dlg_user_data.rotate90 ) free( src.fd_addr ) ; if ( dlg_user_data.filename[0] && dlg_user_data.info.palette ) free( dlg_user_data.info.palette ) ; v_clswk( print_handle ) ; GWDestroyWindow( wprog ) ; return( PWRITERR ) ; } if ( src.fd_nplanes <= 8 ) free( new_img.fd_addr ) ; } if ( dither_mono || dlg_user_data.filename[0] || dlg_user_data.rotate90 ) free( src.fd_addr ) ; if ( dlg_user_data.filename[0] && dlg_user_data.info.palette ) free( dlg_user_data.info.palette ) ; StdProgWText( wprog, 0, msg[MSG_PRINTING] ) ; vst_unload_fonts( handle, 0 ) ; xoffset = (int) (10000.0*dlg_user_data.posx/ptpx) ; yoffset = (int) (10000.0*dlg_user_data.posy/ptpy) ; xyarray[0] = xoffset ; xyarray[1] = yoffset ; xyarray[2] = xoffset+(int) (10000.0*sizex/ptpx) ; xyarray[3] = yoffset+(int) (10000.0*sizey/ptpy) ; mouse_busy() ; vs_page_info(print_handle, APPL, MENU_NAME) ; vs_page_info(print_handle, DOC, nom) ; vs_page_info(print_handle, CREAT, "") ; vs_page_info(print_handle, REM, "Thanks to Thierry Rodolfo !" ) ; if (dither_mono) v_bit_image(print_handle, nom, 0, INTEGER, INTEGER, 0, 0, xyarray) ; else v_bit_image(print_handle, nom, 0, FRACTIONAL, FRACTIONAL, 0, 0, xyarray) ; v_updwk(print_handle) ; v_clrwk(print_handle) ; v_clswk(print_handle) ; vst_load_fonts(handle, 0) ; mouse_restore() ; unlink(nom) ; GWDestroyWindow( wprog ) ; return( 0 ) ; }
void init_tet( void ) { int i; char s[127]; handle=graf_handle( &i, &i, &i, &i ); work_in[0] = 0; work_in[1] = 1; work_in[2] = 1; work_in[3] = 1; work_in[4] = 1; work_in[5] = 1; work_in[6] = 1; work_in[7] = 1; work_in[8] = 1; work_in[9] = 1; work_in[10] = 2; v_opnvwk( work_in, &handle, work_out ); v_clrwk( handle ); v_hide_c( handle ); puts("\033H"); puts("Willkommen zum BLOWCONF-Cheatmodus,\ndem Mini TETris von Michael Eberl"); puts(""); puts("Dieses Programm entstand auf dringenden Wunsch von"); puts("Georg Acher am 14.7.1994 und wurde am 27.9.96 von"); puts("Michael Eberl in BlowConf integriert."); puts(""); puts("Bedienung:"); puts("Bewegung nach links : Linke Shift-Taste"); puts("Bewegung nach rechts : Rechte Shift-Taste"); puts("Drehung des Steins : Alternate-Taste"); puts(""); puts("Aus praktischen Gr�nden ist eine y-Aufl�sung\nvon mind. 544 Punkten n�tig!!!"); puts(""); puts("Nach Spielende wird ein eventueller Highscore abgespeichert,"); puts("dann wird zu BLOWCONF zur�ckgekehrt."); puts(""); puts("Viel Spa�!"); puts(""); puts("Press <Return> to start...!"); (void)gets(s); v_clrwk( handle ); xres = 1+ work_out[0]; yres = 1+ work_out[1]; for (i=0; i<HEIGHT; i++) playfield[i]=0; stones[0]=stone1; stones[1]=stone2; stones[2]=stone3; stones[3]=stone4; stones[4]=stone5; stones[5]=stone6; stones[6]=stone7; if ((highfile=(int)Fopen("HISCORE.DAT", FO_READ))<0) { hiscore=0; strcpy(hiname,""); } else { Fread( highfile, 4, &hiscore ); Fread( highfile, 128, hiname ); Fclose( highfile ); } }
/* ** Description ** Initialize global variables, open vdi workstation etc */ void init_global (WORD physical_vdi_id) { #if 0 int temp_vid; int work_in[] = {1,1,1,1,1,1,1,1,1,1,2}; #endif int work_out[57]; int dum; static int is_inited = FALSE; /* Only initialize globals if they haven't been initialized before */ if(!is_inited) { is_inited = TRUE; DEBUG3 ("Entering init_global"); #if 0 /* FIXME def MINT_TARGET */ /* Only mess with videomodes if running under MiNT */ if(globals.video == 0x00030000L) { fprintf(stderr,"VsetMode\r\n"); oldmode = globals.vmode = 3; oldmodecode = globals.vmodecode = VsetMode(-1); fprintf(stderr,"/VsetMode\r\n"); } else { oldmode = globals.vmode = Getrez(); }; #endif /* MINT_TARGET */ global_common.mouse_owner = -1; global_common.realmove = 0; global_common.realsize = 0; global_common.realslide = 0; global_common.fnt_regul_id = -1; global_common.fnt_regul_sz = -1; global_common.icon_width = 48; global_common.icon_height = 56; global_common.wind_appl = 1; global_common.graf_mbox = 1; global_common.graf_growbox = 1; global_common.graf_shrinkbox = 1; global_common.fsel_sorted = 1; global_common.fsel_extern = 0; DEBUG3 ("init_global: 2"); #if 0 /* FIXME : Remove? def MINT_TARGET */ fprintf(stderr,"appl_init()\r\n"); own_appl_init(); fprintf(stderr,"/appl_init()\r\n"); if(open_physical_ws) { printf("No other AES found. Opening own Workstation.\r\n"); work_in[0] = 5; v_opnwk(work_in,&global_common.vid,work_out); if(global_common.video == 0x00030000L) { VsetScreen(NULL, NULL, global_common.vmode, global_common.vmodecode); } else { VsetScreen((void*)-1, (void *)-1, global_common.vmode, global_common.vmodecode); } } else { printf("Other AES detected.\r\n"); global_common.vid = own_graf_handle(); v_clrwk(global_common.vid); } #endif global_common.physical_vdi_id = physical_vdi_id; DEBUG2 ("lib_global.c: init_global: calling vq_extnd"); vq_extnd (physical_vdi_id, 0, work_out); global_common.screen.x = 0; global_common.screen.y = 0; global_common.screen.width = work_out[0] + 1; global_common.screen.height = work_out[1] + 1; global_common.num_pens = work_out[13]; vq_extnd (physical_vdi_id, 1, work_out); global_common.num_planes = work_out[4]; /* setup systemfont information */ if(global_common.screen.height >= 400) { global_common.fnt_regul_id = 1; global_common.fnt_regul_sz = 13; } else { global_common.fnt_regul_id = 1; global_common.fnt_regul_sz = 9; } global_common.fnt_small_id = global_common.fnt_regul_id; global_common.fnt_small_sz = global_common.fnt_regul_sz / 2; vst_font (physical_vdi_id, global_common.fnt_regul_id); vst_point (physical_vdi_id, global_common.fnt_regul_sz, &dum, &dum, &dum, &dum); global_common.arrowrepeat = 100; DEBUG2 ("lib_global.c: init_global: calling vqt_attributes"); vqt_attributes (physical_vdi_id, work_out); global_common.blwidth = work_out[8] + 3; global_common.blheight = work_out[9] + 3; global_common.clwidth = work_out[8]; global_common.clheight = work_out[9]; global_common.bswidth = work_out[8] / 2 + 3; global_common.bsheight = work_out[9] / 2 + 3; global_common.cswidth = work_out[8] / 2; global_common.csheight = work_out[9] / 2; global_common.time = 0L; #ifndef MINT_TARGET global_common.callback_handler = oaesis_callback; #endif DEBUG2("lib_global.c: init_global: Calling Rsrc_do_rcfix"); Rsrc_do_rcfix (physical_vdi_id, (RSHDR *)resource, FALSE , TRUE ); DEBUG2("lib_global.c: init_global: Called Rsrc_do_rcfix"); Rsrc_do_gaddr((RSHDR *)resource, R_TREE, AICONS, &global_common.aiconstad, TRUE); DEBUG3("init_global: 10"); Rsrc_do_gaddr((RSHDR *)resource, R_TREE, ALERT, &global_common.alerttad, TRUE); Rsrc_do_gaddr((RSHDR *)resource, R_TREE, FISEL, &global_common.fiseltad, TRUE); Rsrc_do_gaddr((RSHDR *)resource, R_TREE, PMENU, &global_common.pmenutad, TRUE); Rsrc_do_gaddr((RSHDR *)resource, R_FRSTR, 0, (OBJECT **)&global_common.fr_string, TRUE); /* Initialize window elements and resource counters */ Rsrc_do_gaddr((RSHDR *)resource, R_TREE, WINDOW, &global_common.windowtad, TRUE); global_common.elemnumber = -1; DEBUG3("init_global: 11"); /* Init mouseforms */ Rsrc_do_rcfix (physical_vdi_id, (RSHDR *)cursors, FALSE , TRUE ); DEBUG3("init_global: 12"); Rsrc_do_gaddr((RSHDR *)cursors, R_TREE, MOUSEFORMS, &global_common.mouseformstad, TRUE); DEBUG3("init_global: 13"); Graf_init_mouseforms(); DEBUG3("init_global: 14"); #ifdef MINT_TARGET /* Initialize semaphore used by Shel_do_write */ Psemaphore(SEM_CREATE, SHEL_WRITE_LOCK, 0); Psemaphore(SEM_UNLOCK, SHEL_WRITE_LOCK, 0); #endif } }