1 #include <intuition/intuition.h>
2 #include <graphics/gfx.h>
3 #include <cybergraphx/cybergraphics.h>
4 #include <proto/exec.h>
5 #include <proto/graphics.h>
6 #include <proto/intuition.h>
7 #include <proto/cybergraphics.h>
11 struct IntuitionBase
*IntuitionBase
;
12 struct GfxBase
*GfxBase
;
13 struct Library
*CyberGfxBase
;
17 #include "ilbmtoc_image.c"
19 UBYTE unpacked_image
[EARTHMAP_SMALL_WIDTH
* EARTHMAP_SMALL_HEIGHT
];
21 #define CONTINENT_RED 18
22 #define CONTINENT_GREEN 114
23 #define CONTINENT_BLUE 58
26 #define OCEAN_GREEN 18
27 #define OCEAN_BLUE 114
29 static unsigned char *unpack_byterun1(unsigned char *source
, unsigned char *dest
, LONG unpackedsize
)
36 c
= (signed char)(*source
++);
42 if (--unpackedsize
<= 0) return source
;
53 if (--unpackedsize
<= 0) return source
;
62 IntuitionBase
= (struct IntuitionBase
*)OpenLibrary("intuition.library", 39);
63 GfxBase
= (struct GfxBase
*)OpenLibrary("graphics.library", 39);
64 CyberGfxBase
= OpenLibrary("cybergraphics.library", 39);
66 if (IntuitionBase
&& GfxBase
&& CyberGfxBase
)
68 printf("All libraries opened\n");
70 win
= OpenWindowTags(0, WA_InnerWidth
, EARTHMAP_SMALL_WIDTH
,
71 WA_InnerHeight
, EARTHMAP_SMALL_HEIGHT
,
75 WA_IDCMP
, IDCMP_CLOSEWINDOW
,
81 unpack_byterun1(earthmap_small_data
, unpacked_image
, EARTHMAP_SMALL_WIDTH
* EARTHMAP_SMALL_HEIGHT
);
86 for(i
= 0; i
< EARTHMAP_SMALL_COLORS
; i
++)
88 ULONG rgb
= earthmap_small_pal
[i
];
89 ULONG red
= (rgb
& 0xFF0000) >> 16;
90 ULONG green
= (rgb
& 0x00FF00) >> 8;
91 ULONG blue
= (rgb
& 0x0000FF);
92 ULONG alpha
= (red
+ green
+ blue
) / 3;
94 red
= (alpha
* OCEAN_RED
+ (255 - alpha
) * CONTINENT_RED
) / 255;
95 green
= (alpha
* OCEAN_GREEN
+ (255 - alpha
) * CONTINENT_GREEN
) / 255;
96 blue
= (alpha
* OCEAN_BLUE
+ (255 - alpha
) * CONTINENT_BLUE
) / 255;
98 rgb
= (red
<< 16) + (green
<< 8) + blue
;
100 earthmap_small_pal
[i
] = rgb
;
105 WriteLUTPixelArray(unpacked_image
,
108 EARTHMAP_SMALL_WIDTH
,
113 EARTHMAP_SMALL_WIDTH
,
114 EARTHMAP_SMALL_HEIGHT
,
117 WaitPort(win
->UserPort
);