1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152
|
/* Definitions for the Mac interface to Xconq.
Copyright (C) 1992-1997 Stanley T. Shebs.
Xconq is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version. See the file COPYING. */
/* All Mac compilers are close enough to ANSI to include these,
even though some don't define __STDC__. */
#include <stddef.h>
#include <stdarg.h>
#include <stdlib.h>
#ifdef THINK_C
#include <MacHeaders>
#include <Sound.h>
#endif /* THINK_C */
#ifdef MPW
#ifndef __MWERKS__ /* actually, "old headers" */
#include <Values.h>
#endif
#ifdef NEW_HEADERS
#include <MacTypes.h>
#else
#include <Types.h>
#endif
#include <Resources.h>
#include <QuickDraw.h>
#include <Fonts.h>
#include <Events.h>
#include <Windows.h>
#include <Menus.h>
#include <TextEdit.h>
#include <Dialogs.h>
#ifndef NEW_HEADERS
#include <Desk.h>
#endif
#include <Scrap.h>
#include <ToolUtils.h>
#ifdef NEW_HEADERS
#include <MacMemory.h>
#else
#include <Memory.h>
#endif
#include <SegLoad.h>
#include <Files.h>
#include <Folders.h>
#include <OSUtils.h>
#include <OSEvents.h>
#include <DiskInit.h>
#include <Packages.h>
#include <Traps.h>
#include <Lists.h>
#include <StandardFile.h>
#include <Sound.h>
#include <Devices.h>
#endif /* MPW */
#include <QDOffscreen.h>
#ifdef NEW_HEADERS
#include <Gestalt.h>
#else
#include <GestaltEqu.h>
#endif
#include <PPCToolbox.h>
#include <AppleEvents.h>
/* Bring in image- and interface-related definitions. */
#include "imf.h"
#include "macimf.h"
#include "ui.h"
/* Bring in the definitions of resources. */
#include "macdefs.h"
#ifdef MPW_C
#define QD(whatever) (qd.##whatever)
#define QDPat(whatever) (&(qd.##whatever))
#endif
#ifdef THINK_C
#define QD(whatever) (whatever)
#define QDPat(whatever) (whatever)
#endif
#ifdef __MWERKS__
#define QD(whatever) (qd.##whatever)
#define QDPat(whatever) (&(qd.##whatever))
#endif
#ifdef MPW_C
/* dangerous way */
#define SET_PAT_ELT(pattern,i,val) ((pattern)[(i)] = (val))
#define PAT_ELT(pattern,i) ((pattern)[(i)])
#endif
#ifdef THINK_C
/* dangerous way */
#define SET_PAT_ELT(pattern,i,val) ((pattern)[(i)] = (val))
#define PAT_ELT(pattern,i) ((pattern)[(i)])
#endif
#ifdef __MWERKS__
#define SET_PAT_ELT(pattern,i,val) ((pattern).pat[(i)] = (val))
#define PAT_ELT(pattern,i) ((pattern).pat[(i)])
#endif
#ifdef THINK_C
/* From MPW, to replace missing definitions in Think C includes. */
enum {
kOnSystemDisk = /* 0x8000 */ -32768
#define kCreateFolder true
#define kDontCreateFolder false
#define kSystemFolderType 'macs' /* the system folder */
#define kDesktopFolderType 'desk' /* the desktop folder; objects in this folder show on the desk top. */
#define kTrashFolderType 'trsh' /* the trash folder; objects in this folder show up in the trash */
#define kWhereToEmptyTrashFolderType 'empt' /* the "empty trash" folder; Finder starts empty from here down */
#define kPrintMonitorDocsFolderType 'prnt' /* Print Monitor documents */
#define kStartupFolderType 'strt' /* Finder objects (applications, documents, DAs, aliases, to...) to open at startup go here */
#define kAppleMenuFolderType 'amnu' /* Finder objects to put into the Apple menu go here */
#define kControlPanelFolderType 'ctrl' /* Control Panels go here (may contain INITs) */
#define kExtensionFolderType 'extn' /* Finder extensions go here */
#define kFontsFolderType 'font' /* Fonts go here */
#define kPreferencesFolderType 'pref' /* preferences for applications go here */
#define kTemporaryFolderType 'temp' /* temporary files go here (deleted periodically, but don't rely on it.) */
};
pascal OSErr FindFolder(short vRefNum,OSType folderType,Boolean createFolder,
short *foundVRefNum,long *foundDirID)
= {0x7000,0xA823};
#endif
/* This is a way - perhaps not the best way - to distinguish "old headers"
from "universal headers". */
#ifndef __CONDITIONALMACROS__
#define SetMenuItemText SetItem
#define InsertMenuItem InsMenuItem
#define SndListHandle Handle
#define AEEventHandlerUPP EventHandlerProcPtr
#define ModalFilterUPP ModalFilterProcPtr
typedef pascal void (*UserItemProcPtr)(WindowPtr theWindow, short itemNo);
#define UserItemUPP UserItemProcPtr
#define ControlActionUPP ProcPtr
#endif
#ifndef NewAEEventHandlerProc
#define NewAEEventHandlerProc(fn) ((EventHandlerProcPtr) (fn))
#endif
#ifndef NewModalFilterProc
#define NewModalFilterProc(fn) ((ModalFilterProcPtr) (fn))
#endif
#ifndef NewUserItemProc
#define NewUserItemProc(fn) ((UserItemProcPtr) (fn))
#endif
#ifndef NewControlActionProc
#define NewControlActionProc(fn) ((ProcPtr) (fn))
#endif
enum grays {
blackgray,
darkgray,
mediumgray,
lightgray,
whitegray,
fullcolor
};
/* The types of available designer tools. */
enum tooltype {
notool,
terraintool,
unittool,
peopletool,
featuretool,
brushsizetool,
materialtool,
elevationtool,
temperaturetool,
cloudstool,
windstool,
viewtool
};
/* The user interface substructure. This is only allocated for sides with
attached displays. */
typedef struct a_ui {
int active;
} UI;
/* Each side can open up any number and shape of maps. */
#define MAXSELECTIONS 500
typedef struct a_map {
short id; /* Identifying number for the map */
VP *vp; /* This map's generic view parameters */
short osx, osy; /* Tracks shifted origin so can be restored */
WindowPtr window;
ControlHandle hscrollbar;
ControlHandle vscrollbar;
/* Offscreen graphics support. */
CGrafPtr windowPortPtr;
GDHandle deviceHdl;
GWorldPtr gworldPortPtr;
QDErr qdErr;
short offsetx; /* Displacement (right, down) in pixels of map window within its gworld */
short offsety; /* offsetx = offsety = 0 means the window is in the center of its gworld */
/* How to draw the map. */
short conw;
short toplineh;
short topunith;
short toph;
short bufx; /* Actual size of horizontal offscreen scrolling buffer */
short bufy; /* Actual size of vertical offscreen scrolling buffer */
short max_bufx; /* Max size of horizontal offscreen scrolling buffer as set in dialog */
short max_bufy; /* Max size of vertical offscreen scrolling buffer as set in dialog */
short featureborders; /* Draw feature/province borders */
short featurenames; /* Draw feature/province names */
short simple_borders; /* Do NOT draw borders to sea & empty land */
short shorelines; /* Draw 3D shorelines */
short sidecolors; /* Use side colors for icons */
short iconmasks; /* Use masks when drawing units */
short boxmasks; /* Use masks when drawing grouping boxes */
short textmasks; /* Use masks when drawing text */
short optimize_fonts; /* Use special font set for maps */
short solid_color_terrain; /* Draw terrain in solid colors */
short draw_topline; /* Draw top line */
short draw_topunit; /* Draw top unit info */
short erase_names; /* Draw row in update_cell_display to erase name of moving unit */
short see_all;
short autoselect;
Unit *curunit;
short moveonclick;
short scrolltocurunit;
short follow_action; /* Scroll to scene of actions? */
int numselections;
int maxselections;
Unit **selections;
Rect contentrect;
RgnHandle cellrgn;
int cellrgnx, cellrgny;
int maxdepth; /* Largest # of bits/pixel of screens this map uses */
struct a_map *next; /* Link to the next map. */
} Map;
/* Each side can open up any number of lists of units. */
#define MAXINLIST 500
typedef struct a_list {
short sidecolors; /* Use side colors for units */
SideMask sides; /* Sides to show the units of */
short completed_units;
short incomplete_units;
int mainsortmi;
enum sortkeys sortkeys[MAXSORTKEYS]; /* attributes to sort list elements on */
UnitVector *contents;
int numunits;
int firstvisible;
int lastvisible;
int firstvisfield;
int lastvisfield;
short largeicons;
short shouldreorg;
short entryspacing;
WindowPtr window;
ControlHandle hscrollbar;
ControlHandle vscrollbar;
struct a_list *next;
} List;
/* A closer look at a unit. */
typedef struct a_unit_closeup {
struct a_unit *unit;
WindowPtr window;
struct a_unit_closeup *next;
} UnitCloseup;
/* Iteration over all windows. */
#define for_all_windows(w) \
for ((w) = FrontWindow(); (w) != NULL; (w) = ((GrafPtr) ((WindowPeek)(w))->nextWindow))
/* Iteration over all of a side's maps. */
#define for_all_maps(m) \
for ((m) = maplist; (m) != NULL; (m) = (m)->next)
/* Iteration over all of a side's lists. */
#define for_all_lists(l) \
for ((l) = listlist; (l) != NULL; (l) = (l)->next)
/* Iteration over all of a side's unit closeups. */
#define for_all_unit_closeups(c) \
for ((c) = unitcloseuplist; (c) != NULL; (c) = (c)->next)
/* Other useful macros. */
#define window_width(w) ((w)->portRect.right - (w)->portRect.left)
#define window_height(w) ((w)->portRect.bottom - (w)->portRect.top)
#define clip_to_limits(lo,x,hi) (max((lo), min((x), (hi))))
#define bords_to_draw(m) (numbordtypes > 0 && bwid[(m)->vp->power] > 0)
#define conns_to_draw(m) (numconntypes > 0 && cwid[(m)->vp->power] > 0)
#define draw_any_materials(m) (0)
#define any_borders_at(x, y, b) (aux_terrain_at(x, y, b) != 0)
#define any_connections_at(x, y, c) (aux_terrain_at(x, y, c) != 0)
enum {
dontdraw,
useblocks,
usepictures,
usepolygons
};
enum {
plain_emblem,
shadow_emblem
};
enum {
NO_MODAL,
MOVE_TO_MODAL,
ATTACK_MODAL,
FIRE_MODAL,
FIRE_INTO_MODAL,
SET_FORMATION_MODAL,
ADD_TERRAIN_MODAL,
REMOVE_TERRAIN_MODAL,
DISTANCE_MODAL,
ZOOM_MODAL,
GENERIC_MODAL
};
#ifndef c2p
#define c2p(STR,PBUF) \
strcpy(((char *) PBUF) + 1, STR); \
PBUF[0] = strlen(STR);
#endif
#ifndef p2c
#define p2c(PSTR,BUF) \
strncpy(BUF, ((char *) (PSTR) + 1), PSTR[0]); \
BUF[PSTR[0]] = '\0';
#endif
#define top_left(rect) (*(Point *) &(rect.top))
#define bottom_right(rect) (*(Point *) &(rect.bottom))
/* The following macros require local vars named win, itemtype, itemhandle, itemrect. */
#define set_flag_from_ditem(di,place) \
GetDItem(win, (di), &itemtype, &itemhandle, &itemrect); \
(place) = GetCtlValue((ControlHandle) itemhandle);
#define put_number_into_ditem(di,num) \
GetDItem(win, (di), &itemtype, &itemhandle, &itemrect); \
NumToString((num), tmpstr); \
SetIText(itemhandle, tmpstr);
#define get_number_from_ditem(di,place) \
GetDItem(win, (di), &itemtype, &itemhandle, &itemrect); \
GetIText(itemhandle, tmpstr); \
StringToNum(tmpstr, (long *) &(place));
/* (should understand nn:mm times) */
#define put_time_into_ditem(di,num) \
GetDItem(win, (di), &itemtype, &itemhandle, &itemrect); \
NumToString((num), tmpstr); \
SetIText(itemhandle, tmpstr);
#define get_time_from_ditem(di,place) \
GetDItem(win, (di), &itemtype, &itemhandle, &itemrect); \
GetIText(itemhandle, tmpstr); \
StringToNum(tmpstr, (long *) &(place));
#define get_string_from_ditem(di,buf) \
GetDItem(win, (di), &itemtype, &itemhandle, &itemrect); \
GetIText(itemhandle, tmpstr); \
p2c(tmpstr, (buf));
extern Side *dside;
extern int playsounds;
extern int nummaps;
extern ImageFamily **uimages;
extern ImageFamily **timages;
extern ImageFamily **eimages;
extern MacImage **tcolors;
extern WindowPtr helpwin;
extern struct a_helpnode *curhelpnode;
extern char *helpstring;
extern TEHandle helptext;
extern WindowPtr instructionswin;
extern WindowPtr gamewin;
extern ControlHandle gamevscrollbar;
extern WindowPtr constructionwin;
extern WindowPtr designwin;
extern enum tooltype tooltype;
extern short curutype;
extern short curttype;
extern short cursidenumber;
extern short curfid;
extern Feature *curfeature;
extern WindowPtr historywin;
extern WindowPtr noticewin;
extern TEHandle noticetext;
extern WindowPtr scoreswin;
extern TEHandle scorestext;
extern MenuHandle sidemenu;
extern MenuHandle utypemenu;
extern MenuHandle mtypemenu;
extern MenuHandle ttypemenu;
extern int hasColorQD;
extern int minscreendepth;
extern int maxscreendepth;
extern int sbarwid;
extern WindowPtr *winmenuwins;
extern int default_draw_grid;
extern int default_draw_names;
extern int default_draw_latlong;
extern int map_modal;
extern int defaultmoveonclick;
extern int defaultautoselect;
extern PolyHandle polygons[];
extern int lastpolyx[], lastpolyy[];
extern PolyHandle gridpolygons[];
extern int lastgridpolyx[], lastgridpolyy[];
extern RgnHandle cellrgns[];
extern int lastcellrgnx[], lastcellrgny[];
extern RgnHandle gridcellrgns[];
extern int lastgridcellrgnx[], lastgridcellrgny[];
extern RgnHandle cellrgns30[];
extern int lastcellrgnx30[], lastcellrgny30[];
extern RgnHandle gridcellrgns30[];
extern int lastgridcellrgnx30[], lastgridcellrgny30[];
extern RgnHandle cellrgns15[];
extern int lastcellrgnx15[], lastcellrgny15[];
extern RgnHandle gridcellrgns15[];
extern int lastgridcellrgnx15[], lastgridcellrgny15[];
extern struct a_map *maplist; /* chain of maps that we're using */
extern struct a_list *listlist; /* chain of lists */
extern struct a_unit_closeup *unitcloseuplist; /* chain of unit closeups */
extern CursHandle paintcursors[];
extern CursHandle cellpaintor;
extern CursHandle bordpaintor;
extern CursHandle connpaintor;
extern CursHandle unitpaintor;
extern CursHandle peoplepaintor;
extern CursHandle featurepaintor;
extern CursHandle materialpaintor;
extern CursHandle elevpaintor;
extern CursHandle cloudpaintor;
extern CursHandle temppaintor;
extern CursHandle movecursors[];
extern CursHandle nomovecursor;
extern CursHandle allmovecursor;
extern CursHandle grayarrowcursor;
extern CursHandle opencrosscursor;
extern CursHandle watchcursor;
extern CursHandle firecursor;
extern CursHandle sendcursor;
extern CursHandle receivecursor;
extern RGBColor graycolor, blackcolor;
extern enum grays gridgray;
extern enum grays unseengray;
extern enum grays bggray;
extern RGBColor gridcolor;
extern RGBColor unseencolor;
extern RGBColor blackcolor;
extern int conwid;
extern int tophgt;
extern int first_windows;
extern short daynight;
extern int grid_matches_unseen;
extern BitMap *bordbitmaps;
extern BitMap *connbitmaps;
extern Pattern *animation_patterns;
extern int animation_pattern_state;
extern WindowPtr playersetupwin;
extern int connection_method;
extern int hosting;
extern Rect dragrect;
extern int foundimagesfile;
extern int Profile;
extern TEHandle command_text;
extern TEHandle run_length_text;
extern int gameinited;
extern int position_set_modally;
extern Point modal_point;
extern Map *modal_map;
extern short pref_color_unit_images;
extern short pref_solid_color_terrain;
extern short small_font_id;
extern short small_font_size;
extern short small_line_spacing;
extern short large_font_id;
extern short large_font_size;
extern short large_line_spacing;
extern short title_font_id;
extern short title_font_size;
extern short title_line_spacing;
extern int gamewinw;
extern int topunithgt;
extern int default_latlong_interval;
extern int use_colornames; /* Save and read colors and colorschemes by name */
extern int use_RGB_values; /* Save and read RGB colors in XCol resource */
extern int show_instructions; /* Show instructions window at start */
extern int fullsize_map; /* Display the first map at full screen size */
extern int unified_cicns; /* Use BitMap as mask for color PixMap */
extern int default_draw_topline; /* Draw top line box (toggle function declared elsewhere) */
extern int default_draw_topunit; /* Draw unit info box (toggle function declared elsewhere) */
extern int default_drawothermaps; /* Draw other-map boxes */
extern int default_sidecolors; /* Use side colors for unit icons */
extern int default_iconmasks; /* Draw unit icon masks */
extern int default_boxmasks; /* Draw masks for grouping boxes */
extern int default_textmasks; /* Draw text masks */
extern int default_featureborders; /* Draw feature borders */
extern int default_featurenames; /* Draw feature names */
extern int default_shorelines; /* Draw 3D shorelines */
extern int default_simple_borders; /* Do not draw borders to sea or empty land */
extern int default_optimize_fonts; /* Use optimized set of font sizes */
extern int default_erase_names; /* Erase names of moving units */
extern int default_power; /* Default power of new map */
extern int default_max_bufx; /* Default size of horizonal offscreen scrolling buffer */
extern int default_max_bufy; /* Default size of vertical offscreen scrolling buffer */
#define FEATURES 10 /* Should equal the number of feature colors below! */
#define forecolor featColor[1] /* Note: differs from ForeColor !!! */
#define maskcolor featColor[2] /* Default mask color for icons, text and boxes */
#define textcolor featColor[3] /* Text color (except for feature names) */
#define gridcolor featColor[4] /* Color of the grid */
#define unseencolor featColor[5] /* Color of unseen land */
#define shorecolor featColor[6] /* Shore line color */
#define featurecolor featColor[7] /* Feature name and border color */
#define frontcolor featColor[8] /* Front line color used by draw_country_borders */
#define meridiancolor featColor[9] /* Color of meridians */
#define contourcolor featColor[10] /* Color of contour lines */
#define gridcolor_name featColorName[4] /* Used to set grid_matches_unseen */
#define unseencolor_name featColorName[5] /* Used to set grid_matches_unseen */
extern RGBColor *featColor; /*[FEATURES+1]; /* This array is used to store the feature colors */
extern RGBColor *sideColor; /*[MAXSIDES+1][4]; /* This array is used to store the side colors */
/* side 0 is the independents, hence MAXSIDES + 1 */
/* sideColor[][0] is not currently used */
extern char **featColorItemName; /*[FEATURES+1][32]; /* Name of item for which featColor is set */
extern char **featColorName; /*[FEATURES+1][32]; /* Name of featColor value (red etc) */
extern char **sideColorName; /*[MAXSIDES+1][4][32]; /* Name of sideColor value (red etc)*/
extern char **default_featColorName; /*[FEATURES+1][32]; /* Default feature color values (by name) */
extern char **default_colorscheme; /*[MAXSIDES+1][96]; /* Default side colorscheme (red,pink,blue) */
extern char **colorscheme; /*[MAXSIDES+1][96]; /* Side colorscheme (red,pink,blue) */
#define get_sideColor(s,n) (sideColor[4 * (s) + (n)])
#define get_sideColorName(s,n) (sideColorName[4 * (s) + (n)])
#define set_sideColor(s,n,c) (sideColor[4 * (s) + (n)] = (c))
#define set_sideColorName(s,n,str) (sideColorName[4 * (s) + (n)] = (str))
/* These are the default numbers for color usage */
extern int default_main_icon_color; /* Number (1-3) of main sideColor used for unit icons */
extern int default_half_icon_color; /* Number (1-3) of sideColor used for right half of icons */
extern int default_icon_mask_color; /* Number (1-3) of sideColor used to draw icon masks */
extern int default_split_icon; /* Use two colors for left and right half if TRUE */
/* These are customized numbers for each player */
extern int *main_icon_color; /*[MAXSIDES +1]; /* Number (1-3) of main sideColor used for unit icons */
extern int *half_icon_color; /*[MAXSIDES +1]; /* Number (1-3) of sideColor used for right half of icons */
extern int *icon_mask_color; /*[MAXSIDES +1]; /* Number (1-3) of sideColor used to draw icon masks */
extern int *split_icon; /*[MAXSIDES +1]; /* Use two colors for left and right half if TRUE */
/* These shorts are defined in macconq.c and used in maccolors.c */
extern short images_refnum; /* frefNum of lib-mac : Images file */
extern short prefs_refnum; /* frefNum of Xconq Preferences file */
/* Function declarations. */
/* Note that although the Xconq kernel must conditionalize its prototypes,
all Mac C compilers are sufficiently standard C to handle them. */
extern int main(void);
extern int splash_dialog(void);
extern void connect_game_dialog(void);
extern void recalc_depths(void);
extern void get_files(void);
extern int open_preferences(void);
extern void close_preferences(void);
extern void get_preferences(void);
extern void save_preferences(void);
extern void ui_update_state(void);
extern void event_loop(void);
extern void get_global_mouse(Point *mouse);
extern void adjust_cursor(Point mouse, RgnHandle region);
extern void grow_window(WindowPtr win, Point where);
extern void zoom_window(WindowPtr win, Point where, int part);
extern void close_window(WindowPtr win);
extern void do_mouse_down(WindowPtr window, EventRecord *event);
extern void activate_window(WindowPtr win, int activate);
extern void update_window(WindowPtr win);
extern void maybe_select_next_unit(void);
extern int is_da_window(WindowPtr win);
extern int is_app_window(WindowPtr win);
extern void won_game_dialog(void);
extern void lost_game_dialog(void);
extern void game_over_dialog(void);
extern int position_on_screen(int h, int v);
extern int position_already_used(int h, int v);
extern GDHandle best_zoom_screen(Rect *rectptr);
extern void force_update(WindowPtr win);
extern void force_overall_update(void);
extern void set_standard_state(WindowPtr win, int fullw, int fullh);
extern void get_main_screen_size(int *widp, int *hgtp);
extern void draw_default_button(DialogPtr dialog, short ditem);
extern void stagger_window(WindowPtr win, int *lasthp, int *lastvp);
extern void set_end_of_game_interaction_modes(void);
extern void draw_selection_animation(Map *map, Unit *unit);
extern void exit_macconq(void);
/* Map-handling prototypes. */
extern int at_all_visible(Map *map, int x, int y);
extern int in_middle(Map *map, int x, int y);
extern void xform(Map *map, int x, int y, int *sxp, int *syp);
extern void m_xform_unit(Map *map, Unit *unit, int *sxp, int *syp, int *swp, int *shp);
extern void m_xform_unit_self(Map *map, Unit *unit, int *sxp, int *syp, int *swp, int *shp);
extern void m_xform_occupant(Map *map, Unit *transport, Unit *unit, int sx, int sy, int sw, int sh, int *sxp, int *syp, int *swp, int *shp);
extern Map *create_map(int power);
extern void set_content_rect(Map *map);
extern void m_focus_on_center(Map *map);
extern void m_center_on_focus(Map *map);
extern void set_map_scrollbars(Map *map);
extern void set_map_power(Map *map, int power);
extern void make_cell_clip(int power);
extern Map *map_from_window(WindowPtr window);
extern void grow_map(Map *map, int w, int h);
extern void zoom_map(Map *map, int part);
extern void adjust_map_decor(Map *map);
extern int m_nearest_cell(Map *map, int sx, int sy, int *xp, int *yp);
extern int m_nearest_boundary(Map *map, int sx, int sy, int *xp, int *yp, int *dirp);
extern int m_nearest_unit(Map *map, int sx, int sy, Unit **unitp);
extern void draw_map(Map *map);
extern void draw_window_background(Map *map);
extern void draw_map_content(Map *map);
extern void draw_area_background(Map *map);
extern void draw_control_panel(Map *map);
extern void draw_top_line(Map *map);
extern void draw_other_maps(Map *map);
extern void draw_related_maps(Map *map);
extern void draw_other_map(Map *map, Map *map2);
extern void draw_row(Map *map, int x0, int y0, int len, int clearit);
// --- MOVED TO MACROW.C -----------------------------
// extern int cell_update(Map *map, int x, int y);
// extern void draw_terrain_row(Map *map, int x0, int y0, int len);
// --- NO LONGER USED --------------------------------
// extern void draw_legend(Map *map, int x, int y);
// ------------------------------------------------
extern void draw_selections(Map *map);
extern void draw_selections_at(Map *map, int x, int y);
extern void draw_selected_unit_setport(Map *map, Unit *unit);
extern void draw_selected_unit(Map *map, Unit *unit);
extern void erase_selections(Map *map);
extern void erase_selection(Map *map, Unit *unit);
extern void draw_unselected_unit(Map *map, Unit *unit);
extern void force_map_update(Map *map);
extern void destroy_map(Map *map);
extern void activate_map(Map *map, int activate);
extern void print_map(Map *map);
extern void draw_unit_image(WindowPtr win, int sx, int sy, int sw, int sh, int u, int s, int mod, int emblem);
extern void draw_side_emblem(WindowPtr win, int ex, int ey, int ew, int eh, int e, int style);
extern void draw_cell_block(int sx, int sy, int n, int power, int t, int over, int angle, int dosolid);
extern void calc_best_terrain_images(void);
extern void draw_hex_region(int sx, int sy, int power, int t, int over, int angle, int dogrid, int dosolid);
extern void draw_border_line_multiple(WindowPtr win, int sx, int sy, int bitmask, int power, int t, int angle, int over, int dosolid);
extern void draw_connection_line_multiple(WindowPtr win, int sx, int sy, int bitmask, int power, int t, int angle, int over, int dosolid);
extern void draw_terrain_sample(WindowPtr win, Rect tmprect, int t);
extern void draw_country_borders(WindowPtr win, int sx, int sy, int bitmask, int power, int shade, int angle);
extern void draw_feature_borders(WindowPtr win, int sx, int sy, int bitmask, int power);
extern void draw_ai_region_borders(WindowPtr win, int sx, int sy, int bitmask, int power);
extern int draw_elevation_here(int x, int y);
extern void draw_elevation(int sx, int sy, int power, int elev);
extern void draw_temperature(int sx, int sy, int power, int temp);
extern void draw_winds(int sx, int sy, int power, int rawwind);
extern int draw_clouds_here(int x, int y);
extern void draw_cloud_block(int sx, int sy, int i, int power, int cloudtype, int angle);
extern void draw_clouds(int sx, int sy, int power, int cloudtype);
extern void draw_coverage(int sx, int sy, int power, int cov, int altcov);
extern void draw_unit_name(Unit *unit, int sx, int sy, int sw, int sh, int masks, int optimize);
extern void draw_legend_text(int sx, int sy, int sh, char *legend, int just, int masks, int optimize);
extern void draw_blast_image(WindowPtr win, int sx, int sy, int sw, int sh, int blasttype);
extern void clear_blast_image(WindowPtr win, int sx, int sy, int sw, int sh, int blasttype);
extern int picture_width(PicHandle pichandle);
extern int picture_height(PicHandle pichandle);
extern void plot_sicn(WindowPtr win, int sx, int sy, Handle sicnhandle, int n, int erase, int mode);
extern void gray_out_rect(Rect *rectptr);
extern void draw_unit_blast(Map *map, Unit *unit, int blast);
extern void clear_unit_blast(Map *map, Unit *unit, int blast);
extern void do_mouse_down_map(Map *map, Point mouse, int mods);
extern void do_mouse_down_map_control_panel(Map *map, int h, int v, int mods);
extern void toggle_survey(Map *map);
extern void magnify_map(Map *map, int inout);
extern void set_map_mag(Map *map, int newpower);
extern void toggle_map_grid(Map *map);
extern void toggle_map_topline(Map *map);
extern void toggle_map_topunit(Map *map);
extern void toggle_map_other_maps(Map *map);
extern void toggle_map_lighting(Map *map);
extern void toggle_map_coverage(Map *map);
extern void toggle_map_names(Map *map);
extern void toggle_map_people(Map *map);
extern void toggle_map_control(Map *map);
extern void toggle_map_elevations(Map *map);
extern void toggle_map_materials(Map *map, int m);
extern void toggle_map_aux_terrain(Map *map, int t);
extern void toggle_map_temperature(Map *map);
extern void toggle_map_winds(Map *map);
extern void toggle_map_clouds(Map *map);
extern void toggle_map_storms(Map *map);
extern void toggle_map_plans(Map *map);
extern void toggle_map_ai(Map *map);
extern void do_mouse_down_map_content(Map *map, int h, int v, int mods);
extern void select_all_dragged_over(Map *map, int h0, int v0, int mods);
extern void select_area_and_zoom(Map *map, int h0, int v0, int mods);
extern void move_on_drag(Map *map, Unit *unit, int mods);
extern void unselect_all(Map *map);
extern void select_unit_on_map(Map *map, Unit *unit);
extern int unit_is_selected(Map *map, Unit *unit);
extern void unselect_unit_on_map(Map *map, Unit *unit);
extern void select_all_units_in_rect(Map *map, Rect *rectptr);
extern int move_the_selected_unit(Map *map, Unit *unit, int h, int v);
extern void fire_the_selected_unit(Map *map, Unit *unit, int h, int v);
extern void select_exactly_one_unit(Map *map, Unit *unit);
extern void select_next_unit(Map *map);
extern void select_previous_unit(Map *map);
extern void select_next_actor(Map *map);
extern void select_previous_actor(Map *map);
extern void select_next_mover(Map *map);
extern void select_previous_mover(Map *map);
extern void select_next_awake_mover(Map *map);
extern void select_previous_awake_mover(Map *map);
extern void select_another(Map *map, Unit *(*fn)(Side *side, Unit *unit));
extern void scroll_best_map_to_unit(Unit *unit, int bringtofront);
extern void scroll_to_unit(Map *map, Unit *unit);
extern void magnify_to_fit(Map *map, int x1, int y1, int x2, int y2);
extern void create_list(void);
extern void init_list_contents(List *list);
extern void organize_list_contents(List *list);
extern void sort_list_contents(List *list);
extern void add_unit_to_list(List *list, Unit *unit);
extern void set_list_scrollbars(List *list);
extern List *list_from_window(WindowPtr window);
extern void draw_list(List *list);
extern void draw_list_contents(List *list);
extern void draw_list_headings(List *list);
extern void draw_unit_list_entry(List *list, int n, int clearfirst);
extern void grow_list(List *list, int w, int h);
extern void zoom_list(List *list, int part);
extern void adjust_list_decor(List *list);
extern void do_mouse_down_list(List *list, Point mouse, int mods);
extern void set_list_sorting(List *list, enum sortkeys newkey, int mi);
extern void toggle_list_completed(List *list);
extern void toggle_list_incomplete(List *list);
extern void toggle_list_large_icons(List *list);
extern void update_unit_in_lists(Unit *unit);
extern int unit_position_in_list(List *list, Unit *unit);
extern void reorganize_list(List *list);
extern void redraw_unit_list_entry(List *list, int n);
extern void clear_selections(List *list);
extern Unit *selected_unit_in_list(List *list);
extern void scroll_to_selected_unit_in_list(List *list);
extern void activate_list(List *list, int activate);
extern void print_list(List *list);
extern void destroy_list(List *list);
extern void init_patterns(void);
extern void init_icons(void);
extern void init_cursors(void);
extern int do_splash_box(void);
extern void new_game_dialog(void);
extern int start_new_game(void);
extern void update_new_game_list(void);
extern int variants_dialog(void);
extern int open_game_dialog(void);
extern int open_game_from_fsspec(FSSpec *fsspec);
extern int open_game_from_name_and_volume(Str255 name, int vrefnum);
extern void handle_player_setup_event(EventRecord *event);
extern int hit_player_setup_dialog(int itemhit, Point mouse);
extern void launch_game_2(void);
extern void check_for_missing_images(void);
extern void open_progress_dialog(void);
extern void close_progress_dialog(void);
extern void init_display(void);
extern void init_terrain_images(void);
extern void interp_named_color(char *name, enum grays *grayvar, RGBColor *colorvar);
extern void init_terrain_colors(void);
extern void init_unit_images(void);
extern void init_all_emblem_images(void);
extern void reinit_all_emblem_images(void);
extern void init_emblem_images(Side *side2);
extern int construction_ever_possible(void);
extern void init_menus(void);
extern void add_window_menu_item(char *name, WindowPtr win);
extern void remove_window_menu_item(WindowPtr win);
extern void build_side_menu(void);
extern void update_side_menu(Side *side2);
extern void build_unit_type_menu(void);
extern void build_material_type_menu(void);
extern void build_terrain_type_menu(void);
extern void build_ai_type_menu(void);
extern void build_feature_menu(void);
extern void build_optional_terrain_type_menu(void);
extern void sanitize_for_menu(char *str, Str255 outstr);
extern void do_menu_command(long which);
extern void do_about_box(void);
extern void save_the_game(int askname, int quitting);
extern void set_preferences(void);
extern void maybe_init_print(void);
extern void quit_the_game(void);
extern void apply_to_all_selected(int (*fn)(), int beepfailure);
extern void do_reserve_command(int value, int radius, int recurse);
extern void do_sleep_command(int value, int radius, int recurse);
extern void do_attack_command(void);
extern void enable_construction(void);
extern int do_move_to_command(void);
extern int do_fire_command(void);
extern int do_fire_into_command(void);
extern void do_profile(void);
extern void do_trace(void);
extern void adjust_menus(void);
extern int add_unit_position(Unit *unit);
extern void set_focus(Map *map, int x, int y);
extern void message_dialog(int sidenum);
extern void command_dialog(void);
extern void do_keyboard_command(int key);
extern void execute_named_command(char *cmdstr);
extern void describe_commands(int arg, char *key, TextBuffer *buf);
struct cmdtab;
extern void describe_command_table(int arg, char *key, TextBuffer *buf, struct cmdtab *cmdtab);
extern void toggle_profiling(void);
extern char *get_string_from_item(Handle itemhandle);
extern void instructions_dialog(void);
extern void create_instructions_dialog(void);
extern int hit_instructions_dialog(DialogPtr dialog, int itemhit, EventRecord *evt);
extern void create_game_window(void);
extern void draw_game(void);
extern void draw_game_date(void);
extern void draw_game_clocks(void);
extern void draw_game_progress(void);
extern void draw_game_side(Side *side2);
extern int feeling_towards(Side *side, Side *side2);
extern void draw_side_status(Side *side2);
extern void do_mouse_down_game(Point mouse, int mods);
extern void create_construction_window(void);
extern void init_construction_lists(void);
extern void reinit_construction_lists(void);
extern void draw_construction(void);
extern void draw_construction_default(void);
extern void calc_construction_rects(void);
extern void activate_construction(int activate);
extern Unit *get_selected_construction_unit(void);
extern int get_selected_construction_type(void);
extern void scroll_to_selected_construction_unit(void);
extern void do_mouse_down_construction(Point mouse, int mods);
extern void select_unit_in_construction_window(Unit *unit);
extern void select_type_in_construction_window(int u);
extern void update_construction_unit_list(Unit *unit);
extern void maybe_add_unit_to_construction_list(Unit *unit);
extern void update_unit_list_for_type(int u);
extern void update_construction_type_list(void);
extern void update_type_list_for_unit(Unit *unit);
extern void adjust_construction_controls(void);
extern void grow_construction(int h, int v);
extern void zoom_construction(int part);
extern int do_key_down_construction(int key);
extern void side_rename_dialog(Side *side);
extern int unit_rename_dialog(Unit *unit);
extern UnitCloseup *find_unit_closeup(Unit *unit);
extern void create_unit_closeup(Unit *unit);
extern void preferred_closeup_size(int u, int *widp, int *hgtp);
extern void draw_unit_closeup(UnitCloseup *unitcloseup);
extern UnitCloseup *unit_closeup_from_window(WindowPtr win);
extern int do_mouse_down_unit_closeup(UnitCloseup *unitcloseup, Point mouse, int mods);
extern void destroy_unit_closeup(UnitCloseup *unitcloseup);
extern void create_history_window(void);
extern void draw_history(void);
extern void draw_historical(HistEvent *hevt, int y, int drawevt);
extern void do_mouse_down_history(Point mouse, int mods);
extern void move_history_scrollbar(int h, int v);
extern void grow_history(int h, int v);
extern void zoom_history(int part);
extern void update_history_window(HistEvent *hevt);
extern void notice_dialog(void);
extern void create_notice_window(void);
extern void append_notice(char *str);
extern void draw_notice(void);
extern void adjust_notice_scrollbar(void);
extern void activate_notice(int activate);
extern void do_mouse_down_notice(Point mouse, int mods);
extern void grow_notice(int h, int v);
extern void zoom_notice(int part);
extern void scores_dialog(void);
extern void create_scores_window(void);
extern void append_scores(char *str);
extern void draw_scores(void);
extern void adjust_scores_scrollbar(void);
extern void activate_scores(int activate);
extern void do_mouse_down_scores(Point mouse, int mods);
extern void grow_scores(int h, int v);
extern void zoom_scores(int part);
extern WindowPtr commandwin;
extern void draw_command(void);
extern void activate_command(int activate);
extern int do_key_down_command(int key);
extern void do_mouse_down_command(Point mouse, int mods);
extern void help_dialog(HelpNode *helpnode);
extern void describe_menus(int arg, char *key, TextBuffer *buf);
extern void describe_mouse(int arg, char *key, TextBuffer *buf);
extern void describe_keyboard(int arg, char *key, TextBuffer *buf);
extern void describe_text_commands(int arg, char *key, TextBuffer *buf);
extern void describe_help(int arg, char *key, TextBuffer *buf);
extern void create_help_window(void);
extern void set_help_content(HelpNode *helpnode);
extern void draw_help(void);
extern void adjust_help_scrollbar(void);
extern void activate_help(int activate);
extern void do_mouse_down_help(Point mouse, int mods);
extern void grow_help(int h, int v);
extern void zoom_help(int part);
#ifdef DESIGNERS
extern void enable_designing(int forsure);
extern void disable_designing(void);
extern void init_design_cursors(void);
extern CursHandle adjust_designer_cursor(Point mouse, RgnHandle region);
extern void create_design_window(void);
extern void position_design_window(void);
extern void draw_design_window(void);
extern void draw_design_window_tool(enum tooltype tool);
extern void do_mouse_down_design(Point mouse, int mods);
extern void mark_allowed_unit_types(void);
extern void mark_allowed_sides(void);
extern void feature_rename_dialog(Feature *feature);
extern void apply_designer_tool(Map *map, int h, int v, int mods);
extern void paint_on_drag(Map *map, int h0, int v0, int mods);
extern void border_on_drag(Map *map, int h0, int v0, int mods, int paintmode);
extern void connect_on_drag(Map *map, int h0, int v0, int mods, int paintmode);
extern void designer_save_dialog(void);
extern void designer_reshape_dialog(Module *module);
#endif /* DESIGNERS */
extern void update_unit_in_maps(Unit *unit);
extern void beep(void);
extern void set_game_file_type(char *name);
extern int get_a_position(Map **map, int *xp, int *yp, int *dirp);
extern int get_a_unit(Map **mapp, Unit **unitp);
extern void interp_mac_ui_data(Obj *uispec);
extern void draw_unit_info(Map *map);
extern void connection_method_dialog(void);
extern void init_connection_method(void);
extern void play_sound(char *soundname);
extern void query_position_modally(int mode);
extern void set_position_modally(void);
extern void enable_command(void);
extern void invert_map(Map *map, int x, int y, int r);
extern Map *front_map(void);
extern void update_all_windows(void);
extern void update_all_map_windows(void);
extern void update_all_visible_windows(void);
extern void update_all_visible_map_windows(void);
extern void scroll_map_window(Map *map, int dx, int dy); /* Scroll map window within its gworld */
extern void copy_from_gworld(Map *map, Rect destRect); /* Copy rect from gworld to screen */
extern void update_resized_map(Map *map); /* Update map and then redraw its gworld */
extern void update_gworld(Map *map); /* Update the gworld (and redraw the map)*/
extern void set_offscreen_buffers(Map *map); /* Set size of offscreen scrolling buffers */
extern int handle_numeric_keypad(EventRecord *event); /* Enables special use of numeric keypad */
extern int cell_is_in_gworld(Map *map, int x, int y); /* Test if cell is within current gworld */
extern void toggle_map_sidecolors(Map *map);
extern void toggle_iconmasks(Map *map);
extern void toggle_boxmasks(Map *map);
extern void toggle_textmasks(Map *map);
extern void toggle_featureborders(Map *map);
extern void toggle_featurenames(Map *map);
extern void toggle_shorelines(Map *map);
extern void toggle_simple_borders(Map *map);
extern void toggle_optimize_fonts(Map *map);
extern void toggle_erase_names(Map *map);
extern void toggle_draw_latlong(Map *map); /* The associated default is declared elsewhere */
extern void toggle_solid_color_terrain(Map *map); /* The associated default is declared elsewhere */
extern void toggle_list_sidecolors(List *list); /* Uses the same default as toggle_map_sidecolors */
extern void read_xcol(void); /* Read RGB colors form XCol resource */
extern void write_xcol(void); /* Write RGB colors to XCol resource */
extern void check_screen_depths(void); /* Check for more than 256 colors */
extern void set_default_colors(void); /* Set default colors */
extern void init_side_colors(void); /* Grab memory, set colors to black, names to undefined */
extern void set_side_colors(int e); /* Side colors Dialog called by Colors menu */
extern void set_default_side_colors(int e); /* Side colors Dialog called by Prefs popup */
extern void set_default_feature_color(int e); /* Feature color Dialog called by Prefs popup */
extern void set_feature_color(int e); /* Feature color Dialog called by Colors menu */
extern void set_terrain_color(Str255 tname); /* Feature color Dialog for terrain */
extern void build_colors_menu(void); /* Build the Colors menu */
extern void build_sides_menu(void); /* Build popup menu for prefs */
extern void build_features_menu(void); /* Build popup menu for prefs */
extern void init_unit_cicns(void); /* Intitialize cicns by a dummy PlotCIcon call */
extern void init_emblem_cicns(void); /* Intitialize cicns ny a dummy PlotCIcon call */
extern void dispose_unit_cicns(void); /* Trash every unit cicn in use */
extern void dispose_emblem_cicns(void); /* Trash every emblem cicn in use */
// --- 68K COLORSCHEME BUG FIX -----------------------------------------------
extern void dissect_colorscheme(int e); /* Dissect a colorscheme into sideColorNames */
// extern void dissect_colorscheme(int sidenum, /* Dissect a colorscheme into sideColorNames */
// char* colorscheme);
// -----------------------------------------------------------------------
/* Functions in maccmd.c now declared here for use elsewhere */
extern void do_recenter(void);
extern void do_mac_zoom_in(void);
extern void do_mac_zoom_out(void);
extern void do_mac_set_map_angle(void);
|