home *** CD-ROM | disk | FTP | other *** search
- /* File drawmap.h */
-
- #define MAX(a,b) ((a)>=(b) ? (a) : (b))
- #define ABS(a) ((a)>=0 ? (a) : (-(a)))
-
- #define BITVAL(x,n) ((x>>n)&1)
- #define BITSETT(x,n) (x | bitval[n])
- #define BITCLEAR(x,n) (x & (~bitval[n]))
- #define BITSTORE(x,n,val) ((val==0) ? (x=BITCLEAR(x,n)) : (x=BITSETT(x,n)))
-
- #define SHADOW_DISP 4 /* shadow displacement (pix) */
-
- #define WC WINDOWCLOSE
- #define WDP WINDOWDEPTH
-
- #define NORMALFLAGS (WC | WDP)
-
- #define IDCMPFLAGS (CLOSEWINDOW | MOUSEBUTTONS)
-
- #define WWIDTH 640 /* window width (pixels) */
- #define WHEIGHT 400 /* window height (pixels) */
- #define VMODE (HIRES | LACE) /* view mode */
- #define DEPTH 2 /* 4 colors => 2 bitplanes */
-
- #define CENTERX WWIDTH/2 /* place origin at center of */
- #define CENTERY (WHEIGHT-10)/2 /* window */
- #define NUMPTS 2100 /* max. no. points per area */
- #define MAXVAL 17718 /* number of words in map */
- #define MAXTIDY 380 /* number of words in map-tidy */
- #define HFACTOR (WWIDTH/360.) /* horizontal scale (pix/deg) */
- #define VFACTOR ((WHEIGHT-10.)/180.) /* vertical scale (pix/deg) */
- #define M_VFACTOR ((WHEIGHT-10.)/4.87) /* vertical scale for Mercator */
- /* map (+/- 80 degrees lat.) */
- #define ASP_RAT ((640./400.)*(188./260.)) /* screen aspect ratio */
- /* (max width / max hgt) */
- #define VRADIUS 160 /* vertical radius of ellipse */
- /* (pixels) */
- #define HRADIUS (short)(ASP_RAT * VRADIUS+0.5) /* horiz. radius (pix) */
-
- #define FILL 1 /* fill area outlines */
- #define NOFILL 0 /* don't fill area outlines */
-
- #define OK 1 /* result flags */
- #define NOT_OK 0
-
- #define BLUE 0L /* workbench colors */
- #define WHITE 1L
- #define BLACK 2L
- #define ORANGE 3L
-
- UWORD mapcolors[] = {
- 0x006b, 0x0fff, 0x0000, 0x0f90, /* blue, white, black, orange */
- 0x0f90, 0x0fff, 0x0000, 0x006b, /* orange, white, black, blue */
- 0x006b, 0x0fff, 0x0000, 0x0caf, /* blue, white, black, violet */
- 0x0caf, 0x0fff, 0x0000, 0x006b, /* violet, white, black, blue */
- 0x006b, 0x0fff, 0x0000, 0x00f0, /* blue, white, black, green */
- 0x00f0, 0x0fff, 0x0000, 0x006b, /* green, white, black, blue */
- 0x006b, 0x0fff, 0x0000, 0x0ff0, /* blue, white, black, yellow */
- 0x0ff0, 0x0fff, 0x0000, 0x006b /* yellow, white, black, blue */
- };
-
- int num_colors = sizeof(mapcolors)/2; /* number of colors in color table */
-
- char mapname[] = "map.bin"; /* names of files containing */
- char mapname_trig[] = "map-trig.bin"; /* map data */
- char tdname[] = "map-tidy.bin";
- char tdname_trig[] = "map-tidy-trig.bin";
-
- #define GLOBE_FILL_MIN 5 /* min # points in area to be */
- /* color-filled on globe */
-
- #define RE 6378.165 /* radius of Earth (kilometers) */
- #define VIEW_HEIGHT 300. /* height above Earth to view */
- /* globe (km) */
- #define MIN_HEIGHT 10. /* minimum view height (km) */
-
- double view_height, eta, etap, facp; /* declare global constants */
-
- double pi = 3.141592653589793;
- double rad, pi2, twopi;
-
- /* region numbers for lakes */
-
- int lakes[] = { 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156 };
-
- int num_lakes = sizeof(lakes) / sizeof(int);
-
- char fontname[] = "topaz.font"; /* screen font name */
-
- struct TextAttr mapfont = { /* screen font */
- (STRPTR) &fontname, 8, 0, 0
- };
-
- struct NewScreen mapscreen = {
- 0, /* left edge of screen */
- 0, /* top edge of screen */
- WWIDTH, WHEIGHT, /* width, height of screen */
- DEPTH, /* 4 colors */
- 1, 0, /* detail pen, block pen */
- VMODE, /* view mode */
- CUSTOMSCREEN, /* type of screen */
- &mapfont, /* screen font */
- "Drawmap v. 2.0, by Bryan Brown", /* screen title */
- NULL,
- NULL
- };
-
- struct NewWindow mapWindow = {
- 0, /* LeftEdge for window measured
- in pixels, at the current
- horizontal resolution, from the
- leftmost edge of the Screen */
- 0, /* TopEdge for window is measured
- in lines from the top of the
- current Screen. */
- WWIDTH, WHEIGHT, /* Width, Height of this window */
- 0, /* DetailPen - what pen number is
- to be used to draw the borders
- of the window */
- 1, /* BlockPen - what pen number is
- to be used to draw system
- generated window gadgets */
- /* (for DetailPen and BlockPen,
- the value of -1 says
- "use the default value") */
- IDCMPFLAGS, /* IDCMP Flags */
- SMART_REFRESH | ACTIVATE | NORMALFLAGS | GIMMEZEROZERO | RMBTRAP |
- BORDERLESS | REPORTMOUSE,
- /* Window Flags */
- NULL, /* FirstGadget */
- NULL, /* CheckMark */
- "Drawmap v. 2.0, by Bryan Brown", /* Window title */
- NULL, /* Pointer to Screen if not
- workbench */
- NULL, /* Pointer to BitMap if a
- SUPERBITMAP window */
- 10, 10, /* minimum width, minimum height */
- WWIDTH, WHEIGHT, /* maximum width, maximum height */
- CUSTOMSCREEN
- };
-
- UWORD arrow_data[] = { /* mouse pointer = arrow */
- 0x0000, 0x0000,
-
- 0x8000, 0x0000,
- 0xc000, 0x0000,
- 0xe000, 0x0000,
-
- 0xf000, 0x0000,
-
- 0xe000, 0x0000,
- 0x2000, 0x0000,
- 0x0000, 0x0000,
-
- 0x0000, 0x0000
- };
-
- int arrow_x_offset = -1;
- int arrow_y_offset = 0;
- int arrow_size = sizeof(arrow_data);
-
- UWORD cross_data[] = { /* mouse pointer = cross */
- 0x0000, 0x0000,
-
- 0x0400, 0x0000,
- 0x0400, 0x0000,
- 0x0400, 0x0000,
- 0x0400, 0x0000,
- 0x0000, 0x0000,
-
- 0xf1e0, 0x0000,
-
- 0x0000, 0x0000,
- 0x0400, 0x0000,
- 0x0400, 0x0000,
- 0x0400, 0x0000,
- 0x0400, 0x0000,
-
- 0x0000, 0x0000
- };
-
- int cross_x_offset = -6;
- int cross_y_offset = -1;
- int cross_size = sizeof(cross_data);
-
- UWORD waiter_data[] = { /* mouse pointer = 'wait' */
- 0x0000, 0x0000,
-
- 0x8800, 0x0000,
- 0x8800, 0x0000,
- 0xa800, 0x0000,
- 0xa800, 0x0000,
- 0x5000, 0x0000,
-
- 0x0e00, 0x0000,
- 0x0100, 0x0000,
- 0x0700, 0x0000,
- 0x0940, 0x0000,
- 0x0700, 0x0000,
-
- 0x00c0, 0x0000,
- 0x0040, 0x0000,
- 0x0040, 0x0000,
- 0x0048, 0x0000,
- 0x00e8, 0x0000,
-
- 0x001c, 0x0000,
- 0x0008, 0x0000,
- 0x0008, 0x0000,
- 0x000a, 0x0000,
- 0x0004, 0x0000,
-
- 0x0000, 0x0000
- };
-
- int waiter_x_offset = -1;
- int waiter_y_offset = 0;
- int waiter_size = sizeof(waiter_data);
-
- UWORD transparent_data[] = { /* mouse pointer = transparent */
- 0x0000, 0x0000,
-
- 0x0000, 0x0000,
- 0x0000, 0x0000,
- 0x0000, 0x0000,
-
- 0x0000, 0x0000
- };
-
- int transparent_x_offset = 0;
- int transparent_y_offset = 0;
- int transparent_size = sizeof(transparent_data);
-