--- /dev/null
+#=============================================================================#
+# Makefile for Rocks'n'Diamonds 1.4.0 #
+# (c) 1995-1999 Holger Schemel, aeglos@valinor.owl.de #
+#=============================================================================#
+
+#-----------------------------------------------------------------------------#
+# configuration section #
+#-----------------------------------------------------------------------------#
+
+# specify your favorite ANSI C compiler
+CC = gcc
+
+# explicitely choose your platform, if defaults doesn't work right
+# needed for SUN/Solaris; Linux and DOS work fine with auto detection
+# PLATFORM = solaris
+# PLATFORM = unix
+# PLATFORM = dos
+# PLATFORM = windows
+
+# specify path to X11 on your system
+# if undefined, use system defaults (works with Linux/gcc/libc5)
+X11_PATH = /usr/X11
+
+# specify directory for read-only game data (like graphics, sounds, levels)
+# default is '.', so you can play without installing game data somewhere
+# RO_GAME_DIR = /usr/games
+
+# specify directory for writable game data (like highscore files)
+# default is '.', so you can play without installing game data somewhere
+# RW_GAME_DIR = /var/games
+
+# uncomment this if your system has no joystick include file
+# JOYSTICK = -DNO_JOYSTICK
+
+# uncomment this if your system has no sound
+# SOUNDS = -DNO_SOUNDS
+
+# choose if you want to allow many global score file entries for one player
+# default is 'MANY_PER_NAME'
+# when installing the game in a multi user environment, choose this
+# SCORE_ENTRIES = ONE_PER_NAME
+# when installing the game in a single user environment, choose this
+# SCORE_ENTRIES = MANY_PER_NAME
+
+# specify path for cross-compiling (only needed for Windows build)
+CROSS_PATH=/usr/local/cross-tools/i386-mingw32/bin
+
+#-----------------------------------------------------------------------------#
+# you should not need to change anything below #
+#-----------------------------------------------------------------------------#
+
+.EXPORT_ALL_VARIABLES:
+
+MAKE = make
+
+SRC_DIR = src
+MAKE_CMD = $(MAKE) -C $(SRC_DIR)
+
+all:
+ @$(MAKE_CMD) TARGET=sdl
+
+x11:
+ @$(MAKE_CMD) TARGET=x11
+
+sdl:
+ @$(MAKE_CMD) TARGET=sdl
+
+sdl_old:
+ @$(MAKE_CMD) TARGET=sdl_old_10
+
+solaris:
+ @$(MAKE_CMD) PLATFORM=solaris
+
+windows:
+ @PATH=$(CROSS_PATH):${PATH} $(MAKE_CMD) PLATFORM=windows
+
+clean:
+ @$(MAKE_CMD) clean
EXTRA_LIBS = -lnsl -lsocket -R$(XLIB_PATH)
endif
-USE_SDL = true
-# USE_SDL = false
+ifeq ($(PLATFORM),windows)
+PROGNAME = ../rocksndiamonds.exe
+TARGET = sdl
+else
+PROFILING = -pg
+endif
+
+ifeq ($(TARGET),sdl_old_10)
+TARGET = sdl
USE_SDL_OLD_LIBS = true
-# USE_SDL_OLD_LIBS = false
+else
+USE_SDL_OLD_LIBS = false
+endif
+
+ifeq ($(TARGET),sdl)
+USE_SDL = true
+else
+USE_SDL = false
+endif
ifeq ($(USE_SDL_OLD_LIBS),true)
SDL_EXTRA_LIBS = -lIMG -lmixer
INCL = $(SYS_CFLAGS)
LIBS = $(SYS_LDFLAGS) $(EXTRA_LIBS) -lm
-endif
+endif # (PLATFORM != dos)
ifdef RO_GAME_DIR # path to read-only game data specified
CONFIG = $(CONFIG_GAME_DIR) $(CONFIG_SCORE_ENTRIES) $(SOUNDS) $(JOYSTICK)
+DEBUG = -DDEBUG -g
-# OPTIONS = -DDEBUG -g -Wall -ansi -pedantic # only for debugging purposes
-OPTIONS = -DDEBUG -g -Wall # only for debugging purposes
+OPTIONS = $(DEBUG) -Wall # only for debugging purposes
+# OPTIONS = $(DEBUG) -O3 -Wall # only for debugging purposes
+# OPTIONS = $(DEBUG) -Wall -ansi -pedantic # only for debugging purposes
# OPTIONS = -O3 -Wall -ansi -pedantic
# OPTIONS = -O3 -Wall
# OPTIONS = -O3
all: $(PROGNAME)
$(PROGNAME): $(OBJS)
- $(CC) $(OBJS) $(LIBS) -o $(PROGNAME)
+ $(CC) $(PROFILING) $(OBJS) $(LIBS) -o $(PROGNAME)
.c.o:
- $(CC) $(CFLAGS) -c $*.c
+ $(CC) $(PROFILING) $(CFLAGS) -c $*.c
clean:
$(RM) *.o
+ $(RM) ../*.exe
$(RM) $(PROGNAME)
return;
}
- if (Mix_OpenAudio(22050, AUDIO_S16, 2, 256) < 0)
+ if (Mix_OpenAudio(22050, AUDIO_S16, 2, 512) < 0)
{
Error(ERR_WARN, "Mix_OpenAudio() failed: %s", SDL_GetError());
sound_status = SOUND_OFF;
int to_x, int to_y, unsigned int color)
{
SDL_Rect rect;
- unsigned int color_r = (color >> 2) && 0xff;
- unsigned int color_g = (color >> 1) && 0xff;
- unsigned int color_b = (color >> 0) && 0xff;
+ unsigned int color_r = (color >> 2) & 0xff;
+ unsigned int color_g = (color >> 1) & 0xff;
+ unsigned int color_b = (color >> 0) & 0xff;
if (from_x > to_x)
swap_numbers(&from_x, &to_x);
inline Key GetEventKey(KeyEvent *event, boolean with_modifiers)
{
#ifdef USE_SDL_LIBRARY
- /*
+#if 0
printf("unicode == '%d', sym == '%d', mod == '0x%04x'\n",
(int)event->keysym.unicode,
(int)event->keysym.sym,
(int)SDL_GetModState());
- */
+#endif
if (with_modifiers && event->keysym.unicode != 0)
return event->keysym.unicode;
else
return event->keysym.sym;
#else
- /*
+#if 0
printf("with modifiers == '0x%04x', without modifiers == '0x%04x'\n",
(int)XLookupKeysym(event, event->state),
(int)XLookupKeysym(event, 0));
- */
+#endif
if (with_modifiers)
return XLookupKeysym(event, event->state);