diff options
Diffstat (limited to 'source/xap/xgames')
-rw-r--r-- | source/xap/xgames/maze.diff | 22 | ||||
-rw-r--r-- | source/xap/xgames/slack-desc | 19 | ||||
-rw-r--r-- | source/xap/xgames/spider.diff | 121 | ||||
-rw-r--r-- | source/xap/xgames/xcolormap.diff | 22 | ||||
-rw-r--r-- | source/xap/xgames/xcuckoo.diff | 12 | ||||
-rwxr-xr-x | source/xap/xgames/xgames.SlackBuild | 154 | ||||
-rw-r--r-- | source/xap/xgames/xlander-2009-07-18.diff | 86 | ||||
-rw-r--r-- | source/xap/xgames/xlander.fixes.diff | 228 |
8 files changed, 664 insertions, 0 deletions
diff --git a/source/xap/xgames/maze.diff b/source/xap/xgames/maze.diff new file mode 100644 index 00000000..77ec739c --- /dev/null +++ b/source/xap/xgames/maze.diff @@ -0,0 +1,22 @@ +--- ./getopt.c.orig Wed Aug 4 14:48:46 1999 ++++ ./getopt.c Wed Aug 4 14:48:55 1999 +@@ -22,7 +22,7 @@ + char *optarg; + + int +-getopt(argc, argv, opts) ++maze_getopt(argc, argv, opts) + int argc; + char **argv, *opts; + { +--- ./maze.c.orig Wed Aug 4 14:48:59 1999 ++++ ./maze.c Wed Aug 4 14:49:10 1999 +@@ -136,7 +136,7 @@ + int flags; + + cmd = argv[0]; +- while ((c = getopt(argc, argv, "rSd:g:")) != EOF) ++ while ((c = maze_getopt(argc, argv, "rSd:g:")) != EOF) + switch(c) { + + case 'S': diff --git a/source/xap/xgames/slack-desc b/source/xap/xgames/slack-desc new file mode 100644 index 00000000..a81a038c --- /dev/null +++ b/source/xap/xgames/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler------------------------------------------------------| +xgames: xgames (small X games collection) +xgames: +xgames: A few small and historic games and toys for X. +xgames: +xgames: Includes maze, spider, xcolormap, xlander, xminesweep, xroach, xsnow. +xgames: +xgames: +xgames: +xgames: +xgames: +xgames: diff --git a/source/xap/xgames/spider.diff b/source/xap/xgames/spider.diff new file mode 100644 index 00000000..b0704f14 --- /dev/null +++ b/source/xap/xgames/spider.diff @@ -0,0 +1,121 @@ +--- ./globals.h.orig 1991-09-28 12:46:20.000000000 -0500 ++++ ./globals.h 2007-02-21 20:14:54.000000000 -0600 +@@ -96,6 +96,6 @@ + Bool can_get_help_files(); + #endif + +-extern char *malloc(); +-extern char *calloc(); +-extern char *realloc(); ++extern void *malloc(); ++extern void *calloc(); ++extern void *realloc(); +--- ./movelog.c.orig 1991-09-28 12:46:17.000000000 -0500 ++++ ./movelog.c 2007-02-21 20:17:21.000000000 -0600 +@@ -22,6 +22,7 @@ + #ifdef SVR4 + #include <unistd.h> + #endif ++#include <stdlib.h> + + #define CACHE_SIZE 50 + static int move_index = 0; +@@ -33,6 +34,21 @@ + + extern int cheat_count; + ++Rank flip_ranks[NUM_RANKS] = { ++ King, Queen, Jack, Ten, Nine, Eight, Seven, ++ Six, Five, Four, Three, Deuce, Ace ++}; ++ ++static int ++card_to_int(card) ++CardPtr card; ++{ ++int val; ++ ++ val = card->suit * 13 + flip_ranks[card->rank]; ++ return (val); ++} ++ + make_deck_cache() + { + CardPtr tmp; +@@ -280,11 +296,6 @@ + } + } + +-Rank flip_ranks[NUM_RANKS] = { +- King, Queen, Jack, Ten, Nine, Eight, Seven, +- Six, Five, Four, Three, Deuce, Ace +-}; +- + static void + int_to_card(val, suit, rank) + int val; +@@ -298,16 +309,6 @@ + assert (*rank >= Ace && *suit <= King); + } + +-static int +-card_to_int(card) +-CardPtr card; +-{ +-int val; +- +- val = card->suit * 13 + flip_ranks[card->rank]; +- return (val); +-} +- + static CardPtr + find_card(cache, suit, rank) + CardPtr *cache; +@@ -709,6 +710,23 @@ + } + } + ++static int ++restore_game(str, str2) ++char *str, *str2; ++{ ++ ++ if (read_position(str) != 0) { ++ return (-1); ++ } ++ ++ init_cache(); /* clear out the move cache */ ++ ++ if (str2) ++ read_moves(str2); ++ ++ return (0); ++} ++ + read_selection(buf) + char *buf; + { +@@ -786,23 +804,6 @@ + show_message(buf); + } + +-static int +-restore_game(str, str2) +-char *str, *str2; +-{ +- +- if (read_position(str) != 0) { +- return (-1); +- } +- +- init_cache(); /* clear out the move cache */ +- +- if (str2) +- read_moves(str2); +- +- return (0); +-} +- + /* + * play the same deck again + */ diff --git a/source/xap/xgames/xcolormap.diff b/source/xap/xgames/xcolormap.diff new file mode 100644 index 00000000..57a0bee7 --- /dev/null +++ b/source/xap/xgames/xcolormap.diff @@ -0,0 +1,22 @@ +--- ./Makefile.orig Wed Aug 4 14:53:55 1999 ++++ ./Makefile Wed Aug 4 14:54:07 1999 +@@ -3,7 +3,7 @@ + PROGRAM = xcolormap + OBJS = xcolormap.o + +-LIBS = -lm -lXt -lX11 ++LIBS = -lm -L /usr/X11R6/lib -lXt -lX11 + + all: $(PROGRAM) + +--- ./xcolormap.c.orig Wed Aug 4 14:53:23 1999 ++++ ./xcolormap.c Wed Aug 4 14:53:49 1999 +@@ -113,7 +113,7 @@ + + if (!TheDisplay) + { +- XtWarning ("%s: can't open display, exiting...", APPNAME); ++ XtWarning ("%s: can't open display, exiting..."); + exit (0); + } + diff --git a/source/xap/xgames/xcuckoo.diff b/source/xap/xgames/xcuckoo.diff new file mode 100644 index 00000000..00c014cb --- /dev/null +++ b/source/xap/xgames/xcuckoo.diff @@ -0,0 +1,12 @@ +diff -u xcuckoo.orig/xcuckoo.c xcuckoo/xcuckoo.c +--- xcuckoo.orig/xcuckoo.c 1992-05-05 02:38:34.000000000 -0500 ++++ xcuckoo/xcuckoo.c 2007-02-28 13:10:37.000000000 -0600 +@@ -37,7 +37,7 @@ + #include "version.h" + #include "patchlevel.h" + +-extern char *malloc(); ++extern void *malloc(); + + /* R4 concession */ + #ifndef XPointer diff --git a/source/xap/xgames/xgames.SlackBuild b/source/xap/xgames/xgames.SlackBuild new file mode 100755 index 00000000..e2514f81 --- /dev/null +++ b/source/xap/xgames/xgames.SlackBuild @@ -0,0 +1,154 @@ +#!/bin/sh + +# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +VERSION=0.3 +ARCH=${ARCH:-x86_64} +BUILD=${BUILD:-2} + +NUMJOBS=${NUMJOBS:-" -j7 "} + +CWD=$(pwd) +TMP=${TMP:-/tmp} +PKG=$TMP/package-xgames +rm -rf $PKG +mkdir -p $TMP $PKG + +# Build spider: +cd $TMP +tar xvf $CWD/spider.tar.gz || exit 1 +cd spider || exit 1 +zcat $CWD/spider.diff.gz | patch -p1 --verbose || exit 1 +xmkmf +make $NUMJOBS || make || exit 1 +mkdir -p $PKG/usr/bin +cat spider > $PKG/usr/bin/spider +mkdir -p $PKG/usr/man/man6 +cat spider.man | gzip -9c > $PKG/usr/man/man6/spider.6.gz +mkdir -p $PKG/usr/doc/xgames-$VERSION/spider +cp -a README* $PKG/usr/doc/xgames-$VERSION/spider + +# Build maze: +cd $TMP +tar xvf $CWD/maze.tar.gz || exit 1 +cd maze || exit 1 +zcat $CWD/maze.diff.gz | patch -p1 || exit 1 +xmkmf +make $NUMJOBS || make || exit 1 +cat maze > $PKG/usr/bin/maze +cat maze.man | gzip -9c > $PKG/usr/man/man6/maze.6.gz +mkdir -p $PKG/usr/doc/xgames-$VERSION/maze +cp -a README $PKG/usr/doc/xgames-$VERSION/maze + +# Build xcolormap: +cd $TMP +tar xvf $CWD/xcolormap.tar.gz || exit 1 +cd xcolormap || exit 1 +zcat $CWD/xcolormap.diff.gz | patch -p1 || exit 1 +make $NUMJOBS || make || exit 1 +cat xcolormap > $PKG/usr/bin/xcolormap +mkdir -p $PKG/usr/doc/xgames-$VERSION/xcolormap +cp -a README $PKG/usr/doc/xgames-$VERSION/xcolormap + +# Build xcuckoo: +cd $TMP +tar xvf $CWD/xcuckoo-1.1.tar.gz || exit 1 +cd xcuckoo || exit 1 +zcat $CWD/xcuckoo.diff.gz | patch -p1 --verbose || exit 1 +xmkmf +make $NUMJOBS || make || exit 1 +cat xcuckoo > $PKG/usr/bin/xcuckoo +cat xcuckoo.man | gzip -9c > $PKG/usr/man/man6/xcuckoo.6.gz +mkdir -p $PKG/usr/doc/xgames-$VERSION/xcuckoo +cp -a CHANGES $PKG/usr/doc/xgames-$VERSION/xcuckoo + +# Build xlander: +cd $TMP +tar xvf $CWD/xlander.tar.gz || exit 1 +cd xlander || exit 1 +zcat $CWD/xlander.fixes.diff.gz | patch -p1 || exit 1 +zcat $CWD/xlander-2009-07-18.diff.gz | patch -p1 || exit 1 +xmkmf +make $NUMJOBS || make || exit 1 +cat xlander > $PKG/usr/bin/xlander +cat xlander.man | gzip -9c > $PKG/usr/man/man6/xlander.6.gz +mkdir -p $PKG/usr/doc/xgames-$VERSION/xlander +cp -a README $PKG/usr/doc/xgames-$VERSION/xlander + +# Build xminesweep: +cd $TMP +tar xvf $CWD/xminesweep3.0.tar.gz || exit 1 +cd xminesweep3.0 || exit 1 +xmkmf +make $NUMJOBS || make || exit 1 +cat xminesweep > $PKG/usr/bin/xminesweep +cat xminesweep.man | gzip -9c > $PKG/usr/man/man6/xminesweep.6.gz +mkdir -p $PKG/usr/doc/xgames-$VERSION/xminesweep +cp -a README $PKG/usr/doc/xgames-$VERSION/xminesweep + +# Build xneko: +cd $TMP +tar xvf $CWD/xneko.tar.gz || exit 1 +cd xneko || exit 1 +xmkmf +make $NUMJOBS || make || exit 1 +cat xneko > $PKG/usr/bin/xneko +cat xneko.man | gzip -9c > $PKG/usr/man/man6/xneko.6.gz +mkdir -p $PKG/usr/doc/xgames-$VERSION/xneko +cp -a README $PKG/usr/doc/xgames-$VERSION/xneko + +# Build xroach: +cd $TMP +tar xvf $CWD/xroach.tar.gz || exit 1 +cd xroach || exit 1 +xmkmf +make $NUMJOBS || make || exit 1 +cat xroach > $PKG/usr/bin/xroach +cat xroach.man | gzip -9c > $PKG/usr/man/man6/xroach.6.gz +mkdir -p $PKG/usr/doc/xgames-$VERSION/xroach +cp -a README.linux $PKG/usr/doc/xgames-$VERSION/xroach + +# Build xsnow: +cd $TMP +tar xvf $CWD/xsnow-1.40.tar.gz || exit 1 +cd xsnow-1.40 || exit 1 +xmkmf +make $NUMJOBS || make || exit 1 +cat xsnow > $PKG/usr/bin/xsnow +cat xsnow.man | gzip -9c > $PKG/usr/man/man6/xsnow.6.gz +mkdir -p $PKG/usr/doc/xgames-$VERSION/xsnow +cp -a README $PKG/usr/doc/xgames-$VERSION/xsnow + +# Fix everything up: +chmod 755 $PKG/usr/bin/* +strip $PKG/usr/bin/* + +( cd $PKG/usr/doc + find . -type f -exec chown root.root {} \; + find . -type f -exec chmod 644 {} \; +) + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $TMP/xgames-$VERSION-$ARCH-$BUILD.txz + diff --git a/source/xap/xgames/xlander-2009-07-18.diff b/source/xap/xgames/xlander-2009-07-18.diff new file mode 100644 index 00000000..21402ea4 --- /dev/null +++ b/source/xap/xgames/xlander-2009-07-18.diff @@ -0,0 +1,86 @@ +diff --git a/game.c b/game.c +index e6f3a53..b789081 100644 +--- a/game.c ++++ b/game.c +@@ -93,7 +93,7 @@ void RateLanding (db, lander) + extern LINE landingpad[]; + int x_distance, z_distance; /* Distance from center of pad */ + int abs (); +- void InitializeLander (), DisplayAcceleration (); ++ void InitFrameRate (), InitializeLander (), DisplayAcceleration (); + + x_distance = + abs ((int) (db->off_x - (landingpad[0].x1 + (PAD_WIDTH >> 1)))); +@@ -108,6 +108,7 @@ void RateLanding (db, lander) + } + XDrawImageString (d, instrBuffer, gcInstr, 381, 84, buf, strlen (buf)); + Pause ("Press mouse button to continue"); ++ InitFrameRate (); + InitializeLander (db, lander); + + /* +diff --git a/initialize.c b/initialize.c +index 99a81c5..279e3f2 100644 +--- a/initialize.c ++++ b/initialize.c +@@ -60,7 +60,7 @@ void InitializeLander (craft, lander) + lander->retro_thruster = 0; + lander->vert_speed = 0.0; + lander->heading = 1.36; +- lander->lat_veloc = 100.0; ++ lander->lat_veloc = 300.0; + lander->fuel = FULL_TANK; + lander->alt = craft->off_y / PIXELS_PER_FOOT; + } +diff --git a/patchlevel.h b/patchlevel.h +index 9625f98..be79bb8 100644 +--- a/patchlevel.h ++++ b/patchlevel.h +@@ -1,2 +1,2 @@ +-#define PATCHLEVEL 3 ++#define PATCHLEVEL 4 + +diff --git a/xlander.c b/xlander.c +index 2b2c103..318e5df 100644 +--- a/xlander.c ++++ b/xlander.c +@@ -101,9 +101,17 @@ void DisplayWorld () + } + + ++void InitFrameRate () ++{ ++ gettimeofday(&frame_time, NULL); ++ gettimeofday(&prev_frame_time, NULL); ++ fps = 1000000.0; /* Avoid initial spike */ ++} ++ ++ + void UpdateFrameRate () + { +- unsigned long sec, usec, diff; ++ long sec, usec, diff; + + gettimeofday(&frame_time, NULL); + sec = frame_time.tv_sec - prev_frame_time.tv_sec; +@@ -164,6 +172,7 @@ int main (argc, argv) + */ + mask = sigblock (sigmask (SIGINT)); + Pause ("Press any mouse button to begin"); ++ InitFrameRate (); + DisplayAcceleration (); + for (;;) { + UpdateOrientation (world, craft, &lander); +diff --git a/xlander.h b/xlander.h +index ea157f7..ea072d3 100644 +--- a/xlander.h ++++ b/xlander.h +@@ -44,7 +44,7 @@ + #define PIXELS_PER_FOOT 6 /* Number of pixels per foot */ + #define ACCELERATION -5.310 /* Acceleration of gravity (ft/sec^2) */ + #define RETRO 35.0 /* Acceleration due to retroactive thruster */ +-#define LATERAL_THRUST 5.0 /* Acceleration due to lateral thruster */ ++#define LATERAL_THRUST 1.0 /* Acceleration due to lateral thruster */ + #define PI 3.1415926535897932384 + #define HALFPI 1.5707963 /* pi/2 */ + #define TWOPI100 628 diff --git a/source/xap/xgames/xlander.fixes.diff b/source/xap/xgames/xlander.fixes.diff new file mode 100644 index 00000000..7212e183 --- /dev/null +++ b/source/xap/xgames/xlander.fixes.diff @@ -0,0 +1,228 @@ +diff -ru a-slackware-1995-06-17/game.c b-gary/game.c +--- a-slackware-1995-06-17/game.c 1995-06-17 21:23:00.000000000 -0400 ++++ b-gary/game.c 2007-03-01 04:08:49.000000000 -0500 +@@ -165,7 +165,7 @@ + switch (event.type) { + case KeyPress: + if (lander->fuel > 0.0) { +- XLookupString (&event, &ch, 1, &keysym, (XComposeStatus *) 0); ++ XLookupString ((XKeyEvent *) &event, &ch, 1, &keysym, (XComposeStatus *) 0); + if (ch == lander->controls[0] || keysym == XK_Up) + lander->rear_thruster = lander->lateral_thrust; + else if (ch == lander->controls[1] || keysym == XK_Down) +@@ -179,7 +179,7 @@ + } + break; + case KeyRelease: +- XLookupString (&event, &ch, 1, &keysym, (XComposeStatus *) 0); ++ XLookupString ((XKeyEvent *) &event, &ch, 1, &keysym, (XComposeStatus *) 0); + if (ch == lander->controls[0] || keysym == XK_Up) + lander->rear_thruster = 0; + else if (ch == lander->controls[1] || keysym == XK_Down) +@@ -197,24 +197,26 @@ + } + + if (lander->retro_thruster > 0) +- lander->fuel -= RETRO_BURN; ++ lander->fuel -= RETRO_BURN / fps; + if (lander->front_thruster > 0) +- lander->fuel -= LATERAL_BURN; ++ lander->fuel -= LATERAL_BURN / fps; + if (lander->rear_thruster > 0) +- lander->fuel -= LATERAL_BURN; ++ lander->fuel -= LATERAL_BURN / fps; + if (lander->left_thruster > 0) +- lander->fuel -= LATERAL_BURN; ++ lander->fuel -= LATERAL_BURN / fps; + if (lander->right_thruster > 0) +- lander->fuel -= LATERAL_BURN; ++ lander->fuel -= LATERAL_BURN / fps; ++ if (lander->fuel < 0.0) ++ lander->fuel = 0.0; /* Prevents gas gauge from going negative */ + lander->vert_speed += +- (lander->retro_thruster + acceleration) / TICKS_PER_SECOND; +- lander->alt += lander->vert_speed / TICKS_PER_SECOND; ++ (lander->retro_thruster + acceleration) / fps; ++ lander->alt += lander->vert_speed / fps; + lat_accel_x = lander->right_thruster - lander->left_thruster; + lat_accel_y = lander->rear_thruster - lander->front_thruster; + lat_veloc_x = lander->lat_veloc * cos (lander->heading) + lat_accel_x; + lat_veloc_y = lander->lat_veloc * sin (lander->heading) + lat_accel_y; +- craft->off_x += (lat_veloc_x / TICKS_PER_SECOND) * PIXELS_PER_FOOT; +- craft->off_z += (lat_veloc_y / TICKS_PER_SECOND) * PIXELS_PER_FOOT; ++ craft->off_x += (lat_veloc_x / fps) * PIXELS_PER_FOOT; ++ craft->off_z += (lat_veloc_y / fps) * PIXELS_PER_FOOT; + lander->lat_veloc = + sqrt (lat_veloc_x * lat_veloc_x + lat_veloc_y * lat_veloc_y); + +diff -ru a-slackware-1995-06-17/globals.c b-gary/globals.c +--- a-slackware-1995-06-17/globals.c 1995-06-17 21:22:36.000000000 -0400 ++++ b-gary/globals.c 2007-03-01 04:08:49.000000000 -0500 +@@ -27,3 +27,4 @@ + XrmDatabase resources = (XrmDatabase) 0; + /* X Resource database */ + float acceleration = 0.0; /* Acceleration due to gravity */ ++float fps; /* Current frames per second */ +diff -ru a-slackware-1995-06-17/globals.h b-gary/globals.h +--- a-slackware-1995-06-17/globals.h 1995-06-17 21:22:41.000000000 -0400 ++++ b-gary/globals.h 2007-03-01 04:08:49.000000000 -0500 +@@ -30,5 +30,6 @@ + extern int px, py, pz; + extern int roll, pitch, yaw; + extern float acceleration; ++extern float fps; + +-#endif _globals_h_ ++#endif /* _globals_h_ */ +diff -ru a-slackware-1995-06-17/initialize.c b-gary/initialize.c +--- a-slackware-1995-06-17/initialize.c 1995-06-17 21:23:00.000000000 -0400 ++++ b-gary/initialize.c 2007-03-01 04:08:49.000000000 -0500 +@@ -61,7 +61,7 @@ + lander->vert_speed = 0.0; + lander->heading = 1.36; + lander->lat_veloc = 100.0; +- lander->fuel = 320.0; ++ lander->fuel = FULL_TANK; + lander->alt = craft->off_y / PIXELS_PER_FOOT; + } + +@@ -293,7 +293,7 @@ + + world->min_x = world->min_y = -HALF_WORLD_LENGTH; + world->max_x = world->max_y = HALF_WORLD_WIDTH; +- srandom ((long) time ((int *) 0)); ++ srandom ((long) time ((time_t *) 0)); + for (x = -HALF_WORLD_WIDTH; x < HALF_WORLD_WIDTH; + r ^= 1, x += EDGE_LENGTH + (int) x_offset) + for (y = r * (int) y_offset - HALF_WORLD_LENGTH; y < HALF_WORLD_LENGTH; +diff -ru a-slackware-1995-06-17/instrument.c b-gary/instrument.c +--- a-slackware-1995-06-17/instrument.c 1995-06-17 21:22:39.000000000 -0400 ++++ b-gary/instrument.c 2007-03-01 04:08:49.000000000 -0500 +@@ -48,7 +48,7 @@ + { + static int heading_x = 50, heading_y = 15; + static int fuel_level = 80, old_x = 290, old_y = 10; +- int new_fuel_level = (int) fuel / 4; ++ int new_fuel_level = (int) (fuel / (float) FULL_TANK * 80.0); + char buf[32]; + + /* +diff -ru a-slackware-1995-06-17/patchlevel.h b-gary/patchlevel.h +--- a-slackware-1995-06-17/patchlevel.h 1995-06-17 21:23:00.000000000 -0400 ++++ b-gary/patchlevel.h 2007-03-01 04:08:49.000000000 -0500 +@@ -1,2 +1,2 @@ +-#define PATCHLEVEL 2 ++#define PATCHLEVEL 3 + +diff -ru a-slackware-1995-06-17/xlander.c b-gary/xlander.c +--- a-slackware-1995-06-17/xlander.c 1995-06-17 21:22:36.000000000 -0400 ++++ b-gary/xlander.c 2007-03-01 04:08:49.000000000 -0500 +@@ -14,6 +14,7 @@ + + #include "xlander.h" + #include "globals.h" ++#include <sys/time.h> + + /* + * A lander +@@ -68,6 +69,7 @@ + static DATABASE *world, *craft, *thrust, *shadow; + static LANDER lander; + int mask; ++struct timeval frame_time, prev_frame_time; + + /****************************************************************************** + ** DisplayWorld +@@ -98,7 +100,26 @@ + XSync (d,False); + } + +-void main (argc, argv) ++ ++void UpdateFrameRate () ++{ ++ unsigned long sec, usec, diff; ++ ++ gettimeofday(&frame_time, NULL); ++ sec = frame_time.tv_sec - prev_frame_time.tv_sec; ++ usec = frame_time.tv_usec - prev_frame_time.tv_usec; ++ if(usec < 0) { ++ usec += 1000000; ++ sec--; ++ } ++ diff = sec * 1000000 + usec; ++ fps = 1000000.0 / (float) diff; ++ prev_frame_time.tv_sec = frame_time.tv_sec; ++ prev_frame_time.tv_usec = frame_time.tv_usec; ++} ++ ++ ++int main (argc, argv) + int argc; + char *argv[]; + { +@@ -113,6 +134,10 @@ + thrust = DBInitFromData (thrust_data, THRUSTSIZE); + shadow = DBInitFromData (shadow_data, SHADOWSIZE); + ++ gettimeofday(&frame_time, NULL); ++ gettimeofday(&prev_frame_time, NULL); ++ fps = 1000000.0; /* Prevent startup pulse */ ++ + /* + * Initial coordinates of the lander... + */ +@@ -143,7 +168,9 @@ + for (;;) { + UpdateOrientation (world, craft, &lander); + DisplayWorld (); ++ UpdateFrameRate (); + (void) sigsetmask (mask); + mask = sigblock (sigmask (SIGINT)); + } ++ return 0; + } +diff -ru a-slackware-1995-06-17/xlander.h b-gary/xlander.h +--- a-slackware-1995-06-17/xlander.h 1995-06-17 21:23:00.000000000 -0400 ++++ b-gary/xlander.h 2007-03-01 04:08:49.000000000 -0500 +@@ -20,6 +20,7 @@ + #ifndef _xlander_h_ + #define _xlander_h_ + ++#include <stdlib.h> + #include <stdio.h> + #include <math.h> + #include <signal.h> +@@ -41,7 +42,6 @@ + #define HALF_WORLD_LENGTH (WORLD_LENGTH >> 1) + #define HALF_WORLD_WIDTH (WORLD_WIDTH >> 1) + #define PIXELS_PER_FOOT 6 /* Number of pixels per foot */ +-#define TICKS_PER_SECOND 3 /* Number of frames per second */ + #define ACCELERATION -5.310 /* Acceleration of gravity (ft/sec^2) */ + #define RETRO 35.0 /* Acceleration due to retroactive thruster */ + #define LATERAL_THRUST 5.0 /* Acceleration due to lateral thruster */ +@@ -53,7 +53,7 @@ + #define LAT_SPEED 30.0 /* Maximum lateral speed without crashing */ + #define RETRO_BURN 1.6 /* Retroactive thruster fuel consumption */ + #define LATERAL_BURN 0.4 /* Lateral thruster fuel consumption */ +-#define FULL_TANK 320 /* Full tank of fuel */ ++#define FULL_TANK 15 /* Full tank of fuel */ + #define MAX_VELOC 640.0 /* Maximum velocity */ + + #define LANDER_WIDTH 600 +@@ -107,9 +107,6 @@ + + DATABASE *DBInit (), *DBInitFromData (), *LoadDataBase (); + void DBInsert (), DBFinish (), DBPlot (), SwapBuffers (), exit (); +-#ifndef _AIX +-char *malloc (); +-#endif + double atof (); + #ifdef sun + int printf (), fprintf (), time (); +@@ -122,4 +119,4 @@ + #define WorldToRadarX(x) (290 + (((int) (x) + (WORLD_WIDTH >> 1)) / 250)) + #define WorldToRadarY(y) (90 - (((int) (y) + (WORLD_LENGTH >> 1)) / 250)) + +-#endif _xlander_h_ ++#endif /* _xlander_h_ */ |