/* 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 IDCMPFLAGS (CLOSEWINDOW | RAWKEY | MOUSEBUTTONS | MENUPICK) #define WYOFFS 10 /* Y-Offset between 0,0 coord. */ /* on Screen and Window */ #define WWIDTH 640 /* window width (pixels) */ #define WHEIGHT 390 /* window height (pixels) */ #define SHEIGHT 400 /* SCREEN height */ #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)/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)/180.) /* vertical scale (pix/deg) */ #define M_VFACTOR ((WHEIGHT)/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 BLACK 2L #define WHITE 3L #define ORANGE 1L #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 600. /* height above Earth to view */ /* globe (km) */ #define MIN_HEIGHT 10. /* minimum view height (km) */ UWORD mapcolors[] = { 0x000C, 0x0F60, 0x0002, 0x0FFF, 0x038f, 0x0b51, 0x0000, 0x0fff, 0x0f91, 0x0fff, 0x0000, 0x009b, 0x0e6f, 0x0000, 0x0901, 0x0fff, 0x0caf, 0x0fff, 0x0000, 0x07e2, 0x00e2, 0x0f6e, 0x0000, 0x00ef, 0x0ff0, 0x003f, 0x0520, 0x0ae9, 0x069e, 0x0192, 0x0000, 0x0fff, 0x0aaa, 0x0eef, 0x0000, 0x0fff, }; #define num_colors sizeof(mapcolors)/2 /* number of colors in color table */ #define mapname "map.bin" /* names of files containing */ #define mapname_trig "map-trig.bin" /* map data */ #define tdname "map-tidy.bin" #define tdname_trig "map-tidy-trig.bin" double view_height, eta, etap, facp; /* declare global constants */ /* double pi = 3.141592653589793; double rad, pi2, twopi; */ #define pi 3.141592653589793 #define pi2 (pi/2.) /* initialize constants */ #define twopi (2.*pi) #define rad (pi/180.) /* pi2 = pi/2.; * initialize constants * twopi = 2.*pi; rad = pi/180.; */ 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 }; #define 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, SHEIGHT, /* width, height of screen */ DEPTH, /* 4 colors */ 2, 1, /* detail pen, block pen */ VMODE, /* view mode */ CUSTOMSCREEN, /* type of screen */ &mapfont, /* screen font */ " Drawmap V. 2.30d, by Bryan Brown", /* screen title */ NULL, NULL }; struct NewWindow mapWindow = { 0, 10, WWIDTH, WHEIGHT, /* Width, Height of this window */ 3, 2, NULL, /* IDCMP Flags, NONE at the Moment */ SMART_REFRESH|ACTIVATE|BACKDROP|BORDERLESS|REPORTMOUSE, /* Window Flags */ NULL, /* FirstGadget */ NULL, /* CheckMark */ NULL, /* 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 }; struct NewWindow maptitleWindow = { 0, 0, 24, 10, 3, 2, NULL, /* NO IDCMP, initialized after creating own IDCMPport */ SMART_REFRESH | BORDERLESS | WINDOWCLOSE | RMBTRAP , 0,0, NULL, 0,0, 0,0,0,0,CUSTOMSCREEN }; #ifdef LATTICE UWORD chip arrow[] = { /* mouse pointer = arrow */ #define arrow_data arrow #else UWORD arrow_data[] = { /* mouse pointer = arrow */ #endif 0x0000, 0x0000, 0x8000, 0x0000, 0xc000, 0x0000, 0xe000, 0x0000, 0xf000, 0x0000, 0xe000, 0x0000, 0x2000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; #define arrow_x_offset -1 #define arrow_y_offset 0 #define arrow_size sizeof(arrow_data) #ifdef LATTICE UWORD chip cross[] = { /* mouse pointer = cross */ #define cross_data cross #else UWORD cross_data[] = { /* mouse pointer = cross */ #endif 0x0000, 0x0000, 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 }; #define cross_x_offset -6 #define cross_y_offset -6 #define cross_size sizeof(cross_data) #ifdef LATTICE UWORD chip waiter[] = { /* mouse pointer = 'wait' */ #define waiter_data waiter #else UWORD waiter_data[] = { /* mouse pointer = 'wait' */ #endif 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 }; #define waiter_x_offset -1 #define waiter_y_offset 0 #define waiter_size sizeof(waiter_data) #ifdef LATTICE UWORD chip transparent[] = { /* mouse pointer = transparent */ #define transparent_data transparent #else UWORD transparent_data[] = { /* mouse pointer = transparent */ #endif 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; #define transparent_x_offset 0 #define transparent_y_offset 0 #define transparent_size sizeof(transparent_data) #ifdef LATTICE UWORD chip close_data[] = { #else UWORD close_data[] = { #endif /*------ plane # 0: --------*/ 0xffff, 0xfee0, 0xffff, 0xfce0, 0xffff, 0xf8e0, 0xffff, 0xf8e0, 0xfff8, 0xf8e0, 0xfff0, 0xf8e0, 0xffff, 0xf8e0, 0xffff, 0xf8e0, 0xf800, 0xe0, 0xf000, 0xe0, /*------ plane # 1: --------*/ 0x1fff, 0xff00, 0x1bff, 0xff00, 0x1c00, 0x700, 0x1c00, 0x700, 0x1c19, 0x700, 0x1c13, 0x700, 0x1c00, 0x700, 0x1c00, 0x700, 0x1fff, 0xff00, 0x1fff, 0xff00 }; #define close_size sizeof(close_data) struct Image closeimage = { 0,0, 27 , 10 , 2 , &close_data[0], 0x1f,0x00, NULL, }; #ifdef LATTICE UWORD chip ilbm_data[] = { #else UWORD ilbm_data[] = { #endif /*------ plane # 0: --------*/ 0x54, 0x0, 0x503, 0x0, 0x591, 0xc000, 0x2700, 0xa000, 0xde0, 0x1000, 0x9f80, 0x7800, 0x8f00, 0xf800, 0x8900, 0xf800, 0x400, 0xf800, 0x83e0, 0x3000, 0x1f8, 0x0, 0x20f0, 0x0, 0x480, 0x0, 0x0, 0x0, /*------ plane # 1: --------*/ 0x0, 0x0, 0x102, 0x8000, 0x591, 0xf000, 0x700, 0xb800, 0xde0, 0x1c00, 0x1f80, 0x7e00, 0xf00, 0xfe00, 0x900, 0xfe00, 0x400, 0xfe00, 0x3e0, 0x3e00, 0x1f8, 0x1800, 0xf0, 0x3000, 0x80, 0xc000, 0xaa, 0x0, }; #define ilbm_size sizeof(ilbm_data) struct Image ilbmimage = { 0,0, 23 , 14 , 2 , &ilbm_data[0], 0x03,0x00, NULL, }; struct DiskObject ILBMobject = { WB_DISKMAGIC, WB_DISKVERSION, /* Gadget Structure */ NULL, /* Ptr to next gadget */ 0,0, /* Leftedge, Topedge */ 23,14, /* Width, Height */ GADGHCOMP|GADGIMAGE, /* Flags */ RELVERIFY|GADGIMMEDIATE, /* Activation */ BOOLGADGET, /* Type */ (APTR)&ilbmimage, /* Render */ NULL, /* Select Render */ NULL, /* Text */ NULL,NULL,NULL,NULL, /* Exclude, Special, ID, UserData */ WBPROJECT, /* WBObject type */ ":c/viewilbm", /* Default tool */ NULL, /* Tool Types */ NO_ICON_POSITION, /* Current X */ NO_ICON_POSITION, /* Current Y */ NULL,NULL,NULL, /* Drawer, ToolWindow, Stack */ }; struct IntuiText hailtexte = { ORANGE,0,JAM1, 16,36, NULL, "Bryan Brown & Ulrich Denker ", NULL }; struct IntuiText hailtextd = { BLACK,0,JAM1, 19,39, NULL, "Bryan Brown & Ulrich Denker", &hailtexte }; struct IntuiText hailtextc = { WHITE,0,JAM1, 0,17, NULL, "Drawmap", &hailtextd }; struct IntuiText hailtextb = { BLACK,ORANGE,JAM2, 2,19, NULL, "Drawmap - a FREEWARE program by", &hailtextc }; struct IntuiText hailtexta = { ORANGE,0,JAM1, 82,0, NULL, "Welcome to", &hailtextb }; struct IntuiText hailtext = { BLACK,0,JAM1, 83,1, NULL, "Welcome to", &hailtexta }; #define TEXTXOFFS -16 #define TEXTYOFFS -22 /* -------- stuff for save() (from Commdore IFF Disk Fish 185) ------- */ /* For masking unwanted Viewmodes bits */ #define BADFLAGS (SPRITES|VP_HIDE|GENLOCK_AUDIO|GENLOCK_VIDEO) #define FLAGMASK (~BADFLAGS) #define CAMGMASK (FLAGMASK & 0x0000FFFFL) /* Other Stuff for saving the picture */ #define bufsize 512 /* ------- stuff for displayhelp(): helpwindowdefs, borders and bufsize */ #define HWIDTH 8*75+2 /* pixel per char * chars per line */ #define HHEIGHT 8*45+2 #define HLEFTEDGE (WWIDTH-HWIDTH)/2 #define HTOPEDGE (WHEIGHT-HHEIGHT)/2+WYOFFS/2 struct NewWindow newhelpw = { HLEFTEDGE, HTOPEDGE, HWIDTH, HHEIGHT, 3,2, MOUSEBUTTONS, /* idcmp */ REPORTMOUSE|NOCAREREFRESH, /* flags */ 0,0, NULL, /* title */ NULL, /* screen */ NULL, 0,0,0,0, /* bitmap, min/max values */ CUSTOMSCREEN }; SHORT border_data[] = { 0,0, HWIDTH-1, 0, HWIDTH-2, 1, 1, 1, 1, HHEIGHT-2, 0, HHEIGHT-1, 0,0 }; struct Border border = { 0,0, WHITE,0, JAM1, (sizeof(border_data)/sizeof(SHORT))/2, &border_data[0], NULL }; #define HELPBUF 128