home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / games / volume14 / xbattle / part04 < prev    next >
Encoding:
Internet Message Format  |  1993-01-26  |  53.0 KB

  1. Path: uunet!zephyr.ens.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v14i075:  xbattle - multi-player battle strategy game for X-Windows, Part04/07
  5. Message-ID: <3514@master.CNA.TEK.COM>
  6. Date: 7 Sep 92 21:23:07 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 1709
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: slehar@cns.bu.edu
  12. Posting-number: Volume 14, Issue 75
  13. Archive-name: xbattle/Part04
  14. Environment: Xlib
  15.  
  16.  
  17.  
  18. #! /bin/sh
  19. # This is a shell archive.  Remove anything before this line, then unpack
  20. # it by saving it into a file and typing "sh file".  To overwrite existing
  21. # files, type "sh file -c".  You can also feed this as standard input via
  22. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  23. # will see the following message at the end:
  24. #        "End of archive 4 (of 7)."
  25. # Contents:  draw.c extern.h
  26. # Wrapped by billr@saab on Mon Sep  7 14:18:50 1992
  27. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  28. if test -f 'draw.c' -a "${1}" != "-c" ; then 
  29.   echo shar: Will not clobber existing file \"'draw.c'\"
  30. else
  31. echo shar: Extracting \"'draw.c'\" \(43247 characters\)
  32. sed "s/^X//" >'draw.c' <<'END_OF_FILE'
  33. X#include <stdio.h>
  34. X  
  35. X/**** x include files ****/
  36. X#include <X11/Xlib.h>
  37. X#include <X11/Xutil.h>
  38. X#include <X11/Xatom.h>
  39. X#include <X11/keysym.h>
  40. X#include <X11/keysymdef.h>
  41. X
  42. X#include "extern.h"
  43. X
  44. X/*************************************************************************/
  45. X/**    drawboard                            **/
  46. X/** draw the game board                            **/
  47. X/**    Steve Lehar (slehar@park.bu.edu)                **/
  48. X/**    Greg Lesher (lesher@park.bu.edu)                **/
  49. X/*************************************************************************/
  50. Xdrawboard(board, player,justboard)
  51. X  square_type *board;
  52. X  int player,
  53. X      justboard;
  54. X{
  55. X  int i, j, k;
  56. X
  57. X  if (winopen[player])
  58. X  {
  59. X    if (enable_hex)
  60. X      XFillRectangle(xwindow[player]->display, xwindow[player]->window, xwindow[player]->hue[dark],
  61. X                  0, 0, (boardsizex-1)*3*hex_halfside + 2*hex_side, boardsizey*2*hex_vert + hex_vert);
  62. X
  63. X    /**** paint the pieces ****/
  64. X    for (i=0; i<boardsizex; i++)
  65. X    {
  66. X      for (j=0; j<boardsizey; j++)
  67. X      {
  68. X        if (enable_hex)
  69. X      blanksquare(xwindow[player],SQUARE(board,i,j),colorarray[player],
  70. X                                         squaresize[colorarray[player]], TRUE);
  71. X
  72. X        if (visible(board,colorarray[player],i,j))
  73. X      drawsquare(xwindow[player],SQUARE(board,i,j),colorarray[player],
  74. X                                         squaresize[colorarray[player]]);
  75. X        else
  76. X          drawblank(xwindow[player], i, j, SQUARE(board,i,j)->value[none],
  77. X                          SQUARE(board,i,j)->seen[colorarray[player]],
  78. X                          SQUARE(board,i,j)->growth, colorarray[player],
  79. X                          squaresize[colorarray[player]], SQUARE(board,i,j));
  80. X
  81. X        if (enable_storage && player == 0)
  82. X          storedrawsquare(SQUARE(board,i,j), squaresize[0], TRUE);
  83. X      }
  84. X    }
  85. X  }
  86. X
  87. X  /**** write the text ****/
  88. X
  89. X  if (!justboard)
  90. X  {
  91. X    for (i=0; i<nplayers; i++)
  92. X    {
  93. X      XDrawImageString(xwindow[i]->display,xwindow[i]->window,
  94. X               xwindow[i]->hue[0],
  95. X               TEXTX,textyh[colorarray[i]][colorarray[i]],
  96. X               blankline,strlen(blankline));
  97. X      XDrawImageString(xwindow[i]->display,xwindow[i]->window,
  98. X               xwindow[i]->hue[0],
  99. X               TEXTX,textyh[colorarray[i]][colorarray[i]],
  100. X               messagestr,strlen(messagestr));
  101. X    }
  102. X  }
  103. X}
  104. X
  105. X
  106. X/*************************************************************************/
  107. X/**    blanksquare                              **/
  108. X/** Draw blank hexagon                            **/ 
  109. X/**    Greg Lesher (lesher@cns.bu.edu)                    **/
  110. X/*************************************************************************/
  111. Xblanksquare (xwindow, square, windowcolor, squaresize, flag)
  112. X  xwindow_type *xwindow;
  113. X  square_type *square;
  114. X  int windowcolor,
  115. X      squaresize,
  116. X      flag;
  117. X{
  118. X  int  xpos, ypos;
  119. X
  120. X  xpos = square->xpos;
  121. X  ypos = square->ypos;
  122. X
  123. X  hex_points[0].x = xpos - hex_halfside;
  124. X  hex_points[0].y = ypos - hex_vert; 
  125. X
  126. X  if (flag)
  127. X    XFillPolygon(xwindow->display,xwindow->window,xwindow->hue[none],
  128. X                               hex_points, 6, Convex, CoordModePrevious);
  129. X  if (enable_grid[windowcolor])
  130. X    XDrawLines(xwindow->display,xwindow->window,xwindow->hue[dark], hex_points, 7, CoordModePrevious);
  131. X}
  132. X
  133. X
  134. X/*************************************************************************/
  135. X/**    drawmarch                              **/
  136. X/** Draw passive march markers                        **/
  137. X/**    Greg Lesher (lesher@park.bu.edu)                **/
  138. X/*************************************************************************/
  139. Xdrawmarch(board)
  140. X  square_type *board;
  141. X{
  142. X  int x, y, k;
  143. X
  144. X  for (x=0; x<boardsizex; x++)
  145. X  {
  146. X    for (y=0; y<boardsizey; y++)
  147. X    {
  148. X      if (SQUARE(board,x,y)->anymarch == ACTIVE)
  149. X        drawmarcharrows (SQUARE(board,x,y),SQUARE(board,x,y)->marchcolor,ACTIVE);
  150. X      else
  151. X      {
  152. X        for (k=0; k<nsides; k++)
  153. X        {
  154. X          if (SQUARE(board,x,y)->march[k] == PASSIVE)
  155. X            if (SQUARE(board,x,y)->color == none)
  156. X            {
  157. X              drawmarcharrows(SQUARE(board,x,y),k,PASSIVE);
  158. X            }
  159. X            else if (!visible(board,k,x,y))
  160. X              drawmarcharrows(SQUARE(board,x,y),k,PASSIVE);
  161. X        }
  162. X      }
  163. X    }
  164. X  }
  165. X}
  166. X
  167. X
  168. X/*************************************************************************/
  169. X/**    drawmarcharrows                              **/
  170. X/** Draw passive march markers                        **/
  171. X/**    Greg Lesher (lesher@park.bu.edu)                **/
  172. X/*************************************************************************/
  173. Xdrawmarcharrows (square,marchcolor,type)
  174. X  square_type *square;
  175. X  int marchcolor,
  176. X      type;
  177. X{
  178. X  int k,
  179. X      xpos, ypos,
  180. X      hafsquare;
  181. X
  182. X  if (enable_hex)
  183. X  {
  184. X    xpos = square->xpos;
  185. X    ypos = square->ypos;
  186. X
  187. X    for (k=0; k<nplayers; k++)
  188. X    {
  189. X      if (colorarray[k] == marchcolor)
  190. X      {
  191. X        if(square->marchdir[marchcolor][HEX_UP])
  192. X        {
  193. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  194. X            xpos+2, ypos, xpos+2, ypos-hex_vert+2);
  195. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  196. X            xpos+3, ypos, xpos+3, ypos-hex_vert+2);
  197. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  198. X            xpos-2, ypos, xpos-2, ypos-hex_vert+2);
  199. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  200. X            xpos-3, ypos, xpos-3, ypos-hex_vert+2);
  201. X        }
  202. X        if(square->marchdir[marchcolor][HEX_DOWN])
  203. X        {
  204. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  205. X            xpos+2, ypos, xpos+2, ypos+hex_vert-2);
  206. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  207. X            xpos+3, ypos, xpos+3, ypos+hex_vert-2);
  208. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  209. X            xpos-2, ypos, xpos-2, ypos+hex_vert-2);
  210. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  211. X            xpos-3, ypos, xpos-3, ypos+hex_vert-2);
  212. X        }
  213. X        if(square->marchdir[marchcolor][HEX_RIGHT_UP])
  214. X        {
  215. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  216. X            xpos-2, ypos-2, xpos+hex_3quarterside-2, ypos-hex_halfvert-2);
  217. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  218. X            xpos-3, ypos-3, xpos+hex_3quarterside-3, ypos-hex_halfvert-3);
  219. X
  220. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  221. X            xpos+2, ypos+2, xpos+hex_3quarterside+2, ypos-hex_halfvert+2);
  222. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  223. X            xpos+3, ypos+3, xpos+hex_3quarterside+3, ypos-hex_halfvert+3);
  224. X        }
  225. X        if(square->marchdir[marchcolor][HEX_RIGHT_DOWN])
  226. X        {
  227. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  228. X            xpos+2, ypos-2, xpos+hex_3quarterside+2, ypos+hex_halfvert-2);
  229. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  230. X            xpos+3, ypos-3, xpos+hex_3quarterside+3, ypos+hex_halfvert-3);
  231. X
  232. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  233. X            xpos-2, ypos+2, xpos+hex_3quarterside-2, ypos+hex_halfvert+2);
  234. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  235. X            xpos-3, ypos+3, xpos+hex_3quarterside-3, ypos+hex_halfvert+3);
  236. X        }
  237. X        if(square->marchdir[marchcolor][HEX_LEFT_UP])
  238. X        {
  239. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  240. X            xpos+2, ypos-2, xpos-hex_3quarterside+2, ypos-hex_halfvert-2);
  241. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  242. X            xpos+3, ypos-3, xpos-hex_3quarterside+3, ypos-hex_halfvert-3);
  243. X
  244. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  245. X            xpos-2, ypos+2, xpos-hex_3quarterside-2, ypos-hex_halfvert+2);
  246. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  247. X            xpos-3, ypos+3, xpos-hex_3quarterside-3, ypos-hex_halfvert+3);
  248. X        }
  249. X        if(square->marchdir[marchcolor][HEX_LEFT_DOWN])
  250. X        {
  251. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  252. X            xpos-2, ypos-2, xpos-hex_3quarterside-2, ypos+hex_halfvert-2);
  253. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  254. X            xpos-3, ypos-3, xpos-hex_3quarterside-3, ypos+hex_halfvert-3);
  255. X
  256. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  257. X            xpos+2, ypos+2, xpos-hex_3quarterside+2, ypos+hex_halfvert+2);
  258. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  259. X            xpos+3, ypos+3, xpos-hex_3quarterside+3, ypos+hex_halfvert+3);
  260. X        }
  261. X  
  262. X        if (type == PASSIVE)
  263. X          XDrawRectangle(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  264. X              xpos-DSIZE, ypos-DSIZE, 2*DSIZE, 2*DSIZE);
  265. X      }
  266. X    }
  267. X  }
  268. X  else
  269. X  {
  270. X    hafsquare=squaresize[marchcolor]/2;
  271. X    xpos = square->x*squaresize[marchcolor]+hafsquare;
  272. X    ypos = square->y*squaresize[marchcolor]+hafsquare;
  273. X
  274. X    for (k=0; k<nplayers; k++)
  275. X    {
  276. X      if (colorarray[k] == marchcolor)
  277. X      {
  278. X        if(square->marchdir[marchcolor][UP])
  279. X        {
  280. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  281. X            xpos+2, ypos, xpos+2, ypos-hafsquare);
  282. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  283. X            xpos+3, ypos, xpos+3, ypos-hafsquare);
  284. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  285. X            xpos-2, ypos, xpos-2, ypos-hafsquare);
  286. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  287. X            xpos-3, ypos, xpos-3, ypos-hafsquare);
  288. X        }
  289. X        if(square->marchdir[marchcolor][DOWN])
  290. X        {
  291. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  292. X            xpos+2, ypos, xpos+2, ypos+hafsquare-1);
  293. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  294. X            xpos+3, ypos, xpos+3, ypos+hafsquare-1);
  295. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  296. X            xpos-2, ypos, xpos-2, ypos+hafsquare-1);
  297. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  298. X            xpos-3, ypos, xpos-3, ypos+hafsquare-1);
  299. X        }
  300. X        if(square->marchdir[marchcolor][RIGHT])
  301. X        {
  302. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  303. X            xpos, ypos+2, xpos+hafsquare-1, ypos+2);
  304. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  305. X            xpos, ypos+3, xpos+hafsquare-1, ypos+3);
  306. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  307. X            xpos, ypos-2, xpos+hafsquare-1, ypos-2);
  308. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  309. X            xpos, ypos-3, xpos+hafsquare-1, ypos-3);
  310. X        }
  311. X        if(square->marchdir[marchcolor][LEFT])
  312. X        {
  313. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  314. X            xpos, ypos+2, xpos-hafsquare, ypos+2);
  315. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  316. X            xpos, ypos+3, xpos-hafsquare, ypos+3);
  317. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  318. X            xpos, ypos-2, xpos-hafsquare, ypos-2);
  319. X          XDrawLine(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  320. X            xpos, ypos-3, xpos-hafsquare, ypos-3);
  321. X        }
  322. X  
  323. X        if (type == PASSIVE)
  324. X          XDrawRectangle(xwindow[k]->display,xwindow[k]->window,xwindow[k]->hue[marchcolor],
  325. X              xpos-DSIZE, ypos-DSIZE, 2*DSIZE, 2*DSIZE);
  326. X      }
  327. X    }
  328. X  }
  329. X}
  330. X
  331. X
  332. X/*************************************************************************/
  333. X/**    drawsquare                              **/
  334. X/** Draw one square of the game board                    **/
  335. X/**    Greg Lesher (lesher@park.bu.edu)                **/
  336. X/*************************************************************************/
  337. Xdrawsquare(xwindow,square,windowcolor,squaresize)
  338. X  xwindow_type *xwindow;
  339. X  square_type *square;
  340. X  int windowcolor,
  341. X      squaresize;
  342. X{
  343. X  int i, j, k,
  344. X      offset,
  345. X      ipos, jpos,
  346. X      hafsquare, psize, bsize, hafpsize, psize1, hafpsize1,
  347. X      value,
  348. X      terrain_type,
  349. X      max, smax, max_pos, smax_pos,
  350. X      csize,hafc;
  351. X  static GC onhue, offhue;
  352. X
  353. X  hafsquare=squaresize/2;
  354. X
  355. X  /**** get square coordinates ****/
  356. X  i = square->x;
  357. X  j = square->y;
  358. X
  359. X  if (enable_hex)
  360. X  {
  361. X    ipos = square->xpos;
  362. X    jpos = square->ypos;
  363. X  }
  364. X  else
  365. X  {
  366. X    ipos = i*squaresize;
  367. X    jpos = j*squaresize;
  368. X  }
  369. X
  370. X  /**** set drawing color & value ****/
  371. X
  372. X  if (square->color == none || square->color == FIGHT)
  373. X    value=0;
  374. X  else
  375. X  {
  376. X    onhue = xwindow->hue[square->color];
  377. X    if ((xwindow->depth==1 && color2bw[sidemap[square->color]]<=GRAY3) ||
  378. X        (xwindow->depth==8 && sidemap[square->color]==BLACK))
  379. X      offhue = xwindow->hue[light];
  380. X    else
  381. X      offhue = xwindow->hue[dark];
  382. X    value = square->value[square->color];
  383. X  }
  384. X
  385. X  if (square->color == none)
  386. X  {
  387. X    onhue = xwindow->hue[none];
  388. X    offhue = xwindow->hue[dark];
  389. X    value = 0;
  390. X  }
  391. X  
  392. X  /**** compute piece size ****/
  393. X
  394. X  if (enable_hex)
  395. X    bsize = 11*hex_vert/6;
  396. X  else
  397. X    bsize = squaresize;
  398. X  psize = (int)(bsize * areavalue[value]);
  399. X  hafpsize = psize/2;
  400. X
  401. X  /**** clear with appropriately colored square ****/
  402. X
  403. X  if (enable_terrain)
  404. X  {
  405. X    terrain_type = square->value[none];
  406. X
  407. X    if (enable_hex)
  408. X    {
  409. X      offset = -2 * square->value[none];
  410. X
  411. X      if (terrain_type < 0)
  412. X      {
  413. X        double_copy (xwindow, square, windowcolor, squaresize, terrain_type, 0);
  414. X        terrain_type = 0;
  415. X      }
  416. X      else
  417. X        offset = 0;
  418. X
  419. X      if (terrain_type == 1 && !enable_hills && !enable_forest)
  420. X        XFillArc (xwindow->display,xwindow->window, xwindow->hue[none],
  421. X           ipos-(hex_vert-1), jpos-(hex_vert-1), 2*(hex_vert-1), 2*(hex_vert-1), 0, 23040);
  422. X      else
  423. X        double_copy (xwindow, square, windowcolor, squaresize, terrain_type, offset);
  424. X    }
  425. X    else
  426. X    {
  427. X      offset = ((double)(-terrain_type) * squaresize)/(2*fillnumber);
  428. X
  429. X      if (terrain_type < 0)
  430. X        terrain_type = 0;
  431. X      else
  432. X        offset = 0;
  433. X
  434. X      if (offset != 0)
  435. X        XCopyArea (xwindow->display, xwindow->terrain[1], xwindow->window,
  436. X                    xwindow->hue[dark], 0, 0, squaresize, squaresize, i*squaresize, j*squaresize);
  437. X
  438. X      XCopyArea (xwindow->display, xwindow->terrain[terrain_type], xwindow->window,
  439. X                          xwindow->hue[dark], 0, 0, squaresize-2*offset, squaresize-2*offset,
  440. X                          i*squaresize+offset, j*squaresize+offset);
  441. X    }
  442. X  }
  443. X  else
  444. X  {
  445. X    if (enable_hex)
  446. X    {
  447. X      XFillArc (xwindow->display,xwindow->window, xwindow->hue[none],
  448. X           ipos-(hex_vert-1), jpos-(hex_vert-1), 2*(hex_vert-1), 2*(hex_vert-1), 0, 23040);
  449. X
  450. X/**
  451. X      blanksquare(xwindow, square, windowcolor, squaresize, TRUE);
  452. X**/
  453. X    }
  454. X    else
  455. X      XFillRectangle(xwindow->display,xwindow->window, xwindow->hue[none],
  456. X           i*squaresize,j*squaresize, squaresize, squaresize);
  457. X  }
  458. X
  459. X  if (!enable_hex && enable_grid[windowcolor])
  460. X  {
  461. X     XDrawLine(xwindow->display,xwindow->window,xwindow->hue[dark],
  462. X           ipos, jpos, ipos+squaresize, jpos);
  463. X     XDrawLine(xwindow->display,xwindow->window,xwindow->hue[dark],
  464. X           ipos, jpos, ipos, jpos+squaresize);
  465. X  }
  466. X
  467. X  
  468. X  /**** singularly occupied square ****/
  469. X  if (square->color != none && square->color != FIGHT)
  470. X  {
  471. X
  472. X    /**** draw center marker ****/
  473. X    if (enable_hex)
  474. X    {
  475. X      XFillArc (xwindow->display,xwindow->window, onhue,
  476. X                          ipos-hafpsize, jpos-hafpsize, psize, psize, 0, 23040);
  477. X      if (xwindow->drawletter[square->color])
  478. X        XDrawString(xwindow->display,xwindow->window, xwindow->flip,
  479. X                     ipos-xwindow->charwidth/2, jpos+xwindow->charheight/2,
  480. X                     xwindow->letter[square->color], 1);
  481. X    }
  482. X    else
  483. X    {
  484. X      if (!xwindow->drawletter[square->color] && !enable_grid[windowcolor])
  485. X          XDrawRectangle(xwindow->display,xwindow->window,xwindow->hue[dark],
  486. X           ipos+hafsquare-CSIZE, jpos+hafsquare-CSIZE, 2*CSIZE, 2*CSIZE);
  487. X
  488. X      XFillRectangle(xwindow->display,xwindow->window,onhue,
  489. X           ipos+hafsquare-hafpsize, jpos+hafsquare-hafpsize, psize, psize);
  490. X
  491. X      if (xwindow->drawletter[square->color])
  492. X        XDrawString(xwindow->display,xwindow->window, xwindow->flip,
  493. X                   ipos+squaresize/2-xwindow->charwidth/2, jpos+squaresize/2+xwindow->charheight/2,
  494. X                   xwindow->letter[square->color], 1);
  495. X    }
  496. X
  497. X    /**** draw arrows ****/
  498. X    if (enable_hidden[windowcolor])
  499. X    {
  500. X      if (square->color == windowcolor)
  501. X      {
  502. X#if SHOWFLOW
  503. X        if (value == 0)
  504. X          drawarrows(xwindow,square,onhue,offhue,i,j,hafpsize,squaresize,TRUE);
  505. X        else
  506. X          drawarrows(xwindow,square,onhue,offhue,i,j,hafpsize,squaresize,FALSE);
  507. X#else
  508. X        drawarrows(xwindow,square,onhue,offhue,i,j,hafpsize,squaresize,FALSE);
  509. X#endif
  510. X      }
  511. X    }
  512. X    else
  513. X    {
  514. X#if SHOWFLOW
  515. X      if (value == 0)
  516. X        drawarrows(xwindow,square,onhue,offhue,i,j,hafpsize,squaresize,TRUE);
  517. X      else
  518. X        drawarrows(xwindow,square,onhue,offhue,i,j,hafpsize,squaresize,FALSE);
  519. X#else
  520. X      drawarrows(xwindow,square,onhue,offhue,i,j,hafpsize,squaresize,FALSE);
  521. X#endif
  522. X    }
  523. X  }
  524. X  else if(square->color == FIGHT)       /**** draw fight square ****/
  525. X  {
  526. X    /**** find two largest components of square ****/
  527. X    max = -1;
  528. X    smax = -1; 
  529. X    max_pos = 0;
  530. X    for (k=0;k<nsides;k++)
  531. X    {
  532. X      if (square->value[k] > max)
  533. X      {
  534. X        smax = max; 
  535. X        smax_pos = max_pos;
  536. X        max = square->value[k];
  537. X        max_pos = k;
  538. X      }
  539. X      else if (square->value[k] > smax)
  540. X      {
  541. X        smax = square->value[k];
  542. X        smax_pos = k;
  543. X      }
  544. X    }
  545. X    onhue = xwindow->hue[max_pos];
  546. X    offhue = xwindow->hue[smax_pos];
  547. X    psize = (int)(bsize * areavalue[square->value[max_pos]]);
  548. X    hafpsize = psize/2;
  549. X    psize1 = (int)(bsize * areavalue[square->value[smax_pos]]);
  550. X    hafpsize1 = psize1/2;
  551. X
  552. X    if (enable_hex)
  553. X    {
  554. X      XFillArc (xwindow->display,xwindow->window, onhue,
  555. X           ipos-hafpsize, jpos-hafpsize, psize, psize, 0, 23040);
  556. X      XFillArc (xwindow->display,xwindow->window, offhue,
  557. X           ipos-hafpsize1, jpos-hafpsize1, psize1, psize1, 0, 23040);
  558. X
  559. X      XDrawLine(xwindow->display, xwindow->window, onhue, ipos - hex_halfside, jpos - hex_halfvert,
  560. X                  ipos + hex_halfside, jpos + hex_halfvert);
  561. X      XDrawLine(xwindow->display, xwindow->window, onhue, ipos - hex_halfside, jpos + hex_halfvert,
  562. X                  ipos + hex_halfside, jpos - hex_halfvert);
  563. X    }
  564. X    else
  565. X    {
  566. X      XFillRectangle(xwindow->display,xwindow->window,onhue,
  567. X             ipos+hafsquare-hafpsize, jpos+hafsquare-hafpsize, psize, psize);
  568. X      XFillRectangle(xwindow->display,xwindow->window,offhue,
  569. X             ipos+hafsquare-hafpsize1, jpos+hafsquare-hafpsize1, psize1, psize1);
  570. X
  571. X      /**** draw battle cross ****/
  572. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  573. X                  ipos+2,jpos+2, ipos+squaresize-2,jpos+squaresize-2);
  574. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  575. X                  ipos+squaresize-2,jpos+2, ipos+2,jpos+squaresize-2);
  576. X    }
  577. X  }
  578. X
  579. X  /**** draw circle for town or base ****/
  580. X  if(square->angle > 0)
  581. X  {
  582. X
  583. X    if (enable_hex)
  584. X    {
  585. X      if (square->angle < 23040)
  586. X        csize = ((square->oldgrowth - 52)*7*hex_vert)/200;
  587. X      else
  588. X        csize = ((square->growth - 52)*7*hex_vert)/200;
  589. X
  590. X      hafc = csize/2;
  591. X
  592. X      XDrawArc(xwindow->display,xwindow->window,offhue,
  593. X           ipos-hafc, jpos-hafc, csize, csize, 0, square->angle);
  594. X
  595. X      XDrawArc(xwindow->display,xwindow->window,offhue,
  596. X           ipos-hafc + 1, jpos-hafc + 1, csize - 2, csize - 2, 0, square->angle);
  597. X    }
  598. X    else
  599. X    {
  600. X      if (square->angle < 23040)
  601. X        csize = ((square->oldgrowth - 52)*squaresize)/50;
  602. X      else
  603. X        csize = ((square->growth - 52)*squaresize)/50;
  604. X
  605. X      hafc = (squaresize - csize)/2;
  606. X
  607. X      XDrawArc(xwindow->display,xwindow->window,offhue,
  608. X               ipos+hafc, jpos+hafc, csize, csize, 0, square->angle);
  609. X
  610. X      XDrawArc(xwindow->display,xwindow->window,offhue,
  611. X               ipos+hafc + 1, jpos+hafc + 1, csize - 2, csize - 2, 0, square->angle);
  612. X    }
  613. X  }
  614. X}
  615. X
  616. X
  617. X/*************************************************************************/
  618. X/**    double_copy                              **/
  619. X/** do flickerless pixmap copy for hexagonal board            **/ 
  620. X/**    Greg Lesher (lesher@cns.bu.edu)                    **/
  621. X/*************************************************************************/
  622. Xdouble_copy (xwindow, square, windowcolor, squaresize, terrain_type, offset)
  623. X  xwindow_type *xwindow;
  624. X  square_type *square;
  625. X  int windowcolor,
  626. X      squaresize,
  627. X      terrain_type,
  628. X      offset;
  629. X{
  630. X  if (terrain_type < 0)
  631. X  {
  632. X    if (enable_hills || enable_forest)
  633. X    {
  634. X      double_copy (xwindow, square, windowcolor, squaresize, 1, 0);
  635. X      if (enable_grid[windowcolor])
  636. X        blanksquare(xwindow, square, windowcolor, squaresize, FALSE);
  637. X    }
  638. X    else
  639. X      blanksquare(xwindow, square, windowcolor, squaresize, TRUE);
  640. X    return;
  641. X  }
  642. X
  643. X  XCopyArea (xwindow->display, xwindow->window, xwindow->terrain[terrain_type], xwindow->hue[light],
  644. X                     square->xpos - hex_side, square->ypos - hex_vert, 2*hex_side, 2*hex_vert,
  645. X                     0, 4*hex_vert);
  646. X
  647. X  XCopyArea (xwindow->display, xwindow->terrain[terrain_type], xwindow->terrain[terrain_type],
  648. X                     xwindow->gc_clear, offset*hex_side, 2*hex_vert, 2*hex_side, 2*hex_vert,
  649. X                     0, 4*hex_vert);
  650. X
  651. X  XCopyArea (xwindow->display, xwindow->terrain[terrain_type], xwindow->terrain[terrain_type],
  652. X                     xwindow->gc_or, offset*hex_side, 0, 2*hex_side, 2*hex_vert,
  653. X                     0, 4*hex_vert);
  654. X
  655. X  XCopyArea (xwindow->display, xwindow->terrain[terrain_type], xwindow->window, xwindow->hue[light],
  656. X                     0, 4*hex_vert, 2*hex_side, 2*hex_vert, square->xpos - hex_side,
  657. X                     square->ypos - hex_vert);
  658. X
  659. X  if (enable_grid[windowcolor])
  660. X    blanksquare(xwindow, square, windowcolor, squaresize, FALSE);
  661. X}
  662. X
  663. X
  664. X/*************************************************************************/
  665. X/**     drawarrows                                                      **/
  666. X/**  Draws appropriate movement arrows                    **/
  667. X/**     Greg Lesher (lesher@park.bu.edu)                                **/
  668. X/*************************************************************************/
  669. Xdrawarrows(xwindow,square,onhue,offhue,i,j,hafpsize, squaresize, halfsize)
  670. X  xwindow_type *xwindow;
  671. X  square_type *square;
  672. X  GC onhue, offhue;
  673. X  int i, j,
  674. X      hafpsize,
  675. X      squaresize,
  676. X      halfsize;
  677. X{
  678. X  int ipos, jpos,
  679. X      vert, horiz, halfvert,
  680. X      hafsquare;
  681. X
  682. X  if (enable_hex)
  683. X  {
  684. X    ipos = square->xpos;
  685. X    jpos = square->ypos;
  686. X
  687. X    vert = hex_vert;
  688. X    halfvert = hex_halfvert;
  689. X    horiz = hex_3quarterside;
  690. X
  691. X    if (halfsize)
  692. X    {
  693. X      vert = vert/2;
  694. X      halfvert = halfvert/2;
  695. X      horiz = horiz/2;
  696. X    }
  697. X
  698. X    /**** draw direction arrows ****/
  699. X    if(square->dir[HEX_UP])
  700. X    {
  701. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos, jpos, ipos, jpos - vert + 2); 
  702. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos+1, jpos, ipos+1, jpos - vert + 2); 
  703. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos-1, jpos, ipos-1, jpos - vert + 2); 
  704. X    }
  705. X    if(square->dir[HEX_DOWN])
  706. X    {
  707. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos, jpos, ipos, jpos + vert - 2); 
  708. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos+1, jpos, ipos+1, jpos + vert - 2); 
  709. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos-1, jpos, ipos-1, jpos + vert - 2); 
  710. X    }
  711. X    if(square->dir[HEX_RIGHT_UP])
  712. X    {
  713. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos, jpos, ipos + horiz - 1,
  714. X                                                jpos - halfvert + 1); 
  715. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos+1, jpos, ipos+1 + horiz - 1,
  716. X                                                jpos - halfvert + 1); 
  717. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos, jpos-1, ipos+1 + horiz - 1,
  718. X                                                jpos-1 - halfvert + 1); 
  719. X    }
  720. X    if(square->dir[HEX_RIGHT_DOWN])
  721. X    {
  722. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos, jpos, ipos + horiz - 1,
  723. X                                                jpos + halfvert - 1); 
  724. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos+1, jpos, ipos+1 + horiz - 1,
  725. X                                                jpos + halfvert - 1); 
  726. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos, jpos+1, ipos + horiz - 1,
  727. X                                                jpos+1 + halfvert - 1); 
  728. X    }    
  729. X    if(square->dir[HEX_LEFT_UP])
  730. X    {
  731. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos, jpos, ipos - horiz + 1,
  732. X                                                jpos - halfvert + 1); 
  733. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos-1, jpos, ipos-1 - horiz + 1,
  734. X                                                jpos - halfvert + 1); 
  735. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos, jpos-1, ipos - horiz + 1,
  736. X                                                jpos-1 - halfvert + 1); 
  737. X    }
  738. X    if(square->dir[HEX_LEFT_DOWN])
  739. X    {
  740. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos, jpos, ipos - horiz + 1,
  741. X                                                jpos + halfvert - 1); 
  742. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos-1, jpos, ipos-1 - horiz + 1,
  743. X                                                jpos + halfvert - 1); 
  744. X      XDrawLine(xwindow->display,xwindow->window,onhue, ipos, jpos+1, ipos - horiz + 1,
  745. X                                                jpos+1 + halfvert - 1); 
  746. X    }    
  747. X  }
  748. X  else
  749. X  {
  750. X    hafsquare=squaresize/2;
  751. X
  752. X    ipos = i*squaresize+hafsquare;
  753. X    jpos = j*squaresize+hafsquare;
  754. X
  755. X    if (halfsize)
  756. X      hafsquare /= 2;
  757. X
  758. X    /**** draw direction arrows ****/
  759. X    if(square->dir[UP])
  760. X    {
  761. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  762. X                  ipos-1, jpos, ipos-1, jpos-hafsquare);
  763. X#if INVERT
  764. X      XDrawLine(xwindow->display,xwindow->window,offhue,
  765. X                  ipos, jpos, ipos, jpos-hafpsize);
  766. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  767. X                  ipos, jpos-hafpsize, ipos, jpos-hafsquare);
  768. X#else
  769. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  770. X                  ipos, jpos, ipos, jpos-hafsquare);
  771. X#endif
  772. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  773. X                  ipos+1, jpos, ipos+1, jpos-hafsquare);
  774. X    }
  775. X    if(square->dir[DOWN])
  776. X    {
  777. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  778. X                  ipos-1, jpos, ipos-1, jpos+hafsquare-1);
  779. X#if INVERT
  780. X      XDrawLine(xwindow->display,xwindow->window,offhue,
  781. X                  ipos, jpos, ipos, jpos+hafpsize);
  782. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  783. X                  ipos, jpos+hafpsize, ipos, jpos+hafsquare-1);
  784. X#else
  785. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  786. X                  ipos, jpos, ipos, jpos+hafsquare-1);
  787. X#endif
  788. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  789. X                  ipos+1, jpos, ipos+1, jpos+hafsquare-1);
  790. X    }
  791. X    if(square->dir[RIGHT])
  792. X    {
  793. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  794. X                  ipos, jpos-1, ipos+hafsquare-1, jpos-1);
  795. X#if INVERT
  796. X      XDrawLine(xwindow->display,xwindow->window,offhue,
  797. X                  ipos, jpos, ipos+hafpsize, jpos);
  798. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  799. X                  ipos+hafpsize, jpos, ipos+hafsquare-1, jpos);
  800. X#else
  801. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  802. X                  ipos, jpos, ipos+hafsquare-1, jpos);
  803. X#endif
  804. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  805. X                  ipos, jpos+1, ipos+hafsquare-1, jpos+1);
  806. X    }
  807. X    if(square->dir[LEFT])
  808. X    {
  809. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  810. X                  ipos, jpos-1, ipos-hafsquare, jpos-1);
  811. X#if INVERT
  812. X      XDrawLine(xwindow->display,xwindow->window,offhue,
  813. X                  ipos, jpos, ipos-hafpsize, jpos);
  814. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  815. X                  ipos-hafpsize, jpos, ipos-hafsquare, jpos);
  816. X#else
  817. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  818. X                  ipos, jpos, ipos-hafsquare, jpos);
  819. X#endif
  820. X      XDrawLine(xwindow->display,xwindow->window,onhue,
  821. X                  ipos, jpos+1, ipos-hafsquare, jpos+1);
  822. X    }
  823. X  }
  824. X}
  825. X
  826. X
  827. X/*************************************************************************/
  828. X/**     drawblank                                                       **/
  829. X/**  Draws a blank square                                               **/
  830. X/**     Mark Lauer (elric@cs.su.oz.au)                                  **/
  831. X/**     Greg Lesher (lesher@park.bu.edu)                                **/
  832. X/*************************************************************************/
  833. Xdrawblank (xwindow, i, j, terrain_type, seen, growth, windowcolor, squaresize, square)
  834. X  xwindow_type *xwindow;
  835. X  int i, j,
  836. X      terrain_type,
  837. X      seen,
  838. X      growth,
  839. X      windowcolor,
  840. X      squaresize;
  841. X  square_type *square;
  842. X{
  843. X  int csize, hafc,
  844. X      ipos, jpos,
  845. X      offset;
  846. X
  847. X  if (enable_hex)
  848. X  {
  849. X    ipos = square->xpos;
  850. X    jpos = square->ypos;
  851. X  }
  852. X  else
  853. X  {
  854. X    ipos = i*squaresize;
  855. X    jpos = j*squaresize;
  856. X  }
  857. X
  858. X  /**** clear with appropriately colored square ****/
  859. X  if (enable_terrain)
  860. X  {
  861. X    if (seen && !enable_localmap[windowcolor])
  862. X    {
  863. X      if (enable_hex)
  864. X      {
  865. X        offset = -2 * square->value[none];
  866. X
  867. X        if (terrain_type < 0)
  868. X        {
  869. X          double_copy (xwindow, square, windowcolor, squaresize, terrain_type, 0);
  870. X          terrain_type = 0;
  871. X        }
  872. X        else
  873. X          offset = 0;
  874. X
  875. X        if (terrain_type == 1 && !enable_hills && !enable_forest)
  876. X          XFillArc (xwindow->display,xwindow->window, xwindow->hue[none],
  877. X             ipos-(hex_vert-1), jpos-(hex_vert-1), 2*(hex_vert-1), 2*(hex_vert-1), 0, 23040);
  878. X        else
  879. X          double_copy (xwindow, square, windowcolor, squaresize, terrain_type, offset);
  880. X      }
  881. X      else
  882. X      {
  883. X        offset = ((double)(-terrain_type) * squaresize)/(2*fillnumber);
  884. X
  885. X        if (terrain_type < 0)
  886. X          terrain_type = 0;
  887. X        else
  888. X          offset = 0;
  889. X
  890. X        if (offset != 0)
  891. X          XCopyArea (xwindow->display, xwindow->terrain[1], xwindow->window,
  892. X                      xwindow->hue[dark], 0, 0, squaresize, squaresize, ipos, jpos);
  893. X  
  894. X        XCopyArea (xwindow->display, xwindow->terrain[terrain_type], xwindow->window,
  895. X                          xwindow->hue[dark], 0, 0, squaresize-2*offset, squaresize-2*offset,
  896. X                          ipos+offset, jpos+offset);
  897. X      }
  898. X
  899. X      if (enable_basemap[windowcolor] && growth > 50)
  900. X      {
  901. X        if (enable_hex)
  902. X        {
  903. X          csize = ((growth - 52)*7*hex_vert)/200;
  904. X          hafc = csize/2;
  905. X
  906. X          XDrawArc(xwindow->display,xwindow->window,xwindow->hue[dark],
  907. X               ipos-hafc, jpos-hafc, csize, csize, 0, square->angle);
  908. X          XDrawArc(xwindow->display,xwindow->window,xwindow->hue[dark],
  909. X               ipos-hafc + 1, jpos-hafc + 1, csize - 2, csize - 2, 0, square->angle);
  910. X        }
  911. X        else
  912. X        {
  913. X          csize = ((growth - 52)*squaresize)/50;
  914. X          hafc = (squaresize - csize)/2;
  915. X          XDrawArc(xwindow->display,xwindow->window,xwindow->hue[dark],
  916. X               ipos+hafc, jpos+hafc, csize, csize, 0, 23040);
  917. X
  918. X          XDrawArc(xwindow->display,xwindow->window,xwindow->hue[dark],
  919. X                   ipos+hafc + 1, jpos+hafc + 1, csize - 2, csize - 2, 0, 23040);
  920. X        }
  921. X      }
  922. X    }
  923. X    else
  924. X    {
  925. X      if (enable_hex)
  926. X      {
  927. X        /** Using double copy results in some aliasing due to fact that hue[none] is **/
  928. X        /** usually drawn not copied and is a stipple.                     **/ 
  929. X/**
  930. X        double_copy (xwindow, square, windowcolor, squaresize, 1, 0);
  931. X**/
  932. X
  933. X        blanksquare(xwindow, square, windowcolor, squaresize, TRUE);
  934. X      }
  935. X      else
  936. X        XFillRectangle(xwindow->display,xwindow->window,
  937. X                       xwindow->hue[none], ipos,jpos, squaresize, squaresize);
  938. X    }
  939. X  }
  940. X  else
  941. X  {
  942. X     if (enable_hex) 
  943. X     {
  944. X        XFillArc (xwindow->display,xwindow->window, xwindow->hue[none],
  945. X           ipos-(hex_vert-1), jpos-(hex_vert-1), 2*(hex_vert-1), 2*(hex_vert-1), 0, 23040);
  946. X/**
  947. X        blanksquare(xwindow, square, windowcolor, squaresize, TRUE);
  948. X**/
  949. X     }
  950. X     else
  951. X       XFillRectangle(xwindow->display,xwindow->window,
  952. X                     xwindow->hue[none],
  953. X                     ipos,jpos, squaresize, squaresize);
  954. X
  955. X    if (enable_basemap[windowcolor])
  956. X    {
  957. X      if (growth > 50 && !enable_localmap[windowcolor] && seen)
  958. X      {
  959. X        if (enable_hex) 
  960. X        {
  961. X          csize = ((growth - 52)*7*hex_vert)/200;
  962. X          hafc = csize/2;
  963. X
  964. X          XDrawArc(xwindow->display,xwindow->window,xwindow->hue[dark],
  965. X               ipos-hafc, jpos-hafc, csize, csize, 0, square->angle);
  966. X          XDrawArc(xwindow->display,xwindow->window,xwindow->hue[dark],
  967. X               ipos-hafc + 1, jpos-hafc + 1, csize - 2, csize - 2, 0, square->angle);
  968. X        }
  969. X        else
  970. X        {
  971. X          csize = ((growth - 52)*squaresize)/50;
  972. X          hafc = (squaresize - csize)/2;
  973. X
  974. X          XDrawArc(xwindow->display,xwindow->window,xwindow->hue[dark],
  975. X             ipos+hafc, jpos+hafc, csize, csize, 0, 23040);
  976. X
  977. X          XDrawArc(xwindow->display,xwindow->window,xwindow->hue[dark],
  978. X               ipos+hafc + 1, jpos+hafc + 1, csize - 2, csize - 2, 0, 23040);
  979. X        }
  980. X      }
  981. X    }
  982. X  }
  983. X
  984. X  if (!enable_hex && enable_grid[windowcolor])
  985. X  {
  986. X     XDrawLine(xwindow->display,xwindow->window,xwindow->hue[dark],
  987. X           ipos,jpos,
  988. X           ipos+squaresize,jpos);
  989. X     XDrawLine(xwindow->display,xwindow->window,xwindow->hue[dark],
  990. X           ipos,jpos,
  991. X           ipos,jpos+squaresize);
  992. X  }
  993. X}
  994. X
  995. X
  996. X/*************************************************************************/
  997. X/**    storedrawsquare                              **/
  998. X/** Draw one square of the game board to a file                **/
  999. X/**    Greg Lesher (lesher@park.bu.edu)                **/
  1000. X/*************************************************************************/
  1001. Xstoredrawsquare(square, squaresize, special_flag)
  1002. X  square_type *square;
  1003. X  int squaresize,
  1004. X      special_flag;
  1005. X{
  1006. X  int i, j, k,
  1007. X      bsize, csize, psize, psize1,
  1008. X      value,
  1009. X      max, smax, max_pos, smax_pos;
  1010. X
  1011. X  i = square->x;
  1012. X  j = square->y;
  1013. X
  1014. X  if (enable_hex)
  1015. X    bsize = 9*hex_vert/5;
  1016. X  else
  1017. X    bsize = squaresize;
  1018. X
  1019. X  if (enable_terrain)
  1020. X  {
  1021. X    if (enable_hex && special_flag)
  1022. X    {
  1023. X      if (!enable_hills && !enable_forest && square->value[none] == 1)
  1024. X        fprintf (fpout,"b%c%c",i,j);
  1025. X      else
  1026. X        fprintf (fpout,"A%c%c%c",i,j,square->value[none]);
  1027. X    }
  1028. X    else
  1029. X      fprintf (fpout,"A%c%c%c",i,j,square->value[none]);
  1030. X  }
  1031. X  else
  1032. X  {
  1033. X    if (enable_hex && special_flag)
  1034. X      fprintf (fpout,"b%c%c",i,j);
  1035. X    else
  1036. X      fprintf (fpout,"B%c%c",i,j);
  1037. X  }
  1038. X  
  1039. X  /**** singularly occupied square ****/
  1040. X  if (square->color != none && square->color != FIGHT)
  1041. X  {
  1042. X    storedrawarrows(square,i,j,square->color);
  1043. X
  1044. X    value = square->value[square->color];
  1045. X    if (value < 0)
  1046. X      value = 0;
  1047. X    psize = (int)(bsize * areavalue[value]);
  1048. X    
  1049. X    fprintf (fpout,"D%c%c%c%c",i,j,psize,square->color);
  1050. X  }
  1051. X  else if(square->color == FIGHT)
  1052. X  {
  1053. X    /**** find two largest components of square ****/
  1054. X    max = -1;
  1055. X    smax = -1; 
  1056. X    for (k=0;k<nsides;k++)
  1057. X    {
  1058. X      if (square->value[k] > max)
  1059. X      {
  1060. X        smax = max; 
  1061. X        smax_pos = max_pos;
  1062. X        max = square->value[k];
  1063. X        max_pos = k;
  1064. X      }
  1065. X      else if (square->value[k] > smax)
  1066. X      {
  1067. X        smax = square->value[k];
  1068. X        smax_pos = k;
  1069. X      }
  1070. X    }
  1071. X    psize = (int)(bsize * areavalue[square->value[max_pos]]);
  1072. X    psize1 = (int)(bsize * areavalue[square->value[smax_pos]]);
  1073. X
  1074. X    fprintf (fpout,"E%c%c%c%c%c%c",i,j,psize,max_pos,psize1,smax_pos);
  1075. X  }
  1076. X
  1077. X  /**** draw circle for town or base ****/
  1078. X  if(square->angle > 0)
  1079. X  {
  1080. X    if (enable_hex)
  1081. X    {
  1082. X      if (square->angle < 23040)
  1083. X        csize = ((square->oldgrowth - 52)*7*hex_vert)/200;
  1084. X      else
  1085. X        csize = ((square->growth - 52)*7*hex_vert)/200;
  1086. X    }
  1087. X    else
  1088. X    {
  1089. X      if (square->angle < 23040)
  1090. X        csize = ((square->oldgrowth - 52)*squaresize)/50;
  1091. X      else
  1092. X        csize = ((square->growth - 52)*squaresize)/50;
  1093. X    }
  1094. X
  1095. X    fprintf (fpout,"F%c%c%c%c",i,j,csize,(square->angle*255)/23040);
  1096. X  }
  1097. X}
  1098. X
  1099. X
  1100. X/*************************************************************************/
  1101. X/**     storedrawarrows                                                 **/
  1102. X/**  Draws appropriate movement arrows to file                **/
  1103. X/**     Greg Lesher (lesher@park.bu.edu)                                **/
  1104. X/*************************************************************************/
  1105. Xstoredrawarrows(square,i,j,colornumber)
  1106. X  square_type *square;
  1107. X  int i, j,
  1108. X      colornumber;
  1109. X{
  1110. X  if (enable_hex)
  1111. X  {
  1112. X    if(square->dir[HEX_UP])
  1113. X      fprintf (fpout,"G%c%c%cu",i,j,colornumber);
  1114. X
  1115. X    if(square->dir[HEX_DOWN])
  1116. X      fprintf (fpout,"G%c%c%cd",i,j,colornumber);
  1117. X
  1118. X    if(square->dir[HEX_RIGHT_UP])
  1119. X      fprintf (fpout,"G%c%c%cR",i,j,colornumber);
  1120. X
  1121. X    if(square->dir[HEX_RIGHT_DOWN])
  1122. X      fprintf (fpout,"G%c%c%cr",i,j,colornumber);
  1123. X
  1124. X    if(square->dir[HEX_LEFT_UP])
  1125. X      fprintf (fpout,"G%c%c%cL",i,j,colornumber);
  1126. X
  1127. X    if(square->dir[HEX_LEFT_DOWN])
  1128. X      fprintf (fpout,"G%c%c%cl",i,j,colornumber);
  1129. X  }
  1130. X  else
  1131. X  {
  1132. X    if(square->dir[UP])
  1133. X      fprintf (fpout,"G%c%c%cu",i,j,colornumber);
  1134. X
  1135. X    if(square->dir[DOWN])
  1136. X      fprintf (fpout,"G%c%c%cd",i,j,colornumber);
  1137. X
  1138. X    if(square->dir[RIGHT])
  1139. X      fprintf (fpout,"G%c%c%cr",i,j,colornumber);
  1140. X
  1141. X    if(square->dir[LEFT])
  1142. X      fprintf (fpout,"G%c%c%cl",i,j,colornumber);
  1143. X  }
  1144. X}
  1145. X
  1146. X
  1147. X/*************************************************************************/
  1148. X/**    print_message                            **/
  1149. X/** Print the latest message to the screen.  The message is purposely    **/
  1150. X/** allowed to flash in order to attract attention.  Further attention    **/
  1151. X/** can be called by use of ^g to ring the bell.            **/
  1152. X/**    Steve Lehar (slehar@park.bu.edu)                **/
  1153. X/**    Greg Lesher (lesher@park.bu.edu)                **/
  1154. X/*************************************************************************/
  1155. Xprint_message(text,textcount,newcolor,player,board)
  1156. X  char text[];
  1157. X  int textcount,
  1158. X      newcolor,
  1159. X      player;
  1160. X  square_type *board;
  1161. X{
  1162. X  int i,
  1163. X      scroll, scrollandprint;
  1164. X
  1165. X  static oldcolor=0,
  1166. X         veryfirst=TRUE,
  1167. X         firsttime[MAXSIDES];
  1168. X
  1169. X  char oldmessage[512],
  1170. X       line[100];
  1171. X
  1172. X  if (veryfirst)
  1173. X  {
  1174. X    for (i=0; i<MAXSIDES; i++)
  1175. X      firsttime[i] = TRUE;
  1176. X    veryfirst = FALSE;
  1177. X  }
  1178. X
  1179. X  scroll = FALSE;
  1180. X  scrollandprint = FALSE;
  1181. X
  1182. X#if !MULTITEXT
  1183. X  /**** copy old message ****/
  1184. X  strcpy (oldmessage,messagestr);
  1185. X  if (newcolor != oldcolor)
  1186. X    strcpy(messagestr,"");
  1187. X#endif
  1188. X
  1189. X  /**** remove control, shift & meta ****/
  1190. X  if (textcount==0)
  1191. X    return;
  1192. X
  1193. X  text[textcount] = 0;
  1194. X
  1195. X  if (firsttime[newcolor])
  1196. X  {
  1197. X    strcpy(personal_messagestr[newcolor], "");
  1198. X    firsttime[newcolor] = FALSE;
  1199. X  }
  1200. X  
  1201. X  switch (text[0])
  1202. X  {
  1203. X    /**** backspace ****/
  1204. X    case BACKSPACE:
  1205. X    case DELETE:
  1206. X#if MULTITEXT
  1207. X      if (strlen(personal_messagestr[newcolor]) > 0)
  1208. X        personal_messagestr[newcolor][(strlen(personal_messagestr[newcolor]))-1] =
  1209. X                                                  messagestr[(strlen(personal_messagestr[newcolor]))];
  1210. X#else
  1211. X      if (strlen(messagestr) > 0)
  1212. X        messagestr[(strlen(messagestr))-1] = messagestr[(strlen(messagestr))];
  1213. X#endif
  1214. X      break;
  1215. X
  1216. X    /**** newline ****/
  1217. X    case RETURN:
  1218. X#if MULTITEXT
  1219. X      strcpy(personal_messagestr[newcolor],"");
  1220. X#else
  1221. X      scroll = TRUE;
  1222. X#endif
  1223. X      break;
  1224. X    
  1225. X    case CTRLC:
  1226. X    case CTRLQ:
  1227. X      firsttime[newcolor] = TRUE;
  1228. X      removeplayer (player, board);
  1229. X      break;
  1230. X
  1231. X    case CTRLP:
  1232. X      gamestats (board);
  1233. X      dump_board (board, "xbattle.xbt");
  1234. X      break;
  1235. X
  1236. X    case CTRLW:
  1237. X      winwatch[player] = TRUE;
  1238. X      enable_personalhorizon[colorarray[player]] = FALSE;
  1239. X      drawboard (board, player, TRUE);
  1240. X      firsttime[newcolor] = TRUE;
  1241. X      sprintf (line, "%s has quit the game", huename[sidemap[colorarray[player]]]);
  1242. X      print_message(line,strlen(line),colorarray[player],player,board);
  1243. X      for (i=0; i<nplayers; i++)
  1244. X        if (winopen[i]) XBell(xwindow[i]->display,100);
  1245. X      break;
  1246. X
  1247. X    case CTRLG:
  1248. X      for (i=0; i<nplayers; i++)
  1249. X        if (winopen[i])
  1250. X          XBell(xwindow[i]->display,100);
  1251. X      break;
  1252. X
  1253. X    case SPACE:
  1254. X#if MULTITEXT
  1255. X      if ((strlen(personal_messagestr[newcolor]) + 1) > 511)
  1256. X      {
  1257. X        scroll = TRUE;
  1258. X      }
  1259. X      else
  1260. X        strcat(personal_messagestr[newcolor]," ");
  1261. X#else
  1262. X      if ((strlen(messagestr) + 1) > 511)
  1263. X      {
  1264. X        scroll = TRUE;
  1265. X      }
  1266. X      else
  1267. X        strcat(messagestr," ");
  1268. X#endif
  1269. X
  1270. X      break;
  1271. X
  1272. X    default:
  1273. X#if MULTITEXT
  1274. X      if ((strlen(personal_messagestr[newcolor]) + strlen(text)) > 511)
  1275. X      {
  1276. X        scroll = TRUE;
  1277. X      }
  1278. X      else
  1279. X        strcat(personal_messagestr[newcolor],text);
  1280. X#else
  1281. X      if ((strlen(messagestr) + strlen(text)) > 511)
  1282. X      {
  1283. X        scroll = TRUE;
  1284. X      }
  1285. X      else
  1286. X        strcat(messagestr,text);
  1287. X#endif
  1288. X
  1289. X      break;
  1290. X  }
  1291. X
  1292. X#if !MULTITEXT
  1293. X  if (newcolor != oldcolor)
  1294. X    scrollandprint = TRUE;
  1295. X#endif
  1296. X
  1297. X  /**** print the string on all xwindows ****/
  1298. X  for (i=0; i<nplayers; i++)
  1299. X  {
  1300. X    if (!winopen[i])
  1301. X      continue;
  1302. X#if !MULTITEXT
  1303. X    /**** scroll bottom text line up ****/
  1304. X    if (scroll || scrollandprint)
  1305. X    {
  1306. X      XDrawImageString(xwindow[i]->display,xwindow[i]->window,
  1307. X               xwindow[i]->hue[oldcolor],
  1308. X               TEXTX,textyh[colorarray[i]][newcolor],
  1309. X               blankline,strlen(blankline));
  1310. X      XDrawImageString(xwindow[i]->display,xwindow[i]->window,
  1311. X               xwindow[i]->hue[oldcolor],
  1312. X               TEXTX,textyh[colorarray[i]][newcolor],
  1313. X               oldmessage,strlen(oldmessage));
  1314. X      XDrawImageString(xwindow[i]->display,xwindow[i]->window,
  1315. X               xwindow[i]->hue[newcolor],
  1316. X               TEXTX,textyl[colorarray[i]][newcolor],
  1317. X               blankline,strlen(blankline));
  1318. X    }
  1319. X
  1320. X    /**** print new text line ****/
  1321. X    if (scrollandprint || !scroll)
  1322. X    {
  1323. X      XDrawImageString(xwindow[i]->display,xwindow[i]->window,
  1324. X               xwindow[i]->hue[newcolor],
  1325. X               TEXTX,textyl[colorarray[i]][newcolor],
  1326. X               blankline,strlen(blankline));
  1327. X      XDrawImageString(xwindow[i]->display,xwindow[i]->window,
  1328. X               xwindow[i]->hue[newcolor],
  1329. X               TEXTX,textyl[colorarray[i]][newcolor],
  1330. X               messagestr,strlen(messagestr));
  1331. X    }
  1332. X#else
  1333. X    /**** print new text line ****/
  1334. X    if (scrollandprint || !scroll)
  1335. X    {
  1336. X      XDrawImageString(xwindow[i]->display,xwindow[i]->window,
  1337. X               xwindow[i]->hue[newcolor],
  1338. X               TEXTX,textyh[colorarray[i]][newcolor],
  1339. X               blankline,strlen(blankline));
  1340. X      XDrawImageString(xwindow[i]->display,xwindow[i]->window,
  1341. X               xwindow[i]->hue[newcolor],
  1342. X               TEXTX,textyh[colorarray[i]][newcolor],
  1343. X               personal_messagestr[newcolor],strlen(personal_messagestr[newcolor]));
  1344. X    }
  1345. X#endif
  1346. X  }
  1347. X
  1348. X#if !MULTITEXT
  1349. X  if (scrollandprint || !scroll)
  1350. X    oldcolor=newcolor;
  1351. X#endif
  1352. X
  1353. X  if (scroll)
  1354. X    strcpy(messagestr,"");
  1355. X}
  1356. END_OF_FILE
  1357. if test 43247 -ne `wc -c <'draw.c'`; then
  1358.     echo shar: \"'draw.c'\" unpacked with wrong size!
  1359. fi
  1360. # end of 'draw.c'
  1361. fi
  1362. if test -f 'extern.h' -a "${1}" != "-c" ; then 
  1363.   echo shar: Will not clobber existing file \"'extern.h'\"
  1364. else
  1365. echo shar: Extracting \"'extern.h'\" \(7347 characters\)
  1366. sed "s/^X//" >'extern.h' <<'END_OF_FILE'
  1367. X/**** game static parameters ****/
  1368. X
  1369. X#define BOARDSIZE     15
  1370. X#define SQUARESIZE     45
  1371. X#define MAXBOARDSIZE     50
  1372. X#define MAXSQUARESIZE     75
  1373. X#define TEXTSIZE     16
  1374. X#define CSIZE         5
  1375. X#define DSIZE         7
  1376. X#define TEXTX         0
  1377. X#define NGREYTONES     3
  1378. X#define NHILLTONES     5
  1379. X#define NFORESTTONES     5
  1380. X#define NSEATONES     2
  1381. X#define SEAVALUE    0.87840
  1382. X#define MAXPLAYERS     11
  1383. X#define MAXSIDES       11
  1384. X#define MAXHUES       11
  1385. X
  1386. X#define NOPTS        49
  1387. X#define POPTS        26
  1388. X#define PVOPTS        6
  1389. X
  1390. X#define SET        0
  1391. X#define FORCE        1
  1392. X
  1393. X#define ACTIVE        1
  1394. X#define PASSIVE        2
  1395. X#define TEMP        3
  1396. X
  1397. X/**** game dynamic parameters ****/
  1398. X#define MAXVAL         20
  1399. X#define FIREPOWER    5.0
  1400. X#define SLOWFACTOR      3.0
  1401. X#define SHELL        1
  1402. X#define SHELL_COST    1
  1403. X#define PARA        1
  1404. X#define PARA_COST    3
  1405. X#define VIEWRANGE      2
  1406. X#define BASERANGE    2
  1407. X#define MARCH        3
  1408. X#define ERODETHRESH    0.04
  1409. X
  1410. X#define SQ3D2        0.8660254
  1411. X
  1412. X/**** x window default parameters ****/
  1413. X#define FONT          "-adobe-courier-bold-r-normal--*-100-*-*-*-*-iso8859-1"
  1414. X#define BORDER         1
  1415. X#define XPOS        0
  1416. X#define YPOS        0
  1417. X
  1418. X/**** necessary constants ****/
  1419. X#define MAXCOLORS      MAXSIDES+NHILLTONES+3
  1420. X#define ALL        MAXHUES+2
  1421. X#define TRUE           1
  1422. X#define FALSE           0
  1423. X#define OK        -1
  1424. X#define GLOBAL        MAXSIDES+2
  1425. X#define NOT_TAKEN    -1
  1426. X
  1427. X/**** COMPILE TIME OPTIONS ****/
  1428. X
  1429. X#define UNIX        TRUE
  1430. X#define INVERT        TRUE
  1431. X#define PAUSE        TRUE
  1432. X#define VARMOUSE    FALSE
  1433. X#define NODRAND48    FALSE
  1434. X#define SHOWFLOW    TRUE
  1435. X#define MULTITEXT    TRUE
  1436. X#define NEWCOLORMAP    FALSE
  1437. X#define MULTIFLUSH    FALSE
  1438. X
  1439. X/**** special flags ****/
  1440. X#define DIRS           6
  1441. X
  1442. X#define HEX_UP      0
  1443. X#define HEX_RIGHT_UP     1
  1444. X#define HEX_RIGHT_DOWN     2
  1445. X#define HEX_DOWN    3
  1446. X#define HEX_LEFT_DOWN     4
  1447. X#define HEX_LEFT_UP     5
  1448. X
  1449. X#define UP          0
  1450. X#define DOWN          2
  1451. X#define RIGHT         1
  1452. X#define LEFT          3
  1453. X
  1454. X/**
  1455. X#define UP          0
  1456. X#define DOWN          2
  1457. X#define RIGHT         1
  1458. X#define LEFT          3
  1459. X**/
  1460. X
  1461. X/**** board square access routine ****/
  1462. X#define SQUARE(board,x,y) ((board)+(y)*boardsizex+(x))
  1463. X
  1464. X
  1465. X/**** window structure ****/
  1466. Xtypedef struct{
  1467. X    Display         *display;
  1468. X    Window         window;
  1469. X    int            xsize,ysize;
  1470. X    XSizeHints         hint;
  1471. X    XWMHints         xwmh;
  1472. X    int         depth,screen;
  1473. X    GC             hue[MAXSIDES+3], flip, gc_clear, gc_or;
  1474. X    Pixmap        terrain[NHILLTONES];
  1475. X    XFontStruct     *font_struct;
  1476. X    Colormap         cmap;
  1477. X    XColor         xcolor[MAXCOLORS];
  1478. X    char        drawletter[MAXSIDES+1];
  1479. X    char        letter[MAXSIDES+1][2];
  1480. X    unsigned long    charwidth, charheight;
  1481. X} xwindow_type;
  1482. X
  1483. X/**** game square structure ****/
  1484. Xtypedef struct SquareType {
  1485. X    char         color;
  1486. X    char         move,dir[DIRS];
  1487. X    char        anymarch, marchcolor, marchcount;
  1488. X    char        march[MAXSIDES],marchdir[MAXSIDES][DIRS],marchtype[MAXSIDES];
  1489. X    short         value[MAXHUES+3];
  1490. X    short        lowbound;
  1491. X    char         growth;
  1492. X    char         oldgrowth;
  1493. X    char         oldcolor;
  1494. X    char        age;
  1495. X    char         x, y;
  1496. X    int            xpos, ypos;
  1497. X    struct SquareType    *connect[DIRS];
  1498. X    char        seen[MAXSIDES];
  1499. X    int            angle;
  1500. X} square_type;
  1501. X
  1502. X/**** square colors ****/
  1503. X#define NONE          0
  1504. X#define BLACK         1
  1505. X#define GRAY3         2
  1506. X#define GRAY2         3
  1507. X#define GRAY1         4
  1508. X#define WHITE         5
  1509. X#define RED        6
  1510. X#define CYAN        7
  1511. X#define MAGENTA        8
  1512. X#define GREEN        9
  1513. X#define BLUE        10
  1514. X#define YELLOW        11
  1515. X#define FIGHT          MAXHUES+1
  1516. X
  1517. X/**** wraparound routine ****/
  1518. X#define MODX(x)  (x+boardsizex)%boardsizex
  1519. X#define MODY(y)  (y+boardsizey)%boardsizey
  1520. X
  1521. X/**** ascii codes ****/
  1522. X#define RETURN 13
  1523. X#define BACKSPACE 8
  1524. X#define DELETE 127
  1525. X#define CTRLC 03
  1526. X#define CTRLQ 17
  1527. X#define CTRLG 07
  1528. X#define CTRLW 23
  1529. X#define SPACE 32
  1530. X#define CTRLF 6
  1531. X#define CTRLD 4
  1532. X#define CTRLS 19
  1533. X#define CTRLB 2
  1534. X#define CTRLP 16
  1535. X
  1536. X/**** global variables ****/
  1537. Xextern xwindow_type *xwindow[MAXPLAYERS];
  1538. X
  1539. Xextern int colorarray[MAXPLAYERS],
  1540. X           rcolorarray[MAXHUES],
  1541. X           sidemap[MAXPLAYERS];
  1542. Xextern char lettermap[MAXSIDES][2];
  1543. X
  1544. Xextern int winopen[MAXPLAYERS],
  1545. X           winwatch[MAXPLAYERS];
  1546. X
  1547. Xextern FILE *fpout, *fopen();
  1548. Xextern char filename[50];
  1549. X
  1550. X/**** default mappings from color to b/w ****/
  1551. Xextern int color2bw[MAXHUES+1];
  1552. X
  1553. Xextern double     towns,
  1554. X        sea,
  1555. X        gamespeed,
  1556. X         farms;
  1557. X
  1558. Xextern double    slowfactor[MAXSIDES],
  1559. X        artillery[MAXSIDES],
  1560. X        paratroops[MAXSIDES],
  1561. X        firepower[MAXSIDES],
  1562. X        militia[MAXSIDES],
  1563. X        hillfactor[MAXSIDES],
  1564. X        forest[MAXSIDES],
  1565. X        areavalue[MAXVAL+5],
  1566. X        decayrate[MAXSIDES],
  1567. X        eroderate[MAXSIDES],
  1568. X                shuntval[MAXSIDES];
  1569. X
  1570. Xextern int    delay,
  1571. X        boardsizex,
  1572. X        boardsizey,
  1573. X        paused,
  1574. X        seed;
  1575. X
  1576. Xextern int     nplayers,
  1577. X        nsides,    
  1578. X        none,
  1579. X        dark,
  1580. X        light,    
  1581. X        maxviewrange,
  1582. X        fillcost,
  1583. X        digcost,
  1584. X        fillnumber,
  1585. X        directions,
  1586. X                oldx[MAXPLAYERS],
  1587. X                oldy[MAXPLAYERS],
  1588. X                dir[MAXPLAYERS][DIRS],
  1589. X                dirtype[MAXPLAYERS];
  1590. X
  1591. Xextern int    armies[MAXSIDES],
  1592. X        bases[MAXSIDES],
  1593. X        rbases[MAXSIDES],
  1594. X        buildrate[MAXSIDES],
  1595. X        scuttlerate[MAXSIDES],
  1596. X        marchrate[MAXSIDES],
  1597. X        viewrange[MAXSIDES],
  1598. X        squaresize[MAXSIDES],
  1599. X               textyh[MAXSIDES][MAXSIDES],
  1600. X                textyl[MAXSIDES][MAXSIDES];
  1601. X
  1602. Xextern int     enable_anywrap,
  1603. X                enable_horizon,
  1604. X                enable_march,
  1605. X                enable_bound,
  1606. X            enable_hills,
  1607. X            enable_forest,
  1608. X            enable_sea,
  1609. X            enable_hex,
  1610. X            enable_border,
  1611. X            enable_terrain,
  1612. X        enable_decay,
  1613. X        enable_anylocalmap,
  1614. X                enable_storage,
  1615. X                enable_replay,
  1616. X                enable_area,
  1617. X                enable_edit,
  1618. X                enable_load,
  1619. X        enable_farms,
  1620. X        enable_towns,
  1621. X        enable_rbases,
  1622. X        enable_bases,
  1623. X        enable_militia,
  1624. X        enable_armies;
  1625. X
  1626. Xextern int     enable_fill[MAXSIDES],
  1627. X            enable_dig[MAXSIDES],
  1628. X            enable_scuttle[MAXSIDES],
  1629. X            enable_build[MAXSIDES],
  1630. X            enable_artillery[MAXSIDES],
  1631. X            enable_paratroops[MAXSIDES],
  1632. X                enable_personalmarch[MAXSIDES],
  1633. X                enable_grid[MAXSIDES],
  1634. X                enable_manpos[MAXSIDES],
  1635. X                enable_wrap[MAXSIDES],
  1636. X                enable_personalhorizon[MAXSIDES],
  1637. X                enable_personalbound[MAXSIDES],
  1638. X                enable_erode[MAXSIDES],
  1639. X                enable_repeat[MAXSIDES],
  1640. X                enable_map[MAXSIDES],
  1641. X                enable_basemap[MAXSIDES],
  1642. X                enable_localmap[MAXSIDES],
  1643. X            enable_hidden[MAXSIDES],
  1644. X            enable_attack[MAXSIDES],
  1645. X            enable_nospigot[MAXSIDES],
  1646. X                enable_disrupt[MAXSIDES],
  1647. X        enable_reserve[MAXSIDES],
  1648. X        enable_digin[MAXSIDES];
  1649. X        
  1650. Xextern char outdated[MAXBOARDSIZE][MAXBOARDSIZE],
  1651. X            oldvalue[MAXBOARDSIZE][MAXBOARDSIZE];
  1652. X
  1653. Xdouble drand48();
  1654. Xvoid srand48();
  1655. X
  1656. Xextern char graytitle[MAXSIDES+1][40];
  1657. Xextern char huetitle[MAXSIDES+1][40];
  1658. Xextern char grayname[MAXHUES+1][10];
  1659. Xextern char huename[MAXHUES+1][10];
  1660. Xextern char personal_messagestr[MAXSIDES][512],
  1661. X            messagestr[512],
  1662. X            storagename[100],
  1663. X            replayname[100],
  1664. X            mapname[100],
  1665. X            blankline[150];
  1666. X
  1667. Xextern int palette[MAXSIDES+1][3];
  1668. Xextern double hillslope[3];
  1669. Xextern double hillintersect[3];
  1670. X
  1671. Xextern int hillpalette[3],
  1672. X           forestpalette[3],
  1673. X           seapalette[3];
  1674. X/**
  1675. X           seapalette[3] =    {  0,   0, 150};
  1676. X**/
  1677. X
  1678. Xextern char *usage;
  1679. X
  1680. Xextern char options[NOPTS][10];
  1681. X
  1682. Xextern int hex_side,
  1683. X           hex_halfside,
  1684. X           hex_quarterside,
  1685. X           hex_3quarterside,
  1686. X           hex_vert,
  1687. X           hex_halfvert,
  1688. X           hex_chart[2*MAXSQUARESIZE][2*MAXSQUARESIZE][2],
  1689. X           hex_horizon_even[200][2], hex_horizon_odd[200][2],
  1690. X           hex_horizon_number;
  1691. Xextern double hex_slope;
  1692. Xextern XPoint hex_points[7]; 
  1693. END_OF_FILE
  1694. if test 7347 -ne `wc -c <'extern.h'`; then
  1695.     echo shar: \"'extern.h'\" unpacked with wrong size!
  1696. fi
  1697. # end of 'extern.h'
  1698. fi
  1699. echo shar: End of archive 4 \(of 7\).
  1700. cp /dev/null ark4isdone
  1701. MISSING=""
  1702. for I in 1 2 3 4 5 6 7 ; do
  1703.     if test ! -f ark${I}isdone ; then
  1704.     MISSING="${MISSING} ${I}"
  1705.     fi
  1706. done
  1707. if test "${MISSING}" = "" ; then
  1708.     echo You have unpacked all 7 archives.
  1709.     rm -f ark[1-9]isdone
  1710. else
  1711.     echo You still need to unpack the following archives:
  1712.     echo "        " ${MISSING}
  1713. fi
  1714. ##  End of shell archive.
  1715. exit 0
  1716.