From decwrl!sun!pitstop!male!sun-barr!rutgers!aramis.rutgers.edu!mcgrew Sun May 14 11:40:12 PDT 1989 Article 1 of comp.sources.sun: Path: decwrl!sun!pitstop!male!sun-barr!rutgers!aramis.rutgers.edu!mcgrew From: mcgrew@aramis.rutgers.edu (Charles Mcgrew) Newsgroups: comp.sources.sun Subject: v01i002: Sunview/X Mazewar, Part02/06 Message-ID: Date: 5 May 89 17:32:15 GMT Organization: Rutgers Univ., New Brunswick, N.J. Lines: 1341 Approved: mcgrew@aramis.rutgers.edu Submitted-by: kent@wsl.dec.com Posting-number: Volume 1, Issue 2 Archive-name: mazeware/part02 #!/bin/sh sed 's/^X//' >./display.c << 'xxFUNNYxx' X/* $Header: display.c,v 1.7 88/08/25 09:57:54 kent Exp $ */ X X/* X * display.c - Display management routines for MazeWar X * X * Author: Christopher A. Kent X * Western Research Laboratory X * Digital Equipment Corporation X * Date: Wed Oct 1 1986 X */ X X/*********************************************************** XCopyright 1986 by Digital Equipment Corporation, Maynard, Massachusetts, X X All Rights Reserved X XPermission to use, copy, modify, and distribute this software and its Xdocumentation for any purpose and without fee is hereby granted, Xprovided that the above copyright notice appear in all copies and that Xboth that copyright notice and this permission notice appear in Xsupporting documentation, and that the names of Digital not be Xused in advertising or publicity pertaining to disstribution of the Xsoftware without specific, written prior permission. X XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS XSOFTWARE. X X******************************************************************/ X X/* X * $Log: display.c,v $ X * Revision 1.7 88/08/25 09:57:54 kent X * More bitmap portability hacks. X * X * Revision 1.6 87/03/31 14:41:43 kent X * Portability considerations, especially byteswapping to/from the net. X * X * Revision 1.5 86/12/04 17:43:39 kent X * A little efficiency in DisplayOthersPosition(). X * X * Revision 1.3 86/12/03 13:29:52 kent X * Lint pass. X * X * Revision 1.2 86/12/01 23:45:36 kent X * Housecleaning and documentation pass. X * X * X * Revision 1.1 86/11/26 16:56:12 kent X * Initial revision X * X */ X X#ifndef lint Xstatic char rcs_ident[] = "$Header: display.c,v 1.7 88/08/25 09:57:54 kent Exp $"; X#endif X X#include X#include X#include X X#include X X#include X X#include "mazewar.h" X X/* X * Manage the display. This routine handles the three areas of the X * screen: the perspective view, the maze overview, and the scores. X * X * The coordinate system of the display is a x-reflected 1st quadrant: X * (0,0) upper left, x increases to the right, y increases down. Just X * like most CRT coordinate systems. North is to the right, for no X * particular reason. Cells in the maze are 16x16. X */ X Xtypedef struct { X Boolean playing; X int x, y; X Direction dir; X} RatState; X Xstatic RatState clearArray[MAXRATS]; X Xstatic XBitCell normalArrows[NDIRECTION] = { X { 0, 0200, 0300, 0340, /* right */ X 0360, 0370, 0177774,01777776, X 0177777,0177776,0177774,0370, X 0360, 0340, 0300, 0200 }, X { 0400, 01400, 03400, 07400, /* left */ X 017400, 037777, 077777, 0177777, X 077777, 037777, 017400, 07400, X 03400, 01400, 0400, 0 }, X { 01740, 01740, 01740, 01740, /* down */ X 01740, 01740, 01740, 01740, X 077777, 037776, 017774, 07770, X 03760, 01740, 0700, 0200 }, X { 0200, 0700, 01740, 03760, /* up */ X 07770, 017774, 037776, 077777, X 01740, 01740, 01740, 01740, X 01740, 01740, 01740, 01740 } X}; X Xstatic XBitCell invincibleArrows[NDIRECTION] = { X { 0, 0600, 0300, 0340, /* right */ X 0160, 0210, 0177464,0177102, X 0177043,0177022,0177544,0210, X 0160, 0340, 0300, 0600 }, X { 0700, 01400, 03400, 07000, /* left */ X 010400, 023377, 044177, 0142177, X 041177, 026377, 010400, 07000, X 03400, 01400, 0700, 0 }, X { 01740, 01740, 01740, 01740, /* down */ X 01740, 01740, 01740, 041041, X 072327, 034416, 012414, 04110, X 02620, 01040, 0700, 0200 }, X { 0200, 0700, 01040, 02320, /* up */ X 04410, 014214, 034116, 072627, X 041041, 01740, 01740, 01740, X 01740, 01740, 01740, 01740 } X}; X Xstatic XBitCell otherArrows[NDIRECTION] = { X { 0, 0200, 0300, 0340, /* right */ X 0177660,0100030,0100014,0100006, X 0100003,0100006,0100014,0100030, X 0177660,0340, 0300, 0200 }, X { 0, 0400, 01400, 03400, /* left */ X 06777, 014001, 030001, 060001, X 0140001,060001, 030001, 014001, X 06777, 03400, 01400, 0400 }, X { 07770, 04010, 04010, 04010, /* down */ X 04010, 04010, 04010, 04010, X 074017, 034016, 014014, 06030, X 03060, 01540, 0700, 0200 }, X { 0200, 0700, 01540, 03060, /* up */ X 06030, 014014, 030006, 074017, /* 074014 in original */ X 04010, 04010, 04010, 04010, X 04010, 04010, 04010, 07770 } X}; X Xstatic XBitCell numbers[MAXRATS] = { X { 0, 0, 0, 0, /* 0 */ X 0, 0, 0300, 0440, X 0440, 0440, 0300, 0, X 0, 0, 0, 0 }, X { 0, 0, 0, 0, /* 1 */ X 0, 0, 0600, 0200, X 0200, 0200, 0700, 0, X 0, 0, 0, 0 }, X { 0, 0, 0, 0, /* 2 */ X 0, 0, 0600, 01100, X 0200, 0400, 01700, 0, X 0, 0, 0, 0 }, X { 0, 0, 0, 0, /* 3 */ X 0, 0, 01600, 0100, X 0600, 0100, 01600, 0, X 0, 0, 0, 0 }, X { 0, 0, 0, 0, /* 4 */ X 0, 0, 01100, 01100, X 01740, 0100, 0100, 0, X 0, 0, 0, 0 }, X { 0, 0, 0, 0, /* 5 */ X 0, 0, 01700, 01000, X 01700, 0100, 01700, 0, X 0, 0, 0, 0 }, X { 0, 0, 0, 0, /* 6 */ X 0, 0, 01700, 01000, X 01700, 01100, 01700, 0, X 0, 0, 0, 0 }, X { 0, 0, 0, 0, /* 7 */ X 0, 0, 01700, 0100, X 0200, 0400, 01000, 0, X 0, 0, 0, 0 } X}; X Xstatic XYpair viewTable[] = { X {{ 67, 333 }, { 67, 67 }}, {{ 67, 333 }, { 333, 333 }}, X {{ 67, 67 }, { 333, 67 }}, {{ 0, 400 }, { 67, 333 }}, X {{ 0, 0 }, { 67, 67 }}, {{ 0, 333 }, { 67, 333 }}, X {{ 0, 67 }, { 67, 67 }}, {{ 333, 333 }, { 333, 67 }}, X {{ 333, 333 }, { 400, 333 }}, {{ 333, 67 }, { 400, 67 }}, X {{ 333, 333 }, { 400, 400 }}, {{ 333, 67 }, { 400, 0 }}, X {{ 120, 280 }, { 120, 120 }}, {{ 120, 280 }, { 280, 280 }}, X {{ 120, 120 }, { 280, 120 }}, {{ 67, 333 }, { 120, 280 }}, X {{ 67, 67 }, { 120, 120 }}, {{ 67, 280 }, { 120, 280 }}, X {{ 67, 120 }, { 120, 120 }}, {{ 280, 280 }, { 280, 120 }}, X {{ 280, 280 }, { 333, 280 }}, {{ 280, 120 }, { 333, 120 }}, X {{ 280, 280 }, { 333, 333 }}, {{ 280, 120 }, { 333, 67 }}, X {{ 143, 257 }, { 143, 143 }}, {{ 143, 257 }, { 257, 257 }}, X {{ 143, 143 }, { 257, 143 }}, {{ 120, 280 }, { 143, 257 }}, X {{ 120, 120 }, { 143, 143 }}, {{ 120, 257 }, { 143, 257 }}, X {{ 120, 143 }, { 143, 143 }}, {{ 257, 257 }, { 257, 143 }}, X {{ 257, 257 }, { 280, 257 }}, {{ 257, 143 }, { 280, 143 }}, X {{ 257, 257 }, { 280, 280 }}, {{ 257, 143 }, { 280, 120 }}, X {{ 156, 244 }, { 156, 156 }}, {{ 156, 244 }, { 244, 244 }}, X {{ 156, 156 }, { 244, 156 }}, {{ 143, 257 }, { 156, 244 }}, X {{ 143, 143 }, { 156, 156 }}, {{ 143, 244 }, { 156, 244 }}, X {{ 143, 156 }, { 156, 156 }}, {{ 244, 244 }, { 244, 156 }}, X {{ 244, 244 }, { 257, 244 }}, {{ 244, 156 }, { 257, 156 }}, X {{ 244, 244 }, { 257, 257 }}, {{ 244, 156 }, { 257, 143 }}, X {{ 164, 236 }, { 164, 164 }}, {{ 164, 236 }, { 236, 236 }}, X {{ 164, 164 }, { 236, 164 }}, {{ 156, 244 }, { 164, 236 }}, X {{ 156, 156 }, { 164, 164 }}, {{ 156, 236 }, { 164, 236 }}, X {{ 156, 164 }, { 164, 164 }}, {{ 236, 236 }, { 236, 164 }}, X {{ 236, 236 }, { 244, 236 }}, {{ 236, 164 }, { 244, 164 }}, X {{ 236, 236 }, { 244, 244 }}, {{ 236, 164 }, { 244, 156 }}, X {{ 170, 230 }, { 170, 170 }}, {{ 170, 230 }, { 230, 230 }}, X {{ 170, 170 }, { 230, 170 }}, {{ 164, 236 }, { 170, 230 }}, X {{ 164, 164 }, { 170, 170 }}, {{ 164, 230 }, { 170, 230 }}, X {{ 164, 170 }, { 170, 170 }}, {{ 230, 230 }, { 230, 170 }}, X {{ 230, 230 }, { 236, 230 }}, {{ 230, 170 }, { 236, 170 }}, X {{ 230, 230 }, { 236, 236 }}, {{ 230, 170 }, { 236, 164 }}, X {{ 174, 226 }, { 174, 174 }}, {{ 174, 226 }, { 226, 226 }}, X {{ 174, 174 }, { 226, 174 }}, {{ 170, 230 }, { 174, 226 }}, X {{ 170, 170 }, { 174, 174 }}, {{ 170, 226 }, { 174, 226 }}, X {{ 170, 174 }, { 174, 174 }}, {{ 226, 226 }, { 226, 174 }}, X {{ 226, 226 }, { 230, 226 }}, {{ 226, 174 }, { 230, 174 }}, X {{ 226, 226 }, { 230, 230 }}, {{ 226, 174 }, { 230, 170 }}, X {{ 177, 223 }, { 177, 177 }}, {{ 177, 223 }, { 223, 223 }}, X {{ 177, 177 }, { 223, 177 }}, {{ 174, 226 }, { 177, 223 }}, X {{ 174, 174 }, { 177, 177 }}, {{ 174, 223 }, { 177, 223 }}, X {{ 174, 177 }, { 177, 177 }}, {{ 223, 223 }, { 223, 177 }}, X {{ 223, 223 }, { 226, 223 }}, {{ 223, 177 }, { 226, 177 }}, X {{ 223, 223 }, { 226, 226 }}, {{ 223, 177 }, { 226, 174 }}, X {{ 179, 221 }, { 179, 179 }}, {{ 179, 221 }, { 221, 221 }}, X {{ 179, 179 }, { 221, 179 }}, {{ 177, 223 }, { 179, 221 }}, X {{ 177, 177 }, { 179, 179 }}, {{ 177, 221 }, { 179, 221 }}, X {{ 177, 179 }, { 179, 179 }}, {{ 221, 221 }, { 221, 179 }}, X {{ 221, 221 }, { 223, 221 }}, {{ 221, 179 }, { 223, 179 }}, X {{ 221, 221 }, { 223, 223 }}, {{ 221, 179 }, { 223, 177 }}, X {{ 181, 219 }, { 181, 181 }}, {{ 181, 219 }, { 219, 219 }}, X {{ 181, 181 }, { 219, 181 }}, {{ 179, 221 }, { 181, 219 }}, X {{ 179, 179 }, { 181, 181 }}, {{ 179, 219 }, { 181, 219 }}, X {{ 179, 181 }, { 181, 181 }}, {{ 219, 219 }, { 219, 181 }}, X {{ 219, 219 }, { 221, 219 }}, {{ 219, 181 }, { 221, 181 }}, X {{ 219, 219 }, { 221, 221 }}, {{ 219, 181 }, { 221, 179 }}, X {{ 183, 217 }, { 183, 183 }}, {{ 183, 217 }, { 217, 217 }}, X {{ 183, 183 }, { 217, 183 }}, {{ 181, 219 }, { 183, 217 }}, X {{ 181, 181 }, { 183, 183 }}, {{ 181, 217 }, { 183, 217 }}, X {{ 181, 183 }, { 183, 183 }}, {{ 217, 217 }, { 217, 183 }}, X {{ 217, 217 }, { 219, 217 }}, {{ 217, 183 }, { 219, 183 }}, X {{ 217, 217 }, { 219, 219 }}, {{ 217, 183 }, { 219, 181 }}, X {{ 184, 216 }, { 184, 184 }}, {{ 184, 216 }, { 216, 216 }}, X {{ 184, 184 }, { 216, 184 }}, {{ 183, 217 }, { 184, 216 }}, X {{ 183, 183 }, { 184, 184 }}, {{ 183, 216 }, { 184, 216 }}, X {{ 183, 184 }, { 184, 184 }}, {{ 216, 216 }, { 216, 184 }}, X {{ 216, 216 }, { 217, 216 }}, {{ 216, 184 }, { 217, 184 }}, X {{ 216, 216 }, { 217, 217 }}, {{ 216, 184 }, { 217, 183 }}, X {{ 186, 214 }, { 186, 186 }}, {{ 186, 214 }, { 214, 214 }}, X {{ 186, 186 }, { 214, 186 }}, {{ 184, 216 }, { 186, 214 }}, X {{ 184, 184 }, { 186, 186 }}, {{ 184, 214 }, { 186, 214 }}, X {{ 184, 186 }, { 186, 186 }}, {{ 214, 214 }, { 214, 186 }}, X {{ 214, 214 }, { 216, 214 }}, {{ 214, 186 }, { 216, 186 }}, X {{ 214, 214 }, { 216, 216 }}, {{ 214, 186 }, { 216, 184 }}, X {{ 187, 213 }, { 187, 187 }}, {{ 187, 213 }, { 213, 213 }}, X {{ 187, 187 }, { 213, 187 }}, {{ 186, 214 }, { 187, 213 }}, X {{ 186, 186 }, { 187, 187 }}, {{ 186, 213 }, { 187, 213 }}, X {{ 186, 187 }, { 187, 187 }}, {{ 213, 213 }, { 213, 187 }}, X {{ 213, 213 }, { 214, 213 }}, {{ 213, 187 }, { 214, 187 }}, X {{ 213, 213 }, { 214, 214 }}, {{ 213, 187 }, { 214, 186 }}, X {{ 188, 212 }, { 188, 188 }}, {{ 188, 212 }, { 212, 212 }}, X {{ 188, 188 }, { 212, 188 }}, {{ 187, 213 }, { 188, 212 }}, X {{ 187, 187 }, { 188, 188 }}, {{ 187, 212 }, { 188, 212 }}, X {{ 187, 188 }, { 188, 188 }}, {{ 212, 212 }, { 212, 188 }}, X {{ 212, 212 }, { 213, 212 }}, {{ 212, 188 }, { 213, 188 }}, X {{ 212, 212 }, { 213, 213 }}, {{ 212, 188 }, { 213, 187 }}, X {{ 188, 212 }, { 188, 188 }}, {{ 188, 212 }, { 212, 212 }}, X {{ 188, 188 }, { 212, 188 }}, {{ 188, 212 }, { 188, 212 }}, X {{ 188, 188 }, { 188, 188 }}, {{ 188, 212 }, { 188, 212 }}, X {{ 188, 188 }, { 188, 188 }}, {{ 212, 212 }, { 212, 188 }}, X {{ 212, 212 }, { 212, 212 }}, {{ 212, 188 }, { 212, 188 }}, X {{ 212, 212 }, { 212, 212 }}, {{ 212, 188 }, { 212, 188 }}, X {{ 189, 211 }, { 189, 189 }}, {{ 189, 211 }, { 211, 211 }}, X {{ 189, 189 }, { 211, 189 }}, {{ 188, 212 }, { 189, 211 }}, X {{ 188, 188 }, { 189, 189 }}, {{ 188, 211 }, { 189, 211 }}, X {{ 188, 189 }, { 189, 189 }}, {{ 211, 211 }, { 211, 189 }}, X {{ 211, 211 }, { 212, 211 }}, {{ 211, 189 }, { 212, 189 }}, X {{ 211, 211 }, { 212, 212 }}, {{ 211, 189 }, { 212, 188 }}, X {{ 190, 210 }, { 190, 190 }}, {{ 190, 210 }, { 210, 210 }}, X {{ 190, 190 }, { 210, 190 }}, {{ 189, 211 }, { 190, 210 }}, X {{ 189, 189 }, { 190, 190 }}, {{ 189, 210 }, { 190, 210 }}, X {{ 189, 190 }, { 190, 190 }}, {{ 210, 210 }, { 210, 190 }}, X {{ 210, 210 }, { 211, 210 }}, {{ 210, 190 }, { 211, 190 }}, X {{ 210, 210 }, { 211, 211 }}, {{ 210, 190 }, { 211, 189 }}, X {{ 190, 210 }, { 190, 190 }}, {{ 190, 210 }, { 210, 210 }}, X {{ 190, 190 }, { 210, 190 }}, {{ 190, 210 }, { 190, 210 }}, X {{ 190, 190 }, { 190, 190 }}, {{ 190, 210 }, { 190, 210 }}, X {{ 190, 190 }, { 190, 190 }}, {{ 210, 210 }, { 210, 190 }}, X {{ 210, 210 }, { 210, 210 }}, {{ 210, 190 }, { 210, 190 }}, X {{ 210, 210 }, { 210, 210 }}, {{ 210, 190 }, { 210, 190 }}, X {{ 191, 209 }, { 191, 191 }}, {{ 191, 209 }, { 209, 209 }}, X {{ 191, 191 }, { 209, 191 }}, {{ 190, 210 }, { 191, 209 }}, X {{ 190, 190 }, { 191, 191 }}, {{ 190, 209 }, { 191, 209 }}, X {{ 190, 191 }, { 191, 191 }}, {{ 209, 209 }, { 209, 191 }}, X {{ 209, 209 }, { 210, 209 }}, {{ 209, 191 }, { 210, 191 }}, X {{ 209, 209 }, { 210, 210 }}, {{ 209, 191 }, { 210, 190 }}, X {{ 191, 209 }, { 191, 191 }}, {{ 191, 209 }, { 209, 209 }}, X {{ 191, 191 }, { 209, 191 }}, {{ 191, 209 }, { 191, 209 }}, X {{ 191, 191 }, { 191, 191 }}, {{ 191, 209 }, { 191, 209 }}, X {{ 191, 191 }, { 191, 191 }}, {{ 209, 209 }, { 209, 191 }}, X {{ 209, 209 }, { 209, 209 }}, {{ 209, 191 }, { 209, 191 }}, X {{ 209, 209 }, { 209, 209 }}, {{ 209, 191 }, { 209, 191 }}, X {{ 192, 208 }, { 192, 192 }}, {{ 192, 208 }, { 208, 208 }}, X {{ 192, 192 }, { 208, 192 }}, {{ 191, 209 }, { 192, 208 }}, X {{ 191, 191 }, { 192, 192 }}, {{ 191, 208 }, { 192, 208 }}, X {{ 191, 192 }, { 192, 192 }}, {{ 208, 208 }, { 208, 192 }}, X {{ 208, 208 }, { 209, 208 }}, {{ 208, 192 }, { 209, 192 }}, X {{ 208, 208 }, { 209, 209 }}, {{ 208, 192 }, { 209, 191 }}, X {{ 192, 208 }, { 192, 192 }}, {{ 192, 208 }, { 208, 208 }}, X {{ 192, 192 }, { 208, 192 }}, {{ 192, 208 }, { 192, 208 }}, X {{ 192, 192 }, { 192, 192 }}, {{ 192, 208 }, { 192, 208 }}, X {{ 192, 192 }, { 192, 192 }}, {{ 208, 208 }, { 208, 192 }}, X {{ 208, 208 }, { 208, 208 }}, {{ 208, 192 }, { 208, 192 }}, X {{ 208, 208 }, { 208, 208 }}, {{ 208, 192 }, { 208, 192 }}, X {{ 192, 208 }, { 192, 192 }}, {{ 192, 208 }, { 208, 208 }}, X {{ 192, 192 }, { 208, 192 }}, {{ 192, 208 }, { 192, 208 }}, X {{ 192, 192 }, { 192, 192 }}, {{ 192, 208 }, { 192, 208 }}, X {{ 192, 192 }, { 192, 192 }}, {{ 208, 208 }, { 208, 192 }}, X {{ 208, 208 }, { 208, 208 }}, {{ 208, 192 }, { 208, 192 }}, X {{ 208, 208 }, { 208, 208 }}, {{ 208, 192 }, { 208, 192 }}, X {{ 193, 207 }, { 193, 193 }}, {{ 193, 207 }, { 207, 207 }}, X {{ 193, 193 }, { 207, 193 }}, {{ 192, 208 }, { 193, 207 }}, X {{ 192, 192 }, { 193, 193 }}, {{ 192, 207 }, { 193, 207 }}, X {{ 192, 193 }, { 193, 193 }}, {{ 207, 207 }, { 207, 193 }}, X {{ 207, 207 }, { 208, 207 }}, {{ 207, 193 }, { 208, 193 }}, X {{ 207, 207 }, { 208, 208 }}, {{ 207, 193 }, { 208, 192 }}, X {{ 193, 207 }, { 193, 193 }}, {{ 193, 207 }, { 207, 207 }}, X {{ 193, 193 }, { 207, 193 }}, {{ 193, 207 }, { 193, 207 }}, X {{ 193, 193 }, { 193, 193 }}, {{ 193, 207 }, { 193, 207 }}, X {{ 193, 193 }, { 193, 193 }}, {{ 207, 207 }, { 207, 193 }}, X {{ 207, 207 }, { 207, 207 }}, {{ 207, 193 }, { 207, 193 }}, X {{ 207, 207 }, { 207, 207 }}, {{ 207, 193 }, { 207, 193 }}, X {{ 193, 207 }, { 193, 193 }}, {{ 193, 207 }, { 207, 207 }}, X {{ 193, 193 }, { 207, 193 }}, {{ 193, 207 }, { 193, 207 }}, X {{ 193, 193 }, { 193, 193 }}, {{ 193, 207 }, { 193, 207 }}, X {{ 193, 193 }, { 193, 193 }}, {{ 207, 207 }, { 207, 193 }}, X {{ 207, 207 }, { 207, 207 }}, {{ 207, 193 }, { 207, 193 }}, X {{ 207, 207 }, { 207, 207 }}, {{ 207, 193 }, { 207, 193 }}, X {{ 193, 207 }, { 193, 193 }}, {{ 193, 207 }, { 207, 207 }}, X {{ 193, 193 }, { 207, 193 }}, {{ 193, 207 }, { 193, 207 }}, X {{ 193, 193 }, { 193, 193 }}, {{ 193, 207 }, { 193, 207 }}, X {{ 193, 193 }, { 193, 193 }}, {{ 207, 207 }, { 207, 193 }}, X {{ 207, 207 }, { 207, 207 }}, {{ 207, 193 }, { 207, 193 }}, X {{ 207, 207 }, { 207, 207 }}, {{ 207, 193 }, { 207, 193 }}, X {{ 194, 206 }, { 194, 194 }}, {{ 194, 206 }, { 206, 206 }}, X {{ 194, 194 }, { 206, 194 }}, {{ 193, 207 }, { 194, 206 }}, X {{ 193, 193 }, { 194, 194 }}, {{ 193, 206 }, { 194, 206 }}, X {{ 193, 194 }, { 194, 194 }}, {{ 206, 206 }, { 206, 194 }}, X {{ 206, 206 }, { 207, 206 }}, {{ 206, 194 }, { 207, 194 }}, X {{ 206, 206 }, { 207, 207 }}, {{ 206, 194 }, { 207, 193 }}, X {{ 194, 206 }, { 194, 194 }}, {{ 194, 206 }, { 206, 206 }}, X {{ 194, 194 }, { 206, 194 }}, {{ 194, 206 }, { 194, 206 }}, X {{ 194, 194 }, { 194, 194 }}, {{ 194, 206 }, { 194, 206 }}, X {{ 194, 194 }, { 194, 194 }}, {{ 206, 206 }, { 206, 194 }}, X {{ 206, 206 }, { 206, 206 }}, {{ 206, 194 }, { 206, 194 }}, X {{ 206, 206 }, { 206, 206 }}, {{ 206, 194 }, { 206, 194 }}, X}; X X#define ratBits_width 384 X#define ratBits_height 64 Xstatic short ratBits[] = { X 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, X 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, X 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, X X 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, X 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, X 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, X X 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, X 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, X 0x0007, 0xe000, 0x0007, 0xe000, 0x003c, 0x0000, 0x3c00, 0x0df0, X X 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x001f, 0xf800, 0x0000, X 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, X 0x003f, 0xfc00, 0x003f, 0xfc00, 0x008f, 0x0000, 0x9f00, 0x13f8, X X 0x0000, 0x001f, 0xf800, 0x0000, 0x0000, 0x01ff, 0xff80, 0x0000, X 0x0000, 0x001f, 0xf800, 0x0000, 0x0000, 0x001f, 0xf800, 0x0000, X 0x00f3, 0xff00, 0x00f3, 0xff00, 0x037f, 0xc003, 0x7fc0, 0x2ffc, X X 0x0000, 0x01ff, 0xff80, 0x0000, 0x0000, 0x0fff, 0xfff0, 0x0000, X 0x0000, 0x01ff, 0xff80, 0x0000, 0x0000, 0x01ff, 0xff80, 0x0000, X 0x01c7, 0xff80, 0x01c7, 0xff80, 0x04ff, 0xe004, 0xffe0, 0x2ffc, X X 0x0000, 0x0fff, 0xfff0, 0x0000, 0x0000, 0x3fff, 0xfffc, 0x0000, X 0x0000, 0x0fff, 0xfff0, 0x0000, 0x0000, 0x0fff, 0xfff0, 0x0000, X 0x031f, 0xffc0, 0x031f, 0xffc0, 0x0bff, 0xf00b, 0xfff0, 0x47fe, X X 0x0000, 0x3fff, 0xfffc, 0x0000, 0x0000, 0xffe3, 0xffff, 0x0000, X 0x0000, 0x3fff, 0xfffc, 0x0000, 0x0000, 0x3fff, 0xfffc, 0x0000, X 0x067f, 0xffe0, 0x067f, 0xffe0, 0x0bff, 0xf00f, 0xfff0, 0x63fe, X X 0x0000, 0xffe3, 0xffff, 0x0000, 0x0001, 0xe79f, 0xffff, 0x8000, X 0x0000, 0xffe3, 0xffff, 0x0000, 0x0000, 0xff8f, 0xffff, 0x0000, X 0x0cff, 0xfff0, 0x0cff, 0xfff0, 0x11ff, 0xf81f, 0xfff8, 0x63fe, X X 0x0001, 0xe79f, 0xffff, 0x8000, 0x0003, 0xf03f, 0xffff, 0xc000, X 0x0001, 0xe79f, 0xffff, 0x8000, 0x0001, 0xe60f, 0xffff, 0x8000, X 0x0bff, 0xfff0, 0x0bff, 0xfff0, 0x10ff, 0xf81f, 0xfff8, 0x47fe, X X 0x0003, 0xf03f, 0xffff, 0xc000, 0x0007, 0xc07f, 0xffff, 0xe000, X 0x0003, 0xf03f, 0xffff, 0xc000, 0x0003, 0xf83f, 0xffff, 0xc000, X 0x19ff, 0xfff8, 0x1fff, 0xfff8, 0x307f, 0xfc3f, 0xfffc, 0x2ffc, X X 0x0007, 0xc07f, 0xffff, 0xe000, 0x000d, 0x01ff, 0xffff, 0xf000, X 0x0007, 0xc07f, 0xffff, 0xe000, 0x0007, 0xc03f, 0xffff, 0xe000, X 0x10ff, 0xfff8, 0x1fff, 0xfff8, 0x383f, 0xfc3f, 0xfffc, 0x3ffc, X X 0x000d, 0x01ff, 0xffff, 0xf000, 0x0018, 0x0dff, 0xffff, 0xf800, X 0x000d, 0x01ff, 0xffff, 0xf000, 0x000f, 0x01ff, 0xffff, 0xf000, X 0x087f, 0xfff8, 0x1fff, 0xfff8, 0x383f, 0xfc3f, 0xfffc, 0x1ff8, X X 0x0018, 0x0dff, 0xffff, 0xf800, 0x003c, 0x3eff, 0xffff, 0xfc00, X 0x0018, 0x0dff, 0xffff, 0xf800, 0x001c, 0x0dff, 0xffff, 0xf800, X 0x183f, 0xfffc, 0x3fff, 0xfffc, 0x307f, 0xfc3f, 0xfffc, 0x1bdc, X X 0x003c, 0x3eff, 0xffff, 0xfc00, 0x0078, 0xfcff, 0xffff, 0xfe00, X 0x003c, 0x3eff, 0xffff, 0xfc00, 0x003c, 0x3eff, 0xffff, 0xfc00, X 0x1c1f, 0xfffc, 0x3fff, 0xfffc, 0x10ff, 0xf81f, 0xfff8, 0x2e3a, X X 0x0078, 0xfcff, 0xffff, 0xfe00, 0x00f1, 0x7eff, 0xffff, 0xff00, X 0x0078, 0xfcff, 0xffff, 0xfe00, 0x0078, 0xfcff, 0xffff, 0xfe00, X 0x3c0f, 0xfffc, 0x3fff, 0xfffc, 0x11ff, 0xf81f, 0xfff8, 0x17f4, X X 0x00f1, 0x7eff, 0xffff, 0xff00, 0x00e3, 0x9fff, 0xffff, 0xff00, X 0x00f1, 0x7eff, 0xffff, 0xff00, 0x00f1, 0x7eff, 0xffff, 0xff00, X 0x3c0f, 0xfffc, 0x3fff, 0xfffc, 0x0fff, 0xf00f, 0xfff0, 0x0000, X X 0x00e3, 0x9fff, 0xffff, 0xff00, 0x01ef, 0xcfff, 0xffff, 0xff80, X 0x00e3, 0x9fff, 0xffff, 0xff00, 0x00e3, 0x9fff, 0xffff, 0xff00, X 0x3c1f, 0xfffc, 0x3fff, 0xfffc, 0x0fff, 0xf00f, 0xfff0, 0x03c0, X X 0x01ef, 0xcfff, 0xffff, 0xff80, 0x01df, 0xffff, 0xffff, 0xfc80, X 0x01ef, 0xcfff, 0xffff, 0xff80, 0x01e7, 0xcfff, 0xffff, 0xff80, X 0x383f, 0xfffc, 0x3fff, 0xfffc, 0x07ff, 0xe007, 0xffe0, 0x0df0, X X 0x013f, 0xffff, 0xffff, 0xff80, 0x03ff, 0xffff, 0xffff, 0xc0c0, X 0x01df, 0xffff, 0xffff, 0xff80, 0x01df, 0xffff, 0xffff, 0xff80, X 0x187f, 0xfff8, 0x1fff, 0xfff8, 0x03ff, 0xc003, 0xffc0, 0x13f8, X X 0x0303, 0xffff, 0xffff, 0xffc0, 0x03ff, 0xffff, 0xfffe, 0x0040, X 0x03ff, 0xffff, 0xffff, 0xffc0, 0x03ff, 0xffe0, 0x07ff, 0xffc0, X 0x10ff, 0xfff8, 0x1fff, 0xfff8, 0x0b7e, 0x680b, 0x7e68, 0x2ffc, X X 0x0200, 0x7fff, 0xffff, 0xffc0, 0x03ff, 0xffff, 0xfff8, 0x0040, X 0x03ff, 0xffff, 0xffff, 0xffc0, 0x03ff, 0xff00, 0x00ff, 0xffc0, X 0x19ff, 0xfff8, 0x1fff, 0xfff8, 0x15f9, 0xd415, 0xf9d4, 0x3ff4, X X 0x0200, 0x1fff, 0xffff, 0xffc0, 0x07ff, 0xffff, 0xffe0, 0x0060, X 0x03ff, 0xffff, 0xffff, 0xffc0, 0x03ff, 0xf800, 0x001f, 0xffc0, X 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0x0aae, 0xa80a, 0xaea8, 0x7fe2, X X 0x0600, 0x07ff, 0xffff, 0xffe0, 0x07ff, 0xffff, 0xffc0, 0x00e0, X 0x07ff, 0xffff, 0xffff, 0xffe0, 0x07ff, 0xc000, 0x0003, 0xffe0, X 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0x0155, 0x4001, 0x5540, 0x7fc6, X X 0x0700, 0xcfff, 0xffff, 0xffe0, 0x07ff, 0xffff, 0xff0a, 0x00e0, X 0x07ff, 0xffff, 0xffff, 0xffe0, 0x07ff, 0x0007, 0xe000, 0xffe0, X 0x07ff, 0xff60, 0x07ff, 0xff60, 0x0000, 0x0000, 0x0000, 0x7fc6, X X 0x0700, 0x30ff, 0xffff, 0xffe0, 0x07ff, 0xffff, 0xfe0c, 0x00e0, X 0x07ff, 0xffff, 0xffff, 0xffe0, 0x07fc, 0x000d, 0xb800, 0x3fe0, X 0x03ff, 0xfcc0, 0x03ff, 0xfcc0, 0x0000, 0x0000, 0x0000, 0x7fe2, X X 0x0700, 0x407f, 0xffff, 0xffe0, 0x0fff, 0xffff, 0xfc38, 0x01f0, X 0x07ff, 0xffff, 0xffff, 0xffe0, 0x07f0, 0x0005, 0xbc00, 0x0fe0, X 0x07ff, 0xff68, 0x07ff, 0xff68, 0x003c, 0x0000, 0x3c00, 0x3ff4, X X 0x0f81, 0x003f, 0xffff, 0xfff0, 0x0fff, 0xffff, 0xf875, 0x81b0, X 0x0fff, 0xffff, 0xffff, 0xfff0, 0x0fc0, 0x0003, 0x7602, 0x03f0, X 0x15ff, 0xf9d4, 0x15ff, 0xf9d4, 0x009f, 0x0000, 0x9f00, 0x3ffc, X X 0x0d80, 0x021f, 0xffff, 0xfff0, 0x0fff, 0xffff, 0xf382, 0x41f0, X 0x0fff, 0xffff, 0xffff, 0xfff0, 0x0fc1, 0x0043, 0xce00, 0x8df0, X 0x2adf, 0xe3aa, 0x2adf, 0xe3aa, 0x037f, 0xc003, 0x7fc0, 0x1ff8, X X 0x0f80, 0x01cf, 0xffff, 0xfff0, 0x0fff, 0xffff, 0xee00, 0x0170, X 0x0fff, 0xffff, 0xffff, 0xfff0, 0x0f2a, 0x00c3, 0xef00, 0x70f0, X 0x157c, 0x3f54, 0x157c, 0x3f54, 0x04ff, 0xe004, 0xffe0, 0x1bdc, X X 0x0e80, 0x6677, 0xffff, 0xfff0, 0x0fff, 0xffff, 0xfc00, 0x0170, X 0x0fff, 0xffff, 0xffff, 0xfff0, 0x0e6d, 0x0091, 0xf900, 0x8070, X 0x0aaf, 0xfaa8, 0x0aaf, 0xfaa8, 0x0bff, 0xf00b, 0xfff0, 0x2e3a, X X 0x0e80, 0x183f, 0xffff, 0xfff0, 0x0fff, 0xffff, 0xc000, 0x0170, X 0x0fff, 0xffff, 0xffff, 0xfff0, 0x0c10, 0x00f8, 0xff00, 0x03b0, X 0x0155, 0x5540, 0x0155, 0x5540, 0x0fff, 0xd00f, 0x81f0, 0x17f4, X X 0x0e80, 0x0003, 0xffff, 0xfff0, 0x0fff, 0xffff, 0xe000, 0x01f0, X 0x0fff, 0xffff, 0xffff, 0xfff0, 0x0c0c, 0x00ff, 0xf700, 0x25f0, X 0x0000, 0x0000, 0x0000, 0x0000, 0x1fff, 0x881e, 0x0078, 0x0000, X X 0x0f80, 0x0007, 0xffff, 0xfff0, 0x0fff, 0xffff, 0xf000, 0x01f0, X 0x0fff, 0xffff, 0xffff, 0xfff0, 0x0e02, 0x0097, 0xf900, 0x1c70, X 0x0000, 0x0000, 0x0000, 0x0000, 0x1fff, 0x0818, 0x1818, 0x03c0, X X 0x0f80, 0x000f, 0xffff, 0xfff0, 0x0fff, 0xffff, 0xf800, 0x01f0, X 0x0fff, 0xffff, 0xffff, 0xfff0, 0x0f01, 0x00fb, 0xe700, 0x00f0, X 0x0007, 0xe000, 0x0007, 0xe000, 0x3ffe, 0x0c30, 0x1c0c, 0x0df0, X X 0x0f80, 0x601f, 0xffff, 0xfff0, 0x0fff, 0xffff, 0xfc00, 0x01b0, X 0x0fff, 0xffff, 0xffff, 0xfff0, 0x0f80, 0x0075, 0xde00, 0x51f0, X 0x003f, 0xfc00, 0x003f, 0xfc00, 0x3ffc, 0x1c20, 0x4e04, 0x13f8, X X 0x0d80, 0x91ff, 0xffff, 0xfff0, 0x07ff, 0xffff, 0xfe00, 0x01e0, X 0x0fff, 0xffff, 0xffff, 0xfff0, 0x0fc0, 0x006f, 0x1604, 0x8bf0, X 0x00f3, 0xff00, 0x00f3, 0xff00, 0x3ffc, 0x1c20, 0x6e04, 0x2ffc, X X 0x0780, 0x0f7f, 0xffff, 0xffe0, 0x07ff, 0xffff, 0xff00, 0x00e0, X 0x07ff, 0xffff, 0xffff, 0xffe0, 0x07f0, 0x0039, 0x7c03, 0x07e0, X 0x01c7, 0xff80, 0x01c7, 0xff80, 0x3ffe, 0x0c30, 0x7e0c, 0x3ffc, X X 0x0700, 0x00ff, 0xffff, 0xffe0, 0x07ff, 0xffff, 0xffc0, 0x00e0, X 0x07ff, 0xffff, 0xffff, 0xffe0, 0x07fc, 0x001d, 0xb810, 0x1fe0, X 0x031f, 0xffc0, 0x031f, 0xffc0, 0x1fff, 0x0818, 0x3c18, 0x7ffe, X X 0x0710, 0x03ff, 0xffff, 0xffe0, 0x07ff, 0xffff, 0xffe0, 0x00e0, X 0x07ff, 0xffff, 0xffff, 0xffe0, 0x07ff, 0x0007, 0xe208, 0x7fe0, X 0x067f, 0xffe0, 0x067f, 0xffe0, 0x1fff, 0x881e, 0x1878, 0x7ffe, X X 0x0708, 0x07ff, 0xffff, 0xffe0, 0x03ff, 0xffff, 0xfff8, 0x00c0, X 0x07ff, 0xffff, 0xffff, 0xffe0, 0x07ff, 0xc000, 0x0191, 0xffe0, X 0x0cff, 0xfff0, 0x0cff, 0xfff0, 0x0fff, 0xf00f, 0x81f0, 0x7ffe, X X 0x0228, 0x1fff, 0xffff, 0xffc0, 0x03ff, 0xffff, 0xfffe, 0x01c0, X 0x03ff, 0xffff, 0xffff, 0xffc0, 0x03ff, 0xf800, 0x0077, 0xffc0, X 0x0bff, 0xfff0, 0x0bff, 0xfff0, 0x0fff, 0xf00f, 0xfff0, 0x7ffe, X X 0x0214, 0x7fff, 0xffff, 0xffc0, 0x03ff, 0xffff, 0xffff, 0xc1c0, X 0x03ff, 0xffff, 0xffff, 0xffc0, 0x03ff, 0xff00, 0x001f, 0xffc0, X 0x1fff, 0xff98, 0x1ff0, 0x0ff8, 0x07ff, 0xe007, 0xffe0, 0x3ffc, X X 0x0203, 0xffff, 0xffff, 0xffc0, 0x01ff, 0xffff, 0xffff, 0xf980, X 0x03ff, 0xffff, 0xffff, 0xffc0, 0x03ff, 0xff00, 0x00ff, 0xffc0, X 0x1fff, 0xff08, 0x1f80, 0x01f8, 0x03ff, 0xc003, 0xffc0, 0x3ffc, X X 0x011f, 0xffff, 0xffff, 0xff80, 0x01ff, 0xffff, 0xffff, 0xff80, X 0x01ff, 0xffff, 0xffff, 0xff80, 0x01ff, 0xffe0, 0x07ff, 0xff80, X 0x1fff, 0xfe18, 0x1e03, 0xc078, 0x0b7e, 0x680b, 0x7e68, 0x1ff8, X X 0x01ff, 0xffff, 0xffff, 0xff80, 0x00ff, 0xffff, 0xffff, 0xdf00, X 0x01ff, 0xffff, 0xffff, 0xff80, 0x01ff, 0xffff, 0xffff, 0xff80, X 0x3fff, 0xfc1c, 0x3801, 0xe01c, 0x15f9, 0xd415, 0xf9d4, 0x1bd4, X X 0x00fb, 0xffff, 0xffff, 0xff00, 0x00ff, 0xffff, 0xffff, 0xff00, X 0x00ff, 0xffff, 0xffff, 0xdf00, 0x00ff, 0xffff, 0xffff, 0xdf00, X 0x3fff, 0xf83c, 0x3009, 0xf00c, 0x0aae, 0xa80a, 0xaea8, 0x2e2a, X X 0x00ff, 0xffff, 0xffff, 0xff00, 0x007f, 0xffff, 0xffff, 0xbe00, X 0x00ff, 0xffff, 0xffff, 0xff00, 0x00ff, 0xffff, 0xffff, 0xff00, X 0x3fff, 0xf03c, 0x200c, 0xf004, 0x0155, 0x4001, 0x5540, 0x17d4, X X 0x007f, 0xffff, 0xffff, 0xbe00, 0x003f, 0xffff, 0xffff, 0x7c00, X 0x007f, 0xffff, 0xffff, 0xbe00, 0x007f, 0xffff, 0xffff, 0xbe00, X 0x3fff, 0xf03c, 0x200f, 0xf004, 0x3e1f, 0x0f87, 0xc000, 0x0000, X X 0x003f, 0xffff, 0xffff, 0x7c00, 0x001f, 0xffff, 0xfff8, 0xf800, X 0x003f, 0xffff, 0xffff, 0x7c00, 0x003f, 0xffff, 0xffff, 0x7c00, X 0x3fff, 0xf83c, 0x300f, 0xf00c, 0x7f3f, 0x9fcf, 0xe000, 0x03c0, X X 0x001f, 0xffff, 0xfff8, 0xf800, 0x000f, 0xffff, 0xffe1, 0xf000, X 0x001f, 0xffff, 0xfff8, 0xf800, 0x001f, 0xffff, 0xfff8, 0xf800, X 0x3fff, 0xfc1c, 0x3807, 0xe01c, 0xffff, 0xfffe, 0xf000, 0x0df0, X X 0x000f, 0xffff, 0xffe1, 0xf000, 0x0003, 0xffff, 0xff07, 0xa000, X 0x000f, 0xffff, 0xffe1, 0xf000, 0x000f, 0xffff, 0xffe1, 0xf000, X 0x1fff, 0xfe18, 0x1e03, 0xc078, 0x3fff, 0x3ff8, 0x3000, 0x13f8, X X 0x0003, 0xffff, 0xff07, 0xa000, 0x0007, 0xffff, 0xf00e, 0x4000, X 0x0003, 0xffff, 0xff07, 0xa000, 0x0003, 0xffff, 0xff07, 0xa000, X 0x1fff, 0xff08, 0x1f80, 0x01f8, 0x8ffc, 0x7ff1, 0x1ad2, 0x2ffc, X X 0x0007, 0xffff, 0xf00e, 0x4000, 0x00ab, 0xffff, 0xfc7d, 0xff00, X 0x0007, 0xffff, 0xf00e, 0x4000, 0x0007, 0xffff, 0xf00e, 0x4000, X 0x1fff, 0xff98, 0x1ff0, 0x0ff8, 0x3fff, 0x3ff8, 0x3000, 0x381c, X X 0x00ab, 0xffff, 0xfc7d, 0xff00, 0x0155, 0xffff, 0xffe3, 0xd540, X 0x00ab, 0xffff, 0xfc7d, 0xff00, 0x00ab, 0xffff, 0xfc7d, 0xff00, X 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0xffff, 0xfffe, 0xf000, 0x6186, X X 0x0155, 0xffff, 0xffe3, 0xd540, 0x02aa, 0xff7f, 0xffcf, 0xaaa0, X 0x0155, 0xffff, 0xffe3, 0xd540, 0x0155, 0xffff, 0xffe3, 0xd540, X 0x0fff, 0xfff0, 0x0fff, 0xfff0, 0x7f3f, 0x9fcf, 0xe000, 0x42c2, X X 0x02aa, 0xff7f, 0xffcf, 0xaaa0, 0x0555, 0x5f3f, 0xfc7f, 0x5550, X 0x02aa, 0xff7f, 0xffcf, 0xaaa0, 0x02aa, 0xff7f, 0xffcf, 0xaaa0, X 0x07ff, 0xff60, 0x07ff, 0xff60, 0x3e1f, 0x0f87, 0xc000, 0x43c2, X X 0x0555, 0x5f3f, 0xfc7f, 0x5550, 0x0aaa, 0xaff3, 0xcffe, 0xaaa0, X 0x0555, 0x5f3f, 0xfc7f, 0x5550, 0x0555, 0x5f3f, 0xfc7f, 0x5550, X 0x03ff, 0xfcc0, 0x03ff, 0xfcc0, 0x30c3, 0x0c49, 0x2000, 0x6186, X X 0x0aaa, 0xaff3, 0xcffe, 0xaaa0, 0x0555, 0x57f8, 0x1ff5, 0x5540, X 0x0aaa, 0xaff3, 0xcffe, 0xaaa0, 0x0aaa, 0xaff3, 0xcffe, 0xaaa0, X 0x07ff, 0xff68, 0x07ff, 0xff68, 0x79e7, 0x9e33, 0xd000, 0x381c, X X 0x0555, 0x57f8, 0x1ff5, 0x5540, 0x02aa, 0xaaff, 0xffaa, 0xaa80, X 0x0555, 0x57f8, 0x1ff5, 0x5540, 0x0555, 0x57f8, 0x1ff5, 0x5540, X 0x15ff, 0xf9d4, 0x15ff, 0xf9d4, 0x3fcf, 0xf349, 0x2000, 0x3ffc, X X 0x02aa, 0xaaff, 0xffaa, 0xaa80, 0x0055, 0x555f, 0xf555, 0x5500, X 0x02aa, 0xaaff, 0xffaa, 0xaa80, 0x02aa, 0xaaff, 0xffaa, 0xaa80, X 0x2adf, 0xe3aa, 0x2adf, 0xe3aa, 0x3fcf, 0xf366, 0x6600, 0x1ff8, X X 0x0055, 0x555f, 0xf555, 0x5500, 0x000a, 0xaaaa, 0xaaaa, 0xa000, X 0x0055, 0x555f, 0xf555, 0x5500, 0x0055, 0x555f, 0xf555, 0x5500, X 0x157c, 0x3f54, 0x157c, 0x3f54, 0x79e7, 0x9e3c, 0xf900, 0x13d4, X X 0x000a, 0xaaaa, 0xaaaa, 0xa000, 0x0000, 0x0555, 0x5550, 0x0000, X 0x000a, 0xaaaa, 0xaaaa, 0xa000, 0x000a, 0xaaaa, 0xaaaa, 0xa000, X 0x0aaf, 0xfaa8, 0x0aaf, 0xfaa8, 0x30c3, 0x0c3c, 0xf900, 0x2a2a, X X 0x0000, 0x0555, 0x5550, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, X 0x0000, 0x0555, 0x5550, 0x0000, 0x0000, 0x0555, 0x5550, 0x0000, X 0x0155, 0x5540, 0x0155, 0x5540, 0x0000, 0x0066, 0x6600, 0x1554 X}; X Xstatic RelativeTokens relativeTokens = { X { REAR, FRONT, RIGHT, LEFT }, /* me north, him [n, s, e, w] */ X { FRONT, REAR, LEFT, RIGHT }, /* me south, him [n, s, e, w] */ X { LEFT, RIGHT, REAR, FRONT }, /* me east ... */ X { RIGHT, LEFT, FRONT, REAR } /* me west ... */ X}; X X/* X * Initialize the display manager. X */ X XInitDisplay(argc, argv) Xchar **argv; X{ X register int i; X register RatState *rsp; X X for (i = 0; i < MAXRATS; i++) { X rsp = &clearArray[i]; X rsp->playing = FALSE; X rsp->x = 1; X rsp->y = 1; X rsp->dir = NORTH; X } X X InitWindow(argc, argv); X} X X/* X * all in the name of portability... actually put the display on X * the screen. Some window systems need to do initialization before X * the net is started, but don't want to display until after. X */ X XStartDisplay() X{ X StartWindow(ratBits, ratBits_width, ratBits_height); X} X X/* X * Manage the top portion of the screen, the perspective view of the X * maze, with the eyeballs. What is seen is controlled by the position X * in the maze and what players are visible. This latter is recorded X * in the R2d2 array (the significance of the name is lost to X * history), which is recomputed every time someone moves. X * X * The perspective view is calculated on the fly from the viewTable array. X * viewTable contains a set of 12 line segments for 30 views. The longest X * corridor is 30 spaces, and for each cell in the maze, there are 12 X * distinct lines (wall edges) that could be visible (never all at once). X * X * Each time, march down the hall in the direction faced and figure X * out which lines to actually draw. Then look in R2d2 and draw in opponents. X */ X X#define NDIR NDIRECTION Xstatic Boolean prevEdge3, prevEdge7; /* plotter smarts */ Xstatic Boolean edge1, edge2, edge3, edge4, edge5, edge6, edge7; Xstatic XYpair edge3Lines[2], edge7Lines[2]; Xstatic XY l1Delta[NDIR] = { {0, -1}, {0, 1}, {1, 0}, {-1, 0} }; Xstatic XY l2Delta[NDIR] = { {1, -1}, {-1, 1}, {1, 1}, {-1, -1} }; Xstatic XY c2Delta[NDIR] = { {1, 0}, {-1, 0}, {0, 1}, {0, -1} }; Xstatic XY r1Delta[NDIR] = { {0, 1}, {0, -1}, {-1, 0}, {1, 0} }; Xstatic XY r2Delta[NDIR] = { {1, 1}, {-1, -1}, {-1, 1}, {1, -1} }; X#undef NDIR X XShowView(x, y, dir) Xint x, y; XDirection dir; X{ X register XYpair *tp = viewTable; X register int tx = x; X register int ty = y; X RatId ratId; X RatLook ratLook; X Boolean oldVisible; X XYpair *hidden(), *plotLine(); X X ClearView(); X prevEdge3 = prevEdge7 = FALSE; X while (!M.maze[tx].y[ty]) { X tp = hidden(tx, ty, dir, tp); /* draw a cell */ X switch (dir) { X case NORTH: tx++; break; X case SOUTH: tx--; break; X case EAST: ty++; break; X case WEST: ty--; break; X } X } X if (prevEdge3) X (void) plotLine(edge3Lines, TRUE); X if (prevEdge7) X (void) plotLine(edge7Lines, TRUE); X X /* show the tokens */ X X for (ratId = 0; ratId < MAXRATS; ratId++) { X if (ratId == M.myRatId) X continue; X ratLook = &R2d2[ratId]; X oldVisible = ratLook->visible; X TokenVisible(ratId); X if (ratLook->visible == TRUE) X XORToken(ratId); X if (ratLook->visible != oldVisible) X UpdateScoreCard(ratId); X } X} X XXYpair * XplotLine(p, two) XXYpair *p; XBoolean two; X{ X while (1) { X DrawViewLine(p->p1.x, p->p1.y, p->p2.x, p->p2.y); X p++; X if (!two) X return p; X two = FALSE; X } X} X XXYpair * Xhidden(x, y, dir, p) Xint x, y; XDirection dir; XXYpair *p; X{ X int l1x, l1y, l2x, l2y; X int r1x, r1y, r2x, r2y; X int c2x, c2y; X X /* first calculate the coordinates of the neighboring cubes */ X X l1x = x + l1Delta[dir].xcor; /* find left cube */ X l1y = y + l1Delta[dir].ycor; X l2x = x + l2Delta[dir].xcor; /* find left forward cube */ X l2y = y + l2Delta[dir].ycor; X r1x = x + r1Delta[dir].xcor; /* find right cube */ X r1y = y + r1Delta[dir].ycor; X r2x = x + r2Delta[dir].xcor; /* find right forward cube */ X r2y = y + r2Delta[dir].ycor; X c2x = x + c2Delta[dir].xcor; /* find forward cube */ X c2y = y + c2Delta[dir].ycor; X X /* next calculate which of the 7 possible cube edges are visible */ X X edge2 = M.maze[c2x].y[c2y]; /* c2 */ X edge3 = M.maze[l1x].y[l1y]; /* l1 */ X edge4 = !edge3; /* !l1 */ X X edge7 = M.maze[r1x].y[r1y]; /* r1 */ X edge6 = !edge7; /* !r1 */ X X edge1 = edge3 && (edge2 || !M.maze[l2x].y[l2y]) X || ((!edge2) && edge4); X edge5 = edge7 && (edge2 || !M.maze[r2x].y[r2y]) X || ((!edge2) && edge6); X X /* X * Should be matching the following: X * x1 = l1 (c2 + !l2) + !c2 !l1 X * x2 = c2 X * x3 = l1 X * x4 = !l1 X * x5 = r1 (c2 + !r2) + !c2 !r1 X * x6 = !r1 X * x7 = r1 X */ X X if (edge1) X p = plotLine(p, FALSE); X else X p++; X if (edge2) X p = plotLine(p, TRUE); X else X p += 2; X if (edge3) { X if (prevEdge3) { X edge3Lines[0].p2 = (p++)->p2; X edge3Lines[1].p2 = p->p2; X } else { X edge3Lines[0] = *p++; X edge3Lines[1] = *p; X prevEdge3 = TRUE; X } X p++; X } else { X if (prevEdge3) { X (void) plotLine(edge3Lines, TRUE); X prevEdge3 = FALSE; X } X p += 2; X } X if (edge4) X p = plotLine(p, TRUE); X else X p += 2; X if (edge5) X p = plotLine(p, FALSE); X else X p++; X if (edge6) X p = plotLine(p, TRUE); X else X p += 2; X if (edge7) { X if (prevEdge7) { X edge7Lines[0].p1 = (p++)->p1; X edge7Lines[1].p1 = p->p1; X } else { X edge7Lines[0] = *p++; X edge7Lines[1] = *p; X prevEdge7 = TRUE; X } X p++; X } else { X if (prevEdge7) { X (void) plotLine(edge7Lines, TRUE); X prevEdge7 = FALSE; X } X p += 2; X } X return p; X} X X/* X * sets R2d2[hisRatId] variables X * uses M.ratcb[hisRatId] as input for his position and direction X */ X XTokenVisible(hisRatId) XRatId hisRatId; X{ X RatLook ratLook = &R2d2[hisRatId]; X RatInfo ratInfo = &M.ratcb.rats[hisRatId]; X Loc tx, ty; X Direction td; X int ix, ix12; X X ratLook->visible = FALSE; X if (!ratInfo->playing) X return; X if (M.peeking) { X tx = M.xPeek; X ty = M.yPeek; X td = M.dirPeek; X } else { X tx = M.xloc; X ty = M.yloc; X td = M.dir; X } X ix = 0; X while (!M.maze[tx].y[ty]) { X switch(td) { X case NORTH: tx++; break; X case SOUTH: tx--; break; X case EAST: ty++; break; X case WEST: ty--; break; X } X ix++; X if ((tx == ratInfo->xLoc) && (ty == ratInfo->yLoc)) { X ratLook->visible = TRUE; X ix12 = ix * 12; X ratLook->x = (viewTable[ix12+3].p2.x + X viewTable[ix12+10].p1.x)/2; X ratLook->y = (viewTable[ix12+3].p1.y + X viewTable[ix12+3].p2.y)/2; X ratLook->tokenId = relativeTokens[td].t[ratInfo->dir]; X ratLook->distance = ix; X break; X } X } X} X X/* X * draw him into the maze, with the right size for his distance away X * and facing the right way. X */ X XXORToken(hisRatId) XRatId hisRatId; X{ X int size; X int srcX, srcY; X X getRat(hisRatId, &srcX, &srcY, &size); X DisplayRatBitmap(R2d2[hisRatId].x - size/2, X R2d2[hisRatId].y - size/2, X size, size, srcX, srcY); X} X X/* X * Dig the appropriate bitmap out of the master bitmap, which has all X * possible views neatly packed into place. X */ X XgetRat(hisRatId, x, y, size) XRatId hisRatId; Xint *x, *y, *size; X{ X int viewT = LEFT; X int view = R2d2[hisRatId].tokenId; X X switch (R2d2[hisRatId].distance) { X case 1: X *size = 64; X *x = 0; X *y = 0; X for (viewT = 0; viewT != view; *x += 64) X viewT++; X return; X X case 2: X *size = 32; X for (*x = 4*64; *x != 64*5; *x += 32) X for (*y = 0; *y != 64; *y += 32) X if (viewT == view) X return; X else X viewT++; X X case 3: X *size = 24; X for (*x = 5*64; *x != 64*5+48; *x += 24) X for (*y = 0; *y != 48; *y += 24) X if (viewT == view) X return; X else X viewT++; X X case 4: X case 5: X *size = 16; X *x = 64*5+48; X for (*y = 0; *y != 64; *y += 16) X if (viewT == view) X return; X else X viewT++; X X case 6: X case 7: X case 8: X *size = 9; X *y = 48; X for (*x = 64*5; *x != 64*5 + 4*9; *x += 9) X if (viewT == view) X return; X else X viewT++; X X case 9: X case 10: X case 11: X case 12: X *size = 6; X *y = 48+9; X for (*x = 64*5; *x != 64*5 + 4*6; *x += 6) X if (viewT == view) X return; X else X viewT++; X X case 13: X case 14: X case 15: X case 16: X case 17: X case 18: X *size = 4; X *y = 48+9+3; X for (*x = 64*5 + 4*6; *x != 64*5 +4*6 + 4*4; *x += 4) X if (viewT == view) X return; X else X viewT++; X X default: X *size = 3; X *y = 48+9; X for (*x = 64*5 + 4*6; *x != 64*5 + 4*6 + 4*3; *x += 3) X if (viewT == view) X return; X else X viewT++; X } X} X X/* X * The maze display. This is controlled by the clearArray (another X * historically significant name, I'm afraid). Each player has his X * loaction and playing information stored here as well as in M.ratcb. X * This is to tell who was playing before the last update/status/location X * packet came in, so we can do the right thing for adding/deleting players. X * X * There are various hooks for setting the contents of clearArray X * from the outside, like SetMyRatId(). X */ X XSetMyRatId(ratId) XRatId ratId; X{ X clearArray[ratId].playing = TRUE; X} X X/* X * Someone joined us; add him to the display. X */ X XAddNewPlayer(ratId, xloc, yloc, dir) XRatId ratId; XDirection dir; X{ X clearArray[ratId].playing = TRUE; X clearArray[ratId].x = xloc; X clearArray[ratId].y = yloc; X clearArray[ratId].dir = dir; X DisplayOthersPosition(ratId, xloc, yloc, dir); X NotifyPlayer(); X} X X/* X * Someone left. X */ XExitPlayer(ratId) XRatId ratId; X{ X clearPosition(ratId, clearArray[ratId].x, clearArray[ratId].y); X clearArray[ratId].playing = FALSE; X} X X/* X * Tell the display controller I moved. X */ X XShowPosition(xloc, yloc, invincible, tdir) Xint xloc, yloc; XBoolean invincible; XDirection tdir; X{ X clearPosition(M.myRatId, clearArray[M.myRatId].x, X clearArray[M.myRatId].y); X showMe(xloc, yloc, invincible, tdir); X} X X/* X * Show where everybody is (only for wizards). X */ X XShowAllPositions() X{ X RatId ratId; X X for (ratId = 0; ratId < MAXRATS; ratId++) { X if (ratId == M.myRatId) X continue; X if (clearArray[ratId].playing && !M.ratcb.rats[ratId].playing) X ExitPlayer(ratId); X else if (!clearArray[ratId].playing && X M.ratcb.rats[ratId].playing) X AddNewPlayer(ratId, M.ratcb.rats[ratId].xLoc, X M.ratcb.rats[ratId].yLoc, X M.ratcb.rats[ratId].dir); X else if (clearArray[ratId].playing) X DisplayOthersPosition(ratId, M.ratcb.rats[ratId].xLoc, X M.ratcb.rats[ratId].yLoc, X M.ratcb.rats[ratId].dir); X } X} X X/* X * Someone else moved; update his info and display the new position. X * Again, only for wizards who are exercising their powers. X */ X XDisplayOthersPosition(ratId, xloc, yloc, dir) XRatId ratId; XDirection dir; X{ X if (!clearArray[ratId].playing && M.ratcb.rats[ratId].playing) { X AddNewPlayer(ratId, xloc, yloc, dir); /* calls me back */ X return; X } X X clearPosition(ratId, clearArray[ratId].x, clearArray[ratId].y); X if (clearArray[ratId].playing && M.omniscient) X showOther(ratId, xloc, yloc, dir); X} X X/* X * Do the actual work of showing me, with the right sort of arrow (in X * case I'm playing wizard). X */ X XshowMe(xloc, yloc, invincible, dir) Xint xloc, yloc; XBoolean invincible; XDirection dir; X{ X register BitCell *bp; X register RatState *rsp; X X if (invincible) X bp = invincibleArrows; X else X bp = normalArrows; X X HackMazeBitmap(xloc, yloc, &bp[dir]); X X rsp = &clearArray[M.myRatId]; X rsp->playing = TRUE; X rsp->x = xloc; X rsp->y = yloc; X rsp->dir = dir; X M.invincible = invincible; X} X X/* X * Bang the bits to show the other guy. X */ X XshowOther(ratId, xloc, yloc, dir) XDirection dir; X{ X register int i; X register RatState *rsp; X BitCell bits; X X for (i = 0; i < 16; i++) X bits.bits[i] = otherArrows[dir].bits[i] | X numbers[ratId].bits[i]; X X HackMazeBitmap(xloc, yloc, &bits); X X rsp = &clearArray[ratId]; X rsp->playing = TRUE; X rsp->x = xloc; X rsp->y = yloc; X rsp->dir = dir; X} X X/* X * When someone moves off a position, clear it out. If there's someone X * "under" him, display the second guy. X */ X XclearPosition(ratId, xClear, yClear) XRatId ratId; X{ X register RatState *rsp; X register int i; X X clearSquare(xClear, yClear); X for (i = 0; i < MAXRATS; i++) { X rsp = &clearArray[i]; X if ((i == ratId) || !(rsp->playing)) X continue; X if ((rsp->x == xClear) && (rsp->y == yClear)) X if (i == M.myRatId) X showMe(rsp->x, rsp->y, M.invincible, rsp->dir); X else X if (M.omniscient) X showOther(i, rsp->x, rsp->y, rsp->dir); X } X} X Xstatic BitCell EMPTY = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; X X/* clear out a square of the maze */ XclearSquare(xClear, yClear) X{ X HackMazeBitmap(xClear, yClear, &EMPTY); X} X X/* X * Handle the score card area. Most of the work is done in window system X * dependent routines. X */ X XNewScoreCard() X{ X register RatId ratId; X X for( ratId = 0; ratId < MAXRATS; ratId++) X UpdateScoreCard(ratId); X if (M.omniscient) X ShowAllPositions(); X} X XUpdateScoreCard(ratId) XRatId ratId; X{ X ClearScoreLine(ratId); X if (M.ratcb.rats[ratId].playing) X WriteScoreString(ratId); X if (R2d2[ratId].visible == TRUE) X InvertScoreLine(ratId); X} X X/* X * Some window systems (notably X10) choose to represent bitmaps in X * little-endian order. That is, the least significant bit in the word is X * the leftmost bit on the screen. This means that bitmaps look X * "backwards" on the screen from the way they look in source code. So, we X * flip them all here, once, at initialization time, so they can be edited X * "by hand". X * X * It is up to the window system initialization code to call this, if X * deemed necessary. X * X * Hack hack. X */ X XFlipBitmaps() X{ X register i; X X bitFlip(normalArrows); X bitFlip(invincibleArrows); X bitFlip(otherArrows); X bitFlip(numbers); /* only gets the first 4 */ X bitFlip(&numbers[4]); /* get the rest */ X for (i = 0; i < ratBits_width * ratBits_height / 16; i += 64) X bitFlip((BitCell *) &ratBits[i]); X} X X/* X * quick bit flipper -- divide and conquer due to Jeff Mogul. X * unrolled to do 4 16 bit words, but generally extensible. X */ X XbitFlip(bits) Xregister BitCell *bits; X{ X register int num, top, bot, i, j; X X for (i = 0; i < 4; i++) { X for (j = 0; j < 16; j++) { X num = bits->bits[j] & 0xffff; X top = num & 0xff00; X bot = num & 0x00ff; X top >>= 8; X bot <<= 8; X num = top|bot; X X top = num & 0xf0f0; X bot = num & 0x0f0f; X top >>= 4; X bot <<= 4; X num = top|bot; X X top = num & 0xcccc; X bot = num & 0x3333; X top >>= 2; X bot <<= 2; X num = top|bot; X X top = num & 0xaaaa; X bot = num & 0x5555; X top >>= 1; X bot <<= 1; X bits->bits[j] = top|bot; X } X bits++; X } X} X X X/* X * Then there are the systems that are perfectly happy with MSBFirst data, but X * byte swap the shorts that are used. We fix that here. X * X * The htons() routine is a defined to be a no-op on machines that don't have X * this problem. X * X */ X XSwapBitmaps() X{ X register i; X X byteSwap(normalArrows); X byteSwap(invincibleArrows); X byteSwap(otherArrows); X byteSwap(numbers); /* only gets first 4 */ X byteSwap(&numbers[4]); /* get the rest */ X for (i = 0; i < ratBits_width * ratBits_height / 16; i += 64) X byteSwap((BitCell *) &ratBits[i]); X} X X/* X * Byte swap 4 16x16 bitmaps. X */ X XbyteSwap(bits) Xregister BitCell *bits; X{ X register int i, j; X X for (i = 0; i < 4; i++, bits++) X for (j = 0; j < 16; j++) X bits->bits[j] = htons(bits->bits[j] & 0xffff); X} xxFUNNYxx