From: Holger Schemel Date: Fri, 8 Sep 2000 23:06:34 +0000 (+0200) Subject: rnd-20000908-1-src X-Git-Tag: 2.0.0^2~43 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=adebc3d223c1611d7c947adba6a8b34885033aec;p=rocksndiamonds.git rnd-20000908-1-src --- diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..10909b96 --- /dev/null +++ b/Makefile @@ -0,0 +1,78 @@ +#=============================================================================# +# 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 diff --git a/src/Makefile b/src/Makefile index 1c20496f..cdef423e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -34,10 +34,25 @@ ifeq ($(PLATFORM),solaris) 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 @@ -62,7 +77,7 @@ endif INCL = $(SYS_CFLAGS) LIBS = $(SYS_LDFLAGS) $(EXTRA_LIBS) -lm -endif +endif # (PLATFORM != dos) ifdef RO_GAME_DIR # path to read-only game data specified @@ -81,9 +96,11 @@ CONFIG_GAME_DIR = $(CONFIG_RO_GAME_DIR) $(CONFIG_RW_GAME_DIR) 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 @@ -143,11 +160,12 @@ OBJS = main.o \ 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) diff --git a/src/init.c b/src/init.c index f1c7ffd9..9c842f45 100644 --- a/src/init.c +++ b/src/init.c @@ -170,7 +170,7 @@ void InitSound() 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; diff --git a/src/sdl.c b/src/sdl.c index c37cbff1..e573d363 100644 --- a/src/sdl.c +++ b/src/sdl.c @@ -62,9 +62,9 @@ inline void SDLDrawSimpleLine(SDL_Surface *surface, int from_x, int from_y, 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); diff --git a/src/system.c b/src/system.c index b34fcd9a..dd329f1c 100644 --- a/src/system.c +++ b/src/system.c @@ -160,23 +160,23 @@ inline void NextEvent(Event *event) 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);