Skip to content

Commit

Permalink
Add modified Xinvaders 3D game
Browse files Browse the repository at this point in the history
Builds for X or direct display via the Vectrex Interface library.
The latter needs clipping of lines outside the display area and is
mainly for comparative purposes.
  • Loading branch information
ComputerNerdKev committed Jul 8, 2022
1 parent b7c07cb commit 9a5935d
Show file tree
Hide file tree
Showing 30 changed files with 6,489 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Makefile.raspbian
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all: vecx.emulated/vecx vecx.direct/vecx gyrocks/gyrocks battlezone/battlezone gravitar/gravitar spaceduel/spaceduel tempest/tempest blackwidow/blackwidow deluxe/deluxe lunar/lunar cinematronics/cinemu helloWorld redbaron/redbaron linmenu/linmenu VMMenu/vmmenu xhyperoid/vhyperoid zblast/zblast tailgunner/tailgunner asteroids_sbt/asteroids
all: vecx.emulated/vecx vecx.direct/vecx gyrocks/gyrocks battlezone/battlezone gravitar/gravitar spaceduel/spaceduel tempest/tempest blackwidow/blackwidow deluxe/deluxe lunar/lunar cinematronics/cinemu helloWorld redbaron/redbaron linmenu/linmenu VMMenu/vmmenu xhyperoid/vhyperoid zblast/zblast tailgunner/tailgunner asteroids_sbt/asteroids xinvaders3d/xinv3d

lunar/lunar:
cd lunar; make -f Makefile.raspbian
Expand Down Expand Up @@ -67,15 +67,19 @@ linmenu/linmenu:
VMMenu/vmmenu:
cd VMMenu; make -f Makefile.raspbian
cd ..

xhyperoid/vhyperoid:
cd xhyperoid; make -f Makefile
cd ..

zblast/zblast:
cd zblast; make -f Makefile
cd ..

xinvaders3d/xinv3d:
cd xinvaders3d; make -f Makefile
cd ..

clean:
cd lunar; make -f Makefile.raspbian clean
cd ..
Expand Down Expand Up @@ -123,6 +127,8 @@ clean:
cd ..
cd zblast; make -f Makefile clean
cd ..
cd xinvaders3d; make -f Makefile clean
cd ..

install:
mkdir -p /opt/pitrex/bin
Expand Down
340 changes: 340 additions & 0 deletions xinvaders3d/COPYING

Large diffs are not rendered by default.

60 changes: 60 additions & 0 deletions xinvaders3d/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
BUILD_DIR_PURE := build.raspbian
BUILD_DIR := $(BUILD_DIR_PURE)/

PITREX_DIR := ../pitrex/pitrex/
VECTREX_DIR := ../pitrex/vectrex/

.PHONY: pitrexLib

all: game pitrex

CC = gcc
XLIB = -L/usr/X11R6/lib -I/usr/X11R6/include
LIBS = -lm
XOBJS = game.o aliens.o player.o effects.o \
object.o camera.o main-x11.o vec4x1.o mat4x4.o
PITREXOBJS = $(PITREX_DIR)$(BUILD_DIR)bcm2835.o \
$(PITREX_DIR)$(BUILD_DIR)pitrexio-gpio.o \
$(VECTREX_DIR)$(BUILD_DIR)vectrexInterface.o \
$(VECTREX_DIR)$(BUILD_DIR)osWrapper.o \
$(VECTREX_DIR)$(BUILD_DIR)baremetalUtil.o \
game.o aliens.o player.o effects.o \
object.o camera.o main-pitrex.o vec4x1.o mat4x4.o
DEPENDS =
#CFLAGS = -g -Wall -pedantic -ansi
CFLAGS = -g -I../pitrex/ -DPIZERO -DRPI0 -Wall
#OPTIONS = -D_GNU_SOURCE -DGAME_LINUX_X11 -DGAME_DEBUG
OPTIONS = -DGAME_LINUX_X11

pitrexLib:
$(MAKE) -C $(PITREX_DIR) -f Makefile.raspbian all
$(MAKE) -C $(VECTREX_DIR) -f Makefile.raspbian all

.c.o: $(DEPENDS)
$(CC) -c $(CFLAGS) $(OPTIONS) $< -o $@

game: $(XOBJS) $(DEPENDS)
$(CC) $(CFLAGS) -o xinv3d $(XOBJS) $(XLIB) $(LIBS) -lX11 $(OPTIONS)

pitrex: $(PITREXOBJS) $(DEPENDS) pitrexLib
$(CC) $(CFLAGS) -o xinv3d_pitrex $(PITREXOBJS) $(LIBS) $(OPTIONS)

clean:
$(RM) *.o xinv3d xinv3d_pitrex

aliens.o: aliens.c game.h vec4x1.h mat4x4.h camera.h system.h defines.h \
object.h externs.h
camera.o: camera.c mat4x4.h vec4x1.h camera.h
effects.o: effects.c game.h vec4x1.h mat4x4.h camera.h system.h \
defines.h object.h externs.h
game.o: game.c game.h vec4x1.h mat4x4.h camera.h system.h defines.h \
object.h externs.h
object.o: object.c mat4x4.h vec4x1.h defines.h object.h
main-x11.o: main-x11.c game.h vec4x1.h mat4x4.h camera.h system.h \
defines.h object.h externs.h
main-pitrex.o: main-pitrex.c game.h vec4x1.h mat4x4.h camera.h system.h \
defines.h object.h externs.h
mat4x4.o: mat4x4.c mat4x4.h vec4x1.h
player.o: player.c game.h vec4x1.h mat4x4.h camera.h system.h defines.h \
object.h externs.h
vec4x1.o: vec4x1.c vec4x1.h
36 changes: 36 additions & 0 deletions xinvaders3d/Makefile.dos
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
all: game

CC = gcc
LIBS = -lalleg -lm
OBJS = game.o aliens.o player.o effects.o \
object.o camera.o main-dos.o vec4x1.o mat4x4.o
DEPENDS =
#CFLAGS = -pg -Wall -pedantic -ansi
#CFLAGS = -ansi
#OPTIONS = -D_GNU_SOURCE -DGAME_LINUX_X11 -DGAME_DEBUG
OPTIONS= -DGAME_LINUX_X11

.c.o: $(DEPENDS)
$(CC) -c $(CFLAGS) $(OPTIONS) $< -o $@

game: $(OBJS) $(DEPENDS)
$(CC) -o xinv3d $(OBJS) $(LIBS) $(OPTIONS)

clean:
del *.o
del xinv3d.exe

aliens.o: aliens.c game.h vec4x1.h mat4x4.h camera.h system.h defines.h \
object.h externs.h
camera.o: camera.c mat4x4.h vec4x1.h camera.h
effects.o: effects.c game.h vec4x1.h mat4x4.h camera.h system.h \
defines.h object.h externs.h
game.o: game.c game.h vec4x1.h mat4x4.h camera.h system.h defines.h \
object.h externs.h
object.o: object.c mat4x4.h vec4x1.h defines.h object.h
main-dos.o: main-dos.c game.h vec4x1.h mat4x4.h camera.h system.h \
defines.h object.h externs.h
mat4x4.o: mat4x4.c mat4x4.h vec4x1.h
player.o: player.c game.h vec4x1.h mat4x4.h camera.h system.h defines.h \
object.h externs.h
vec4x1.o: vec4x1.c vec4x1.h
183 changes: 183 additions & 0 deletions xinvaders3d/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@

XInvaders 3D v1.3.6
-=-=-=-=-=-=-=-=-=-
XInvaders 3D is a vector-graphics Space Invaders clone
for the X Window System.

Modified for PiTrex by Kevin Koster, 2022.

================================================================

Objective:
-=-=-=-=-=-
Clear all the aliens in each level. The UFO yields bonus
points if hit. A new life will be added every 7500 points.

Game-over: either if the player has lost all its lives
or if the alien formation reaches the player position.

================================================================

Point System:
-=-=-=-=-=-=-

From bottom to top:
Row 0 aliens yield 10 pts
Row 1 aliens yield 50 pts
Row 2 aliens yield 100 pts
Row 3 aliens yield 150 pts
Row 4 aliens yield 200 pts

UFO yields 500 pts

================================================================

Buttons:
-=-=-=-

4 : Fire Missile
1 : Reset game
2 : Show frame-rate
3 : Pause game

================================================================

How to compile and play the game:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

1. Requirements: gcc and Xlib
2. Compile the game, type: make
3. Run the game, type: ./xinv3d

note:
You may have to edit the Makefile depending on where
your headers and libraries are. For other systems please
see the README.xxx for that system.

xinv3d_pitrex is the PiTrex-direct version. The PiTrex-direct
version doesn't require X, but doesn't yet suport bare-metal. It
needs clipping to be added.

================================================================

Contact Author:
-=-=-=-=-=-=-=-
Don Llopis
[email protected]
http://xinvaders3d.sourceforge.net

================================================================

Greetings:
-=-=-=-=-=-
Greets to following people whose games helped inspire
this project:

Bill Kendrick
who wrote ICBM3d http://www.newbreedsoftware.com

Yuusuke Hashimoto
who wrote XSoldier http://www.surfline.ne.jp/hachi/xsoldier.html

James Eibisch
who wrote a Space Invaders clone in quick-basic
http://www.revolver.demon.co.uk/coding/index.html

Thanks to the following people who contributed to the development
of XInvaders3d:

Thomas Boutell for contributing the Windows Port of XInvaders, and
misc code fixes.

Sam Bushell for the ZONE_HEIGHT bug fix.

Andreas Jeitler for creating the RPM package.

Chris Butler for creating the DEB package.

Peter da Silva for the FreeBSD fix.

Bill Kendrick for the Window Manager fix.

================================================================

History:
-=-=-=-=-

1.3.6:
Minor fixes.
Changed some game text which had the wrong
contact information.
Made some more code clean ups.

1.3.5:
Moved all game text to gtext.h.
Removed `goto' in init code.
Put a space in ``game over.''

1.32-1.34:
Minor fixes.

1.31:
Fixed drawing order. Objects were being drawn in reverse.

1.3:
Many thanks to Thomas Boutell, he has contributed a
Windows port of XInvaders 3D. See README.win for more
information.

XInvaders 3D DOS port finished. XInvaders 3D will now run
as a full-screen 640x480x8 DOS game. For windows users it
will run in a DOS window just fine. I used DJGPP+Allegro
to port it. See README.dos for more information.

Added Vector-fonts. All text graphics have been
replaced with Vector-fonts. Gives the game a
cleaner look.

New player blinking routine. Player now cycles
through red colors, rather than being drawn
each alternate frame, when a new level
has been started.

New special effect: 1-UP indicator. When 7500pts
have been reached a new life is indicated by
a nice little vector 1-UP floating towards
the player.

New alien-shoot missile routine. Aliens now shoot
more.

New Distance-of-Point-to-Line routine, used for
collision detection.

Added fix for FreeBSD systems, thanks to Peter da Silva.

Fixed ZONE_HEIGHT bug in game.c, which was generating
bad pointers, thanks to Sam Bushell.

Cleaned up code, for portability reasons, thanks to
Thomas Boutell for his help.

Left-Shift key is no longer being used.

1.2:
Cleaned up some more code.

Adjusted formation movement.

Changed missile color to yellow, suggested by Mattia Engdeg.

Fixed some warnings which the pedantic flag generates,
thanks to Jarmo Pussinen for pointing them out.

1.1:
Fixed incompatible pointer warnings.

Fixed window manager bug which Bill Kendrick pointed out.

Windows were opening at an odd width and height under
the Enlightenment Window manager.

1.0:
Initial release.
28 changes: 28 additions & 0 deletions xinvaders3d/README.dos
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
See the file README for complete information about XInvaders 3D
in general. This file covers MS-DOS issues only.

INFORMATION FOR PLAYERS:

This is the MS-DOS port of XInvaders 3D. It should run on any
IBM-PC or compatible, running some version of MS-DOS greater than 6.0.
To start the game, just type: xinv3d. See README for instructions.

MS-DOS port done by Don Llopis ([email protected]).

INFORMATION FOR PROGRAMMERS:

To build the game, type:
make -f Makefile.dos

You must have the latest version of DJGPP (a 32bit DOS compiler) and at
least version 3.12 of the Allegro graphics library.

If you make any modifications to the code, please keep ALL DOS-specific
code in main-dos.c.

Both DJGPP and Allegro can be found here:
http://www.delorie.com/djgpp/

Have Fun!
Don Llopis
[email protected]
25 changes: 25 additions & 0 deletions xinvaders3d/README.win
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
See the file README for complete information about XInvaders 3D
in general. This file covers Microsoft Windows issues only.

INFORMATION FOR PLAYERS:

This Windows port of XInvaders 3D runs on Windows 95, 98, NT,
and 2000. To start the game, just launch xinv3d.exe. See README
for instructions, or look at "How to Play" on the system menu
after you start the game.

This Windows port was done by Thomas Boutell ([email protected]).

INFORMATION FOR PROGRAMMERS:

To build the game, just add all of the .c files to a "Win32 Application"
project, including main-w.c, but excluding main-x11.c and any other
main-*.c files for non-Windows operating systems. Then, BE SURE TO
DEFINE THE PREPROCESSOR MACRO GAME_WIN32. If you prefer Makefiles, use
the Unix Makefile as a guide. This game is very easy to build with
any Windows development environment.

If you make any modifications to the code, please keep ALL Windows-specific
code in main-w.c where it belongs!

Windows-specific questions? Contact Thomas Boutell ([email protected]).
Loading

0 comments on commit 9a5935d

Please sign in to comment.