home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1994 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1994.iso
/
compsrcs
/
games
/
vmsnet
/
mazewar
/
part05
< prev
next >
Wrap
Text File
|
1993-07-09
|
55KB
|
1,608 lines
Newsgroups: vmsnet.sources.games
Path: uunet!ddsw1!lll-winken.llnl.gov!uwm.edu!linac!newsaintmail
From: SNYDER@d0sb10.fnal.gov
Subject: Mazewar for VMS (5/5)
Message-ID: <SNYDER.93Jul10033629@d0sb10.fnal.gov>
Sender: daemon@linac.fnal.gov (The Background Man)
Nntp-Posting-Host: d0sb10.fnal.gov
Organization: SUNY Stony Brook High Energy Physics
Date: Sat, 10 Jul 1993 09:36:29 GMT
Lines: 1595
Xref: uunet vmsnet.sources.games:750
-+-+-+-+-+-+-+-+ START OF PART 5 -+-+-+-+-+-+-+-+
X`7D`09`09`09`09`09RatPacket;
X
X/*`20variables`20"exported"`20by`20the`20mazewar`20"module"`20*/
X
Xstruct`20_mazewar`20`7B
X`09Direction`09dir;`09`09/*`20which`20way`20am`20I`20looking?`20*/
X`09Direction`09dirPeek;`09/*`20direction`20for`20peek`20display`20*/
X`09Boolean`09duke;`09`09`09/*`20I`20am`20the`20duke`20*/
X`09Sockaddr`09dukeAddr;`09/*`20where`20is`20the`20duke?`20*/
X`09Boolean`09invincible;`09`09/*`20can`20I`20be`20killed?`20*/
X`09MazeType`09maze;`09`09/*`20the`20maze`20in`20bits`20*/
X`09long`09`09mazePort;`09/*`20the`20port`20to`20keep`20busy`20*/
X`09Sockaddr`09myAddr;`09`09/*`20my`20net`20address`20*/
X`09RatId`09myRatId;`09`09/*`20my`20index`20into`20the`20ratcb`20*/
X`09Boolean`09omniscient;`09`09/*`20can`20I`20see`20everyone?`20*/
X`09Boolean`09peeking;`09`09/*`20peeking`20in`20progress`20*/
X`09int`09theSocket;`09`09/*`20the`20main`20socket`20*/
X`09short`09randomVector`5BVECTORSIZE`5D;
X`09RatCb`09ratcb;`09`09`09/*`20my`20copy`20of`20the`20world`20*/
X`09Score`09score;`09`09`09/*`20my`20total`20so`20far`20*/
X`09Loc`09xloc;`09`09`09/*`20current`20x`20location`20*/
X`09Loc`09yloc;`09`09`09/*`20current`20y`20location`20*/
X`09Loc`09xPeek;`09`09`09/*`20x`20for`20peek`20display`20*/
X`09Loc`09yPeek;`09`09`09/*`20y`20for`20peek`20display`20*/
X`7DM;`09`09`09`09`09/*`20expediency`20wins`20out`20*/
X
X/*`20events`20*/
X
X#define`09EVENT_A`09`091`09`09/*`20user`20pressed`20"A"`20*/
X#define`09EVENT_S`09`092`09`09/*`20user`20pressed`20"S"`20*/
X#define`09EVENT_D`09`093`09`09/*`20user`20pressed`20"D"`20*/
X#define`09EVENT_F`09`094`09`09/*`20user`20pressed`20"F"`20*/
X#define`09EVENT_BAR`095`09`09/*`20user`20pressed`20space`20bar`20*/
X#define`09EVENT_I`09`096`09`09/*`20user`20pressed`20"I"`20*/
X#define`09EVENT_K`09`097`09`09/*`20user`20pressed`20"K"`20*/
X#define`09EVENT_O`09`098`09`09/*`20user`20pressed`20"O"`20*/
X#define`09EVENT_L`09`099`09`09/*`20user`20pressed`20"L"`20*/
X#define`09EVENT_LEFT_D`0910`09`09/*`20user`20pressed`20left`20mouse`20button
V`20*/
X#define`09EVENT_LEFT_U`0911`09`09/*`20user`20released`20l.m.b`20*/
X#define`09EVENT_MIDDLE_D`0912`09`09/*`20user`20pressed`20middle`20button`20*/
X#define`09EVENT_RIGHT_D`0913`09`09/*`20user`20pressed`20right`20button`20*/
X#define`09EVENT_RIGHT_U`0914`09`09/*`20user`20released`20r.m.b`20*/
X#define`09EVENT_NETWORK`0915`09`09/*`20incoming`20network`20packet`20*/
X#define`09EVENT_INT`0916`09`09/*`20user`20pressed`20interrupt`20key`20*/
X#define`09EVENT_TIMEOUT`0917`09`09/*`20nothing`20happened!`20*/
X
Xtypedef`09struct`20`7B
X`09short`09`09eventType;
X`09RatPacket`09*eventDetail;`09/*`20for`20incoming`20data`20*/
X`09Sockaddr`09eventSource;
X`7D`09`09`09`09`09MWEvent;
X
XR2d2_t`09`09R2d2;
XRatKillQ_t`09RatKillQ;
X
Xvoid`09NextEvent();
X`09
Xchar`09*malloc();
$ call unpack [.MAZEWAR]MAZEWAR.H;1 1948739102 ""
$!
$ create 'f'
Xsys$share:decw$xtshr/share
Xsys$share:decw$xlibshr/share
Xmultinet:multinet_socket_library/share
$ call unpack [.MAZEWAR]MAZEWAR.OPT;3 -
508047064 "FORMAT STREAM_LF;CARRIAGE_CONTROL CARRIAGE_RETURN"
$!
$ create 'f'
XThis`20is`20Mazewar`20for`20UNIX.`20It`20is`20a`20direct`20descendant`20of`20t
Vhe`20Mazewar
Xplayed`20at`20MIT`20and`20Xerox`20PARC,`20and`20boasts`20none`20of`20the`20emb
Vellishments`20found
Xin`20other`20such`20programs.`20It's`20basically`20just`20run,`20peek,`20and
V`20shoot;`20no`20robot
Xamenuenses,`20teleport`20traps,`20or`20other`20such`20fluff.
X
XBasically,`20ASDF`20and`20space`20move`20you`20around,`20middle`20mouse`20shoo
Vts,`20left`20and
Xright`20mouse`20let`20you`20peek`20around`20corners.`20Type`20Q`20to`20quit.
V`20Lefties`20may`20use
Xthe`20numeric`20pad`20instead`20of`20ASDF;`20on`20a`20DEC`20LK201`20keyboard,
V`20the`20456,`20row
Xserves`20for`20ASDF,`20and`20the`20right`20cursor`20arrow`20is`20equivalent
V`20to`20the`20space`20bar.
XQ`20quits.
X
XGames`20are`20normally`20begun`20by`20broadcasting`20to`20find`20members`20of
V`20a`20game;`20if
Xyour`20system`20doesn't`20allow`20normal`20users`20to`20do`20broadcasts,`20you
V'll`20have`20to`20do
Xsomething`20like`20run`20it`20setuid`20root`20(or`20whomever)`20and`20change
V`20findDuke$init.c
Xto`20do`20a`20setuid(getuid())`20after`20the`20broadcast.`20The`20code`20as
V`20distributed`20does`20a
Xbroadcast`20to`20INADDR_BROADCAST`20(all`201s);`20your`20network`20might`20sti
Vll`20be`20configured
Xto`20use`20INADDR_ANY`20(all`200s).`20The`20place`20to`20change`20this`20is
V`20in`20the`20declaration`20of
XCFLAGS`20in`20the`20Makefile.
X
XAlso,`20the`204.3`20setsockopt()`20call`20is`20pickier`20about`20its`20argumen
Vts`20when`20trying`20to
Xenable`20broadcasting.`20`20Define`20BSD_43`20in`20the`20Makefile`20to`20compi
Vle`20the`20appropriate
Xcode`20for`204.3`20and`204.3-derived`20systems.`20`20The`20code`20that`20worke
Vd`20on`204.2`20is`20still
Xavailable`20for`20systems`20that`20might`20not`20like`20the`20new`20arguments.
V
X
XIf`20you`20know`20you`20don't`20have`20broadcast`20ability`20and`20never`20wil
Vl,`20define
XNO_BROADCAST`20in`20the`20Makefile,`20and`20that`20code`20will`20be`20compiled
V`20out`20of`20init.c;
Xmazefind`20isn't`20touched,`20but`20it`20won't`20do`20anything`20useful.`20In
V`20this`20case,`20you`20must
Xspecify`20a`20duke`20host`20(the`20name`20of`20any`20host`20currently`20in`20a
V`20game`20will`20do)`20or`20the
Xplayers`20won't`20be`20able`20to`20find`20each`20other.`20
X
XIn`20each`20game`20there`20is`20one`20player`20who`20is`20designated`20the`20"
Vduke"`20and`20manages
Xthe`20joining`20and`20leaving`20of`20other`20players.`20When`20starting`20a
V`20game,`20if`20you
Xwish`20to`20join`20a`20specific`20game,`20especially`20one`20on`20a`20differen
Vt`20net,`20you`20may
Xspecify`20the`20name`20of`20the`20duke`20host,`20which`20will`20be`20contacted
V`20directly.`20This
Xhas`20not`20been`20extensively`20tested.`20Games`20across`20long`20network`20d
Velays`20might`20be
Xpretty`20strange...
X
XIf`20you`20enjoy`20this`20program`20and`20keep`20it,`20please`20send`20a`20pic
Vture`20post`20card`20to`20me:
X
XChris`20Kent
XDEC`20Western`20Research`20Lab
X100`20Hamilton`20Avenue
XPalo`20Alto,`20CA`2094301
X
XInclude`20your`20ArpaNet`20or`20UUCP`20mailing`20address`20and`20I'll`20keep
V`20you`20informed`20
Xof`20updates.
X
XDecember,`201986
X
XBob`20Brown,`20Malcolm`20Slaney,`20and`20Mike`20Yang`20deserve`20a`20long`20ro
Vund`20of`20applause`20for
Xhaving`20ported`20to`20new`20window`20systems.`20`20We've`20tested`20it`20on
V`20a`20lot`20of
Xarchitectures,`20but`20byte-`20or`20bit-order`20bugs`20may`20still`20be`20lurk
Ving.`20`20Note`20that
Xthere`20is`20conditional`20code`20in`20the`20X11`20driver`20to`20not`20use`20s
Verver-resident`20bitmaps
Xif`20your`20server`20doesn't`20do`20them`20right`20(this`20was`20designed`20fo
Vr`20the`20QDSS).
X
XHave`20fun,
Xchris
X
XAugust,`201988
$ call unpack [.MAZEWAR]README.;1 561999293 ""
$!
$ create 'f'
X
XMazewar`20on`20VMS
X
XThis`20is`20a`20port`20of`20the`20X11`20mazewar`20game`20to`20VMS/Multinet.
XYou`20can`20compile`20it`20with`20either`20gcc`20or`20VAX`20C.`20`20Look`20at
V`20descrip.mms,
Xuncomment`20the`20appropriate`20lines,`20and`20run`20MMS.`20`20If`20you`20don'
Vt`20have
XMMS,`20it`20shouldn't`20be`20difficult`20to`20do`20by`20hand.`20`20See`20the
V`20man`20pages
Xfor`20playing`20instructions.
X
XNote`20that`20this`20kit`20does`20not`20include`20all`20of`20the`20original
V`20distribution;`20i've
Xleft`20out`20the`20subview`20and`20X10`20support`20files.
X
Xscott`20snyder
Xsnyder@fnald0.fnal.gov
$ call unpack [.MAZEWAR]VMS-README.;1 -
1517435425 "FORMAT STREAM_LF;CARRIAGE_CONTROL CARRIAGE_RETURN"
$!
$ create 'f'
X/*`20$Header:`20winX11.c,v`201.30`2089/02/24`2016:29:44`20kent`20Exp`20$`20*/
X
X/*`20
X`20*`20window_X11.c`20-`20Window-system`20specific`20routines`20for`20X11
X`20*`20
X`20*`20Author:`09Mike`20Yang
X`20*`20`09`09Western`20Research`20Laboratory
X`20*`09`20`09Digital`20Equipment`20Corporation
X`20*`20Date:`09Mon`20Jul`2025`201988
X`20*/
X
X/***********************************************************
XCopyright`201988`20by`20Digital`20Equipment`20Corporation,`20Maynard,`20Massac
Vhusetts,
X
X`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20All
V`20Rights`20Reserved
X
XPermission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20software
V`20and`20its`20
Xdocumentation`20for`20any`20purpose`20and`20without`20fee`20is`20hereby`20gran
Vted,`20
Xprovided`20that`20the`20above`20copyright`20notice`20appear`20in`20all`20copie
Vs`20and`20that
Xboth`20that`20copyright`20notice`20and`20this`20permission`20notice`20appear
V`20in`20
Xsupporting`20documentation,`20and`20that`20the`20names`20of`20Digital`20not
V`20be
Xused`20in`20advertising`20or`20publicity`20pertaining`20to`20disstribution`20o
Vf`20the
Xsoftware`20without`20specific,`20written`20prior`20permission.`20`20
X
XDIGITAL`20DISCLAIMS`20ALL`20WARRANTIES`20WITH`20REGARD`20TO`20THIS`20SOFTWARE,
V`20INCLUDING
XALL`20IMPLIED`20WARRANTIES`20OF`20MERCHANTABILITY`20AND`20FITNESS,`20IN`20NO
V`20EVENT`20SHALL
XDIGITAL`20BE`20LIABLE`20FOR`20ANY`20SPECIAL,`20INDIRECT`20OR`20CONSEQUENTIAL
V`20DAMAGES`20OR
XANY`20DAMAGES`20WHATSOEVER`20RESULTING`20FROM`20LOSS`20OF`20USE,`20DATA`20OR
V`20PROFITS,
XWHETHER`20IN`20AN`20ACTION`20OF`20CONTRACT,`20NEGLIGENCE`20OR`20OTHER`20TORTIO
VUS`20ACTION,
XARISING`20OUT`20OF`20OR`20IN`20CONNECTION`20WITH`20THE`20USE`20OR`20PERFORMANC
VE`20OF`20THIS
XSOFTWARE.
X
X******************************************************************/
X
X/*`20
X`20*`20It`20is`20intended`20that`20this`20file`20presents`20a`20window`20syste
Vm-independent
X`20*`20set`20of`20routines`20to`20MazeWar;`20that`20is,`20if`20you`20want`20to
V`20run`20MW`20under
X`20*`20another`20window`20system,`20this`20is`20the`20only`20file`20that`20nee
Vds`20to`20be
X`20*`20changed.`20It`20isn't`20yet`20clear`20how`20well`20I've`20succeeded,
V`20but`20it's`20a`20start.
X`20*`20
X`20*`20Routines`20that`20are`20presented`20to`20the`20outside`20are`20capitali
Vzed;`20local
X`20*`20routines`20are`20not.
X`20*/
X
X/*#define`09USE_BITMAPS`09/*`20turn`20on`20if`20you`20know`20CopyPlanes`20work
Vs`20*/
X
X/*
X`20*`20vms`20port`207/93`20`20scott`20snyder`20<snyder@fnald0.fnal.gov>
X`20*`20$Log:`09winX11.c,v`20$
X`20*`20Revision`201.30`20`2089/02/24`20`2016:29:44`20`20kent
X`20*`20Changed`20inversion`20code`20to`20use`20GXxor`20instead`20of`20GXcopyIn
Vverted.`20Makes
X`20*`20the`20code`20a`20little`20cleaner,`20and`20Joel`20says`20it'll`20run
V`20slightly`20
X`20*`20faster`20(big`20deal).
X`20*`20
X`20*`20Revision`201.29`20`2089/02/24`20`2016:18:51`20`20kent
X`20*`20Fixed`20a`20number`20of`20problems`20with`20the`20icon`20flashing`20cod
Ve.
X`20*`20
X`20*`20Revision`201.28`20`2089/02/23`20`2010:10:25`20`20kent
X`20*`20Changed`20to`20X11`20format`20bitmaps.
X`20*`20
X`20*`20Revision`201.27`20`2089/02/22`20`2017:28:08`20`20kent
X`20*`20Make`20the`20cursor`20bitmap`20files`20internal,`20instead`20of`20tryin
Vg`20to`20read
X`20*`20them`20at`20runtime`20(!).`20Requires`20some`20byteswapping`20on`20MSBF
Virst`20machines.
X`20*`20
X`20*`20Revision`201.26`20`2089/01/18`20`2017:26:46`20`20kent
X`20*`20Set`20class`20hints`20for`20the`20window`20so`20the`20window`20manager
V`20does
X`20*`20the`20right`20thing.
X`20*`20
X`20*`20Revision`201.25`20`2088/09/07`20`2010:49:07`20`20kent
X`20*`20Many`20changes`20in`20the`20name`20of`20portability.
X`20*`20
X`20*`20Revision`201.24`20`2088/08/12`20`2011:01:24`20`20kent
X`20*`20Cleaned`20up`20image`20code.
X`20*`20
X`20*`20Revision`201.22`20`2088/08/11`20`2008:48:44`20`20kent
X`20*`20Put`20Bitmap/CopyPlane`20code`20in`20for`20those`20that`20can`20use`20i
Vt.
X`20*`20
X`20*`20Revision`201.21`20`2088/08/10`20`2016:41:08`20`20kent
X`20*`20Changed`20rats`20to`20be`20an`20XImage`20that`20I`20put.`20Fixed`20xor
V`20so`20it`20works`20properly
X`20*`20on`20ANY`20sex`20display.
X`20*`20
X`20*`20Revision`201.20`20`2088/08/10`20`2011:16:55`20`20kent
X`20*`20Eliminated`20use`20of`20keycodes`20in`20input`20event`20mapping.`20
X`20*`20
X`20*`20Revision`201.19`20`2088/08/09`20`2020:19:33`20`20kent
X`20*`20Changed`20the`20mazePixmap`20to`20use`20an`20XImage`20and`20always`20pu
Vt`20the`20bits
X`20*`20remotely.`20Amazingly`20enough,`20the`20performance`20is`20a`20lot`20be
Vtter,`20and
X`20*`20the`20startup`20delay`20is`20a`20lot`20less.
X`20*`20
X`20*`20Revision`201.18`20`2088/08/09`20`2019:42:32`20`20kent
X`20*`20Sped`20up`20arrow`20display`20code`20(HackMazeBitmap).`20Previously`20w
Vas`20creating
X`20*`20a`20Pixmap`20(and`20not`20destroying`20it!)`20every`20time`20--`20costi
Vng`20a`20round`20trip
X`20*`20for`20each`20call.`20Changed`20it`20to`20Create/Put/Destroy`20an`20XIma
Vge,`20which
X`20*`20costs`20a`20little`20locally,`20but`20no`20round`20trips.`20Big`20diffe
Vrence!
X`20*`20
X`20*`20Also`20some`20general`20code`20cleanup.
X`20*`20
X`20*`20Revision`201.17`20`2088/07/25`20`2018:18:27`20`20kent
X`20*`20Switch`20to`20zero-width`20lines.`20Much`20faster.
X`20*`20
X`20*`20Revision`201.16`20`2088/07/25`20`2009:12:40`20`20mikey
X`20*`20cleanup`20source
X`20*`20
X`20*`20Revision`201.15`20`2088/07/25`20`2009:01:54`20`20mikey
X`20*`20Coalesced`20line`20drawing`20requests,`20fixed`20depth`20bugs
X`20*`20
X`20*`20Revision`201.14`20`2088/07/20`20`2011:53:26`20`20mikey
X`20*`20moved`20code`20from`20StartWindow`20to`20InitWindow`20so`20as`20to`20el
Viminate`20timeout
X`20*`20problems`20with`20ratDoctor.
X`20*`20
X`20*`20Revision`201.13`20`2088/06/21`20`2009:24:51`20`20mikey
X`20*`20Fixed`20some`20bugs`20in`20the`20previous`20version.`20`20FocusIn`20doe
Vsn't
X`20*`20do`20anything`20now`20if`20an`20Expose`20event`20is`20in`20the`20queue
V`20at`20all.
X`20*`20
X`20*`20Revision`201.12`20`2088/06/20`20`2016:52:35`20`20mikey
X`20*`20Use`20XCheckIfEvent`20to`20reduce`20duplication`20if`20focusin`20and
V`20expose`20events
X`20*`20follow`20each`20other,`20eliminated`20use`20of`20GXcopyInverted`20and
V`20instead
X`20*`20set`20foreground`20and`20background,`20tried`20to`20eliminate`20buttonp
Vress
X`20*`20effect`20when`20selecting`20window.
X`20*`20
X`20*`20Revision`201.11`20`2088/06/20`20`2010:01:06`20`20mikey
X`20*`20Inverts`20display`20when`20input`20focus`20is`20not`20in`20the`20window
V.`20`20A`20lot`20of
X`20*`20updating...`20maybe`20it`20can`20be`20reduced.
X`20*`20
X`20*`20Revision`201.10`20`2088/06/19`20`2015:16:18`20`20mikey
X`20*`20Handles`2032x32`20bitmap`20for`20X11`20and`20eliminated`20kludges`20for
V`20wm.
X`20*`20Currently`20flashes`20icon`20depending`20on`20input`20focus.`20`20Shoul
Vd
X`20*`20change`20to`20depending`20on`20open/closed.
X`20*`20
X`20*`20Revision`201.9`20`2088/06/17`20`2014:53:12`20`20mikey
X`20*`20Flashing`20icon`20on`20focus`20events
X`20*`20
X`20*`20Revision`201.8`20`2088/06/17`20`2012:48:52`20`20mikey
X`20*`20Icon`20fixed`20for`20color`20(gpx)`20displays.
X`20*`20
X`20*`20Revision`201.7`20`2088/06/17`20`2011:35:41`20`20mikey
X`20*`20fixed`20inverted`20bitmaps`20on`20vs100,`20eliminated`20blob,`20created
V`20icon
X`20*`20for`20monochrome`20wm.`20`20icon`20still`20messed`20for`20gpx.
X`20*`20
X`20*`20Revision`201.6`20`2088/06/17`20`2010:47:31`20`20mikey
X`20*`20undid`20invertDisplay`20because`20of`20problems`20with`20screen`20saver
V`20and`20with
X`20*`20window`20exposure/update.`20`20other`20problems:`20blob`20in`20upperlef
Vt`20of`5C
X`20*`20maze`20on`20vs100,`20inverted`20bitmaps`20on`20vs100,`20unsuccessful
V`20creation
X`20*`20of`2032x32`20icon`20`5Boxmap.
X`20*`20
X`20*`20Revision`201.5`20`2088/06/16`20`2016:09:30`20`20mikey
X`20*`20replaced`20most`20uses`20of`20XCreateBitmap`20with`20XCreatePixmapFromB
VitmapData
X`20*`20to`20solve`20vs100`20problems.`20`20still`20have`20negated-black/white
V`20problems
X`20*`20with`20bitmaps`20and`20vs100.
X`20*`20
X`20*`20Revision`201.4`20`2088/06/16`20`2015:29:55`20`20mikey
X`20*`20disabled`20icon`20flashing,`20fixed`20inverting`20problems,`20still`20h
Vave`20to
X`20*`20fix`20vs100`20bitmap`20display
X`20*`20
X`20*`20Revision`201.3`20`2088/06/15`20`2011:40:05`20`20mikey
X`20*`20before`20trying`20to`20fix`20icon`20window
X`20*`20
X`20*/
X
X#ifndef`09lint
Xstatic`20char`20rcs_ident`5B`5D`20=`20"$Header:`20winX11.c,v`201.30`2089/02/24
V`2016:29:44`20kent`20Exp`20$";
X#endif
X
X#if`20defined(VMS)`20`26`26`20defined(__GNUC__)
X#define`20TYPES_H_DEFINED
X#endif
X#ifdef`20VMS
X#define`20__TIME
X#endif
X
X#include`20<sys/types.h>
X
X#include`20<X11/Xos.h>
X#include`20<X11/Xlib.h>
X#include`20<X11/Xutil.h>
X#include`20<X11/Xatom.h>
X#include`20<X11/Xresource.h>
X#include`20<X11/StringDefs.h>
X
X#include`20<sys/time.h>
X
X#include`20<netinet/in.h>
X
X#include`20<errno.h>
X#include`20<stdio.h>
X#ifdef`20VMS
X#include`20<string.h>
X#else
X#include`20<pwd.h>
X#include`20<strings.h>
X#endif
X
X#include`20"mazewar.h"
X#undef`09Boolean
X
X#include`20<X11/Intrinsic.h>
X
X#define`09VIEW_X_DIM`09400
X#define`09VIEW_Y_DIM`09400
X#define`09VIEW_X_ORIGIN`09100
X#define`09VIEW_Y_ORIGIN`0950
X#define`09MAZE_X_DIM`09(MAZEXMAX*16)
X#define`09MAZE_Y_DIM`09(MAZEYMAX*16)
X#define`09MAZE_X_ORIGIN`0948
X#define`09MAZE_Y_ORIGIN`09451
X#define`09SCORE_X_DIM`09192
X#define`09SCORE_Y_DIM`09((scoreFontInfo->max_bounds.ascent`20+`20scoreFontInfo
V->max_bounds.descent)`20*`20MAXRATS)
X#define`09SCORE_X_ORIGIN`09208
X#define`09SCORE_Y_ORIGIN`09708
X#define`09MIN_X_DIM`09608`09`09/*`20see`20comments`20for`20InitWindow()`20*/
X#define`09MIN_Y_DIM`09SCORE_Y_ORIGIN`09/*`20see`20InitWindow()`20*/
X
X#define`20DEFAULT_FONT`20"-*-Fixed-Medium-R-Normal--13-**-1"
X#define`20DEFAULT_POSITION`20"%dx%d+0+0"`09/*`20upper`20left`20hand`20corner
V`20*/
X
X#define`20ICON_FLASH_PERIOD`204
X
Xshort`09mazeBits`5BMAZEXMAX*MAZEYMAX*16`5D;`09/*`20shorts`20better`20be`2016
V`20bits!`20*/
XWindow`09mwWindow;`09`09`09/*`20parent`20window`20*/
X#ifdef`09USE_BITMAPS
XPixmap`09mazeBitmap;`09`09`09/*`20the`20maze`20*/
XPixmap`09ratsBitmap;`09`09`09/*`20the`20rats`20*/
X#else
XXImage`09*ratsImage;`09`09`09/*`20the`20rats`20*/
XXImage`09*mazeImage;`09`09`09/*`20the`20maze`20*/
X#endif`09USE_BITMAPS
XPixmap`09iconMask;`09`09`09/*`20mask`20for`20icon`20outline`20*/
XXFontStruct`09*scoreFontInfo;
XBoolean`09mapped`20=`09FALSE;`09`09/*`20should`20really`20display?`20*/
XBoolean`09flashIcon`20=`09FALSE;`09`09/*`20should`20icon`20be`20flashing?`20*/
V
XBoolean`09iconInverted`20=`09FALSE;`09`09/*`20icon`20should`20be/is`20inverted
V`20*/
Xint`09displayFD;`09`09`09/*`20fd`20of`20display`20for`20events`20*/
X
XPixel`09`09fg_pixel;`09`09/*`20color`20of`20lines`20and`20such`20*/
XPixel`09`09bg_pixel;`09`09/*`20color`20of`20background`20*/
XPixel`09`09mouseground;`09`09/*`20mouse`20cursor`20color`20*/
XFont`09`09scoreFont;`09`09/*`20font`20for`20printing`20scores`20*/
XPixel`09`09borderColor;
XCardinal`09borderWidth;
X
XDisplay`09*dpy;`09`09`09`09/*`20display`20used`20*/
Xint`09screen;`09`09`09`09/*`20screen`20on`20the`20display`20*/
Xunsigned`20int`09cur_width,`20cur_height;`09/*`20current`20width,`20height`20o
Vf`20window`20*/
XGC`09copyGC,`20xorGC;`09`09`09/*`20graphics`20contexts`20for`20window`20*/
XPixmap`09icon_pixmap,`20iconmask_pixmap;`09/*`20icon,`20mask`20bitmaps`20*/
XPixmap`09icon_reverse_pixmap;
Xint`09icon_flash`20=`200;
XXImage`09*arrowImage;
X
X#include`20"bitmaps/icon.ic"
X#include`20"bitmaps/rat.cur"
X#include`20"bitmaps/ratMask.cur"
X#include`20"bitmaps/dRat.cur"
X#include`20"bitmaps/dRatMask.cur"
X#include`20"bitmaps/cup.cur"
X
Xstatic`20Cursor`09ratCursor,`20deadRatCursor,`20hourGlassCursor;
X
Xextern`20char`09*getenv();
Xextern`20int`09errno;
X
Xstatic`20char`09*progName;
X
XPixmap`09`09xCreateBitmapFromBitCell();
Xstatic`20repaintWindow`20();
Xstatic`20repaintIcon`20();
X
Xstatic`20XrmOptionDescRec`20opTable`5B`5D`20=`20`7B
X`7B"-mouse",`09"*mouseColor",`09XrmoptionSepArg,`09(caddr_t)`20NULL`7D,
X`7D;
X
X#define`09XtNmouse`09"mouse"
X
Xint`09zero`20=`200;
Xint`09one`20=`201;
X
Xstatic`20XtResource`20resources`5B`5D`20=`20`7B
X`09`7BXtNforeground,`20XtCForeground,`20XtRPixel,`20sizeof(Pixel),
X`09`20(Cardinal)`26fg_pixel,`20XtRString,`20"black"`7D,
X`09`7BXtNbackground,`20XtCBackground,`20XtRPixel,`20sizeof(Pixel),
X`09`20(Cardinal)`26bg_pixel,`20XtRString,`20"white"`7D,
X`09`7BXtNmouse,`20XtCCursor,`20XtRPixel,`20sizeof(Pixel),
X`09`20(Cardinal)`26mouseground,`20XtRString,`20"black"`7D,
X`09`7BXtNfont,`20XtCFont,`20XtRFont,`20sizeof(Font),
X`09`20(Cardinal)`26scoreFont,`20XtRString,`20DEFAULT_FONT`7D,`20
X`09`7BXtNborderWidth,`20XtCBorderWidth,`20XtRInt,`20sizeof(int),
X`09`20(Cardinal)`26borderWidth,`20XtRInt,`20(caddr_t)`20`26one`7D,
X`09`7BXtNborder,`20XtCBorderColor,`20XtRPixel,`20sizeof(Pixel),
X`09`20(Cardinal)`26borderColor,`20XtRString,`20"black"`7D,
X`7D;
X
X/*`20
X`20*`20ALL`20COORDINATES`20ASSUME`20ORIGIN`20(0,0)`20AT`20UPPER`20LEFT!
X`20*/
X
X/*`20
X`20*`20Initialize`20the`20window.`20The`20overall`20window`20must`20be`20at
V`20least`20608x`20by
X`20*`20808y`20(the`20size`20of`20the`20Alto`20screen).`20There`20are`20three
V`20distinct
X`20*`20subregions:
X`20*`09A`20400x`20by`20400y`20area`20for`20the`20view,`20beginning`20at`20(100
V,50)
X`20*`09A`20512x`20by`20256y`20area`20for`20the`20maze,`20beginning`20at`20(48,
V`20451)
X`20*`09A`20192x`20by`2096y`20area`20for`20the`20score`20lines,`20at`20(208,
V`20706)
X`20*
X`20*`09Actually,`20the`20y`20dimension`20of`20both`20the`20whole`20window`20an
Vd`20the`20score
X`20*`09subwindow`20must`20be`20enough`20to`20accommodate`20MAXRATS`20lines`20o
Vf`20the
X`20*`09height`20of`20the`20scoreFont.
X`20*/
X
X/*`20parse`20arguments`20and`20set`20up`20window`20state`20*/
X
X#if`20defined(VMS)`20`26`26`20!defined(__GNUC__)
X#define`20rindex`20strrchr
X#endif
X
XInitWindow(argc,`20argv)
Xchar`09**argv;
X`7B
X`09XGCValues`20gc_values;
X`09XWMHints`20wmhints;
X`09Widget`09w;
X`09XClassHint`09classHint;
X`09GC`09iconGC;
X
X`09progName`20=`20rindex(argv`5B0`5D,`20'/');
X`09if`20(progName)
X`09`09progName++;
X`09else
X`09`09progName`20=`20argv`5B0`5D;
X
X`09/*
X`09`20*`20We`20cheat`20here`20by`20using`20the`20Toolkit`20to`20do`20the`20ini
Vtialization`20work.
X`09`20*`20We`20just`20ignore`20the`20top-level`20widget`20that`20gets`20create
Vd.
X`09`20*/
X
X`09w`20=`20XtInitialize("mazewar",`20"mazewar",`20opTable,`20XtNumber(opTable)
V,`20
X`09`09`09`26argc,`20argv);
X
X`09dpy`20=`20XtDisplay(w);
X`09screen`20=`20DefaultScreen(dpy);
X
X`09XtGetApplicationResources(w,`20(caddr_t)`20NULL,`20resources,`20
X`09`09`09`09XtNumber(resources),`20NULL,`20(Cardinal)`200);
X`09
X`09if`20(!scoreFont)
X`09`09MWError("cannot`20open`20font");
X`09scoreFontInfo`20=`20XQueryFont(dpy,`20scoreFont);
X
X`20`20`20`20`20`20`20`20cur_width`20=`20MIN_X_DIM;
X`20`20`20`20`20`20`20`20cur_height`20=`20MIN_Y_DIM`20+`20(MAXRATS+1)`20*
X`09`20`20`20`20`20`20`20`20`20`20`20`20`20(scoreFontInfo->max_bounds.ascent
V`20+
X`09`09`20`20`20`20`20`20scoreFontInfo->max_bounds.descent);
X
X`09mwWindow`20=`20XCreateSimpleWindow(dpy,`20
X`09`09`09`09`09RootWindow(dpy,`20screen),
X`09`09`09`09`090,`200,`20
X`09`09`09`09`09cur_width,`20cur_height,
X`09`09`09`09`09borderWidth,`200,`20bg_pixel);
X`09XStoreName(dpy,`20mwWindow,`20"MazeWar");
X`09XSetIconName(dpy,`20mwWindow,`20"MazeWar");
X`09classHint.res_name`20=`20"mazewar";
X`09classHint.res_class`20=`20"mazewar";
X`09XSetClassHint(dpy,`20mwWindow,`20`26classHint);
X
X`09gc_values.function`20=`20GXcopy;
X`09gc_values.foreground`20=`20fg_pixel;
X`09gc_values.background`20=`20bg_pixel;
X`09gc_values.font`20=`20scoreFont;
X`09gc_values.line_width`20=`200;
X`09copyGC`20=`20XCreateGC(dpy,`20mwWindow,
X`09`09`20`20`20`20`20`20`20GCFunction`20`7C`20GCForeground`20`7C`20GCBackgroun
Vd
X`09`09`20`20`20`20`20`20`20`7C`20GCLineWidth`20`7C`20GCFont,
X`09`09`20`20`20`20`20`20`20`26gc_values);
X
X`09gc_values.function`20=`20GXxor;
X`09gc_values.plane_mask`20=`20AllPlanes;
X`09gc_values.foreground`20=`20fg_pixel`20`5E`20bg_pixel;
X`09gc_values.background`20=`200;
X`09xorGC`20=`20XCreateGC(dpy,`20mwWindow,
X`09`09`20`20`20`20`20`20`20GCFunction`20`7C`20GCForeground`20`7C`20GCBackgroun
Vd`20`7C`20GCPlaneMask,
X`09`09`20`20`20`20`20`20`20`26gc_values);
X
X`09icon_pixmap`20=`20XCreatePixmapFromBitmapData(
X`09`09`09dpy,`20mwWindow,`20
X`09`09`09icon_bits,`20
X`09`09`09icon_width,`20icon_height,`20
X`09`09`09fg_pixel,`20bg_pixel,`20
X`09`09`09XDefaultDepth(dpy,`20screen));
X
X`09/*`20is`20this`20even`20used?`20*/
X`09gc_values.function`20=`20GXclear;
X`09gc_values.plane_mask`20=`20AllPlanes;
X`09iconGC`20=`20XCreateGC(dpy,`20mwWindow,`20
X`09`09`09GCFunction`20`7C`20GCPlaneMask,`20
X`09`09`09`26gc_values);
X`09iconmask_pixmap`20=`20XCreatePixmap(dpy,`20mwWindow,
X`09`09`09`09`09icon_width,`20icon_height,`20
X`09`09`09`09`09XDefaultDepth(dpy,`20screen));
X`09XFillRectangle(dpy,`20iconmask_pixmap,`20iconGC,`200,`200,
X`09`09`09icon_width,`20icon_height);
X
X`09icon_reverse_pixmap`20=`20XCreatePixmapFromBitmapData(dpy,`20mwWindow,
X`09`09`09`09`09`09`20`20icon_bits,
X`09`09`09`09`09`09`20`20icon_width,`20icon_height,
X`09`09`09`09`09`09`20`20bg_pixel,`20fg_pixel,`20
X`09`09`09`09`09`09`20`20XDefaultDepth(dpy,`20screen));
X
X`20`20`20`20`20`20`20`20wmhints.flags`20=`20IconPixmapHint`20`7C`20IconMaskHin
Vt;
X`20`20`20`20`20`20`20`20wmhints.icon_pixmap`20=`20icon_pixmap;
X`20`20`20`20`20`20`20`20wmhints.icon_mask`20=`20iconmask_pixmap;
X`20`20`20`20`20`20`20`20XSetWMHints(dpy,`20mwWindow,`20`26wmhints);
X
X`09initCursors();
X`09arrowImage`20=`20XCreateImage(dpy,`20DefaultVisual(dpy,`20DefaultScreen(dpy
V)),
X`09`09`09`091,`20XYBitmap,`200,`20NULL,`20
X`09`09`09`0916,`2016,`208,`202);
X`09arrowImage->byte_order`20=`20MSBFirst;
X`09arrowImage->bitmap_bit_order`20=`20MSBFirst;
X`7D
X
X/*`20
X`20*`20actually`20start`20the`20display`20up,`20after`20all`20the`20user`20int
Veraction`20has
X`20*`20been`20done.
X`20*/
X
XStartWindow(ratBits,`20ratWidth,`20ratHeight)
Xshort`09*ratBits;
X`7B
X`09XSelectInput(dpy,`20mwWindow,`20KeyPressMask`20`7C`20ButtonPressMask`20`7C
X`09`09`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20`20ButtonReleas
VeMask`20`7C`20`20ExposureMask`20`7C
X`09`09`09`09`20`20`20`20StructureNotifyMask`20`7C`20FocusChangeMask);
X`09HourGlassCursor();
X
X`09initMaze();
X`09SwapBitmaps();
X
X`09displayFD`20=`20XConnectionNumber(dpy);
X
X`09XMapWindow(dpy,`20mwWindow);`09`09/*`20Map`20window`20to`20screen`20*/
X`09initRats(ratBits,`20ratWidth,`20ratHeight);
X`7D
X
X/*
X`20*`20Shut`20down`20the`20window`20system,`20resetting`20any`20terminal`20mod
Ves`20or`20what
X`20*`20have`20you`20that`20may`20have`20been`20altered.`20No-op`20for`20X11.
X`20*/
X
XStopWindow()
X`7B
X`09
X`7D
X
X/*`20
X`20*`20Clear`20out`20the`20view`20subwindow.`20If`20possible,`20delay`20the
V`20visible`20effect
X`20*`20until`20all`20the`20lines`20have`20been`20drawn`20(since`20this`20is
V`20only`20called`20by
X`20*`20ShowView(),`20which`20is`20about`20to`20draw`20a`20bunch`20of`20lines).
V
X`20*/
X
XClearView()
X`7B
X`09XClearArea(dpy,`20mwWindow,`20VIEW_X_ORIGIN,`20VIEW_Y_ORIGIN,
X`09`09`20`20`20`20`20`20`20VIEW_X_DIM,`20VIEW_Y_DIM,`20False);
X`7D
X
X/*
X`20*`20Flash`20the`20view`20window`20to`20indicate`20a`20hit`20on`20an`20oppon
Vent.
X`20*/
X
XFlashTop()
X`7B
X`09XFillRectangle(dpy,`20mwWindow,`20xorGC,`20
X`09`09VIEW_X_ORIGIN,`20VIEW_Y_ORIGIN,`20
X`09`09VIEW_X_DIM,`20VIEW_Y_DIM);
X`09XFlush(dpy);
X
X`09/*`20might`20want`20some`20delay`20here`20*/
X
X`09XFillRectangle(dpy,`20mwWindow,`20xorGC,`20
X`09`09VIEW_X_ORIGIN,`20VIEW_Y_ORIGIN,`20
X`09`09VIEW_X_DIM,`20VIEW_Y_DIM);
X`09XFlush(dpy);
X`7D
X
X/*
X`20*`20Flash`20the`20whole`20window`20to`20indicate`20we`20were`20hit.
X`20*/
X
XFlashScreen()
X`7B
X`09XFillRectangle(dpy,`20mwWindow,`20xorGC,`200,`200,`20cur_width,`20cur_heigh
Vt);
X`09XFlush(dpy);
X
X`09/*`20might`20want`20some`20delay`20here`20*/
X
X`09XFillRectangle(dpy,`20mwWindow,`20xorGC,`200,`200,`20cur_width,`20cur_heigh
Vt);
X`09XFlush(dpy);
X`7D
X
X/*`20
X`20*`20Draw`20a`20line`20in`20the`20view`20subwindow.`20Don't`20show`20it`20ri
Vght`20away`20if`20possible.
X`20*/
X
XDrawViewLine(x1,`20y1,`20x2,`20y2)
X`7B
X`09XDrawLine(dpy,`20mwWindow,`20copyGC,`20x1+VIEW_X_ORIGIN,`20y1+VIEW_Y_ORIGIN
V,
X`09`09`20`20x2+VIEW_X_ORIGIN,`20y2+VIEW_Y_ORIGIN);
X`7D
X
X#ifdef`20VMS
X#include`20<vms/inetiodef.h>
X#include`20<ssdef.h>
X#include`20<sys/socket.h>
Xconst`20int`20net_efn`20=`2010;
Xstatic`20int`20input_inited`20=`200;
Xstatic`20struct`20`7B
X`20`20short`20stat;
X`20`20short`20len;
X`20`20int`20x;
X`7D`20net_iosb;
X
Xvoid`20arm_net_input`20(int`20socket)
X`7B
X`20`20int`20stat;
X`20`20static`20char`20buffer`5B1024`5D;
X
X`20`20sys$clref`20(net_efn);
X`20`20stat`20=`20sys$qio`20(net_efn,`20socket,`20IO$_RECEIVE,`20`26net_iosb,
V`200,`200,
X`09`09`20`20buffer,`20sizeof`20(buffer),`20MSG_PEEK,`200,`200,`200);
X`20`20if`20((stat`261)`20==`200)`20lib$signal`20(stat);
X`7D
X
X#endif
X
X/*`20
X`20*`20Event`20handling.`20Presents`20a`20uniform`20event`20interface`20to`20t
Vhe`20game,`20and
X`20*`20handles`20all`20other`20events`20in`20here.`20The`20game`20only`20sees
V`20the`20events
X`20*`20that`20affect`20it`20directly,`20as`20defined`20in`20mazewar.h.`20They
V`20are:
X`20*
X`20*`09keypresses`20that`20affect`20the`20game
X`20*`09mouse`20button`20clicks
X`20*`09incoming`20network`20packets
X`20*`09timeouts`20(there's`20a`20"heartbeat"`20to`20drive`20the`20shot`20clock
V)
X`20*
X`20*`20All`20other`20events`20should`20be`20swallowed`20by`20this`20routine.
V`20Also,`20since
X`20*`20keyboard`20focus`20is`20dependent`20on`20the`20mouse`20being`20in`20the
V`20game`20window,
X`20*`20try`20to`20let`20the`20user`20know`20that`20he's`20wandered`20outside
V`20the`20window
X`20*`20by`20inverting`20the`20window`20(should`20make`20it`20obvious)`20and
V`20is`20now`20vulnerable
X`20*`20and`20defenseless.
X`20*/
X
Xvoid
XNextEvent(event)
XMWEvent`09*event;
X`7B
X`09int`09fdmask;
X`09XEvent`09xev;
X`09struct`20timeval`20timeout;
X`09int`09ret;
X`09char`09c`20=`200;
X
X#ifdef`20VMS
X`09int`20efn_mask;
X`20`20`20if`20(!input_inited)`20`7B
X`20`20`20`20`20arm_net_input`20(M.theSocket);
X`20`20`20`20`20input_inited`20=`201;
X`20`20`20`7D
X#endif
X
X`20`20`20`20while`20(1)`20`7B
X`09icon_flash`20=`20(++icon_flash)`20%`20ICON_FLASH_PERIOD;
X
X`09if`20(!XPending(dpy))`09/*`20this`20does`20an`20XFlush,`20too`20*/
X`09`09if`20(flashIcon`20`26`26`20!icon_flash`20`26`26`20!mapped)`20`7B
X`09`09`09/*`20invert`20the`20icon`20`20*/
X`09`09`09iconInverted`20=`20!iconInverted;
X`09`09`09repaintIcon();
X`09`09`7D
X
X`09/*
X`09`20*`20Look`20for`20events.`20`20Try`20to`20arrange`20that`20X`20events`20h
Vave`20priority`20over
X`09`20*`20network`20traffic.`20`20See`20if`20there's`20an`20X`20event`20pendin
Vg.`20`20If`20so,`20check
X`09`20*`20for`20a`20net`20event,`20too;`20if`20not,`20select`20on`20both`20the
V`20network`20and`20the`20X
X`09`20*`20connection.`20`20If`20that`20doesn't`20time`20out,`20but`20there's
V`20no`20X`20event
X`09`20*`20pending,`20try`20again,`20just`20selecting`20on`20the`20X`20connecti
Von.`20`20If`20that
X`09`20*`20times`20out,`20let`20the`20network`20event`20get`20processed.
X`09`20*
X`09`20*`20Can't`20just`20select`20on`20the`20two`20fds,`20because`20there`20ma
Vy`20be`20X`20events
X`09`20*`20pending`20in`20the`20queue`20that`20have`20already`20been`20read.
X`09`20*
X`09`20*`20This`20may`20look`20baroque,`20but`20we've`20seen`20some`20instances
V`20where`20X`20server
X`09`20*`20latency`20seems`20to`20let`20the`20network`20events`20take`20priorit
Vy`20over`20sever
X`09`20*`20events,`20leading`20to`20sluggish`20keyboard`20response`20and`20lots
V`20of`20local
X`09`20*`20death.
X`09`20*
X`09`20*`20Also,`20can't`20just`20ignore`20network`20events`20--`20if`20the`20s
Verver`20is`20slow`20and
X`09`20*`20lots`20of`20X`20events`20get`20queued,`20someone`20else's`20ratDocto
Vr`20will`20time`20you
X`09`20*`20out`20if`20you`20never`20answer.
X`09`20*/
X
X`09if`20(!XPending(dpy))`20`7B
X#ifdef`20VMS
X`09`20`20`20`20`20`20`20`20ret`20=`20XMultiplexInput`20(1,`20`26dpy,`201<<net_
Vefn,`20500,`200,`20`26efn_mask);
X`09`09if`20(ret`20<`200)
X`09`09`20`20MWError`20("XMultiplexInput`20error");
X#else
X`09`09fdmask`20=`20(1`20<<`20displayFD)`20`7C`20(1`20<<`20M.theSocket);
X`09`09timeout.tv_sec`20=`200;
X`09`09timeout.tv_usec`20=`20500000;
X`09`09while`20((ret`20=`20select(32,`20`26fdmask,`20NULL,`20NULL,`20`26timeout
V))`20==`20-1)
X`09`09`09if`20(errno`20!=`20EINTR)
X`09`09`09`09MWError("select`20error`20on`20events");
X#endif
X`09`09if`20(ret`20==`200)`20`7B
X`09`09`09event->eventType`20=`20EVENT_TIMEOUT;
X`09`09`09return;
X`09`09`7D
X`09`7D`20else`20`7B
X#ifndef`20VMS
X`09`09fdmask`20=`201`20<<`20M.theSocket;
X`09`09timeout.tv_sec`20=`200;
X`09`09timeout.tv_usec`20=`200;
X`09`09while`20((ret`20=`20select(32,`20`26fdmask,`20NULL,`20NULL,`20`26timeout
V))`20==`20-1)
X`09`09`09if`20(errno`20!=`20EINTR)
X`09`09`09`09MWError("select`20error`20on`20events");
X#endif
X`09`7D
X`09if`20(XPending(dpy))`20`7B
X`09`09XNextEvent(dpy,`20`26xev);
X`09`09switch`20(xev.type)`20`7B
X`09`09case`20KeyPress:
X`09`09`09event->eventType`20=`200;
X`09`09`09XLookupString((XKeyEvent`20*)`20`26xev,`20`26c,`201,`20
X`09`09`09`09`09NULL,`20NULL);
X`09`09`09
X`09`09`09switch(c)`20`7B
X`09`09`09case`20'a':
X`09`09`09case`20'4':`09/*`20keypad`20*/
X`09`09`09`09event->eventType`20=`20EVENT_A;
X`09`09`09`09return;
X
X`09`09`09case`20's':
X`09`09`09case`20'5':
X`09`09`09`09event->eventType`20=`20EVENT_S;
X`09`09`09`09return;
X
X`09`09`09case`20'd':
X`09`09`09case`20'6':
X`09`09`09`09event->eventType`20=`20EVENT_D;
X`09`09`09`09return;
X
X`09`09`09case`20'f':
X`09`09`09case`20',':
X`09`09`09`09event->eventType`20=`20EVENT_F;
X`09`09`09`09return;
X
X`09`09`09case`20'`20':
X`09`09`09case`20'`5C033':`09/*`20ESC`20lead`20in`20of`20arrow`20*/
X`09`09`09`09event->eventType`20=`20EVENT_BAR;
X`09`09`09`09return;
X
X`09`09`09case`20'i':
X`09`09`09`09event->eventType`20=`20EVENT_I;
X`09`09`09`09return;
X
X`09`09`09case`20'k':
X`09`09`09`09event->eventType`20=`20EVENT_K;
X`09`09`09`09return;
X
X`09`09`09case`20'o':
X`09`09`09`09event->eventType`20=`20EVENT_O;
X`09`09`09`09return;
X
X`09`09`09case`20'l':
X`09`09`09`09event->eventType`20=`20EVENT_L;
X`09`09`09`09return;
X
X`09`09`09case`20'q':
X`09`09`09case`20'`5C177':`09/*`20DEL`20*/
X`09`09`09case`20'`5C003':`09/*`20`5EC`20*/
X`09`09`09`09event->eventType`20=`20EVENT_INT;
X`09`09`09`09return;
X`09`09`09`7D
X`09`09`09break;
X
X#define`09RightButton`09Button3
X#define`09MiddleButton`09Button2
X#define`09LeftButton`09Button1
X`09`09case`20ButtonPress:
X`09`09`09event->eventType`20=`200;
X`09`09`09switch(((XButtonPressedEvent`20*)`20
X`09`09`09`09`26xev)->button`20`26`200xff)`20`7B
X`09`09`09case`20RightButton:
X`09`09`09`09event->eventType`20=`20EVENT_RIGHT_D;
X`09`09`09`09return;
X
X`09`09`09case`20MiddleButton:
X`09`09`09`09event->eventType`20=`20EVENT_MIDDLE_D;
X`09`09`09`09return;
X
X`09`09`09case`20LeftButton:
X`09`09`09`09event->eventType`20=`20EVENT_LEFT_D;
X`09`09`09`09return;
X`09`09`09`7D
X`09`09`09break;
X
X`09`09case`20ButtonRelease:
X`09`09`09event->eventType`20=`200;
X`09`09`09switch(((XButtonReleasedEvent`20*)`20
X`09`09`09`09`26xev)->button`260xff)`20`7B
X`09`09`09case`20RightButton:
X`09`09`09`09event->eventType`20=`20EVENT_RIGHT_U;
X`09`09`09`09return;
X
X`09`09`09case`20LeftButton:
X`09`09`09`09event->eventType`20=`20EVENT_LEFT_U;
X`09`09`09`09return;
X`09`09`09`7D
X`09`09`09break;
X
X`09`09case`20Expose:
X`09`09`09repaintWindow();
X`09`09`09break;
X
X`09`09case`20FocusIn:
X`09`09case`20MapNotify:
X`09`09`09mapped`20=`20TRUE;
X`09`09`09iconInverted`20=`20FALSE;
X`09`09`09flashIcon`20=`20FALSE;
X`09`09`09repaintIcon();
X`09`09`09break;
X
X`09`09case`20FocusOut:
X`09`09case`20UnmapNotify:
X`09`09`09mapped`20=`20FALSE;
X`09`09`09break;
X`09`09`7D
X`09`7D
X
X#ifdef`20VMS
X`09if`20(sys$readef`20(net_efn,`20`26efn_mask)`20==`20SS$_WASSET)`20`7B
X#else
X`09if`20(fdmask`20`26`20(1`20<<`20M.theSocket))`20`7B
X#endif
X`09`09int`20fromLen`20=`20sizeof(event->eventSource);
X`09`09int`20cc;
X
X`09`09event->eventType`20=`20EVENT_NETWORK;
X`09`09cc`20=`20recvfrom(M.theSocket,`20event->eventDetail,
X`09`09`09sizeof(RatPacket),`200,`20`26event->eventSource,`20`26fromLen);
X#ifdef`20VMS
X`09`09arm_net_input`20(M.theSocket);
X#endif
X`09`09if`20(cc`20<=`200)`20`7B
X`09`09`09if`20(cc`20<`200`20`26`26`20errno`20!=`20EINTR)
X`09`09`09`09perror("event`20recvfrom");
X`09`09`09continue;
X`09`09`7D
X`09`09if`20(fromLen`20!=`20sizeof(struct`20sockaddr_in))
X`09`09`09continue;
X`09`09ConvertIncoming(event->eventDetail);
X`09`09return;
X`09`7D
X`20`20`20`20`7D
X`7D
X
X
X/*`20
X`20*`20Peek`20to`20see`20if`20there's`20a`20keyboard`20event`20waiting,`20in
V`20case`20the
X`20*`20program`20wants`20to`20short-circuit`20some`20code.`20If`20your`20syste
Vm`20won't`20let
X`20*`20you`20implement`20this`20feature`20easily,`20just`20always`20return`20F
VALSE.
X`20*/
X
XBoolean
XKBEventPending()
X`7B
X`20`20`20`20`20`20`20`20return`20(XPending(dpy)`20!=`200);
X`7D
X
X/*`20Please`20stand`20by`20...`20*/
X
XHourGlassCursor()
X`7B
X`09XDefineCursor(dpy,`20mwWindow,`20hourGlassCursor);
X`09XFlush(dpy);
X`7D
X
X/*`20Let`20the`20games`20begin!`20*/
XRatCursor()
X`7B
X`09XDefineCursor(dpy,`20mwWindow,`20ratCursor);
X`09XFlush(dpy);
X`7D
X
X/*`20He's`20dead,`20Jim`20...`20or`20might`20be`20*/
XDeadRatCursor()
X`7B
X`09XDefineCursor(dpy,`20mwWindow,`20deadRatCursor);
X`09XFlush(dpy);
X`7D
X
X/*`20
X`20*`20Update`20the`20displayed`20bitmap.`20Would`20really`20like`20to`20store
V`20the`20arrow`20bitmaps
X`20*`20remotely,`20but`20the`20non-normal`20ones`20(especially`20otherArrows)
V`20may`20change.`20
X`20*/
X
XHackMazeBitmap(x,`20y,`20newBits)
XBitCell`20*newBits;
X`7B
X`09arrowImage->data`20=`20(char`20*)newBits;
X`09XPutImage(dpy,`20mwWindow,`20copyGC,`20arrowImage,`200,`200,`20
X`09`09`09`20`20x*16`20+`20MAZE_X_ORIGIN,`20y*16`20+`20MAZE_Y_ORIGIN,`20
X`09`09`09`20`2016,`2016);
X`7D
X
X/*
X`20*`20Display`20a`20rat.`20`20Width,`20height,`20srcX`20and`20srcY`20describe
V`20the`20subbitmap`20in`20the
X`20*`20rats`20bitmap`20that`20is`20the`20desired`20view`20of`20the`20opponent.
V
X`20*/
X
XDisplayRatBitmap(screenX,`20screenY,`20width,`20height,`20srcX,`20srcY)
X`7B
X#ifdef`09USE_BITMAPS
X`09XCopyPlane(dpy,`20ratsBitmap,`20mwWindow,`20xorGC,`20srcX,`20srcY,
X`09`09`20`20width,`20height,
X`09`09`20`20screenX+VIEW_X_ORIGIN,`20screenY+VIEW_Y_ORIGIN,`201);
X#else
X`09XPutImage(dpy,`20mwWindow,`20xorGC,`20ratsImage,`20srcX,`20srcY,`20
X`09`09`20`20screenX+VIEW_X_ORIGIN,`20screenY+VIEW_Y_ORIGIN,
X`09`09`20`20width,`20height);
X#endif`09USE_BITMAPS
X`7D
X
X/*`20
X`20*`20Display`20the`20score`20line`20for`20the`20indicated`20player.`20Name
V`20is`20left
X`20*`20justified,`20score`20is`20right`20justified`20within`20the`20score`20wi
Vndow.
X`20*/
X
XWriteScoreString(rat)
XRatId`09rat;
X`7B
X`09char`09buf`5B64`5D;
X`09int`09leftEdge;
X
X`09sprintf(buf,`20"%d",`20(unsigned`20int)`20M.ratcb.rats`5Brat`5D.score);
X
X`09XClearArea(dpy,`20mwWindow,`20SCORE_X_ORIGIN,
X`09`09`20`20`20SCORE_Y_ORIGIN`20+
X`09`09`20`20`20rat`20*`20(scoreFontInfo->max_bounds.ascent`20+
X`09`09`09`20`20scoreFontInfo->max_bounds.descent),
X`09`09`20`20`20SCORE_X_DIM,
X`09`09`20`20`20(scoreFontInfo->max_bounds.ascent`20+
X`09`09`20`20`20`20scoreFontInfo->max_bounds.descent),
X`09`09`20`20`20FALSE);
X`09XDrawImageString(dpy,`20mwWindow,`20copyGC,`20SCORE_X_ORIGIN,
X`09`09`09`20SCORE_Y_ORIGIN`20+
X`09`09`09`20rat`20*`20(scoreFontInfo->max_bounds.ascent`20+
X`09`09`09`09scoreFontInfo->max_bounds.descent)`20+
X`09`09`09`20scoreFontInfo->max_bounds.ascent,
X`09`09`09`20M.ratcb.rats`5Brat`5D.name,`20strlen(M.ratcb.rats`5Brat`5D.name));
V
X`09leftEdge`20=`20SCORE_X_DIM`20-`20XTextWidth(scoreFontInfo,`20buf,`20strlen(
Vbuf));
X`09XDrawImageString(dpy,`20mwWindow,`20copyGC,`20leftEdge+SCORE_X_ORIGIN,
X`09`09`09`20SCORE_Y_ORIGIN`20+
X`09`09`09`20rat`20*`20(scoreFontInfo->max_bounds.ascent`20+
X`09`09`09`09scoreFontInfo->max_bounds.descent)`20+
X`09`09`09`20scoreFontInfo->max_bounds.ascent,
X`09`09`09`20buf,`20strlen(buf));
X`7D
X
X/*`20
X`20*`20Clear`20out`20the`20score`20line`20for`20a`20player`20that's`20left`20t
Vhe`20game.
X`20*/
X
XClearScoreLine(rat)
XRatId`09rat;
X`7B
X`09XClearArea(dpy,`20mwWindow,`20SCORE_X_ORIGIN,
X`09`09`20`20`20`20`20`20`20SCORE_Y_ORIGIN`20+
X`09`09`20`20`20`20`20`20`20rat`20*`20(scoreFontInfo->max_bounds.ascent`20+
X`09`09`09`20`20`20`20`20`20scoreFontInfo->max_bounds.descent),
X`09`09`20`20`20`20`20`20`20SCORE_X_DIM,
X`09`09`20`20`20`20`20`20`20scoreFontInfo->max_bounds.ascent`20+
X`09`09`20`20`20`20`20`20`20`20`20scoreFontInfo->max_bounds.descent,`20False);
X`7D
X
X/*`20
X`20*`20Pretty`20obvious,`20eh?`20Means`20the`20guy's`20in`20sight.
X`20*/
X
XInvertScoreLine(rat)
XRatId`09rat;
X`7B
X`09XFillRectangle(dpy,`20mwWindow,`20xorGC,`20
X`09`09`20`20SCORE_X_ORIGIN,
X`09`09`20`20SCORE_Y_ORIGIN`20+
X`09`09`20`20rat`20*`20(scoreFontInfo->max_bounds.ascent`20+
X`09`09`09`20scoreFontInfo->max_bounds.descent),
X`09`09`20`20SCORE_X_DIM,
X`09`09`20`20scoreFontInfo->max_bounds.ascent`20+
X`09`09`20`20scoreFontInfo->max_bounds.descent);
X`7D
X
X/*`20
X`20*`20Let`20the`20user`20know`20that`20a`20new`20player`20joined.`20This`20re
Vally`20should`20only
X`20*`20take`20effect`20if`20the`20window`20is`20iconic,`20so`20you`20can`20kee
Vp`20a`20game`20around
X`20*`20all`20day,`20close`20it`20up`20when`20there's`20no`20activity,`20and
V`20know`20when
X`20*`20someone`20else`20is`20also`20out`20to`20kill`20some`20time.
X`20*/
X
XNotifyPlayer()
X`7B
X`09flashIcon`20=`20TRUE;
X`7D
X
X/*
X`20*`20END`20PUBLIC`20ROUTINES
X`20*/
X
X/*`20set`20up`20needed`20bitmaps`20in`20the`20server`20*/
X
XinitCursors()
X`7B
X`20`20`20`20`20`20`20`20Pixmap`09p,`20m;
X`09XColor`09mc,`20bc;
X
X`09mc.pixel`20=`20mouseground;
X`09bc.pixel`20=`20bg_pixel;
X`09mc.flags`20=`20DoRed`20`7C`20DoGreen`20`7C`20DoBlue;
X`09bc.flags`20=`20DoRed`20`7C`20DoGreen`20`7C`20DoBlue;
X`09XQueryColor(dpy,`20DefaultColormap(dpy,`20screen),`20`26mc);
X`09XQueryColor(dpy,`20DefaultColormap(dpy,`20screen),`20`26bc);
X
X`09m`20=`20XCreateBitmapFromData(dpy,`20mwWindow,`20
X`09`09(char`20*)ratMask_bits,`20
X`09`09ratMask_width,`20ratMask_height);
X`09p`20=`20XCreateBitmapFromData(dpy,`20mwWindow,`20
X`09`09(char`20*)rat_bits,`20
X`09`09rat_width,`20rat_height);
X`09ratCursor`20=`20XCreatePixmapCursor(dpy,`20p,`20m,`20`26mc,`20`26bc,`20
X`09`09rat_x_hot,`20rat_y_hot);
X
X`09m`20=`20XCreateBitmapFromData(dpy,`20mwWindow,`20
X`09`09(char`20*)dRatMask_bits,`20
X`09`09dRatMask_width,`20dRatMask_height);
X`09p`20=`20XCreateBitmapFromData(dpy,`20mwWindow,`20
X`09`09(char`20*)dRat_bits,`20
X`09`09dRat_width,`20dRat_height);
X`09deadRatCursor`20=`20XCreatePixmapCursor(dpy,`20p,`20m,`20`26mc,`20`26bc,
V`200,`200);
X
X`09p`20=`20XCreateBitmapFromData(dpy,`20mwWindow,`20
X`09`09(char`20*)cup_bits,
X`09`09cup_width,`20cup_height);
X`09hourGlassCursor`20=`20XCreatePixmapCursor(dpy,`20p,`20p,`20`26mc,`20`26bc,
V`200,`200);
X`7D
X
X/*
X`20*`20construct`20an`20XImage`20of`20the`20maze.
X`20*/
X
XinitMaze()
X`7B
X`09register`20int`09i,`20j,`20k,`20line,`20index;
X
X`09for`20(i`20=`200;`20i`20<`20MAZEYMAX;`20i++)`20`7B
X`09`09line`20=`20i`20*`20MAZEXMAX`20*`20MAZEYMAX;
X`09`09for`20(j`20=`200;`20j`20<`20MAZEXMAX;`20j++)`20`7B
X`09`09`09index`20=`20line`20+`20j;
X`09`09`09for`20(k`20=`200;`20k`20<`2016;`20k++)`20`7B
X`09`09`09`09if`20(M.maze`5Bj`5D.y`5Bi`5D)
X`09`09`09`09`09mazeBits`5Bindex`5D`20=`200177777;
X`09`09`09`09else
X`09`09`09`09`09mazeBits`5Bindex`5D`20=`200;
X`09`09`09`09index`20+=`2032;
X`09`09`09`7D
X`09`09`09`09`09
X`09`09`7D
X`09`7D
X
X#ifdef`09USE_BITMAPS
X`09mazeBitmap`20=`20xCreateBitmapFromBitCell(dpy,`20mwWindow,`20(char`20*)`20m
VazeBits,
X`09`09`09`09`09MAZE_X_DIM,`20MAZE_Y_DIM);
X`09if`20(mazeBitmap`20==`200)
X#else
X`09mazeImage`20=`20XCreateImage(dpy,`20DefaultVisual(dpy,`20DefaultScreen(dpy)
V),
X`09`09`09`091,`20XYBitmap,`200,`20(char`20*)mazeBits,`20
X`09`09`09`09MAZE_X_DIM,`20MAZE_Y_DIM,`208,`20MAZE_X_DIM>>3);
X`09mazeImage->byte_order`20=`20MSBFirst;
X`09mazeImage->bitmap_bit_order`20=`20MSBFirst;
X
X`09if`20(mazeImage`20==`200)
X#endif`09USE_BITMAPS
X`09`09MWError("Can't`20create`20maze`20Pixmap");
X`7D
X
X/*
X`20*`20actually`20put`20the`20maze`20Pixmap`20on`20the`20screen.`20
X`20*/
X
XdrawMaze()
X`7B
X#ifdef`09USE_BITMAPS
X`09XCopyPlane(dpy,`20mazeBitmap,`20mwWindow,`20copyGC,`200,`200,`20
X`09`09`09MAZE_X_DIM,`20MAZE_Y_DIM,`20
X`09`09`09MAZE_X_ORIGIN,`20MAZE_Y_ORIGIN,`201);
X#else
X`09XPutImage(dpy,`20mwWindow,`20copyGC,`20mazeImage,`200,`200,`20
X`09`09`09MAZE_X_ORIGIN,`20MAZE_Y_ORIGIN,
X`09`09`09MAZE_X_DIM,`20MAZE_Y_DIM);
X#endif`09USE_BITMAPS
X`7D
X
X/*
X`20*`20Create`20the`20bitmap`20of`20the`20rats`20for`20later`20use.
X`20*/
X
XinitRats(bits,`20width,`20height)
Xshort`20*bits;
X`7B
X#ifdef`09USE_BITMAPS
X`09ratsBitmap`20=`20xCreateBitmapFromBitCell(dpy,`20mwWindow,`20(char`20*)`20b
Vits,`20
X`09`09`09`09`09width,`20height);
X`09if`20(ratsBitmap`20==`200)
X#else
X`09ratsImage`20=`20XCreateImage(dpy,`20DefaultVisual(dpy,`20DefaultScreen(dpy)
V),
X`09`09`09`091,`20XYBitmap,`200,`20(char`20*)`20bits,
X`09`09`09`09width,`20height,`208,`20width>>3);
X`09ratsImage->byte_order`20=`20MSBFirst;
X`09ratsImage->bitmap_bit_order`20=`20MSBFirst;
X
X`09if`20(ratsImage`20==`200)
X#endif`09USE_BITMAPS
X`09`09MWError("Can't`20create`20rats");
X`7D
X
X/*
X`20*`20Repaint`20the`20window`20for`20exposure`20and`20resize`20events.`20All
V`20drawing`20is
X`20*`20done`20here,`20even`20though`20there`20are`20times`20during`20the`20ini
Vtialization
X`20*`20code`20when`20it`20would`20seem`20obvious`20to`20put`20some`20of`20the
V`20display`20up;`20this
X`20*`20way`20portions`20of`20the`20display`20aren't`20shown`20twice`20then.
X`20*/
X
Xstatic
XrepaintWindow()
X`7B
X`09drawMaze();
X`09ShowPosition(M.xloc,`20M.yloc,`20M.invincible,`20M.dir);
X`09ShowView(M.xloc,`20M.yloc,`20M.dir);
X`09ShowAllPositions();
X
X`09NewScoreCard();
X`09XFlush(dpy);
X`7D
X
X/*`20
X`20*`20Repaint`20the`20icon`20for`20exposure`20events,`20or`20while`20flashing
V`20to`20indicate
X`20*`20that`20there's`20a`20new`20player.`20
X`20*/
X
Xstatic
XrepaintIcon()
X`7B
X`09XWMHints`20wmhints;
X
X`09if`20(!iconInverted)
X`09`09wmhints.icon_pixmap`20=`20icon_pixmap;
X`09else
X`09`09wmhints.icon_pixmap`20=`20icon_reverse_pixmap;
X`09wmhints.flags`20=`20IconPixmapHint`20`7C`20IconMaskHint;
X`09wmhints.icon_mask`20=`20iconmask_pixmap;
X`09XSetWMHints(dpy,`20mwWindow,`20`26wmhints);
X`7D
X
X/*`20
X`20*`20Invert`20the`20whole`20display.`20Used`20to`20let`20the`20user`20know
V`20the`20mouse`20has
X`20*`20strayed`20outside`20the`20window.`20We`20don't`20do`20this`20for`20X11.
V
X`20*/
X
Xstatic
XinvertDisplay()
X`7B
X
X`7D
X
X/*
X`20*`20A`20hack`20of`20XCreateBitmapFromData`20that`20assumes`20MSBFirst`20Bit
VCells`20insterad`20of
X`20*`20LSBFirst`20bytes.
X`20*/
X
XPixmap
XxCreateBitmapFromBitCell(display,`20d,`20data,`20width,`20height)
XDisplay`20*display;
XDrawable`20d;
Xchar`20*data;
Xunsigned`20int`20width,`20height;
X`7B
X`09XImage`20ximage;
X`09GC`20gc;
X`09Pixmap`20pix;
X
X`09pix`20=`20XCreatePixmap(display,`20d,`20width,`20height,`201);
X`09if`20(!pix)
X`09`20`20return(0);
X`09gc`20=`20XCreateGC(display,`20pix,`20(unsigned`20long)0,`20(XGCValues`20*)0
V);
X`09ximage.height`20=`20height;
X`09ximage.width`20=`20width;
X`09ximage.depth`20=`201;
X`09ximage.xoffset`20=`200;
X`09ximage.format`20=`20ZPixmap;
X`09ximage.data`20=`20data;
X`09ximage.byte_order`20=`20MSBFirst;
X`09ximage.bitmap_unit`20=`208;
X`09ximage.bitmap_bit_order`20=`20MSBFirst;
X`09ximage.bitmap_pad`20=`208;
X`09ximage.bytes_per_line`20=`20(width+7)/8;
X
X`09XPutImage(display,`20pix,`20gc,`20`26ximage,`200,`200,`200,`200,`20width,
V`20height);
X`09XFreeGC(display,`20gc);
X`09return(pix);
X`7D
$ call unpack [.MAZEWAR]WINX11.C;23 1044224713 ""
$!
$ create 'f'
X#define`20cup_width`2016
X#define`20cup_height`2016
X#define`20cup_x_hot`201
X#define`20cup_y_hot`2012
Xstatic`20char`20cup_bits`5B`5D`20=`20`7B
X`20`20`200x80,`200x00,`200x00,`200x07,`200x00,`200x08,`200xc0,`200x07,`200x20,
V`200x00,`200xf0,`200x07,
X`20`20`200x48,`200x3c,`200xf8,`200x47,`200x08,`200x58,`200x08,`200x40,`200x08,
V`200x3c,`200x18,`200x08,
X`20`20`200xf6,`200x37,`200x02,`200x20,`200xfc,`200x17,`200x00,`200x00`7D;
$ call unpack [.MAZEWAR.BITMAPS]CUP.CUR;1 91030048 ""
$!
$ create 'f'
X`7B
X`20`20`20`200x0000,`200x2088,`200x1045,`200x0082,
X`20`20`20`200x0000,`200x1000,`200x2000,`200x4100,
X`20`20`20`200x8220,`200x87ff,`200x8ffa,`200x7ffc,
X`20`20`20`200x0fe8,`200x07c0,`200x0000,`200x0000
X`7D
$ call unpack [.MAZEWAR.BITMAPS]DEADRAT.ICON;1 1426785107 ""
$!
$ create 'f'
X#define`20dRat_width`2016
X#define`20dRat_height`2016
X#define`20dRat_x_hot`200
X#define`20dRat_y_hot`209
Xstatic`20char`20dRat_bits`5B`5D`20=`20`7B
X`20`20`200x00,`200x00,`200x88,`200x20,`200x45,`200x10,`200x82,`200x00,`200x00,
V`200x00,`200x00,`200x10,
X`20`20`200x00,`200x20,`200x00,`200x41,`200x20,`200x82,`200xff,`200x87,`200xfa,
V`200x8f,`200xfc,`200x7f,
X`20`20`200xe8,`200x0f,`200xc0,`200x07,`200x00,`200x00,`200x00,`200x00`7D;
$ call unpack [.MAZEWAR.BITMAPS]DRAT.CUR;1 158162923 ""
$!
$ create 'f'
X#define`20dRatMask_width`2016
X#define`20dRatMask_height`2016
X#define`20dRatMask_x_hot`20-1
X#define`20dRatMask_y_hot`20-1
Xstatic`20char`20dRatMask_bits`5B`5D`20=`20`7B
X`20`20`200x98,`200x60,`200xdd,`200x71,`200xef,`200x38,`200xc7,`200x19,`200x82,
V`200x00,`200x00,`200x30,
X`20`20`200x00,`200xf1,`200xe0,`200xf3,`200xff,`200xc7,`200xff,`200xcf,`200xff,
V`200xff,`200xfe,`200xff,
X`20`20`200xfc,`200x7f,`200xe8,`200x0f,`200xc0,`200x07,`200x00,`200x00`7D;
$ call unpack [.MAZEWAR.BITMAPS]DRATMASK.CUR;1 1729771963 ""
$!
$ create 'f'
X#define`20icon_width`2032
X#define`20icon_height`2032
Xstatic`20char`20icon_bits`5B`5D`20=`20`7B
X`20`20`200x0000,`200x0000,`200x0000,`200x0000,`200x0002,`200x0000,`200x0000,
V`200x003c,
X`20`20`200x0004,`200x0000,`200x0000,`200x0006,`200x0008,`200x0000,`200x0000,
V`200x0005,
X`20`20`200x0010,`200x0000,`200x0080,`200x0004,`200x0020,`200x0000,`200x0040,
V`200x0004,
X`20`20`200x0040,`200x0000,`200x0020,`200x0004,`200x0040,`200x0000,`200x0010,
V`200x0004,
X`20`20`200x00c0,`200x00ff,`200x000f,`200x0004,`200x0040,`200x0000,`200x0008,
V`200x0004,
X`20`20`200x0040,`200x0000,`200x0008,`200x0004,`200x0040,`200x0000,`200x0008,
V`200x0004,
X`20`20`200x0040,`200x0000,`200x0008,`200x0004,`200x0040,`200x0000,`200x0008,
V`200x0004,
X`20`20`200x0040,`200x0000,`200x0008,`200x0004,`200x00c0,`200x00ff,`200x000f,
V`200x0004,
X`20`20`200x0040,`200x0000,`200x0010,`200x0004,`200x0040,`200x0000,`200x0020,
V`200x0004,
X`20`20`200x0020,`200x00f0,`200x0041,`200x0004,`200x0010,`200x00fa,`200x0083,
V`200x0004,
X`20`20`200x0008,`200x00ff,`200x0003,`200x0005,`200x0084,`200x00fe,`200x001f,
V`200x0006,
X`20`20`200x00c2,`200x00ff,`200x0023,`200x003c,`200x0080,`200x0010,`200x0022,
V`200x0000,
X`20`20`200x0000,`200x0000,`200x0010,`200x0000,`200x0000,`200x00c0,`200x000f,
V`200x0000,
X`20`20`200x0000,`200x0020,`200x0000,`200x0000,`200x0000,`200x0040,`200x0000,
V`200x0000,
X`20`20`200x0000,`200x0080,`200x0000,`200x0000,`200x0000,`200x0040,`200x0000,
V`200x0000,
X`20`20`200x0000,`200x0000,`200x0000,`200x0000,`200x0000,`200x0000,`200x0000,
V`200x0000`7D;
$ call unpack [.MAZEWAR.BITMAPS]ICON.IC;1 1311781663 ""
$!
$ create 'f'
X/*`20Format_version=1,`20Width=64,`20Height=64,`20Depth=1,`20Valid_bits_per_it
Vem=16
X`20*/
X`090x8888,0x8888,0x8888,0x8888,0x8800,0x0000,0x0000,0x0008,
X`090x2200,0x0000,0x0000,0x0022,0x2284,0x0000,0x0820,0x0022,
X`090x8884,0x0000,0x0820,0x0008,0x88CC,0x71F1,0xC827,0x1608,
X`090x22CC,0x8812,0x2928,0x9922,0x22B4,0x0822,0x2540,0x9022,
X`090x88B4,0x7843,0xE547,0x9008,0x8884,0x8882,0x0548,0x9008,
X`090x2284,0x8902,0x2288,0x9022,0x2284,0x79F1,0xC287,0x9022,
X`090x8800,0x0000,0x0000,0x0008,0x8800,0x0000,0x0000,0x0008,
X`090x2200,0x0000,0x0000,0x0022,0x2222,0x2222,0x2222,0x2222,
X`090x8888,0x8888,0x8888,0x8888,0x9FFF,0xFFFF,0xFFFF,0xFFFC,
X`090x3800,0x0000,0x0000,0x0006,0x3400,0x0000,0x0000,0x0006,
X`090x9200,0x0000,0x0000,0x0004,0x9100,0x0000,0x0000,0x0004,
X`090x3080,0x0000,0x0000,0x0006,0x3040,0x0000,0x0000,0x01FE,
X`090x9020,0x0000,0x0000,0x0304,0x9010,0x0000,0x0000,0x0504,
X`090x3008,0x0000,0x0000,0x0906,0x3004,0x0000,0x0000,0x1106,
X`090x9002,0x0000,0x0000,0x2104,0x9001,0x0000,0x0000,0x4104,
X`090x3000,0x8000,0x0000,0x8106,0x3000,0x4000,0x0001,0x0106,
X`090x9000,0x3FFF,0xFFFE,0x0104,0x9000,0x2000,0x0002,0x0104,
X`090x3000,0x2000,0x0002,0x0106,0x3000,0x2000,0x0002,0x0106,
X`090x9000,0x2000,0x0002,0x0104,0x9000,0x2000,0x0002,0x0104,
X`090x3000,0x2000,0x0002,0x0106,0x3000,0x2000,0x0002,0x0106,
X`090x9000,0x2000,0x0002,0x0104,0x9000,0x2000,0x0002,0x0104,
X`090x3000,0x2000,0x0002,0x0106,0x3000,0x3FFF,0xFFFE,0x0106,
X`090x9000,0x4000,0x0001,0x0104,0x9000,0x8000,0x0000,0x8104,
X`090x3001,0x0000,0x0000,0x4106,0x3002,0x0000,0x0000,0x2106,
X`090x9004,0x0000,0x0000,0x1104,0x9008,0x0001,0xF000,0x0904,
X`090x3010,0x000B,0xF800,0x0506,0x3020,0x001F,0xF800,0x0306,
X`090x9040,0x002F,0xFF00,0x01FC,0x9080,0x007F,0xF880,0x0004,
X`090x3100,0x0021,0x0880,0x0006,0x3200,0x0000,0x0100,0x0006,
X`090x9400,0x0000,0x7E00,0x0004,0x9800,0x0000,0x8000,0x0004,
X`090x3000,0x0000,0x4000,0x0006,0x3000,0x0000,0x2000,0x0006,
X`090x9FFF,0xFFFF,0xFFFF,0xFFFC,0x8888,0x8888,0x8888,0x8888,
X`090x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222,0x2222
$ call unpack [.MAZEWAR.BITMAPS]MAZE.ICON;1 2019630532 ""
$!
$ create 'f'
X#define`20rat_width`2016
X#define`20rat_height`2016
X#define`20rat_x_hot`200
X#define`20rat_y_hot`206
Xstatic`20char`20rat_bits`5B`5D`20=`20`7B
X`20`20`200x00,`200x00,`200x00,`200x00,`200xc0,`200x07,`200xe8,`200x0f,`200xfc,
V`200x0f,`200xfa,`200x7f,
X`20`20`200xff,`200x8f,`200x42,`200x08,`200x00,`200x40,`200x00,`200x3f,`200x80,
V`200x00,`200x00,`200x01,
X`20`20`200x00,`200x02,`200x00,`200x01,`200x00,`200x00,`200x00,`200x00`7D;
$ call unpack [.MAZEWAR.BITMAPS]RAT.CUR;1 978398403 ""
$!
$ create 'f'
X#define`20ratMask_width`2016
X#define`20ratMask_height`2016
X#define`20ratMask_x_hot`20-1
X#define`20ratMask_y_hot`20-1
Xstatic`20char`20ratMask_bits`5B`5D`20=`20`7B
X`20`20`200x00,`200x00,`200xc0,`200x07,`200xe8,`200x0f,`200xfc,`200x1f,`200xfe,
V`200x7f,`200xff,`200xff,
X`20`20`200xff,`200xff,`200xff,`200xdf,`200xe7,`200xfc,`200x00,`200xff,`200x80,
V`200x7f,`200x80,`200x03,
X`20`20`200x00,`200x03,`200x80,`200x03,`200x00,`200x01,`200x00,`200x00`7D;
X
$ call unpack [.MAZEWAR.BITMAPS]RATMASK.CUR;1 708512115 ""
$ v=f$verify(v)
$ exit