Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1 | pmbaty | 1 | /* |
| 2 | * Portions of this file are copyright Rebirth contributors and licensed as |
||
| 3 | * described in COPYING.txt. |
||
| 4 | * Portions of this file are copyright Parallax Software and licensed |
||
| 5 | * according to the Parallax license below. |
||
| 6 | * See COPYING.txt for license details. |
||
| 7 | |||
| 8 | THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX |
||
| 9 | SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO |
||
| 10 | END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A |
||
| 11 | ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS |
||
| 12 | IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS |
||
| 13 | SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE |
||
| 14 | FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE |
||
| 15 | CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS |
||
| 16 | AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE. |
||
| 17 | COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. |
||
| 18 | */ |
||
| 19 | |||
| 20 | #include <conio.h> |
||
| 21 | #include <stdio.h> |
||
| 22 | #include <stdlib.h> |
||
| 23 | |||
| 24 | #include "iff.h" |
||
| 25 | #include "vga.h" |
||
| 26 | #include "palette.h" |
||
| 27 | #include "mem.h" |
||
| 28 | |||
| 29 | //#define ANIM_TEST 1 //if defined, read in anim brush |
||
| 30 | |||
| 31 | rle_span(ubyte *dest,ubyte *src,int len); |
||
| 32 | |||
| 33 | |||
| 34 | ubyte test_span[] = {0,1,2,3,4,4,5,6,7,8,8,8,8,8,9,10,11,11}; |
||
| 35 | ubyte new_span[256]; |
||
| 36 | |||
| 37 | extern void gr_pal_setblock( int start, int number, unsigned char * pal ); |
||
| 38 | |||
| 39 | main(int argc,char **argv) |
||
| 40 | { |
||
| 41 | int ret; |
||
| 42 | grs_bitmap my_bitmap; |
||
| 43 | ubyte my_palette[256*3]; |
||
| 44 | grs_bitmap *bm_list[100]; |
||
| 45 | int n_bitmaps; |
||
| 46 | char key; |
||
| 47 | |||
| 48 | #if 0 |
||
| 49 | { |
||
| 50 | int new_len,i; |
||
| 51 | new_len=rle_span(new_span,test_span,sizeof(test_span)); |
||
| 52 | printf("old span (%d): ",sizeof(test_span)); |
||
| 53 | for (i=0;i<sizeof(test_span);i++) printf("%d ",test_span[i]); |
||
| 54 | printf("\nnew span (%d): ",new_len); |
||
| 55 | for (i=0;i<new_len;i++) printf("%d ",new_span[i]); |
||
| 56 | exit(0); |
||
| 57 | } |
||
| 58 | #endif |
||
| 59 | |||
| 60 | #ifdef ANIM_TEST |
||
| 61 | ret = iff_read_animbrush(argv[1],bm_list,100,&n_bitmaps,&my_palette); |
||
| 62 | #else |
||
| 63 | ret = iff_read_bitmap(argv[1],&my_bitmap,bm_mode::linear,&my_palette); |
||
| 64 | bm_list[0] = &my_bitmap; |
||
| 65 | n_bitmaps = 1; |
||
| 66 | #endif |
||
| 67 | |||
| 68 | printf("ret = %d\n",ret); |
||
| 69 | printf("error message = <%s>",iff_errormsg(ret)); |
||
| 70 | |||
| 71 | if (ret == IFF_NO_ERROR) { |
||
| 72 | int i; |
||
| 73 | |||
| 74 | vga_init(); |
||
| 75 | gr_init(); |
||
| 76 | vga_set_mode(SM_320x200C); |
||
| 77 | |||
| 78 | for (i=0;i<n_bitmaps;) { |
||
| 79 | |||
| 80 | if (argc>2) { |
||
| 81 | ret = iff_write_bitmap(argv[2],bm_list[i],&my_palette); |
||
| 82 | printf("ret = %d\n",ret); |
||
| 83 | } |
||
| 84 | |||
| 85 | //gr_pal_setblock(0,256,&my_palette); |
||
| 86 | gr_palette_load(&my_palette); |
||
| 87 | //gr_pal_fade_in(grd_curscreen->pal); //in case palette is blacked |
||
| 88 | |||
| 89 | gr_ubitmap(0,0,bm_list[i]); |
||
| 90 | |||
| 91 | key = getch(); |
||
| 92 | |||
| 93 | if (key=='-') {if (i) i--;} |
||
| 94 | else i++; |
||
| 95 | |||
| 96 | } |
||
| 97 | |||
| 98 | gr_close(); |
||
| 99 | |||
| 100 | for (i=0;i<n_bitmaps;i++) { |
||
| 101 | free(bm_list[i]->bm_data); |
||
| 102 | |||
| 103 | #ifdef ANIM_TEST |
||
| 104 | free(bm_list[i]); |
||
| 105 | #endif |
||
| 106 | |||
| 107 | } |
||
| 108 | } |
||
| 109 | |||
| 110 | } |
||
| 111 |