Mercurial > hg > dmlib
comparison tools/lib64gfx.h @ 2139:84780a9d8d17
Improve and fix charmap format decoding.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 29 May 2019 13:11:00 +0300 |
parents | 6528a1398e8e |
children | 487157934904 |
comparison
equal
deleted
inserted
replaced
2138:fdd0fd7dc0e6 | 2139:84780a9d8d17 |
---|---|
26 // Bitmap constants | 26 // Bitmap constants |
27 #define D64_SCR_WIDTH 320 | 27 #define D64_SCR_WIDTH 320 |
28 #define D64_SCR_HEIGHT 200 | 28 #define D64_SCR_HEIGHT 200 |
29 #define D64_SCR_CH_WIDTH (D64_SCR_WIDTH/8) | 29 #define D64_SCR_CH_WIDTH (D64_SCR_WIDTH/8) |
30 #define D64_SCR_CH_HEIGHT (D64_SCR_HEIGHT/8) | 30 #define D64_SCR_CH_HEIGHT (D64_SCR_HEIGHT/8) |
31 #define D64_MAX_EXTRA_DATA 64 | 31 #define D64_MAX_EXTRA_DATA 16 |
32 #define D64_MAX_EXTRA_INFO 64 | |
32 | 33 |
33 // C64 video screen pixel aspect ratio on PAL | 34 // C64 video screen pixel aspect ratio on PAL |
34 #define D64_SCR_PAR_XY (0.9365f) | 35 #define D64_SCR_PAR_XY (0.9365f) |
35 | 36 |
36 // Sprite constants | 37 // Sprite constants |
82 enum | 83 enum |
83 { | 84 { |
84 D64_CHCFG_SCREEN, // Use screen memory | 85 D64_CHCFG_SCREEN, // Use screen memory |
85 D64_CHCFG_LINEAR = 1, // Generate linear pattern so that first line | 86 D64_CHCFG_LINEAR = 1, // Generate linear pattern so that first line |
86 // of chars is 0-39, second 40-79, up to 255. | 87 // of chars is 0-39, second 40-79, up to 255. |
88 }; | |
89 | |
90 | |
91 // Various extra settings (see DMC64Image::extraInfo[]) | |
92 enum | |
93 { | |
94 D64_EI_CHAR_CASE = 0, | |
95 D64_EI_CHAR_MODE, | |
96 D64_EI_CHAR_CUSTOM, | |
87 }; | 97 }; |
88 | 98 |
89 | 99 |
90 // Image <-> bitmap conversion dithering | 100 // Image <-> bitmap conversion dithering |
91 enum | 101 enum |
176 Uint8 d020, bgcolor, d022, d023, d024; | 186 Uint8 d020, bgcolor, d022, d023, d024; |
177 | 187 |
178 // Extra data areas used by some formats, | 188 // Extra data areas used by some formats, |
179 // for example raster colours might be stored | 189 // for example raster colours might be stored |
180 DMC64MemBlock extraData[D64_MAX_EXTRA_DATA]; | 190 DMC64MemBlock extraData[D64_MAX_EXTRA_DATA]; |
191 | |
192 // Extra information / settings used by some formats, | |
193 // for example some PETSCII-type formats. | |
194 // See D64_EI_* constants. | |
195 Uint8 extraInfo[D64_MAX_EXTRA_INFO]; | |
181 | 196 |
182 //DMC64Sprite sprites[D64_MAX_SPRITES]; | 197 //DMC64Sprite sprites[D64_MAX_SPRITES]; |
183 } DMC64Image; | 198 } DMC64Image; |
184 | 199 |
185 | 200 |
472 switch ((img->charData[chrbank].data[chroffs] >> vshift) & 3) | 487 switch ((img->charData[chrbank].data[chroffs] >> vshift) & 3) |
473 { | 488 { |
474 case 0: *col = bgcolor; break; | 489 case 0: *col = bgcolor; break; |
475 case 1: *col = bgd022; break; | 490 case 1: *col = bgd022; break; |
476 case 2: *col = bgd023; break; | 491 case 2: *col = bgd023; break; |
477 case 3: *col = ccol & 15; | 492 case 3: *col = ccol & 7; |
478 } | 493 } |
479 } | 494 } |
480 else | 495 else |
481 { | 496 { |
482 const int vshift = 7 - (rasterX & 7); | 497 const int vshift = 7 - (rasterX & 7); |