Commit 8d2914bd authored by TANIGUCHI Takaki's avatar TANIGUCHI Takaki

Imported Upstream version 0.8.1

parents
# Makefile for single executable C++ project with auto-dependencies and
# multiple build options
# Copyright (C) 2000-2003 Marc Mongenet
###############################################################################
# PROJECT SPECIFIC DEFINITIONS
###############################################################################
# name of file to build
EXE = xgalaga++
# name of manual (leave empty if none)
MANUAL = xgalaga++.6x
# source files suffix (all source files must have the same suffix)
SOURCE_SUFFIX = cc
# C++ compiler
CXX = g++
# source files directory
srcdir = .
# build directory
builddir = .
# installation directories
installprefix = /usr
bindir = $(installprefix)/games
mandir = $(installprefix)/share/man/man6
# preprocessor options to find all included files
INC_PATH = -I$(srcdir) -I/usr/X11R6/include
# libraries link options ('-lm' is common to link with the math library)
LNK_LIBS = -lm -lX11 -lXpm -L/usr/X11R6/lib/
# other compilation options
# The high scores file is only writable by the executable and shared
# by all players.
HIGH_SCORES_FILE=/var/games/xgalaga++.scores
#HIGH_SCORES_FILE=.xgalaga++.scores
# This group is used for the executable and high scores file.
# The executable is setgid.
EXE_GROUP=games
COMPILE_OPTS = -DHIGH_SCORES_FILE=$(HIGH_SCORES_FILE)
# basic compiler warning options (for GOAL_EXE)
BWARN_OPTS = -Wall -ansi
# extented compiler warning options (for GOAL_DEBUG)
EWARN_OPTS = $(BWARN_OPTS) -pedantic -W\
-Wshadow -Wpointer-arith -Wcast-qual -Wcast-align\
-Wwrite-strings -Woverloaded-virtual -Winline
###############################################################################
# INTERNAL DEFINITIONS
# The following definitions are designed to be project neutral.
###############################################################################
# You may freely change the following goal names if you dislike them.
GOAL_DEBUG = debug
GOAL_PROF = prof
GOAL_EXE = all
# build options for GOAL_DEBUG (executable for debugging) goal
ifeq "$(MAKECMDGOALS)" "$(GOAL_DEBUG)"
# specific options for debugging
GOAL_OPTS = -g
# compilation verification options
WARN_OPTS = $(EWARN_OPTS)
# optimization options
OPTIMISE_OPTS =
# dependencies must be up to date
CHECK_DEPS = yes
else
# build options for GOAL_PROF (executable for profiling) goal
ifeq "$(MAKECMDGOALS)" "$(GOAL_PROF)"
# specific options for profiling
GOAL_OPTS = -pg
# compilation verification options
WARN_OPTS = $(BWARN_OPTS)
# optimization options
OPTIMISE_OPTS = -O
# dependencies must be up to date
CHECK_DEPS = yes
else
# build options for GOAL_EXE (optimized executable) goal
ifeq "$(MAKECMDGOALS)" "$(GOAL_EXE)"
# specific options for optimized executable
GOAL_OPTS = -s
# compilation verification options
WARN_OPTS = $(BWARN_OPTS)
# optimization options
OPTIMISE_OPTS = -Os -fomit-frame-pointer
# dependencies must be up to date
CHECK_DEPS = yes
else
# Other goals do not require up to date dependencies.
CHECK_DEPS = no
endif
endif
endif
# preprocessor options
CPPOPTS = $(INC_PATH)
# compiler options
CXXOPTS = $(GOAL_OPTS) $(COMPILE_OPTS) $(WARN_OPTS) $(OPTIMISE_OPTS)
# linker options
LDOPTS = $(GOAL_OPTS) $(LNK_LIBS)
# source files in this project
sources := $(wildcard $(srcdir)/*.$(SOURCE_SUFFIX))
# object files in this project
objs := $(notdir $(sources))
objs := $(addprefix $(builddir)/, $(objs))
objs := $(objs:.$(SOURCE_SUFFIX)=.o)
# executable with full path
exe = $(builddir)/$(EXE)
# This makefile creates and includes makefiles containing actual dependencies.
# For every source file a dependencies makefile is created and included.
# The deps variable contains the list of all dependencies makefiles.
deps_suffix = d
deps := $(objs:.o=.$(deps_suffix))
# To detect goal changes (for instance from GOAL_DEBUG to GOAL_EXE)
# between invocations, this makefile creates an empty file (the goal flag
# file) which suffix is the goal name.
goal_flag_file_prefix = $(builddir)/Last_make_goal_was_
goal_flag_file = $(goal_flag_file_prefix)$(MAKECMDGOALS)
###############################################################################
# TARGETS
###############################################################################
# Delete the target file of a rule if the command used to update it failed.
# Do that because the newly generated target file may be corrupted but appear
# up to date.
.DELETE_ON_ERROR:
# Clear default suffix list to disable all implicit rules.
.SUFFIXES:
# usage message for this makefile
.PHONY: usage
usage:
@echo "GOAL EFFECT"
@echo "---- ------"
@echo "usage print this message"
@echo "list list the source files"
@echo "$(GOAL_EXE) build the executable"
@echo "$(GOAL_DEBUG) build the executable with debug options"
@echo "$(GOAL_PROF) build the executable with profiling options"
@echo "clean remove all built files"
# If source files exist then build the EXE file.
.PHONY: $(GOAL_EXE)
ifneq "$(strip $(sources))" ""
$(GOAL_EXE): $(exe)
else
$(GOAL_EXE):
@echo "No source file found."
endif
# GOAL_DEBUG and GOAL_PROF targets use the same rules than GOAL_EXE.
.PHONY: $(GOAL_DEBUG)
$(GOAL_DEBUG): $(GOAL_EXE)
.PHONY: $(GOAL_PROF)
$(GOAL_PROF): $(GOAL_EXE)
###############################################################################
# BUILDING
# Note: CPPFLAGS, CXXFLAGS or LDFLAGS are not used but may be specified by the
# user at make invocation.
###############################################################################
# linking
$(exe): $(objs)
$(CXX) $^ -o $@ $(LDOPTS) $(LDFLAGS)
# explicit definition of the implicit rule used to compile source files
$(builddir)/%.o: $(srcdir)/%.$(SOURCE_SUFFIX)
$(CXX) -c $< $(CPPOPTS) $(CXXOPTS) $(CPPFLAGS) $(CXXFLAGS) -o $@
# Rule to build our included dependencies makefiles.
# This rule is used by GNU Make because it automatically tries to (re)build
# obsolete or non-existent included makefiles.
# These files are created with one line of the form:
# 1.o 1.d: $(goal_flag_file) 1.cc 1.h 2.h 3.h g.h
# The implicit rule previously defined will be used for compilation.
# Note that the dependencies can be goal specific.
# The goal_flag_file is determined at run time because it must be the current
# goal and not the goal in use when the dependencies makefile was created.
$(builddir)/%.$(deps_suffix): $(srcdir)/%.$(SOURCE_SUFFIX) $(goal_flag_file)
$(SHELL) -ec '$(CXX) -MM $(CPPOPTS) $(CPPFLAGS) $< |\
sed '\''s@\($*\)\.o[ :]*@$(builddir)/\1.o $@: $$(goal_flag_file) @g'\'' > $@;\
[ -s $@ ] || rm -f $@'
# If dependencies have to be up to date then include dependencies makefiles.
ifeq "$(CHECK_DEPS)" "yes"
ifneq "$(strip $(sources))" ""
include $(deps)
endif
endif
# Rule to produce the goal flag file.
# If the goal has changed then we must rebuild on a clean state because
# pre-processor DEFINE's may have changed.
$(goal_flag_file):
rm -f $(exe) $(goal_flag_file_prefix)* $(objs) $(deps)
touch $@
###############################################################################
# NON-BUILD TARGETS
###############################################################################
# List the source files
.PHONY: list
list:
@echo $(sources) | tr [:space:] \\n
# Remove all files that are normally created by building the program.
.PHONY: clean
clean:
rm -f $(exe) $(goal_flag_file_prefix)* $(objs) $(deps)
###############################################################################
# INSTALLATION TARGETS
###############################################################################
# Installation procedure
# Customized for XGalaga++
install:
cp $(EXE) $(bindir)
if [ -n "$(MANUAL)" ]; then cp $(MANUAL) $(mandir); fi
if [ -n "$(EXE_GROUP)" ]; then chgrp $(EXE_GROUP) $(bindir)/$(EXE); fi
chmod g+s $(bindir)/$(EXE)
touch $(HIGH_SCORES_FILE)
if [ -n "$(EXE_GROUP)" ]; then chgrp $(EXE_GROUP) $(HIGH_SCORES_FILE); fi
chmod 664 $(HIGH_SCORES_FILE)
XGALAGA++
XGalaga++ is a classic vertical scrolling shoot'em up. It requires no X Window
extension and its window is freely resizable. It is inspired by XGalaga,
but rewritten from scratch, except for the graphics.
Home page: http://marc.mongenet.ch/OSS/XGalaga/
COPYRIGHT
2003, 2004, 2008, 2009 Marc Mongenet
Xgalaga++ is free software, available under the terms of the GNU General
Public License.
Note:
Graphic art copied from XGalaga 2.0.34, 1995, 1998, Joe Rumsey.
REQUIREMENTS
- POSIX system
- X11R6
for development:
- GNU Make
- Standard C++ compiler
- X11R6 XLibs dev libs (including Xpm v4 dev libs)
INSTALL
make all
make install
You may need to edit installation pathes in the Makefile.
Note: The Makefile is a "Generic Makefiles" from
http://marc.mongenet.ch/OSS/GenericMakefiles/.
VERSIONS
(2009-09-23) v0.8.1: Fixed includes to compile with GCC 4.3.
(2008-05-21) v0.8: -Os build option
Update email & website
Completed manual
Less randomness in bonus distribution
Save high scores date
Draw less scrolling stars
(2004-04-08) v0.7: Added multi-fire bonus
Added three levels
(2004-03-09) v0.6.1: Corrected a bug in high score display
(2004-03-08) v0.6: Added XGAL_PSEUDO environment variable
Player name always displayed in start menu & high scores
Scrollable high scores
(2004-01-19) v0.5: Added high scores
Standardized the build/install make targets
Created a Debian source package
(2003-10-15) v0.4: More precise (shaped) sprite erasure
Nicer start menu
Many code cleanups & optimizations
Created a binary (i386) Debian package
Added a man page
(2003-10-10) v0.3: Better difficulty progression, less dependent on window size
Upgraded all levels, now they are 10 levels
New default window size and choice of standard sizes
Added a cheat key
Corrected huge memory leak
(2003-09-30) v0.2: Pseudo color visuals supported
More precise sprites positioning
Blueish player explosions
(2003-09-27) v0.1: First release
TODO
Before 1.0
- Add fire power bonus
- Add solidity to aliens
Sometime
- Invisible cursor
- High precision collision detection
- Sound
- Mouse/Joystisk/Joypad control
- Multiplayer
BUGS
Know bugs
- Sprite are erased before being drawn at a new position and erasure also
affects the background. Could be corrected with dual-buffering, but it
takes much more CPU time.
- The scrolling is not _really_ smooth (I miss the Amiga :-)) However, it is
not worse than other X11 games.
Please send bug reports and suggestions to marc@mongenet.ch.
AUTHOR
Marc Mongenet
marc@mongenet.ch
http://marc.mongenet.ch/
I created this game because I was annoyed by bugs in XGalaga 2.0.34 and the
source files were too difficult to modify. So I learned X11 (XLib) programming
from Web tutorials and wrote this game.
/* XPM */
const char *const alien1_xpm[] = {
"18 17 7 1",
" c None",
". c #603000",
"+ c #F0F000",
"@ c #A05000",
"# c #C0C000",
"$ c #909000",
"% c #F08000",
" ..++++.. ",
" @@+#$$#+@@ ",
" @@.@. .@.@@ ",
" @@@..%..%..@@@ ",
" .@@%%.@%%@.%%@@. ",
".@%%@@@@ @@@@%%@.",
"@.@@ .@@. @@.@",
"@%. @%%@ %@",
"@. @..@ .@",
"%@. .%%. .@%",
"@. @..@ .@",
". .@%%@. .",
" @%@@%@ ",
" @% %@ ",
" .% %. ",
" @ @ ",
" @ @ "};
/* XPM */
const char *const alien10_xpm[] = {
"14 13 10 1",
" c None",
". c #FFFFFF",
"+ c #797979",
"@ c #BCBCBC",
"# c #010000",
"$ c #FF0000",
"% c #A80000",
"& c #0000AF",
"* c #0000FF",
"= c #00FFFF",
" .. ",
" +..+ ",
" @ @..@ @ ",
" @ @..@ @ ",
"@ @##@ @",
"@...+@##@+...@",
"...++####++...",
"$$%%%@..@%%%$$",
"@ @..@ @",
"@ +..+ @",
" @ &*==*& @ ",
" @ &**& @ ",
" && "};
/* XPM */
const char *const alien11_xpm[] = {
"14 16 12 1",
" c None",
". c #C1C1C1",
"+ c #909090",
"@ c #A1A1A1",
"# c #B0B0B0",
"$ c #E16F6F",
"% c #7F503F",
"& c #600000",
"* c #00FF00",
"= c #A19050",
"- c #C15F5F",
"; c #FF0000",
". +@@+ .",
"+ +####+ +",
"+ +##$$##+ +",
"+ $%&.%%.&%$ +",
"* $==&==&==$ *",
"*@#$-=$$=-$#@*",
"*@##$----$##@*",
"*@+ -%%- +@*",
"+ == +",
"+ + @--@ + +",
" +@$..$@+ ",
" *@#..#@* ",
" * ;; * ",
" * * ",
" + + ",
" + + "};
/* XPM */
const char *const alien12_xpm[] = {
"13 18 7 1",
" c None",
". c #BF6A41",
"+ c #FF8E57",
"@ c #008100",
"# c #00B000",
"$ c #00E500",
"% c #010000",
" ..+.. ",
" +++++ ",
" @@@@@@@ ",
" @###$###@ ",
" @###$###@ ",
" @##$##@ ",
" @##$##@ ",
" @#$#@ ",
" @#$#@ ",
" @$@ ",
" @@@@#$#@@@@ ",
"@#####$#####@",
" @####$####@ ",
" @##%%%##@ ",
" @#%%%#@ ",
" @#%#@ ",
" @$@ ",
" @ "};
/* XPM */
const char *const alien13_xpm[] = {
"13 17 7 1",
" c None",
". c #606000",
"+ c #A0A000",
"@ c #F0F000",
"# c #F00000",
"$ c #C00000",
"% c #900000",
". .",
"+. .+",
".@. ### .@.",
".+. $$.$$ .+.",
" +@.+$+$+.@+ ",
" . @+%@%+@ . ",
" .+.@@@.+. ",
" + +@+ + ",
" +@+ ",
" .@. ",
" .@. ",
" .+. ",
" .+. ",
" .@. ",
" .@+@. ",
" .+. .+. ",
" .+. "};
/* XPM */
const char *const alien14_xpm[] = {
"12 17 8 1",
" c None",
". c #0000AF",
"+ c #0000FF",
"@ c #99953E",
"# c #010000",
"$ c #CFC954",
"% c #FFFF00",
"& c #FF0000",
" .+. .+. ",
".++++@@++++.",
"+++++##+++++",
".++++$$++++.",
" .+++##+++. ",
" .+++%%+++. ",
" +++##+++ ",
" +++%%+++ ",
" .++@##@++. ",
" .++$%%$++. ",
".+++%##%+++.",
"++++$%%$++++",
".+++@##@+++.",
" .+.@%%@.+. ",
" @%@@%@ ",
" %@&&@% ",
" %&&&&% "};
/* XPM */
const char *const alien2_xpm[] = {
"17 14 5 1",
" c None",
". c #0000FF",
"+ c #99953E",
"@ c #CFC954",
"# c #FFF968",
" . ",
" ++++++...++++++ ",
"+@@@@@+...+@@@@@+",
" +@@###+.+###@@+ ",
" ++@###+###@++ ",
" +@#######@+ ",
" +@#######@+ ",
" +@##+##@+ ",
" +@+ +@+ ",
" +@+ +@+ ",
" +@#+#@+ ",
" +@#@+ ",
" +@+ ",
" + "};
/* XPM */
const char *const alien3_xpm[] = {
"17 18 7 1",
" c None",
". c #900000",
"+ c #C00000",
"@ c #F00000",
"# c #005000",
"$ c #009000",
"% c #00D000",
" . +@@@+ . ",
" ## @+...+@ ## ",
" ##$$$$%%%$$$$## ",
" #$$%%%$$$%%%$$# ",
"##$%$$#%%%#$$%$##",
"#$$%$# #$%$$#",
"#$$%$$$###$$$%$$#",
"#$$%%%$$$$$%%%$$#",
"#$$%$#$%%%$#$%$$#",
"#$$%$##$%$##$%$$#",
"#$$%$ #$%$# $%$$#",
"##$%$ #$%$# $%$##",
" #$%$ #$%$# $%$# ",
" ##%$#$$%$$#$%## ",
" #%$ $ $ $%# ",
" ##$ #$%$# $## ",
" #$ $# ",
" # # "};
/* XPM */
const char *const alien4_xpm[] = {
"17 17 6 1",
" c None",
". c #006000",
"+ c #00A000",
"@ c #00F000",
"# c #A05020",
"$ c #F0F0F0",
" ..++@.+.. ",
" +++++@..+++ ",
" +++++@...++ ",
" ..+++@..... ",
" +++++ ",
" ++@++ ",
" +@@@+ ",
" #+@ @+# ",
" # . . # ",
" @@@@@@@@@@@@@@@ ",
"@@@@@@@@@@@@@@@@@",
"@@@@@@@@@@@@@@@@@",
" @@@@@@@@@@@@@@@ ",
" .+++. ",
" +@@@+ ",
" ",
" $$$$$ "};
/* XPM */
const char *const alien5_xpm[] = {
"16 13 11 1",
" c None",
". c #C1C1C1",
"+ c #B0B0B0",
"@ c #00FF00",
"# c #909090",
"$ c #A1A1A1",
"% c #C15F5F",
"& c #E16F6F",
"* c #7F503F",
"= c #A19050",
"- c #FF0000",
". .",
". ++ .",
"@ #$..$# @",
"@% #++&&++# %@",
"@*&#$++**++$#&*@",
"@+=%&+*==*+&%=+@",
"@+*=%*=&&=*%=*+@",
". $*=%%==%%=*$ .",
"+ #*==&&==*# +",
"# $+*%%*+$ #",
" #*%--%*# ",
" =* *= ",
" % % "};
/* XPM */
const char *const alien6_xpm[] = {
"16 15 7 1",
" c None",
". c #99953E",
"+ c #FFFF00",
"@ c #BCBCBC",
"# c #FFFFFF",
"$ c #A80000",
"% c #FF0000",
" .. .. ",
" .++. .++. ",
".++++. .++++.",
".++++. .++++.",
" .+++@ @+++. ",
" ..@#@ @#@.. ",
" @#@@#@ ",
" @##@ ",
" @@ ",
" $$ ",
" $%%$ ",
" $%%%%$ ",
" $%%%%$ ",
" $%%$ ",
" $$ "};
/* XPM */
const char *const alien7_xpm[] = {
"16 18 7 1",
" c None",
". c #CFC954",
"+ c #FFF968",
"@ c #A80000",
"# c #FF0000",
"$ c #6E0000",
"% c #010000",
" ...... ",
" ++++++++++ ",
" @##########@ ",
" @##########@ ",
" @########@ ",
" @@@@@@@@@@ ",
" $$$$$$$$$$ ",
" @@@@@@@@@@ ",
" @@@@@@@@@@@@@@ ",
"@##############@",
" @############@ ",
" @###%%%%###@ ",
" @###%%###@ ",
" @##%%##@ ",
" @######@ ",
" @######@ ",
" @####@ ",
" @@@@ "};
/* XPM */
const char *const alien8_xpm[] = {
"15 16 8 1",
" c None",
". c #C00000",
"+ c #900000",
"@ c #606000",
"# c #F00000",
"$ c #A0A000",
"% c #F0F000",
"& c #0000F0",
" . +@+ . ",
".#. +.$.+ .#.",
".#.++.#%#.++.#.",
"+$%$.##%##.$%$+",
" $%$. .$%$ ",
" $%$$ $$%$ ",
" $%$%$%$ ",
" $%%%$ ",
" $%$ ",
" $%$ ",
" $%$ ",
" $%$ ",
" $%$ ",
" &$& ",
" &&&&& ",
" &&& "};
/* XPM */
const char *const alien9_xpm[] = {
"15 18 11 1",
" c None",
". c #909090",
"+ c #B0B0B0",
"@ c #FF0000",
"# c #A1A1A1",
"$ c #C1C1C1",
"% c #E16F6F",
"& c #C15F5F",
"* c #7F503F",
"= c #A19050",
"- c #00FF00",
" . . ",
" +@+ ",
" #$# ",
" %$% ",
" #&# ",
" #&*&# ",
". ##*%=%*## .",
".##&&=*%*=&&##.",
"-#%=#+=%=+#=%#-",
"- & -",
"- % -",
". # .",
" # ",
" # ",
" #+# ",
" +$+ ",
" .+. ",
" . "};
/* XPM */
const char *const bomb_xpm[] = {
"5 5 4 1",
" c None",
". c #955500",
"+ c #FFC800",
"@ c #FFD4B5",
" . ",
" .+..",
".+@+.",
"..+. ",
" . "};