Wed Dec 29 23:56:01 2021 UTC ()
games: add xchomp
Xchomp is a game closely patterned after Pac-Man(tm) that runs under the X
Window System, with several different mazes added.
This is strictly a keyboard-controlled game. The arcade game had very simple
controls -- one four-directional joystick. In xchomp, all control is through
the arrow keys.
(nia)
diff -r1.508 -r1.509 pkgsrc/games/Makefile
diff -r0 -r1.1 pkgsrc/games/xchomp/DESCR
diff -r0 -r1.1 pkgsrc/games/xchomp/Makefile
diff -r0 -r1.1 pkgsrc/games/xchomp/PLIST
diff -r0 -r1.1 pkgsrc/games/xchomp/distinfo
diff -r0 -r1.1 pkgsrc/games/xchomp/patches/patch-Imakefile
diff -r0 -r1.1 pkgsrc/games/xchomp/patches/patch-contact.c
diff -r0 -r1.1 pkgsrc/games/xchomp/patches/patch-demo.c
diff -r0 -r1.1 pkgsrc/games/xchomp/patches/patch-drivers.c
diff -r0 -r1.1 pkgsrc/games/xchomp/patches/patch-main.c
diff -r0 -r1.1 pkgsrc/games/xchomp/patches/patch-maze.c
diff -r0 -r1.1 pkgsrc/games/xchomp/patches/patch-props.c
diff -r0 -r1.1 pkgsrc/games/xchomp/patches/patch-resources.c
diff -r0 -r1.1 pkgsrc/games/xchomp/patches/patch-status.c
diff -r0 -r1.1 pkgsrc/games/xchomp/patches/patch-xchomp.h
--- pkgsrc/games/Makefile 2021/12/18 00:13:01 1.508
+++ pkgsrc/games/Makefile 2021/12/29 23:56:01 1.509
| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: Makefile,v 1.508 2021/12/18 00:13:01 wiz Exp $ | | 1 | # $NetBSD: Makefile,v 1.509 2021/12/29 23:56:01 nia Exp $ |
2 | # | | 2 | # |
3 | | | 3 | |
4 | COMMENT= Games | | 4 | COMMENT= Games |
5 | | | 5 | |
6 | SUBDIR+= 0verkill | | 6 | SUBDIR+= 0verkill |
7 | SUBDIR+= 2048-cli | | 7 | SUBDIR+= 2048-cli |
8 | SUBDIR+= 4stAttack | | 8 | SUBDIR+= 4stAttack |
9 | SUBDIR+= 7kaa | | 9 | SUBDIR+= 7kaa |
10 | SUBDIR+= 7kaa-music | | 10 | SUBDIR+= 7kaa-music |
11 | SUBDIR+= AitDoB | | 11 | SUBDIR+= AitDoB |
12 | SUBDIR+= InterLOGIC | | 12 | SUBDIR+= InterLOGIC |
13 | SUBDIR+= KoboDeluxe | | 13 | SUBDIR+= KoboDeluxe |
14 | SUBDIR+= LostPixels | | 14 | SUBDIR+= LostPixels |
| @@ -422,26 +422,27 @@ SUBDIR+= woof | | | @@ -422,26 +422,27 @@ SUBDIR+= woof |
422 | SUBDIR+= wordsearch | | 422 | SUBDIR+= wordsearch |
423 | SUBDIR+= wordwarvi | | 423 | SUBDIR+= wordwarvi |
424 | SUBDIR+= wormz | | 424 | SUBDIR+= wormz |
425 | SUBDIR+= wtf | | 425 | SUBDIR+= wtf |
426 | SUBDIR+= xbat | | 426 | SUBDIR+= xbat |
427 | SUBDIR+= xbill | | 427 | SUBDIR+= xbill |
428 | SUBDIR+= xblast | | 428 | SUBDIR+= xblast |
429 | SUBDIR+= xblockout | | 429 | SUBDIR+= xblockout |
430 | SUBDIR+= xboard | | 430 | SUBDIR+= xboard |
431 | SUBDIR+= xboing | | 431 | SUBDIR+= xboing |
432 | SUBDIR+= xbomb | | 432 | SUBDIR+= xbomb |
433 | SUBDIR+= xbomber | | 433 | SUBDIR+= xbomber |
434 | SUBDIR+= xbreaky | | 434 | SUBDIR+= xbreaky |
| | | 435 | SUBDIR+= xchomp |
435 | SUBDIR+= xclannad | | 436 | SUBDIR+= xclannad |
436 | SUBDIR+= xconq | | 437 | SUBDIR+= xconq |
437 | SUBDIR+= xcowsay | | 438 | SUBDIR+= xcowsay |
438 | SUBDIR+= xdemineur | | 439 | SUBDIR+= xdemineur |
439 | SUBDIR+= xdoom | | 440 | SUBDIR+= xdoom |
440 | SUBDIR+= xemeraldia | | 441 | SUBDIR+= xemeraldia |
441 | SUBDIR+= xevil | | 442 | SUBDIR+= xevil |
442 | SUBDIR+= xfreecell | | 443 | SUBDIR+= xfreecell |
443 | SUBDIR+= xfrisk | | 444 | SUBDIR+= xfrisk |
444 | SUBDIR+= xgalaga | | 445 | SUBDIR+= xgalaga |
445 | SUBDIR+= xgospel | | 446 | SUBDIR+= xgospel |
446 | SUBDIR+= xjewel | | 447 | SUBDIR+= xjewel |
447 | SUBDIR+= xjig | | 448 | SUBDIR+= xjig |
Xchomp is a game closely patterned after Pac-Man(tm) that runs under the X
Window System, with several different mazes added.
This is strictly a keyboard-controlled game. The arcade game had very simple
controls -- one four-directional joystick. In xchomp, all control is through
the arrow keys.
# $NetBSD: Makefile,v 1.1 2021/12/29 23:56:01 nia Exp $
DISTNAME= xchomp-pl1
CATEGORIES= games
MASTER_SITES= https://ftp.gwdg.de/pub/x11/x.org/R5contrib/
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://vidalc.chez.com/xchomp/xchomp.html
COMMENT= Game for X11 closely patterned after Pac-Man
WRKSRC= ${WRKDIR}/xchomp
USE_IMAKE= yes
.include "../../x11/libX11/buildlink3.mk"
.include "../../x11/libXext/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
@comment $NetBSD: PLIST,v 1.1 2021/12/29 23:56:01 nia Exp $
bin/xchomp
$NetBSD: distinfo,v 1.1 2021/12/29 23:56:01 nia Exp $
BLAKE2s (xchomp-pl1.tar.gz) = 16fe81471aa1aa8bdd5fe2a51d9746ba980b4bab3adaaceeac04d13af2580744
SHA512 (xchomp-pl1.tar.gz) = c5d40e97c8b14d96fe11e82d537128c0aa6ed12e9befb36a5432a84bf744cbce3e4bc6dbb068489974caa3235b5a1618a3fff9ddeede02a5c05083d1780b3d8f
Size (xchomp-pl1.tar.gz) = 33987 bytes
SHA1 (patch-Imakefile) = c5178798d35c9ebb8fff49d52cf6cea7d9e8e768
SHA1 (patch-contact.c) = dbca9684d645d8b8bd4548c1011f764cd797f865
SHA1 (patch-demo.c) = 9c7dadbd26a8788882617e93bc0ca1eb68e59467
SHA1 (patch-drivers.c) = 38e484eca54a7dcf0ebe9735242c7971c6d0daed
SHA1 (patch-main.c) = 711c36ebb772f261ce9d9bac633393eb94ca62e4
SHA1 (patch-maze.c) = da13497888aa34b8793f7620df7cc1c73b3f2178
SHA1 (patch-props.c) = cce3ddb8abb68f13f0e6970a482eb7b5586defdd
SHA1 (patch-resources.c) = f2f11c68af575ed17e79e804409bc59e17684ae6
SHA1 (patch-status.c) = e335db1e2fbce9c69be69890ba257c0532dafb4a
SHA1 (patch-xchomp.h) = 872c740b80e219a88891999fa2318f101da46d9d
$NetBSD: patch-Imakefile,v 1.1 2021/12/29 23:56:01 nia Exp $
Fix installation without a man page.
From FreeBSD Ports.
--- Imakefile.orig 1994-03-18 05:16:10.000000000 +0000
+++ Imakefile
@@ -2,7 +2,7 @@
#include BandAidCompiler
#endif
-DEFINES = -DX11
+DEFINES = -DX11 -DFRAME_DELAY=40000
INCLUDES = -I$(TOP) -I$(TOP)/X11
DEPLIBS = $(DEPXLIB)
LOCAL_LIBRARIES = $(XLIB)
@@ -11,4 +11,4 @@ SYS_LIBRARIES = -lm
SRCS = contact.c demo.c drivers.c main.c maze.c props.c resources.c status.c
OBJS = contact.o demo.o drivers.o main.o maze.o props.o resources.o status.o
-ComplexProgramTarget(xchomp)
+ComplexProgramTargetNoMan(xchomp)
$NetBSD: patch-contact.c,v 1.1 2021/12/29 23:56:01 nia Exp $
Add return types. from FreeBSD Ports.
--- contact.c.orig 1994-03-18 05:13:16.000000000 +0000
+++ contact.c
@@ -17,7 +17,7 @@
* with which the player collided. In this case, it doesn't matter.
*/
/*ARGSUSED*/
-die(dummy)
+void die(dummy)
int dummy;
{
register int xx = pac_x, yy = pac_y, i, dx, dy;
@@ -116,7 +116,7 @@ int dummy;
* of the eaten ghost, and then continues. The parameter is
* the array index of the eaten ghost.
*/
-eat(i)
+void eat(i)
int i;
{
register int xx = pac_x, yy = pac_y, j;
@@ -166,7 +166,7 @@ int i;
* The eyes are harmless; this is a no-op.
*/
/*ARGSUSED*/
-noop(dummy)
+void noop(dummy)
int dummy;
{
}
$NetBSD: patch-demo.c,v 1.1 2021/12/29 23:56:01 nia Exp $
Add return types. from FreeBSD Ports.
--- demo.c.orig 1994-03-18 05:12:23.000000000 +0000
+++ demo.c
@@ -6,7 +6,7 @@
* for the game.
*/
-demo_seq()
+void demo_seq()
{
int i, xx, yy, direction, ascent, descent, len;
XCharStruct chars;
@@ -127,7 +127,7 @@ demo_seq()
if (event.xany.window != window) continue;
switch (event.type) {
case KeyPress:
- XLookupString(&event, &c_buf, 1, &last_key, &status);
+ XLookupString((XKeyEvent *) &event, &c_buf, 1, &last_key, &status);
if ((last_key == XK_q) || (last_key == XK_Q))
do_exit();
XFillRectangle(display, window, clearGC, 0, 0, WIN_WIDTH,
$NetBSD: patch-drivers.c,v 1.1 2021/12/29 23:56:01 nia Exp $
Add return types. from FreeBSD Ports.
--- drivers.c.orig 1994-03-18 05:15:08.000000000 +0000
+++ drivers.c
@@ -12,7 +12,7 @@
* variables (pac_x, pac_y), the direction variables (pac_ix, pac_iy),
* and the clipping region (pac_region).
*/
-control_pac()
+void control_pac()
{
register int xx = pac_x, yy = pac_y, i, dx, dy;
register char *pc = md[yy >> 4] + (xx >> 4);
@@ -89,7 +89,7 @@ control_pac()
* eaten something which is not a ghost -- a dot, a power-dot,
* or the fruit. If so, the appropriate action is taken.
*/
-check_dots()
+void check_dots()
{
register char *pi;
register int i;
@@ -218,7 +218,7 @@ check_dots()
* The function below causes ghosts to follow the player around, with a bit
* of randomness thrown in as well.
*/
-follow(i)
+void follow(i)
register int i;
{
int xx = ghost_x[i], yy = ghost_y[i];
@@ -289,7 +289,7 @@ register int i;
* at half speed. It is set up as the driver function during
* the ghost-eating periods of the game.
*/
-run(i)
+void run(i)
register int i;
{
int xx = ghost_x[i], yy = ghost_y[i];
@@ -358,7 +358,7 @@ register int i;
* high speed. It is set up as the driver for ghosts which have
* been eaten.
*/
-go_home(i)
+void go_home(i)
register int i;
{
int xx = ghost_x[i], yy = ghost_y[i];
@@ -459,14 +459,14 @@ register int i;
* They simply hover around in a circular pattern. Randomness is
* used to decide when the ghosts leave the box.
*/
-hover(i)
+void hover(i)
register int i;
{
register int yy = ghost_y[i] >> 4, xx = ghost_x[i] >> 4;
char *pc = md[yy] + xx;
register int *px = ghost_ix + i, *py = ghost_iy + i;
- if (xx == door_x)
+ if (xx == door_x) {
if (yy == (door_y - 1)) {
/*
@@ -490,6 +490,7 @@ register int i;
*px = 0, *py = (-2);
return;
}
+ }
/*
* The rest of the function drives the ghost around the
@@ -514,14 +515,14 @@ register int i;
* the ghost-eating periods of the game -- they move at half
* speed.
*/
-hover2(i)
+void hover2(i)
register int i;
{
register int yy = ghost_y[i] >> 4, xx = ghost_x[i] >> 4;
char *pc = md[yy] + xx;
register int *px = ghost_ix + i, *py = ghost_iy + i;
- if (xx == door_x)
+ if (xx == door_x) {
if (yy == (door_y - 1)) {
drive[i] = run;
run(i);
@@ -532,6 +533,7 @@ register int i;
*px = 0, *py = (-1);
return;
}
+ }
if (*px > 0) {
if (pc[1]) *px = 0, *py = (-1);
$NetBSD: patch-main.c,v 1.1 2021/12/29 23:56:01 nia Exp $
Add return types.
Allow FRAME_DELAY to be set from the command line.
from FreeBSD Ports.
--- main.c.orig 1994-03-18 05:12:24.000000000 +0000
+++ main.c
@@ -2,7 +2,7 @@
#define EXTERN
#include "xchomp.h"
-main(argc, argv)
+int main(argc, argv)
int argc;
char *argv[];
{
@@ -10,6 +10,12 @@ char *argv[];
int dummy;
XCharStruct chars;
unsigned long event_mask;
+ int fdelay = 0;
+
+ /* User may set FRAME_DELAY from the command line */
+ if (argc >= 2) {
+ fdelay = atoi(argv[1]);
+ }
/* open the display */
display = XOpenDisplay(NULL);
@@ -64,17 +70,18 @@ char *argv[];
}
/* go to it */
- play_game();
+ play_game(fdelay);
/* exit */
do_exit();
+ return 0;
}
/*
* The following function contains the main game loop.
*/
-play_game() {
+void play_game(fdelay) {
register int i;
char c_buf;
XComposeStatus status;
@@ -166,7 +173,7 @@ play_game() {
if (event.xany.window != window) continue;
switch (event.type) {
case KeyPress:
- XLookupString(&event, &c_buf, 1, &last_key, &status);
+ XLookupString((XKeyEvent *) &event, &c_buf, 1, &last_key, &status);
if (last_key == XK_space)
if (!pause_seq())
goto demo;
@@ -325,7 +332,11 @@ play_game() {
XSync(display, False);
#ifdef FRAME_DELAY
- usleep(FRAME_DELAY);
+ if (fdelay > 0) {
+ usleep(fdelay);
+ } else {
+ usleep(FRAME_DELAY);
+ }
#endif
} /* while */
@@ -347,7 +358,7 @@ play_game() {
}
-do_exit()
+void do_exit()
{
destroy_regions();
XUnmapWindow(display, window);
$NetBSD: patch-maze.c,v 1.1 2021/12/29 23:56:01 nia Exp $
Add return types, from FreeBSD Ports.
--- maze.c.orig 1994-03-18 05:13:16.000000000 +0000
+++ maze.c
@@ -124,7 +124,7 @@ static mazedata mazes[] = {
"z---x---x---x---x---c" } };
-read_maze(num)
+void read_maze(num)
int num;
{
int i, xx, yy;
@@ -259,7 +259,7 @@ int num;
* The function which follows is used at the beginning of each level to
* set up the initial parameters for all of the moving figures.
*/
-position_players()
+void position_players()
{
int i;
XRectangle ghost_rect[MAX_GHOSTS], pac_rect;
$NetBSD: patch-props.c,v 1.1 2021/12/29 23:56:01 nia Exp $
Add return types, from FreeBSD Ports.
--- props.c.orig 1994-03-18 05:13:17.000000000 +0000
+++ props.c
@@ -9,7 +9,7 @@
/* the get-ready sequence */
-get_ready()
+void get_ready()
{
int xx, yy, i;
int direction, ascent, descent;
@@ -41,7 +41,7 @@ get_ready()
/* the game-over sequence */
-game_over()
+void game_over()
{
int xx, yy;
int direction, ascent, descent;
@@ -64,7 +64,7 @@ game_over()
/* the end-of-level sequence -- the screen flashes a few times */
-finish()
+void finish()
{
int i;
@@ -115,7 +115,7 @@ Bool pause_seq()
if (event.xany.window != window) continue;
switch (event.type) {
case KeyPress:
- XLookupString(&event, &c_buf, 1, &last_key, &status);
+ XLookupString((XKeyEvent *) &event, &c_buf, 1, &last_key, &status);
if ((last_key == XK_q) || (last_key == XK_Q))
do_exit();
if ((last_key == XK_r) || (last_key == XK_R))
@@ -136,7 +136,7 @@ Bool pause_seq()
}
-do_sleep(secs)
+void do_sleep(secs)
{
int i;
@@ -147,7 +147,7 @@ do_sleep(secs)
}
-do_usleep(usecs)
+void do_usleep(usecs)
{
int i, d, r;
@@ -164,7 +164,7 @@ do_usleep(usecs)
}
-check_normal_events()
+void check_normal_events()
{
char c_buf;
XEvent event;
@@ -175,7 +175,7 @@ check_normal_events()
if (event.xany.window != window) continue;
switch (event.type) {
case KeyPress:
- XLookupString(&event, &c_buf, 1, &last_key, &status);
+ XLookupString((XKeyEvent *) &event, &c_buf, 1, &last_key, &status);
if (last_key == XK_space)
if (!pause_seq())
longjmp(jb_start, 1);
$NetBSD: patch-resources.c,v 1.1 2021/12/29 23:56:01 nia Exp $
Add return types, from FreeBSD Ports.
--- resources.c.orig 1994-03-18 05:12:25.000000000 +0000
+++ resources.c
@@ -9,7 +9,7 @@
* contexts.
*/
-create_window(argc, argv)
+void create_window(argc, argv)
int argc;
char *argv[];
{
@@ -39,7 +39,7 @@ char *argv[];
}
-create_pac()
+void create_pac()
{
int i;
@@ -127,7 +127,7 @@ create_pac()
}
-create_ghost()
+void create_ghost()
{
int i;
@@ -164,7 +164,7 @@ create_ghost()
}
-create_maze_symbols()
+void create_maze_symbols()
{
int i;
Pixmap empty;
@@ -190,7 +190,7 @@ create_maze_symbols()
}
-create_maps()
+void create_maps()
{
powermap = XCreatePixmap(display, root, WIN_WIDTH, WIN_HEIGHT, depth);
save = XCreatePixmap(display, root, WIN_WIDTH, WIN_HEIGHT, depth);
@@ -199,8 +199,7 @@ create_maps()
}
-
-create_fruit()
+void create_fruit()
{
fruit_pix[0] = XCreatePixmapFromBitmapData(display, root, fcherry_bits,
GHOST_SIZE, GHOST_SIZE, 1, 0, 1);
@@ -261,7 +260,7 @@ create_fruit()
}
-create_GCs()
+void create_GCs()
{
XGCValues gcv;
unsigned long mask;
@@ -341,7 +340,7 @@ create_GCs()
}
-create_demo_images()
+void create_demo_images()
{
demo_mask[0] = XCreatePixmapFromBitmapData(display, root, bigc_bits,
48, 48, 1, 0, 1);
@@ -380,7 +379,7 @@ create_demo_images()
}
-clear_maps()
+void clear_maps()
{
XFillRectangle(display, powermap, clearGC, 0, 0, WIN_WIDTH, WIN_HEIGHT);
XFillRectangle(display, save, clearGC, 0, 0, WIN_WIDTH, WIN_HEIGHT);
@@ -388,7 +387,7 @@ clear_maps()
}
-create_regions()
+void create_regions()
{
XRectangle full_rect;
int i;
@@ -411,7 +410,7 @@ create_regions()
}
-destroy_regions()
+void destroy_regions()
{
int i;
$NetBSD: patch-status.c,v 1.1 2021/12/29 23:56:01 nia Exp $
Add return types, from FreeBSD Ports.
--- status.c.orig 1994-03-18 05:12:46.000000000 +0000
+++ status.c
@@ -8,7 +8,7 @@
* score, the fruit level, and the number of lives remaining.
*/
-print_score(incr)
+void print_score(incr)
long incr;
{
static char string[6];
@@ -48,7 +48,7 @@ int num;
}
-display_level(slowly)
+void display_level(slowly)
Bool slowly;
{
int i, xx;
@@ -73,14 +73,14 @@ Bool slowly;
}
-display_title()
+void display_title()
{
XCopyPlane(display, title, window, fullcopyGC, 0, 0, TITLE_WIDTH,
TITLE_HEIGHT, 12 * GHOST_SIZE, WIN_HEIGHT + 1, 1);
}
-restore_status()
+void restore_status()
{
print_score(0L);
(void)set_lives(lives);
$NetBSD: patch-xchomp.h,v 1.1 2021/12/29 23:56:01 nia Exp $
Add return types, from FreeBSD Ports.
--- xchomp.h.orig 1994-03-18 05:13:17.000000000 +0000
+++ xchomp.h
@@ -6,6 +6,7 @@
#include <signal.h>
#include <setjmp.h>
#include <string.h>
+#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -74,7 +75,7 @@ EXTERN struct timeval st_delay;
typedef int intm[8];
typedef char charm[BLOCK_WIDTH];
typedef charm mazedata[BLOCK_HEIGHT];
-typedef int (*funcptr)();
+typedef void (*funcptr)();
EXTERN Atom DEC_icon_atom;
@@ -136,6 +137,44 @@ EXTERN Bool dead, completed;
EXTERN jmp_buf jb_start;
-extern follow(), hover(), hover2(), run(), go_home();
-extern die(), eat(), noop();
-extern Bool pause_seq();
+EXTERN void follow(int);
+EXTERN void run(int);
+EXTERN void go_home(int);
+EXTERN void hover(int);
+EXTERN void hover2(int);
+EXTERN void die(int);
+EXTERN void eat(int);
+EXTERN void noop(int);
+EXTERN Bool pause_seq();
+
+void do_exit();
+void play_game(int);
+void destroy_regions();
+void create_ghost();
+void create_pac();
+void create_fruit();
+void create_maze_symbols();
+void create_demo_images();
+void create_GCs();
+void create_window(int, char **);
+void create_maps();
+void create_regions();
+void demo_seq();
+void display_title();
+void print_score(long);
+void display_level(Bool);
+void clear_maps();
+void read_maze(int);
+void position_players();
+int set_lives(int);
+void get_ready();
+void restore_status();
+void control_pac();
+void usleep(int);
+void do_sleep(int);
+void do_usleep(int);
+void game_over();
+void finish();
+void control_pac();
+void check_dots();
+void check_normal_events();