commit 563103b890425880dfe2393693ac12cfcd1ba484 Author: gerstrong Date: Sat Jun 6 19:24:55 2009 +0000 First real upload of the files used for developing git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@5 4df4b0f3-56ce-47cb-b001-ed939b7d65a6 diff --git a/Debug/CommanderGenius b/Debug/CommanderGenius new file mode 100755 index 000000000..bf206ca01 Binary files /dev/null and b/Debug/CommanderGenius differ diff --git a/Debug/makefile b/Debug/makefile new file mode 100644 index 000000000..1ac62e62f --- /dev/null +++ b/Debug/makefile @@ -0,0 +1,68 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +-include ../makefile.init + +RM := rm -rf + +# All of the sources participating in the build are defined here +-include sources.mk +-include subdir.mk +-include src/vorticon/subdir.mk +-include src/vorbis/subdir.mk +-include src/subdir.mk +-include src/sdl/video/subdir.mk +-include src/sdl/sound/subdir.mk +-include src/sdl/subdir.mk +-include src/scale2x/subdir.mk +-include src/hqp/subdir.mk +-include src/fileio/subdir.mk +-include src/ai/subdir.mk +-include objects.mk + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(C++_DEPS)),) +-include $(C++_DEPS) +endif +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +ifneq ($(strip $(CC_DEPS)),) +-include $(CC_DEPS) +endif +ifneq ($(strip $(CPP_DEPS)),) +-include $(CPP_DEPS) +endif +ifneq ($(strip $(CXX_DEPS)),) +-include $(CXX_DEPS) +endif +ifneq ($(strip $(C_UPPER_DEPS)),) +-include $(C_UPPER_DEPS) +endif +endif + +-include ../makefile.defs + +# Add inputs and outputs from these tool invocations to the build variables + +# All Target +all: CommanderGenius + +# Tool invocations +CommanderGenius: $(OBJS) $(USER_OBJS) + @echo 'Building target: $@' + @echo 'Invoking: GCC C++ Linker' + g++ -o"CommanderGenius" $(OBJS) $(USER_OBJS) $(LIBS) + @echo 'Finished building target: $@' + @echo ' ' + +# Other Targets +clean: + -$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) CommanderGenius + -@echo ' ' + +.PHONY: all clean dependents +.SECONDARY: + +-include ../makefile.targets diff --git a/Debug/objects.mk b/Debug/objects.mk new file mode 100644 index 000000000..01f6ebe85 --- /dev/null +++ b/Debug/objects.mk @@ -0,0 +1,7 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +USER_OBJS := + +LIBS := -lSDL -lGL -lvorbisfile -lvorbis diff --git a/Debug/sources.mk b/Debug/sources.mk new file mode 100644 index 000000000..a7b453a24 --- /dev/null +++ b/Debug/sources.mk @@ -0,0 +1,36 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +O_SRCS := +CPP_SRCS := +C_UPPER_SRCS := +C_SRCS := +S_SRCS := +OBJ_SRCS := +ASM_SRCS := +CXX_SRCS := +C++_SRCS := +CC_SRCS := +OBJS := +C++_DEPS := +C_DEPS := +CC_DEPS := +CPP_DEPS := +EXECUTABLES := +CXX_DEPS := +C_UPPER_DEPS := + +# Every subdirectory with source files must be described here +SUBDIRS := \ +src/vorticon \ +src/vorbis \ +src \ +src/sdl/video \ +src/sdl/sound \ +src/sdl \ +src/scale2x \ +src/hqp \ +src/fileio \ +src/ai \ + diff --git a/Debug/src/CCGenius.d b/Debug/src/CCGenius.d new file mode 100644 index 000000000..2edf64896 --- /dev/null +++ b/Debug/src/CCGenius.d @@ -0,0 +1,6 @@ +src/CCGenius.d src/CCGenius.o: ../src/CCGenius.cpp ../src/CCGenius.h \ + ../src/CSingleton.h + +../src/CCGenius.h: + +../src/CSingleton.h: diff --git a/Debug/src/CGame.d b/Debug/src/CGame.d new file mode 100644 index 000000000..deafae965 --- /dev/null +++ b/Debug/src/CGame.d @@ -0,0 +1,99 @@ +src/CGame.d src/CGame.o: ../src/CGame.cpp ../src/CGame.h ../src/CLatch.h \ + ../src/fileio.h ../src/keen.h ../src/vorticon/sounds.h \ + ../src/funcdefs.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/sdl/sound/CSound.h \ + ../src/sdl/sound/../../CSingleton.h ../src/sdl/sound/CSoundChannel.h \ + ../src/sdl/sound/CSoundSlot.h ../src/sdl/sound/../../hqp/hq_sound.h + +../src/CGame.h: + +../src/CLatch.h: + +../src/fileio.h: + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/sdl/sound/CSound.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/CSoundChannel.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: diff --git a/Debug/src/CGraphics.d b/Debug/src/CGraphics.d new file mode 100644 index 000000000..6ea02da63 --- /dev/null +++ b/Debug/src/CGraphics.d @@ -0,0 +1,109 @@ +src/CGraphics.d src/CGraphics.o: ../src/CGraphics.cpp ../src/CGraphics.h \ + ../src/CSingleton.h /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h \ + /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h \ + /usr/include/SDL/SDL_platform.h /usr/include/SDL/begin_code.h \ + /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h \ + /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h \ + /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h \ + /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h \ + /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h \ + /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h \ + /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h \ + /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h \ + /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h \ + /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h \ + ../src/hqp/CHQBitmap.h ../src/keen.h ../src/vorticon/sounds.h \ + ../src/funcdefs.h ../src/fileio.h ../src/CLatch.h \ + ../src/include/playeraction.h ../src/include/declarations.h \ + ../src/keenext.h ../src/sdl/CVideoDriver.h ../src/sdl/../CSingleton.h \ + ../src/sdl/COpenGL.h /usr/include/SDL/SDL_opengl.h \ + ../src/sdl/../scale2x/scalebit.h ../src/sdl/video/colourtable.h \ + ../src/CLogFile.h + +../src/CGraphics.h: + +../src/CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/hqp/CHQBitmap.h: + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/COpenGL.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/sdl/../scale2x/scalebit.h: + +../src/sdl/video/colourtable.h: + +../src/CLogFile.h: diff --git a/Debug/src/CLatch.d b/Debug/src/CLatch.d new file mode 100644 index 000000000..445ba1131 --- /dev/null +++ b/Debug/src/CLatch.d @@ -0,0 +1,89 @@ +src/CLatch.d src/CLatch.o: ../src/CLatch.cpp ../src/CLatch.h \ + ../src/fileio.h ../src/keen.h ../src/vorticon/sounds.h \ + ../src/funcdefs.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/CLogFile.h ../src/CSingleton.h + +../src/CLatch.h: + +../src/fileio.h: + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/CLogFile.h: + +../src/CSingleton.h: diff --git a/Debug/src/CLogFile.d b/Debug/src/CLogFile.d new file mode 100644 index 000000000..965e6eadc --- /dev/null +++ b/Debug/src/CLogFile.d @@ -0,0 +1,6 @@ +src/CLogFile.d src/CLogFile.o: ../src/CLogFile.cpp ../src/CLogFile.h \ + ../src/CSingleton.h + +../src/CLogFile.h: + +../src/CSingleton.h: diff --git a/Debug/src/SDL/subdir.mk b/Debug/src/SDL/subdir.mk new file mode 100644 index 000000000..5f80e065f --- /dev/null +++ b/Debug/src/SDL/subdir.mk @@ -0,0 +1,30 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/SDL/Input.cpp \ +../src/SDL/Timer.cpp \ +../src/SDL/Video.cpp + +OBJS += \ +./src/SDL/Input.o \ +./src/SDL/Timer.o \ +./src/SDL/Video.o + +CPP_DEPS += \ +./src/SDL/Input.d \ +./src/SDL/Timer.d \ +./src/SDL/Video.d + + +# Each subdirectory must supply rules for building sources it contributes +src/SDL/%.o: ../src/SDL/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DDEBUG -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/ai/baby.d b/Debug/src/ai/baby.d new file mode 100644 index 000000000..10470042f --- /dev/null +++ b/Debug/src/ai/baby.d @@ -0,0 +1,105 @@ +src/ai/baby.d src/ai/baby.o: ../src/ai/baby.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/balljack.d b/Debug/src/ai/balljack.d new file mode 100644 index 000000000..081f9ad97 --- /dev/null +++ b/Debug/src/ai/balljack.d @@ -0,0 +1,91 @@ +src/ai/balljack.d src/ai/balljack.o: ../src/ai/balljack.cpp \ + ../src/ai/../keen.h ../src/ai/../vorticon/sounds.h \ + ../src/ai/../funcdefs.h ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/enemyai.h \ + ../src/ai/../include/game.h + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/enemyai.h: + +../src/ai/../include/game.h: diff --git a/Debug/src/ai/bear.d b/Debug/src/ai/bear.d new file mode 100644 index 000000000..82b855c08 --- /dev/null +++ b/Debug/src/ai/bear.d @@ -0,0 +1,105 @@ +src/ai/bear.d src/ai/bear.o: ../src/ai/bear.cpp ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h \ + ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: diff --git a/Debug/src/ai/butler.d b/Debug/src/ai/butler.d new file mode 100644 index 000000000..471debce4 --- /dev/null +++ b/Debug/src/ai/butler.d @@ -0,0 +1,105 @@ +src/ai/butler.d src/ai/butler.o: ../src/ai/butler.cpp ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h \ + ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: diff --git a/Debug/src/ai/door.d b/Debug/src/ai/door.d new file mode 100644 index 000000000..bcf2e6031 --- /dev/null +++ b/Debug/src/ai/door.d @@ -0,0 +1,88 @@ +src/ai/door.d src/ai/door.o: ../src/ai/door.cpp ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/enemyai.h + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/earth.d b/Debug/src/ai/earth.d new file mode 100644 index 000000000..785031809 --- /dev/null +++ b/Debug/src/ai/earth.d @@ -0,0 +1,88 @@ +src/ai/earth.d src/ai/earth.o: ../src/ai/earth.cpp ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/enemyai.h + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/fireball.d b/Debug/src/ai/fireball.d new file mode 100644 index 000000000..b1053cbbe --- /dev/null +++ b/Debug/src/ai/fireball.d @@ -0,0 +1,107 @@ +src/ai/fireball.d src/ai/fireball.o: ../src/ai/fireball.cpp \ + ../src/ai/../keen.h ../src/ai/../vorticon/sounds.h \ + ../src/ai/../funcdefs.h ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/ray.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h \ + ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/ray.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: diff --git a/Debug/src/ai/foob.d b/Debug/src/ai/foob.d new file mode 100644 index 000000000..3ead79cd2 --- /dev/null +++ b/Debug/src/ai/foob.d @@ -0,0 +1,102 @@ +src/ai/foob.d src/ai/foob.o: ../src/ai/foob.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: diff --git a/Debug/src/ai/garg.d b/Debug/src/ai/garg.d new file mode 100644 index 000000000..e226f7d3e --- /dev/null +++ b/Debug/src/ai/garg.d @@ -0,0 +1,102 @@ +src/ai/garg.d src/ai/garg.o: ../src/ai/garg.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: diff --git a/Debug/src/ai/icebit.d b/Debug/src/ai/icebit.d new file mode 100644 index 000000000..085c9a433 --- /dev/null +++ b/Debug/src/ai/icebit.d @@ -0,0 +1,88 @@ +src/ai/icebit.d src/ai/icebit.o: ../src/ai/icebit.cpp ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/enemyai.h + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/icechunk.d b/Debug/src/ai/icechunk.d new file mode 100644 index 000000000..e0b114a85 --- /dev/null +++ b/Debug/src/ai/icechunk.d @@ -0,0 +1,105 @@ +src/ai/icechunk.d src/ai/icechunk.o: ../src/ai/icechunk.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/meep.d b/Debug/src/ai/meep.d new file mode 100644 index 000000000..78769b92d --- /dev/null +++ b/Debug/src/ai/meep.d @@ -0,0 +1,105 @@ +src/ai/meep.d src/ai/meep.o: ../src/ai/meep.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/mother.d b/Debug/src/ai/mother.d new file mode 100644 index 000000000..535c3b0dc --- /dev/null +++ b/Debug/src/ai/mother.d @@ -0,0 +1,105 @@ +src/ai/mother.d src/ai/mother.o: ../src/ai/mother.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/nessie.d b/Debug/src/ai/nessie.d new file mode 100644 index 000000000..ef66ee58f --- /dev/null +++ b/Debug/src/ai/nessie.d @@ -0,0 +1,91 @@ +src/ai/nessie.d src/ai/nessie.o: ../src/ai/nessie.cpp ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/ninja.d b/Debug/src/ai/ninja.d new file mode 100644 index 000000000..aecb6ca9d --- /dev/null +++ b/Debug/src/ai/ninja.d @@ -0,0 +1,105 @@ +src/ai/ninja.d src/ai/ninja.o: ../src/ai/ninja.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/platform.d b/Debug/src/ai/platform.d new file mode 100644 index 000000000..6482b47d3 --- /dev/null +++ b/Debug/src/ai/platform.d @@ -0,0 +1,91 @@ +src/ai/platform.d src/ai/platform.o: ../src/ai/platform.cpp \ + ../src/ai/../keen.h ../src/ai/../vorticon/sounds.h \ + ../src/ai/../funcdefs.h ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/platvert.d b/Debug/src/ai/platvert.d new file mode 100644 index 000000000..685aa39e7 --- /dev/null +++ b/Debug/src/ai/platvert.d @@ -0,0 +1,91 @@ +src/ai/platvert.d src/ai/platvert.o: ../src/ai/platvert.cpp \ + ../src/ai/../keen.h ../src/ai/../vorticon/sounds.h \ + ../src/ai/../funcdefs.h ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/ray.d b/Debug/src/ai/ray.d new file mode 100644 index 000000000..49f26bc03 --- /dev/null +++ b/Debug/src/ai/ray.d @@ -0,0 +1,107 @@ +src/ai/ray.d src/ai/ray.o: ../src/ai/ray.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h ../src/ai/ray.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: + +../src/ai/ray.h: diff --git a/Debug/src/ai/rope.d b/Debug/src/ai/rope.d new file mode 100644 index 000000000..60a80d1d0 --- /dev/null +++ b/Debug/src/ai/rope.d @@ -0,0 +1,107 @@ +src/ai/rope.d src/ai/rope.o: ../src/ai/rope.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/vort.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/vort.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/se.d b/Debug/src/ai/se.d new file mode 100644 index 000000000..889fca496 --- /dev/null +++ b/Debug/src/ai/se.d @@ -0,0 +1,106 @@ +src/ai/se.d src/ai/se.o: ../src/ai/se.cpp ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/ray.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/ray.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/sndwave.d b/Debug/src/ai/sndwave.d new file mode 100644 index 000000000..e9e8a04e1 --- /dev/null +++ b/Debug/src/ai/sndwave.d @@ -0,0 +1,91 @@ +src/ai/sndwave.d src/ai/sndwave.o: ../src/ai/sndwave.cpp \ + ../src/ai/../keen.h ../src/ai/../vorticon/sounds.h \ + ../src/ai/../funcdefs.h ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/subdir.mk b/Debug/src/ai/subdir.mk new file mode 100644 index 000000000..7d56c1bef --- /dev/null +++ b/Debug/src/ai/subdir.mk @@ -0,0 +1,102 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/ai/baby.cpp \ +../src/ai/balljack.cpp \ +../src/ai/bear.cpp \ +../src/ai/butler.cpp \ +../src/ai/door.cpp \ +../src/ai/earth.cpp \ +../src/ai/fireball.cpp \ +../src/ai/foob.cpp \ +../src/ai/garg.cpp \ +../src/ai/icebit.cpp \ +../src/ai/icechunk.cpp \ +../src/ai/meep.cpp \ +../src/ai/mother.cpp \ +../src/ai/nessie.cpp \ +../src/ai/ninja.cpp \ +../src/ai/platform.cpp \ +../src/ai/platvert.cpp \ +../src/ai/ray.cpp \ +../src/ai/rope.cpp \ +../src/ai/se.cpp \ +../src/ai/sndwave.cpp \ +../src/ai/tank.cpp \ +../src/ai/tankep2.cpp \ +../src/ai/teleport.cpp \ +../src/ai/vort.cpp \ +../src/ai/walker.cpp \ +../src/ai/yorp.cpp + +OBJS += \ +./src/ai/baby.o \ +./src/ai/balljack.o \ +./src/ai/bear.o \ +./src/ai/butler.o \ +./src/ai/door.o \ +./src/ai/earth.o \ +./src/ai/fireball.o \ +./src/ai/foob.o \ +./src/ai/garg.o \ +./src/ai/icebit.o \ +./src/ai/icechunk.o \ +./src/ai/meep.o \ +./src/ai/mother.o \ +./src/ai/nessie.o \ +./src/ai/ninja.o \ +./src/ai/platform.o \ +./src/ai/platvert.o \ +./src/ai/ray.o \ +./src/ai/rope.o \ +./src/ai/se.o \ +./src/ai/sndwave.o \ +./src/ai/tank.o \ +./src/ai/tankep2.o \ +./src/ai/teleport.o \ +./src/ai/vort.o \ +./src/ai/walker.o \ +./src/ai/yorp.o + +CPP_DEPS += \ +./src/ai/baby.d \ +./src/ai/balljack.d \ +./src/ai/bear.d \ +./src/ai/butler.d \ +./src/ai/door.d \ +./src/ai/earth.d \ +./src/ai/fireball.d \ +./src/ai/foob.d \ +./src/ai/garg.d \ +./src/ai/icebit.d \ +./src/ai/icechunk.d \ +./src/ai/meep.d \ +./src/ai/mother.d \ +./src/ai/nessie.d \ +./src/ai/ninja.d \ +./src/ai/platform.d \ +./src/ai/platvert.d \ +./src/ai/ray.d \ +./src/ai/rope.d \ +./src/ai/se.d \ +./src/ai/sndwave.d \ +./src/ai/tank.d \ +./src/ai/tankep2.d \ +./src/ai/teleport.d \ +./src/ai/vort.d \ +./src/ai/walker.d \ +./src/ai/yorp.d + + +# Each subdirectory must supply rules for building sources it contributes +src/ai/%.o: ../src/ai/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/ai/tank.d b/Debug/src/ai/tank.d new file mode 100644 index 000000000..16fa0adff --- /dev/null +++ b/Debug/src/ai/tank.d @@ -0,0 +1,105 @@ +src/ai/tank.d src/ai/tank.o: ../src/ai/tank.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/tankep2.d b/Debug/src/ai/tankep2.d new file mode 100644 index 000000000..4051515af --- /dev/null +++ b/Debug/src/ai/tankep2.d @@ -0,0 +1,105 @@ +src/ai/tankep2.d src/ai/tankep2.o: ../src/ai/tankep2.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/teleport.d b/Debug/src/ai/teleport.d new file mode 100644 index 000000000..674a841db --- /dev/null +++ b/Debug/src/ai/teleport.d @@ -0,0 +1,105 @@ +src/ai/teleport.d src/ai/teleport.o: ../src/ai/teleport.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/vort.d b/Debug/src/ai/vort.d new file mode 100644 index 000000000..c54791364 --- /dev/null +++ b/Debug/src/ai/vort.d @@ -0,0 +1,107 @@ +src/ai/vort.d src/ai/vort.o: ../src/ai/vort.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/vort.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/vort.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/walker.d b/Debug/src/ai/walker.d new file mode 100644 index 000000000..ea29d5092 --- /dev/null +++ b/Debug/src/ai/walker.d @@ -0,0 +1,105 @@ +src/ai/walker.d src/ai/walker.o: ../src/ai/walker.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/ai/yorp.d b/Debug/src/ai/yorp.d new file mode 100644 index 000000000..57aba1e6e --- /dev/null +++ b/Debug/src/ai/yorp.d @@ -0,0 +1,105 @@ +src/ai/yorp.d src/ai/yorp.o: ../src/ai/yorp.cpp \ + ../src/ai/../sdl/sound/CSound.h \ + ../src/ai/../sdl/sound/../../CSingleton.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/ai/../sdl/sound/CSoundChannel.h \ + ../src/ai/../sdl/sound/CSoundSlot.h \ + ../src/ai/../sdl/sound/../../hqp/hq_sound.h ../src/ai/../keen.h \ + ../src/ai/../vorticon/sounds.h ../src/ai/../funcdefs.h \ + ../src/ai/../fileio.h ../src/ai/../CLatch.h \ + ../src/ai/../include/playeraction.h ../src/ai/../include/declarations.h \ + ../src/ai/../keenext.h ../src/ai/../include/game.h \ + ../src/ai/../include/enemyai.h + +../src/ai/../sdl/sound/CSound.h: + +../src/ai/../sdl/sound/../../CSingleton.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/ai/../sdl/sound/CSoundChannel.h: + +../src/ai/../sdl/sound/CSoundSlot.h: + +../src/ai/../sdl/sound/../../hqp/hq_sound.h: + +../src/ai/../keen.h: + +../src/ai/../vorticon/sounds.h: + +../src/ai/../funcdefs.h: + +../src/ai/../fileio.h: + +../src/ai/../CLatch.h: + +../src/ai/../include/playeraction.h: + +../src/ai/../include/declarations.h: + +../src/ai/../keenext.h: + +../src/ai/../include/game.h: + +../src/ai/../include/enemyai.h: diff --git a/Debug/src/eseq_ep1.d b/Debug/src/eseq_ep1.d new file mode 100644 index 000000000..3f3da6bf5 --- /dev/null +++ b/Debug/src/eseq_ep1.d @@ -0,0 +1,118 @@ +src/eseq_ep1.d src/eseq_ep1.o: ../src/eseq_ep1.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/include/game.h ../src/include/gamedo.h \ + ../src/include/gamepdo.h ../src/sdl/CInput.h ../src/sdl/../CSingleton.h \ + ../src/sdl/CTimer.h ../src/include/eseq_ep1.h ../src/include/eseq_ep2.h \ + ../src/include/menu.h ../src/include/../CGame.h \ + ../src/include/../CLatch.h ../src/CGraphics.h ../src/CSingleton.h \ + ../src/hqp/CHQBitmap.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/include/game.h: + +../src/include/gamedo.h: + +../src/include/gamepdo.h: + +../src/sdl/CInput.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/CTimer.h: + +../src/include/eseq_ep1.h: + +../src/include/eseq_ep2.h: + +../src/include/menu.h: + +../src/include/../CGame.h: + +../src/include/../CLatch.h: + +../src/CGraphics.h: + +../src/CSingleton.h: + +../src/hqp/CHQBitmap.h: diff --git a/Debug/src/eseq_ep2.d b/Debug/src/eseq_ep2.d new file mode 100644 index 000000000..b44cebdaf --- /dev/null +++ b/Debug/src/eseq_ep2.d @@ -0,0 +1,133 @@ +src/eseq_ep2.d src/eseq_ep2.o: ../src/eseq_ep2.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/include/game.h ../src/include/gamedo.h \ + ../src/include/gamepdo.h ../src/sdl/CTimer.h ../src/sdl/../CSingleton.h \ + ../src/sdl/CInput.h ../src/sdl/sound/CSound.h \ + ../src/sdl/sound/../../CSingleton.h ../src/sdl/sound/CSoundChannel.h \ + ../src/sdl/sound/CSoundSlot.h ../src/sdl/sound/../../hqp/hq_sound.h \ + ../src/include/eseq_ep2.h ../src/include/eseq_ep1.h \ + ../src/include/menu.h ../src/include/../CGame.h \ + ../src/include/../CLatch.h ../src/include/enemyai.h ../src/CGraphics.h \ + ../src/CSingleton.h ../src/hqp/CHQBitmap.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/include/game.h: + +../src/include/gamedo.h: + +../src/include/gamepdo.h: + +../src/sdl/CTimer.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/CInput.h: + +../src/sdl/sound/CSound.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/CSoundChannel.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: + +../src/include/eseq_ep2.h: + +../src/include/eseq_ep1.h: + +../src/include/menu.h: + +../src/include/../CGame.h: + +../src/include/../CLatch.h: + +../src/include/enemyai.h: + +../src/CGraphics.h: + +../src/CSingleton.h: + +../src/hqp/CHQBitmap.h: diff --git a/Debug/src/eseq_ep3.d b/Debug/src/eseq_ep3.d new file mode 100644 index 000000000..802fe139d --- /dev/null +++ b/Debug/src/eseq_ep3.d @@ -0,0 +1,121 @@ +src/eseq_ep3.d src/eseq_ep3.o: ../src/eseq_ep3.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/include/game.h ../src/include/gamedo.h \ + ../src/sdl/CTimer.h ../src/sdl/../CSingleton.h ../src/sdl/CInput.h \ + ../src/sdl/sound/CSound.h ../src/sdl/sound/../../CSingleton.h \ + ../src/sdl/sound/CSoundChannel.h ../src/sdl/sound/CSoundSlot.h \ + ../src/sdl/sound/../../hqp/hq_sound.h ../src/include/eseq_ep3.h \ + ../src/include/eseq_ep2.h ../src/include/menu.h \ + ../src/include/../CGame.h ../src/include/../CLatch.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/include/game.h: + +../src/include/gamedo.h: + +../src/sdl/CTimer.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/CInput.h: + +../src/sdl/sound/CSound.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/CSoundChannel.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: + +../src/include/eseq_ep3.h: + +../src/include/eseq_ep2.h: + +../src/include/menu.h: + +../src/include/../CGame.h: + +../src/include/../CLatch.h: diff --git a/Debug/src/fileio.d b/Debug/src/fileio.d new file mode 100644 index 000000000..d7b236008 --- /dev/null +++ b/Debug/src/fileio.d @@ -0,0 +1,133 @@ +src/fileio.d src/fileio.o: ../src/fileio.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/sdl/CVideoDriver.h ../src/sdl/../CSingleton.h \ + ../src/sdl/COpenGL.h /usr/include/SDL/SDL_opengl.h \ + ../src/sdl/../scale2x/scalebit.h ../src/sdl/sound/CSound.h \ + ../src/sdl/sound/../../CSingleton.h ../src/sdl/sound/CSoundChannel.h \ + ../src/sdl/sound/CSoundSlot.h ../src/sdl/sound/../../hqp/hq_sound.h \ + ../src/hqp/CMusic.h ../src/hqp/../CSingleton.h ../src/include/fileio.h \ + ../src/include/fileio/lzexe.h ../src/include/fileio/rle.h \ + ../src/vorticon/CPlayer.h ../src/CLogFile.h ../src/CSingleton.h \ + ../src/CGraphics.h ../src/hqp/CHQBitmap.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/COpenGL.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/sdl/../scale2x/scalebit.h: + +../src/sdl/sound/CSound.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/CSoundChannel.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: + +../src/hqp/CMusic.h: + +../src/hqp/../CSingleton.h: + +../src/include/fileio.h: + +../src/include/fileio/lzexe.h: + +../src/include/fileio/rle.h: + +../src/vorticon/CPlayer.h: + +../src/CLogFile.h: + +../src/CSingleton.h: + +../src/CGraphics.h: + +../src/hqp/CHQBitmap.h: diff --git a/Debug/src/fileio/CParser.d b/Debug/src/fileio/CParser.d new file mode 100644 index 000000000..1a719d8e4 --- /dev/null +++ b/Debug/src/fileio/CParser.d @@ -0,0 +1,9 @@ +src/fileio/CParser.d src/fileio/CParser.o: ../src/fileio/CParser.cpp \ + ../src/fileio/CParser.h ../src/fileio/../CLogFile.h \ + ../src/fileio/../CSingleton.h + +../src/fileio/CParser.h: + +../src/fileio/../CLogFile.h: + +../src/fileio/../CSingleton.h: diff --git a/Debug/src/fileio/lzexe.d b/Debug/src/fileio/lzexe.d new file mode 100644 index 000000000..fb25ddb9a --- /dev/null +++ b/Debug/src/fileio/lzexe.d @@ -0,0 +1 @@ +src/fileio/lzexe.d src/fileio/lzexe.o: ../src/fileio/lzexe.cpp diff --git a/Debug/src/fileio/rle.d b/Debug/src/fileio/rle.d new file mode 100644 index 000000000..1762637e7 --- /dev/null +++ b/Debug/src/fileio/rle.d @@ -0,0 +1,6 @@ +src/fileio/rle.d src/fileio/rle.o: ../src/fileio/rle.cpp \ + ../src/fileio/../funcdefs.h ../src/fileio/../fileio.h + +../src/fileio/../funcdefs.h: + +../src/fileio/../fileio.h: diff --git a/Debug/src/fileio/story.d b/Debug/src/fileio/story.d new file mode 100644 index 000000000..8c2abcef1 --- /dev/null +++ b/Debug/src/fileio/story.d @@ -0,0 +1,97 @@ +src/fileio/story.d src/fileio/story.o: ../src/fileio/story.cpp \ + ../src/fileio/../keen.h ../src/fileio/../vorticon/sounds.h \ + ../src/fileio/../funcdefs.h ../src/fileio/../fileio.h \ + ../src/fileio/../CLatch.h ../src/fileio/../include/playeraction.h \ + /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h \ + /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h \ + /usr/include/SDL/SDL_platform.h /usr/include/SDL/begin_code.h \ + /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h \ + /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h \ + /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h \ + /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h \ + /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h \ + /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h \ + /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h \ + /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h \ + /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h \ + /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h \ + ../src/fileio/../include/declarations.h ../src/fileio/../keenext.h \ + ../src/fileio/../include/fileio/lzexe.h \ + ../src/fileio/../include/fileio.h ../src/fileio/../CLogFile.h \ + ../src/fileio/../CSingleton.h + +../src/fileio/../keen.h: + +../src/fileio/../vorticon/sounds.h: + +../src/fileio/../funcdefs.h: + +../src/fileio/../fileio.h: + +../src/fileio/../CLatch.h: + +../src/fileio/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/fileio/../include/declarations.h: + +../src/fileio/../keenext.h: + +../src/fileio/../include/fileio/lzexe.h: + +../src/fileio/../include/fileio.h: + +../src/fileio/../CLogFile.h: + +../src/fileio/../CSingleton.h: diff --git a/Debug/src/fileio/subdir.mk b/Debug/src/fileio/subdir.mk new file mode 100644 index 000000000..b40db2206 --- /dev/null +++ b/Debug/src/fileio/subdir.mk @@ -0,0 +1,33 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/fileio/CParser.cpp \ +../src/fileio/lzexe.cpp \ +../src/fileio/rle.cpp \ +../src/fileio/story.cpp + +OBJS += \ +./src/fileio/CParser.o \ +./src/fileio/lzexe.o \ +./src/fileio/rle.o \ +./src/fileio/story.o + +CPP_DEPS += \ +./src/fileio/CParser.d \ +./src/fileio/lzexe.d \ +./src/fileio/rle.d \ +./src/fileio/story.d + + +# Each subdirectory must supply rules for building sources it contributes +src/fileio/%.o: ../src/fileio/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/finale.d b/Debug/src/finale.d new file mode 100644 index 000000000..eee6d38bd --- /dev/null +++ b/Debug/src/finale.d @@ -0,0 +1,94 @@ +src/finale.d src/finale.o: ../src/finale.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/include/fileio.h ../src/CGraphics.h \ + ../src/CSingleton.h ../src/hqp/CHQBitmap.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/include/fileio.h: + +../src/CGraphics.h: + +../src/CSingleton.h: + +../src/hqp/CHQBitmap.h: diff --git a/Debug/src/game.d b/Debug/src/game.d new file mode 100644 index 000000000..721f444a6 --- /dev/null +++ b/Debug/src/game.d @@ -0,0 +1,153 @@ +src/game.d src/game.o: ../src/game.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/demobox.h ../src/include/game.h \ + ../src/sdl/CVideoDriver.h ../src/sdl/../CSingleton.h \ + ../src/sdl/COpenGL.h /usr/include/SDL/SDL_opengl.h \ + ../src/sdl/../scale2x/scalebit.h ../src/include/menu.h \ + ../src/include/../CGame.h ../src/include/../CLatch.h \ + ../src/include/misc.h ../src/include/gamedo.h ../src/include/gamepdo.h \ + ../src/include/gm_pdowm.h ../src/include/eseq_ep3.h ../src/sdl/CTimer.h \ + ../src/sdl/CInput.h ../src/sdl/sound/CSound.h \ + ../src/sdl/sound/../../CSingleton.h ../src/sdl/sound/CSoundChannel.h \ + ../src/sdl/sound/CSoundSlot.h ../src/sdl/sound/../../hqp/hq_sound.h \ + ../src/include/enemyai.h ../src/hqp/CMusic.h ../src/hqp/../CSingleton.h \ + ../src/vorticon/CPlayer.h ../src/vorticon/CHighScores.h \ + ../src/hqp/CHQBitmap.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/demobox.h: + +../src/include/game.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/COpenGL.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/sdl/../scale2x/scalebit.h: + +../src/include/menu.h: + +../src/include/../CGame.h: + +../src/include/../CLatch.h: + +../src/include/misc.h: + +../src/include/gamedo.h: + +../src/include/gamepdo.h: + +../src/include/gm_pdowm.h: + +../src/include/eseq_ep3.h: + +../src/sdl/CTimer.h: + +../src/sdl/CInput.h: + +../src/sdl/sound/CSound.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/CSoundChannel.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: + +../src/include/enemyai.h: + +../src/hqp/CMusic.h: + +../src/hqp/../CSingleton.h: + +../src/vorticon/CPlayer.h: + +../src/vorticon/CHighScores.h: + +../src/hqp/CHQBitmap.h: diff --git a/Debug/src/game/subdir.mk b/Debug/src/game/subdir.mk new file mode 100644 index 000000000..35fd0e834 --- /dev/null +++ b/Debug/src/game/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/game/Resources.cpp + +OBJS += \ +./src/game/Resources.o + +CPP_DEPS += \ +./src/game/Resources.d + + +# Each subdirectory must supply rules for building sources it contributes +src/game/%.o: ../src/game/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DDEBUG -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/game/vorticon/subdir.mk b/Debug/src/game/vorticon/subdir.mk new file mode 100644 index 000000000..bb5358fda --- /dev/null +++ b/Debug/src/game/vorticon/subdir.mk @@ -0,0 +1,30 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/game/vorticon/CDemo.cpp \ +../src/game/vorticon/CIntro.cpp \ +../src/game/vorticon/CTitle.cpp + +OBJS += \ +./src/game/vorticon/CDemo.o \ +./src/game/vorticon/CIntro.o \ +./src/game/vorticon/CTitle.o + +CPP_DEPS += \ +./src/game/vorticon/CDemo.d \ +./src/game/vorticon/CIntro.d \ +./src/game/vorticon/CTitle.d + + +# Each subdirectory must supply rules for building sources it contributes +src/game/vorticon/%.o: ../src/game/vorticon/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DDEBUG -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/gamedo.d b/Debug/src/gamedo.d new file mode 100644 index 000000000..f30b8f8a8 --- /dev/null +++ b/Debug/src/gamedo.d @@ -0,0 +1,133 @@ +src/gamedo.d src/gamedo.o: ../src/gamedo.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/include/game.h ../src/include/gamedo.h \ + ../src/include/gamepdo.h ../src/include/misc.h \ + ../src/sdl/CVideoDriver.h ../src/sdl/../CSingleton.h \ + ../src/sdl/COpenGL.h /usr/include/SDL/SDL_opengl.h \ + ../src/sdl/../scale2x/scalebit.h ../src/sdl/sound/CSound.h \ + ../src/sdl/sound/../../CSingleton.h ../src/sdl/sound/CSoundChannel.h \ + ../src/sdl/sound/CSoundSlot.h ../src/sdl/sound/../../hqp/hq_sound.h \ + ../src/CGraphics.h ../src/CSingleton.h ../src/hqp/CHQBitmap.h \ + ../src/sdl/CInput.h ../src/vorticon/CPlayer.h ../src/include/enemyai.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/include/game.h: + +../src/include/gamedo.h: + +../src/include/gamepdo.h: + +../src/include/misc.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/COpenGL.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/sdl/../scale2x/scalebit.h: + +../src/sdl/sound/CSound.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/CSoundChannel.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: + +../src/CGraphics.h: + +../src/CSingleton.h: + +../src/hqp/CHQBitmap.h: + +../src/sdl/CInput.h: + +../src/vorticon/CPlayer.h: + +../src/include/enemyai.h: diff --git a/Debug/src/gamepdo.d b/Debug/src/gamepdo.d new file mode 100644 index 000000000..ce450ee14 --- /dev/null +++ b/Debug/src/gamepdo.d @@ -0,0 +1,143 @@ +src/gamepdo.d src/gamepdo.o: ../src/gamepdo.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/sdl/CInput.h ../src/sdl/../CSingleton.h \ + ../src/sdl/CVideoDriver.h ../src/sdl/COpenGL.h \ + /usr/include/SDL/SDL_opengl.h ../src/sdl/../scale2x/scalebit.h \ + ../src/sdl/CTimer.h ../src/sdl/sound/CSound.h \ + ../src/sdl/sound/../../CSingleton.h ../src/sdl/sound/CSoundChannel.h \ + ../src/sdl/sound/CSoundSlot.h ../src/sdl/sound/../../hqp/hq_sound.h \ + ../src/include/game.h ../src/include/gamepdo.h ../src/include/gamedo.h \ + ../src/include/gm_pdowm.h ../src/include/misc.h ../src/include/menu.h \ + ../src/include/../CGame.h ../src/include/../CLatch.h \ + ../src/vorticon/CDialog.h ../src/CGraphics.h ../src/CSingleton.h \ + ../src/hqp/CHQBitmap.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/sdl/CInput.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/COpenGL.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/sdl/../scale2x/scalebit.h: + +../src/sdl/CTimer.h: + +../src/sdl/sound/CSound.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/CSoundChannel.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: + +../src/include/game.h: + +../src/include/gamepdo.h: + +../src/include/gamedo.h: + +../src/include/gm_pdowm.h: + +../src/include/misc.h: + +../src/include/menu.h: + +../src/include/../CGame.h: + +../src/include/../CLatch.h: + +../src/vorticon/CDialog.h: + +../src/CGraphics.h: + +../src/CSingleton.h: + +../src/hqp/CHQBitmap.h: diff --git a/Debug/src/gm_pdowm.d b/Debug/src/gm_pdowm.d new file mode 100644 index 000000000..91e22323a --- /dev/null +++ b/Debug/src/gm_pdowm.d @@ -0,0 +1,116 @@ +src/gm_pdowm.d src/gm_pdowm.o: ../src/gm_pdowm.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/sdl/CInput.h ../src/sdl/../CSingleton.h \ + ../src/include/game.h ../src/include/misc.h ../src/include/gm_pdowm.h \ + ../src/include/gamepdo.h ../src/sdl/sound/CSound.h \ + ../src/sdl/sound/../../CSingleton.h ../src/sdl/sound/CSoundChannel.h \ + ../src/sdl/sound/CSoundSlot.h ../src/sdl/sound/../../hqp/hq_sound.h \ + ../src/hqp/CMusic.h ../src/hqp/../CSingleton.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/sdl/CInput.h: + +../src/sdl/../CSingleton.h: + +../src/include/game.h: + +../src/include/misc.h: + +../src/include/gm_pdowm.h: + +../src/include/gamepdo.h: + +../src/sdl/sound/CSound.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/CSoundChannel.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: + +../src/hqp/CMusic.h: + +../src/hqp/../CSingleton.h: diff --git a/Debug/src/hqp/CHQBitmap.d b/Debug/src/hqp/CHQBitmap.d new file mode 100644 index 000000000..530762bf9 --- /dev/null +++ b/Debug/src/hqp/CHQBitmap.d @@ -0,0 +1,69 @@ +src/hqp/CHQBitmap.d src/hqp/CHQBitmap.o: ../src/hqp/CHQBitmap.cpp \ + ../src/hqp/CHQBitmap.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h + +../src/hqp/CHQBitmap.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: diff --git a/Debug/src/hqp/CMusic.d b/Debug/src/hqp/CMusic.d new file mode 100644 index 000000000..184a1de50 --- /dev/null +++ b/Debug/src/hqp/CMusic.d @@ -0,0 +1,81 @@ +src/hqp/CMusic.d src/hqp/CMusic.o: ../src/hqp/CMusic.cpp \ + ../src/hqp/CMusic.h /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h \ + /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h \ + /usr/include/SDL/SDL_platform.h /usr/include/SDL/begin_code.h \ + /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h \ + /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h \ + /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h \ + /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h \ + /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h \ + /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h \ + /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h \ + /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h \ + /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h \ + /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h \ + ../src/hqp/../CSingleton.h ../src/hqp/../hqp/hq_sound.h \ + ../src/hqp/../CLogFile.h ../src/hqp/../CSingleton.h \ + ../src/hqp/../include/vorbis/oggsupport.h + +../src/hqp/CMusic.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/hqp/../CSingleton.h: + +../src/hqp/../hqp/hq_sound.h: + +../src/hqp/../CLogFile.h: + +../src/hqp/../CSingleton.h: + +../src/hqp/../include/vorbis/oggsupport.h: diff --git a/Debug/src/hqp/hq_sound.d b/Debug/src/hqp/hq_sound.d new file mode 100644 index 000000000..32fd0fba9 --- /dev/null +++ b/Debug/src/hqp/hq_sound.d @@ -0,0 +1,110 @@ +src/hqp/hq_sound.d src/hqp/hq_sound.o: ../src/hqp/hq_sound.cpp \ + /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h \ + /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h \ + /usr/include/SDL/SDL_platform.h /usr/include/SDL/begin_code.h \ + /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h \ + /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h \ + /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h \ + /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h \ + /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h \ + /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h \ + /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h \ + /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h \ + /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h \ + /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h \ + ../src/hqp/../hqp/hq_sound.h ../src/hqp/../keen.h \ + ../src/hqp/../vorticon/sounds.h ../src/hqp/../funcdefs.h \ + ../src/hqp/../fileio.h ../src/hqp/../CLatch.h \ + ../src/hqp/../include/playeraction.h \ + ../src/hqp/../include/declarations.h ../src/hqp/../keenext.h \ + ../src/hqp/../sdl/CVideoDriver.h ../src/hqp/../sdl/../CSingleton.h \ + ../src/hqp/../sdl/COpenGL.h /usr/include/SDL/SDL_opengl.h \ + ../src/hqp/../sdl/../scale2x/scalebit.h \ + ../src/hqp/../include/vorbis/oggsupport.h ../src/hqp/../CLogFile.h \ + ../src/hqp/../CSingleton.h + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/hqp/../hqp/hq_sound.h: + +../src/hqp/../keen.h: + +../src/hqp/../vorticon/sounds.h: + +../src/hqp/../funcdefs.h: + +../src/hqp/../fileio.h: + +../src/hqp/../CLatch.h: + +../src/hqp/../include/playeraction.h: + +../src/hqp/../include/declarations.h: + +../src/hqp/../keenext.h: + +../src/hqp/../sdl/CVideoDriver.h: + +../src/hqp/../sdl/../CSingleton.h: + +../src/hqp/../sdl/COpenGL.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/hqp/../sdl/../scale2x/scalebit.h: + +../src/hqp/../include/vorbis/oggsupport.h: + +../src/hqp/../CLogFile.h: + +../src/hqp/../CSingleton.h: diff --git a/Debug/src/hqp/subdir.mk b/Debug/src/hqp/subdir.mk new file mode 100644 index 000000000..2596c41c4 --- /dev/null +++ b/Debug/src/hqp/subdir.mk @@ -0,0 +1,30 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/hqp/CHQBitmap.cpp \ +../src/hqp/CMusic.cpp \ +../src/hqp/hq_sound.cpp + +OBJS += \ +./src/hqp/CHQBitmap.o \ +./src/hqp/CMusic.o \ +./src/hqp/hq_sound.o + +CPP_DEPS += \ +./src/hqp/CHQBitmap.d \ +./src/hqp/CMusic.d \ +./src/hqp/hq_sound.d + + +# Each subdirectory must supply rules for building sources it contributes +src/hqp/%.o: ../src/hqp/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/launcher/subdir.mk b/Debug/src/launcher/subdir.mk new file mode 100644 index 000000000..4d0290b9b --- /dev/null +++ b/Debug/src/launcher/subdir.mk @@ -0,0 +1,27 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/launcher/GameSlot.cpp \ +../src/launcher/GamesMenu.cpp + +OBJS += \ +./src/launcher/GameSlot.o \ +./src/launcher/GamesMenu.o + +CPP_DEPS += \ +./src/launcher/GameSlot.d \ +./src/launcher/GamesMenu.d + + +# Each subdirectory must supply rules for building sources it contributes +src/launcher/%.o: ../src/launcher/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DDEBUG -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/lz.d b/Debug/src/lz.d new file mode 100644 index 000000000..383479080 --- /dev/null +++ b/Debug/src/lz.d @@ -0,0 +1,89 @@ +src/lz.d src/lz.o: ../src/lz.cpp ../src/keen.h ../src/vorticon/sounds.h \ + ../src/funcdefs.h ../src/fileio.h ../src/CLatch.h \ + ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/CLogFile.h ../src/CSingleton.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/CLogFile.h: + +../src/CSingleton.h: diff --git a/Debug/src/main.d b/Debug/src/main.d new file mode 100644 index 000000000..fdfb1fbcd --- /dev/null +++ b/Debug/src/main.d @@ -0,0 +1,158 @@ +src/main.d src/main.o: ../src/main.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/sdl/joydrv.h ../src/sdl/CInput.h \ + ../src/sdl/../CSingleton.h ../src/sdl/CTimer.h \ + ../src/sdl/sound/CSound.h ../src/sdl/sound/../../CSingleton.h \ + ../src/sdl/sound/CSoundChannel.h ../src/sdl/sound/CSoundSlot.h \ + ../src/sdl/sound/../../hqp/hq_sound.h ../src/include/misc.h \ + ../src/include/menu.h ../src/include/../CGame.h \ + ../src/include/../CLatch.h ../src/sdl/CVideoDriver.h \ + ../src/sdl/COpenGL.h /usr/include/SDL/SDL_opengl.h \ + ../src/sdl/../scale2x/scalebit.h ../src/include/game.h \ + ../src/include/eseq_ep2.h ../src/include/fileio.h \ + ../src/include/fileio/story.h ../src/include/main.h \ + ../src/fileio/CParser.h ../src/vorticon/CPlayer.h \ + ../src/vorticon/CHighScores.h ../src/CLogFile.h ../src/CSingleton.h \ + ../src/CGame.h ../src/CGraphics.h ../src/hqp/CHQBitmap.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/sdl/joydrv.h: + +../src/sdl/CInput.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/CTimer.h: + +../src/sdl/sound/CSound.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/CSoundChannel.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: + +../src/include/misc.h: + +../src/include/menu.h: + +../src/include/../CGame.h: + +../src/include/../CLatch.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/COpenGL.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/sdl/../scale2x/scalebit.h: + +../src/include/game.h: + +../src/include/eseq_ep2.h: + +../src/include/fileio.h: + +../src/include/fileio/story.h: + +../src/include/main.h: + +../src/fileio/CParser.h: + +../src/vorticon/CPlayer.h: + +../src/vorticon/CHighScores.h: + +../src/CLogFile.h: + +../src/CSingleton.h: + +../src/CGame.h: + +../src/CGraphics.h: + +../src/hqp/CHQBitmap.h: diff --git a/Debug/src/map.d b/Debug/src/map.d new file mode 100644 index 000000000..94ad5901c --- /dev/null +++ b/Debug/src/map.d @@ -0,0 +1,92 @@ +src/map.d src/map.o: ../src/map.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/CGraphics.h ../src/CSingleton.h \ + ../src/hqp/CHQBitmap.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/CGraphics.h: + +../src/CSingleton.h: + +../src/hqp/CHQBitmap.h: diff --git a/Debug/src/menu.d b/Debug/src/menu.d new file mode 100644 index 000000000..80ad393b8 --- /dev/null +++ b/Debug/src/menu.d @@ -0,0 +1,157 @@ +src/menu.d src/menu.o: ../src/menu.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/pressf10.h ../src/include/menu.h \ + ../src/include/../CGame.h ../src/include/../CLatch.h \ + ../src/include/misc.h ../src/sdl/CVideoDriver.h \ + ../src/sdl/../CSingleton.h ../src/sdl/COpenGL.h \ + /usr/include/SDL/SDL_opengl.h ../src/sdl/../scale2x/scalebit.h \ + ../src/include/game.h ../src/include/gamedo.h ../src/sdl/CTimer.h \ + ../src/sdl/sound/CSound.h ../src/sdl/sound/../../CSingleton.h \ + ../src/sdl/sound/CSoundChannel.h ../src/sdl/sound/CSoundSlot.h \ + ../src/sdl/sound/../../hqp/hq_sound.h ../src/include/eseq_ep2.h \ + ../src/include/fileio.h ../src/include/gm_pdowm.h ../src/include/main.h \ + ../src/CGraphics.h ../src/CSingleton.h ../src/hqp/CHQBitmap.h \ + ../src/sdl/video/colourtable.h ../src/include/gui/dialog.h \ + ../src/sdl/CInput.h ../src/vorticon/CDialog.h ../src/CLogFile.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/pressf10.h: + +../src/include/menu.h: + +../src/include/../CGame.h: + +../src/include/../CLatch.h: + +../src/include/misc.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/COpenGL.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/sdl/../scale2x/scalebit.h: + +../src/include/game.h: + +../src/include/gamedo.h: + +../src/sdl/CTimer.h: + +../src/sdl/sound/CSound.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/CSoundChannel.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: + +../src/include/eseq_ep2.h: + +../src/include/fileio.h: + +../src/include/gm_pdowm.h: + +../src/include/main.h: + +../src/CGraphics.h: + +../src/CSingleton.h: + +../src/hqp/CHQBitmap.h: + +../src/sdl/video/colourtable.h: + +../src/include/gui/dialog.h: + +../src/sdl/CInput.h: + +../src/vorticon/CDialog.h: + +../src/CLogFile.h: diff --git a/Debug/src/misc.d b/Debug/src/misc.d new file mode 100644 index 000000000..0adf3dd6e --- /dev/null +++ b/Debug/src/misc.d @@ -0,0 +1,141 @@ +src/misc.d src/misc.o: ../src/misc.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/sdl/joydrv.h ../src/sdl/CInput.h \ + ../src/sdl/../CSingleton.h ../src/sdl/CTimer.h \ + ../src/sdl/CVideoDriver.h ../src/sdl/COpenGL.h \ + /usr/include/SDL/SDL_opengl.h ../src/sdl/../scale2x/scalebit.h \ + ../src/sdl/sound/CSound.h ../src/sdl/sound/../../CSingleton.h \ + ../src/sdl/sound/CSoundChannel.h ../src/sdl/sound/CSoundSlot.h \ + ../src/sdl/sound/../../hqp/hq_sound.h ../src/include/misc.h \ + ../src/include/game.h ../src/include/eseq_ep1.h \ + ../src/include/eseq_ep2.h ../src/include/eseq_ep3.h \ + ../src/include/gamedo.h ../src/CLogFile.h ../src/CSingleton.h \ + ../src/CGraphics.h ../src/hqp/CHQBitmap.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/sdl/joydrv.h: + +../src/sdl/CInput.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/CTimer.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/COpenGL.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/sdl/../scale2x/scalebit.h: + +../src/sdl/sound/CSound.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/CSoundChannel.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: + +../src/include/misc.h: + +../src/include/game.h: + +../src/include/eseq_ep1.h: + +../src/include/eseq_ep2.h: + +../src/include/eseq_ep3.h: + +../src/include/gamedo.h: + +../src/CLogFile.h: + +../src/CSingleton.h: + +../src/CGraphics.h: + +../src/hqp/CHQBitmap.h: diff --git a/Debug/src/scale2x/getopt.d b/Debug/src/scale2x/getopt.d new file mode 100644 index 000000000..e5a4e8d52 --- /dev/null +++ b/Debug/src/scale2x/getopt.d @@ -0,0 +1 @@ +src/scale2x/getopt.d src/scale2x/getopt.o: ../src/scale2x/getopt.cpp diff --git a/Debug/src/scale2x/pixel.d b/Debug/src/scale2x/pixel.d new file mode 100644 index 000000000..a1cfb52bf --- /dev/null +++ b/Debug/src/scale2x/pixel.d @@ -0,0 +1,4 @@ +src/scale2x/pixel.d src/scale2x/pixel.o: ../src/scale2x/pixel.cpp \ + ../src/scale2x/pixel.h + +../src/scale2x/pixel.h: diff --git a/Debug/src/scale2x/scale2x.d b/Debug/src/scale2x/scale2x.d new file mode 100644 index 000000000..573e12d64 --- /dev/null +++ b/Debug/src/scale2x/scale2x.d @@ -0,0 +1,4 @@ +src/scale2x/scale2x.d src/scale2x/scale2x.o: ../src/scale2x/scale2x.cpp \ + ../src/scale2x/scale2x.h + +../src/scale2x/scale2x.h: diff --git a/Debug/src/scale2x/scale3x.d b/Debug/src/scale2x/scale3x.d new file mode 100644 index 000000000..be45b06f6 --- /dev/null +++ b/Debug/src/scale2x/scale3x.d @@ -0,0 +1,4 @@ +src/scale2x/scale3x.d src/scale2x/scale3x.o: ../src/scale2x/scale3x.cpp \ + ../src/scale2x/scale3x.h + +../src/scale2x/scale3x.h: diff --git a/Debug/src/scale2x/scalebit.d b/Debug/src/scale2x/scalebit.d new file mode 100644 index 000000000..1227c452d --- /dev/null +++ b/Debug/src/scale2x/scalebit.d @@ -0,0 +1,7 @@ +src/scale2x/scalebit.d src/scale2x/scalebit.o: \ + ../src/scale2x/scalebit.cpp ../src/scale2x/scale2x.h \ + ../src/scale2x/scale3x.h + +../src/scale2x/scale2x.h: + +../src/scale2x/scale3x.h: diff --git a/Debug/src/scale2x/subdir.mk b/Debug/src/scale2x/subdir.mk new file mode 100644 index 000000000..a4f1eecbb --- /dev/null +++ b/Debug/src/scale2x/subdir.mk @@ -0,0 +1,36 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/scale2x/getopt.cpp \ +../src/scale2x/pixel.cpp \ +../src/scale2x/scale2x.cpp \ +../src/scale2x/scale3x.cpp \ +../src/scale2x/scalebit.cpp + +OBJS += \ +./src/scale2x/getopt.o \ +./src/scale2x/pixel.o \ +./src/scale2x/scale2x.o \ +./src/scale2x/scale3x.o \ +./src/scale2x/scalebit.o + +CPP_DEPS += \ +./src/scale2x/getopt.d \ +./src/scale2x/pixel.d \ +./src/scale2x/scale2x.d \ +./src/scale2x/scale3x.d \ +./src/scale2x/scalebit.d + + +# Each subdirectory must supply rules for building sources it contributes +src/scale2x/%.o: ../src/scale2x/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/sdl/CInput.d b/Debug/src/sdl/CInput.d new file mode 100644 index 000000000..8daebbd20 --- /dev/null +++ b/Debug/src/sdl/CInput.d @@ -0,0 +1,76 @@ +src/sdl/CInput.d src/sdl/CInput.o: ../src/sdl/CInput.cpp \ + /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h \ + /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h \ + /usr/include/SDL/SDL_platform.h /usr/include/SDL/begin_code.h \ + /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h \ + /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h \ + /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h \ + /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h \ + /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h \ + /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h \ + /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h \ + /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h \ + /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h \ + /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h \ + ../src/sdl/CInput.h ../src/sdl/../CSingleton.h ../src/sdl/../CLogFile.h \ + ../src/sdl/../CSingleton.h + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/sdl/CInput.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/../CLogFile.h: + +../src/sdl/../CSingleton.h: diff --git a/Debug/src/sdl/COpenGL.d b/Debug/src/sdl/COpenGL.d new file mode 100644 index 000000000..a1c968fc9 --- /dev/null +++ b/Debug/src/sdl/COpenGL.d @@ -0,0 +1,78 @@ +src/sdl/COpenGL.d src/sdl/COpenGL.o: ../src/sdl/COpenGL.cpp \ + ../src/sdl/COpenGL.h /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h \ + /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h \ + /usr/include/SDL/SDL_platform.h /usr/include/SDL/begin_code.h \ + /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h \ + /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h \ + /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h \ + /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h \ + /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h \ + /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h \ + /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h \ + /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h \ + /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h \ + /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h \ + /usr/include/SDL/SDL_opengl.h ../src/sdl/../scale2x/scalebit.h \ + ../src/sdl/../CLogFile.h ../src/sdl/../CSingleton.h + +../src/sdl/COpenGL.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/sdl/../scale2x/scalebit.h: + +../src/sdl/../CLogFile.h: + +../src/sdl/../CSingleton.h: diff --git a/Debug/src/sdl/CTimer.d b/Debug/src/sdl/CTimer.d new file mode 100644 index 000000000..72a7d45b4 --- /dev/null +++ b/Debug/src/sdl/CTimer.d @@ -0,0 +1,93 @@ +src/sdl/CTimer.d src/sdl/CTimer.o: ../src/sdl/CTimer.cpp \ + ../src/sdl/../keen.h ../src/sdl/../vorticon/sounds.h \ + ../src/sdl/../funcdefs.h ../src/sdl/../fileio.h ../src/sdl/../CLatch.h \ + ../src/sdl/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/sdl/../include/declarations.h \ + ../src/sdl/../keenext.h ../src/sdl/../keenext.h ../src/sdl/CTimer.h \ + ../src/sdl/../CSingleton.h + +../src/sdl/../keen.h: + +../src/sdl/../vorticon/sounds.h: + +../src/sdl/../funcdefs.h: + +../src/sdl/../fileio.h: + +../src/sdl/../CLatch.h: + +../src/sdl/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/sdl/../include/declarations.h: + +../src/sdl/../keenext.h: + +../src/sdl/../keenext.h: + +../src/sdl/CTimer.h: + +../src/sdl/../CSingleton.h: diff --git a/Debug/src/sdl/CVideoDriver.d b/Debug/src/sdl/CVideoDriver.d new file mode 100644 index 000000000..ca79aa15f --- /dev/null +++ b/Debug/src/sdl/CVideoDriver.d @@ -0,0 +1,116 @@ +src/sdl/CVideoDriver.d src/sdl/CVideoDriver.o: \ + ../src/sdl/CVideoDriver.cpp ../src/sdl/CVideoDriver.h \ + ../src/sdl/../CSingleton.h ../src/sdl/COpenGL.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h /usr/include/SDL/SDL_opengl.h \ + ../src/sdl/../scale2x/scalebit.h ../src/sdl/CInput.h \ + ../src/sdl/../keen.h ../src/sdl/../vorticon/sounds.h \ + ../src/sdl/../funcdefs.h ../src/sdl/../fileio.h ../src/sdl/../CLatch.h \ + ../src/sdl/../include/playeraction.h \ + ../src/sdl/../include/declarations.h ../src/sdl/../keenext.h \ + ../src/sdl/video/colourconvert.h ../src/sdl/video/colourtable.h \ + ../src/sdl/../CLogFile.h ../src/sdl/../CSingleton.h \ + ../src/sdl/../CGraphics.h ../src/sdl/../hqp/CHQBitmap.h + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/COpenGL.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/sdl/../scale2x/scalebit.h: + +../src/sdl/CInput.h: + +../src/sdl/../keen.h: + +../src/sdl/../vorticon/sounds.h: + +../src/sdl/../funcdefs.h: + +../src/sdl/../fileio.h: + +../src/sdl/../CLatch.h: + +../src/sdl/../include/playeraction.h: + +../src/sdl/../include/declarations.h: + +../src/sdl/../keenext.h: + +../src/sdl/video/colourconvert.h: + +../src/sdl/video/colourtable.h: + +../src/sdl/../CLogFile.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/../CGraphics.h: + +../src/sdl/../hqp/CHQBitmap.h: diff --git a/Debug/src/sdl/joydrv.d b/Debug/src/sdl/joydrv.d new file mode 100644 index 000000000..20618de6d --- /dev/null +++ b/Debug/src/sdl/joydrv.d @@ -0,0 +1,108 @@ +src/sdl/joydrv.d src/sdl/joydrv.o: ../src/sdl/joydrv.cpp \ + ../src/sdl/../keen.h ../src/sdl/../vorticon/sounds.h \ + ../src/sdl/../funcdefs.h ../src/sdl/../fileio.h ../src/sdl/../CLatch.h \ + ../src/sdl/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/sdl/../include/declarations.h \ + ../src/sdl/../keenext.h ../src/sdl/../keenext.h \ + ../src/sdl/CVideoDriver.h ../src/sdl/../CSingleton.h \ + ../src/sdl/COpenGL.h /usr/include/SDL/SDL_opengl.h \ + ../src/sdl/../scale2x/scalebit.h ../src/sdl/../CLogFile.h \ + ../src/sdl/../CSingleton.h ../src/sdl/joydrv.h + +../src/sdl/../keen.h: + +../src/sdl/../vorticon/sounds.h: + +../src/sdl/../funcdefs.h: + +../src/sdl/../fileio.h: + +../src/sdl/../CLatch.h: + +../src/sdl/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/sdl/../include/declarations.h: + +../src/sdl/../keenext.h: + +../src/sdl/../keenext.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/COpenGL.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/sdl/../scale2x/scalebit.h: + +../src/sdl/../CLogFile.h: + +../src/sdl/../CSingleton.h: + +../src/sdl/joydrv.h: diff --git a/Debug/src/sdl/sound/CSound.d b/Debug/src/sdl/sound/CSound.d new file mode 100644 index 000000000..33e3b4870 --- /dev/null +++ b/Debug/src/sdl/sound/CSound.d @@ -0,0 +1,121 @@ +src/sdl/sound/CSound.d src/sdl/sound/CSound.o: \ + ../src/sdl/sound/CSound.cpp ../src/sdl/sound/../../keen.h \ + ../src/sdl/sound/../../vorticon/sounds.h \ + ../src/sdl/sound/../../funcdefs.h ../src/sdl/sound/../../fileio.h \ + ../src/sdl/sound/../../CLatch.h \ + ../src/sdl/sound/../../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h \ + ../src/sdl/sound/../../include/declarations.h \ + ../src/sdl/sound/../../keenext.h \ + ../src/sdl/sound/../../include/fileio/lzexe.h ../src/sdl/sound/CSound.h \ + ../src/sdl/sound/../../CSingleton.h ../src/sdl/sound/CSoundChannel.h \ + ../src/sdl/sound/CSoundSlot.h ../src/sdl/sound/../../hqp/hq_sound.h \ + ../src/sdl/sound/../../include/fileio.h \ + ../src/sdl/sound/../../CLogFile.h ../src/sdl/sound/../../CSingleton.h \ + ../src/sdl/sound/../../hqp/CMusic.h \ + ../src/sdl/sound/../../hqp/../CSingleton.h \ + ../src/sdl/sound/../../vorticon/sounds.h + +../src/sdl/sound/../../keen.h: + +../src/sdl/sound/../../vorticon/sounds.h: + +../src/sdl/sound/../../funcdefs.h: + +../src/sdl/sound/../../fileio.h: + +../src/sdl/sound/../../CLatch.h: + +../src/sdl/sound/../../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/sdl/sound/../../include/declarations.h: + +../src/sdl/sound/../../keenext.h: + +../src/sdl/sound/../../include/fileio/lzexe.h: + +../src/sdl/sound/CSound.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/CSoundChannel.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: + +../src/sdl/sound/../../include/fileio.h: + +../src/sdl/sound/../../CLogFile.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/../../hqp/CMusic.h: + +../src/sdl/sound/../../hqp/../CSingleton.h: + +../src/sdl/sound/../../vorticon/sounds.h: diff --git a/Debug/src/sdl/sound/CSoundChannel.d b/Debug/src/sdl/sound/CSoundChannel.d new file mode 100644 index 000000000..8a1aab632 --- /dev/null +++ b/Debug/src/sdl/sound/CSoundChannel.d @@ -0,0 +1,74 @@ +src/sdl/sound/CSoundChannel.d src/sdl/sound/CSoundChannel.o: \ + ../src/sdl/sound/CSoundChannel.cpp ../src/sdl/sound/CSoundChannel.h \ + /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h \ + /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h \ + /usr/include/SDL/SDL_platform.h /usr/include/SDL/begin_code.h \ + /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h \ + /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h \ + /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h \ + /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h \ + /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h \ + /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h \ + /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h \ + /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h \ + /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h \ + /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h \ + ../src/sdl/sound/CSoundSlot.h ../src/sdl/sound/../../hqp/hq_sound.h + +../src/sdl/sound/CSoundChannel.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: diff --git a/Debug/src/sdl/sound/CSoundSlot.d b/Debug/src/sdl/sound/CSoundSlot.d new file mode 100644 index 000000000..115c57d44 --- /dev/null +++ b/Debug/src/sdl/sound/CSoundSlot.d @@ -0,0 +1,79 @@ +src/sdl/sound/CSoundSlot.d src/sdl/sound/CSoundSlot.o: \ + ../src/sdl/sound/CSoundSlot.cpp ../src/sdl/sound/CSoundSlot.h \ + ../src/sdl/sound/../../hqp/hq_sound.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/sdl/sound/../../CLogFile.h \ + ../src/sdl/sound/../../CSingleton.h ../src/sdl/sound/../../fileio.h + +../src/sdl/sound/CSoundSlot.h: + +../src/sdl/sound/../../hqp/hq_sound.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/sdl/sound/../../CLogFile.h: + +../src/sdl/sound/../../CSingleton.h: + +../src/sdl/sound/../../fileio.h: diff --git a/Debug/src/sdl/sound/subdir.mk b/Debug/src/sdl/sound/subdir.mk new file mode 100644 index 000000000..72675f50c --- /dev/null +++ b/Debug/src/sdl/sound/subdir.mk @@ -0,0 +1,30 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/sdl/sound/CSound.cpp \ +../src/sdl/sound/CSoundChannel.cpp \ +../src/sdl/sound/CSoundSlot.cpp + +OBJS += \ +./src/sdl/sound/CSound.o \ +./src/sdl/sound/CSoundChannel.o \ +./src/sdl/sound/CSoundSlot.o + +CPP_DEPS += \ +./src/sdl/sound/CSound.d \ +./src/sdl/sound/CSoundChannel.d \ +./src/sdl/sound/CSoundSlot.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdl/sound/%.o: ../src/sdl/sound/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/sdl/subdir.mk b/Debug/src/sdl/subdir.mk new file mode 100644 index 000000000..d60f9bedb --- /dev/null +++ b/Debug/src/sdl/subdir.mk @@ -0,0 +1,36 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/sdl/CInput.cpp \ +../src/sdl/COpenGL.cpp \ +../src/sdl/CTimer.cpp \ +../src/sdl/CVideoDriver.cpp \ +../src/sdl/joydrv.cpp + +OBJS += \ +./src/sdl/CInput.o \ +./src/sdl/COpenGL.o \ +./src/sdl/CTimer.o \ +./src/sdl/CVideoDriver.o \ +./src/sdl/joydrv.o + +CPP_DEPS += \ +./src/sdl/CInput.d \ +./src/sdl/COpenGL.d \ +./src/sdl/CTimer.d \ +./src/sdl/CVideoDriver.d \ +./src/sdl/joydrv.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdl/%.o: ../src/sdl/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/sdl/video/colourconvert.d b/Debug/src/sdl/video/colourconvert.d new file mode 100644 index 000000000..adbecbbab --- /dev/null +++ b/Debug/src/sdl/video/colourconvert.d @@ -0,0 +1,69 @@ +src/sdl/video/colourconvert.d src/sdl/video/colourconvert.o: \ + ../src/sdl/video/colourconvert.cpp /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/sdl/video/colourtable.h + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/sdl/video/colourtable.h: diff --git a/Debug/src/sdl/video/subdir.mk b/Debug/src/sdl/video/subdir.mk new file mode 100644 index 000000000..7efe451bf --- /dev/null +++ b/Debug/src/sdl/video/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/sdl/video/colourconvert.cpp + +OBJS += \ +./src/sdl/video/colourconvert.o + +CPP_DEPS += \ +./src/sdl/video/colourconvert.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdl/video/%.o: ../src/sdl/video/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/sdlold/subdir.mk b/Debug/src/sdlold/subdir.mk new file mode 100644 index 000000000..5659ab2a8 --- /dev/null +++ b/Debug/src/sdlold/subdir.mk @@ -0,0 +1,39 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +C_SRCS += \ +../src/sdlold/control.c \ +../src/sdlold/joydrv.c \ +../src/sdlold/polling.c \ +../src/sdlold/snddrv.c \ +../src/sdlold/timedrv.c \ +../src/sdlold/viddrv.c + +OBJS += \ +./src/sdlold/control.o \ +./src/sdlold/joydrv.o \ +./src/sdlold/polling.o \ +./src/sdlold/snddrv.o \ +./src/sdlold/timedrv.o \ +./src/sdlold/viddrv.o + +C_DEPS += \ +./src/sdlold/control.d \ +./src/sdlold/joydrv.d \ +./src/sdlold/polling.d \ +./src/sdlold/snddrv.d \ +./src/sdlold/timedrv.d \ +./src/sdlold/viddrv.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdlold/%.o: ../src/sdlold/%.c + @echo 'Building file: $<' + @echo 'Invoking: GCC C Compiler' + gcc -DBUILD_SDL -DBUILD_WITH_OGG -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/sgrle.d b/Debug/src/sgrle.d new file mode 100644 index 000000000..75dfe0d02 --- /dev/null +++ b/Debug/src/sgrle.d @@ -0,0 +1,85 @@ +src/sgrle.d src/sgrle.o: ../src/sgrle.cpp ../src/keen.h \ + ../src/vorticon/sounds.h ../src/funcdefs.h ../src/fileio.h \ + ../src/CLatch.h ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h + +../src/keen.h: + +../src/vorticon/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: diff --git a/Debug/src/subdir.mk b/Debug/src/subdir.mk new file mode 100644 index 000000000..c1b235657 --- /dev/null +++ b/Debug/src/subdir.mk @@ -0,0 +1,81 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/CCGenius.cpp \ +../src/CGame.cpp \ +../src/CGraphics.cpp \ +../src/CLatch.cpp \ +../src/CLogFile.cpp \ +../src/eseq_ep1.cpp \ +../src/eseq_ep2.cpp \ +../src/eseq_ep3.cpp \ +../src/fileio.cpp \ +../src/finale.cpp \ +../src/game.cpp \ +../src/gamedo.cpp \ +../src/gamepdo.cpp \ +../src/gm_pdowm.cpp \ +../src/lz.cpp \ +../src/main.cpp \ +../src/map.cpp \ +../src/menu.cpp \ +../src/misc.cpp \ +../src/sgrle.cpp + +OBJS += \ +./src/CCGenius.o \ +./src/CGame.o \ +./src/CGraphics.o \ +./src/CLatch.o \ +./src/CLogFile.o \ +./src/eseq_ep1.o \ +./src/eseq_ep2.o \ +./src/eseq_ep3.o \ +./src/fileio.o \ +./src/finale.o \ +./src/game.o \ +./src/gamedo.o \ +./src/gamepdo.o \ +./src/gm_pdowm.o \ +./src/lz.o \ +./src/main.o \ +./src/map.o \ +./src/menu.o \ +./src/misc.o \ +./src/sgrle.o + +CPP_DEPS += \ +./src/CCGenius.d \ +./src/CGame.d \ +./src/CGraphics.d \ +./src/CLatch.d \ +./src/CLogFile.d \ +./src/eseq_ep1.d \ +./src/eseq_ep2.d \ +./src/eseq_ep3.d \ +./src/fileio.d \ +./src/finale.d \ +./src/game.d \ +./src/gamedo.d \ +./src/gamepdo.d \ +./src/gm_pdowm.d \ +./src/lz.d \ +./src/main.d \ +./src/map.d \ +./src/menu.d \ +./src/misc.d \ +./src/sgrle.d + + +# Each subdirectory must supply rules for building sources it contributes +src/%.o: ../src/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/textconsole/subdir.mk b/Debug/src/textconsole/subdir.mk new file mode 100644 index 000000000..e642ff880 --- /dev/null +++ b/Debug/src/textconsole/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/textconsole/TextConsole.cpp + +OBJS += \ +./src/textconsole/TextConsole.o + +CPP_DEPS += \ +./src/textconsole/TextConsole.d + + +# Each subdirectory must supply rules for building sources it contributes +src/textconsole/%.o: ../src/textconsole/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DDEBUG -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/vorbis/oggsupport.d b/Debug/src/vorbis/oggsupport.d new file mode 100644 index 000000000..cdc590eb3 --- /dev/null +++ b/Debug/src/vorbis/oggsupport.d @@ -0,0 +1,90 @@ +src/vorbis/oggsupport.d src/vorbis/oggsupport.o: \ + ../src/vorbis/oggsupport.cpp /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/vorbis/../include/declarations.h \ + ../src/vorbis/../hqp/hq_sound.h ../src/vorbis/../sdl/CVideoDriver.h \ + ../src/vorbis/../sdl/../CSingleton.h ../src/vorbis/../sdl/COpenGL.h \ + /usr/include/SDL/SDL_opengl.h \ + ../src/vorbis/../sdl/../scale2x/scalebit.h ../src/vorbis/../CLogFile.h \ + ../src/vorbis/../CSingleton.h + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/vorbis/../include/declarations.h: + +../src/vorbis/../hqp/hq_sound.h: + +../src/vorbis/../sdl/CVideoDriver.h: + +../src/vorbis/../sdl/../CSingleton.h: + +../src/vorbis/../sdl/COpenGL.h: + +/usr/include/SDL/SDL_opengl.h: + +../src/vorbis/../sdl/../scale2x/scalebit.h: + +../src/vorbis/../CLogFile.h: + +../src/vorbis/../CSingleton.h: diff --git a/Debug/src/vorbis/subdir.mk b/Debug/src/vorbis/subdir.mk new file mode 100644 index 000000000..2bf236bd3 --- /dev/null +++ b/Debug/src/vorbis/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/vorbis/oggsupport.cpp + +OBJS += \ +./src/vorbis/oggsupport.o + +CPP_DEPS += \ +./src/vorbis/oggsupport.d + + +# Each subdirectory must supply rules for building sources it contributes +src/vorbis/%.o: ../src/vorbis/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Debug/src/vorticon/CDialog.d b/Debug/src/vorticon/CDialog.d new file mode 100644 index 000000000..af906ffe6 --- /dev/null +++ b/Debug/src/vorticon/CDialog.d @@ -0,0 +1,107 @@ +src/vorticon/CDialog.d src/vorticon/CDialog.o: \ + ../src/vorticon/CDialog.cpp ../src/vorticon/CDialog.h \ + ../src/vorticon/../funcdefs.h ../src/vorticon/../fileio.h \ + ../src/vorticon/../keen.h ../src/vorticon/../vorticon/sounds.h \ + ../src/vorticon/../funcdefs.h ../src/vorticon/../CLatch.h \ + ../src/vorticon/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h \ + ../src/vorticon/../include/declarations.h ../src/vorticon/../keenext.h \ + ../src/vorticon/../sdl/CTimer.h ../src/vorticon/../sdl/../CSingleton.h \ + ../src/vorticon/../include/gamedo.h ../src/vorticon/../CGraphics.h \ + ../src/vorticon/../CSingleton.h ../src/vorticon/../hqp/CHQBitmap.h + +../src/vorticon/CDialog.h: + +../src/vorticon/../funcdefs.h: + +../src/vorticon/../fileio.h: + +../src/vorticon/../keen.h: + +../src/vorticon/../vorticon/sounds.h: + +../src/vorticon/../funcdefs.h: + +../src/vorticon/../CLatch.h: + +../src/vorticon/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/vorticon/../include/declarations.h: + +../src/vorticon/../keenext.h: + +../src/vorticon/../sdl/CTimer.h: + +../src/vorticon/../sdl/../CSingleton.h: + +../src/vorticon/../include/gamedo.h: + +../src/vorticon/../CGraphics.h: + +../src/vorticon/../CSingleton.h: + +../src/vorticon/../hqp/CHQBitmap.h: diff --git a/Debug/src/vorticon/CHighScores.d b/Debug/src/vorticon/CHighScores.d new file mode 100644 index 000000000..524137c75 --- /dev/null +++ b/Debug/src/vorticon/CHighScores.d @@ -0,0 +1,115 @@ +src/vorticon/CHighScores.d src/vorticon/CHighScores.o: \ + ../src/vorticon/CHighScores.cpp ../src/vorticon/../keen.h \ + ../src/vorticon/../vorticon/sounds.h ../src/vorticon/../funcdefs.h \ + ../src/vorticon/../fileio.h ../src/vorticon/../CLatch.h \ + ../src/vorticon/../include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h \ + ../src/vorticon/../include/declarations.h ../src/vorticon/../keenext.h \ + ../src/vorticon/../include/menu.h ../src/vorticon/../include/../CGame.h \ + ../src/vorticon/../include/../CLatch.h \ + ../src/vorticon/../include/gamedo.h ../src/vorticon/CHighScores.h \ + ../src/vorticon/../sdl/CInput.h ../src/vorticon/../sdl/../CSingleton.h \ + ../src/vorticon/../sdl/CTimer.h ../src/vorticon/../CGraphics.h \ + ../src/vorticon/../CSingleton.h ../src/vorticon/../hqp/CHQBitmap.h + +../src/vorticon/../keen.h: + +../src/vorticon/../vorticon/sounds.h: + +../src/vorticon/../funcdefs.h: + +../src/vorticon/../fileio.h: + +../src/vorticon/../CLatch.h: + +../src/vorticon/../include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/vorticon/../include/declarations.h: + +../src/vorticon/../keenext.h: + +../src/vorticon/../include/menu.h: + +../src/vorticon/../include/../CGame.h: + +../src/vorticon/../include/../CLatch.h: + +../src/vorticon/../include/gamedo.h: + +../src/vorticon/CHighScores.h: + +../src/vorticon/../sdl/CInput.h: + +../src/vorticon/../sdl/../CSingleton.h: + +../src/vorticon/../sdl/CTimer.h: + +../src/vorticon/../CGraphics.h: + +../src/vorticon/../CSingleton.h: + +../src/vorticon/../hqp/CHQBitmap.h: diff --git a/Debug/src/vorticon/CObject.d b/Debug/src/vorticon/CObject.d new file mode 100644 index 000000000..d4efa6fe0 --- /dev/null +++ b/Debug/src/vorticon/CObject.d @@ -0,0 +1,4 @@ +src/vorticon/CObject.d src/vorticon/CObject.o: \ + ../src/vorticon/CObject.cpp ../src/vorticon/CObject.h + +../src/vorticon/CObject.h: diff --git a/Debug/src/vorticon/CPlayer.d b/Debug/src/vorticon/CPlayer.d new file mode 100644 index 000000000..65bd38de7 --- /dev/null +++ b/Debug/src/vorticon/CPlayer.d @@ -0,0 +1,97 @@ +src/vorticon/CPlayer.d src/vorticon/CPlayer.o: \ + ../src/vorticon/CPlayer.cpp /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/vorticon/CPlayer.h \ + ../src/vorticon/../sdl/CInput.h ../src/vorticon/../sdl/../CSingleton.h \ + ../src/vorticon/../keen.h ../src/vorticon/../vorticon/sounds.h \ + ../src/vorticon/../funcdefs.h ../src/vorticon/../fileio.h \ + ../src/vorticon/../CLatch.h ../src/vorticon/../include/playeraction.h \ + ../src/vorticon/../include/declarations.h ../src/vorticon/../keenext.h \ + ../src/vorticon/../funcdefs.h + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/vorticon/CPlayer.h: + +../src/vorticon/../sdl/CInput.h: + +../src/vorticon/../sdl/../CSingleton.h: + +../src/vorticon/../keen.h: + +../src/vorticon/../vorticon/sounds.h: + +../src/vorticon/../funcdefs.h: + +../src/vorticon/../fileio.h: + +../src/vorticon/../CLatch.h: + +../src/vorticon/../include/playeraction.h: + +../src/vorticon/../include/declarations.h: + +../src/vorticon/../keenext.h: + +../src/vorticon/../funcdefs.h: diff --git a/Debug/src/vorticon/subdir.mk b/Debug/src/vorticon/subdir.mk new file mode 100644 index 000000000..62b20ac08 --- /dev/null +++ b/Debug/src/vorticon/subdir.mk @@ -0,0 +1,33 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/vorticon/CDialog.cpp \ +../src/vorticon/CHighScores.cpp \ +../src/vorticon/CObject.cpp \ +../src/vorticon/CPlayer.cpp + +OBJS += \ +./src/vorticon/CDialog.o \ +./src/vorticon/CHighScores.o \ +./src/vorticon/CObject.o \ +./src/vorticon/CPlayer.o + +CPP_DEPS += \ +./src/vorticon/CDialog.d \ +./src/vorticon/CHighScores.d \ +./src/vorticon/CObject.d \ +./src/vorticon/CPlayer.d + + +# Each subdirectory must supply rules for building sources it contributes +src/vorticon/%.o: ../src/vorticon/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/EP1DEMO3.dat b/EP1DEMO3.dat new file mode 100644 index 000000000..223295498 Binary files /dev/null and b/EP1DEMO3.dat differ diff --git a/EP2DEMO1.DAT b/EP2DEMO1.DAT new file mode 100644 index 000000000..50b66d3cf Binary files /dev/null and b/EP2DEMO1.DAT differ diff --git a/EP3DEMO1.DAT b/EP3DEMO1.DAT new file mode 100644 index 000000000..76166a94d Binary files /dev/null and b/EP3DEMO1.DAT differ diff --git a/EP3DEMO4.DAT b/EP3DEMO4.DAT new file mode 100644 index 000000000..389692812 Binary files /dev/null and b/EP3DEMO4.DAT differ diff --git a/Linux32/makefile b/Linux32/makefile new file mode 100644 index 000000000..a4292a928 --- /dev/null +++ b/Linux32/makefile @@ -0,0 +1,68 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +-include ../makefile.init + +RM := rm -rf + +# All of the sources participating in the build are defined here +-include sources.mk +-include subdir.mk +-include src/vorticon/subdir.mk +-include src/vorbis/subdir.mk +-include src/subdir.mk +-include src/sdl/video/subdir.mk +-include src/sdl/sound/subdir.mk +-include src/sdl/subdir.mk +-include src/scale2x/subdir.mk +-include src/hqp/subdir.mk +-include src/fileio/subdir.mk +-include src/ai/subdir.mk +-include objects.mk + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(C++_DEPS)),) +-include $(C++_DEPS) +endif +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +ifneq ($(strip $(CC_DEPS)),) +-include $(CC_DEPS) +endif +ifneq ($(strip $(CPP_DEPS)),) +-include $(CPP_DEPS) +endif +ifneq ($(strip $(CXX_DEPS)),) +-include $(CXX_DEPS) +endif +ifneq ($(strip $(C_UPPER_DEPS)),) +-include $(C_UPPER_DEPS) +endif +endif + +-include ../makefile.defs + +# Add inputs and outputs from these tool invocations to the build variables + +# All Target +all: CommanderGenius + +# Tool invocations +CommanderGenius: $(OBJS) $(USER_OBJS) + @echo 'Building target: $@' + @echo 'Invoking: GCC C++ Linker' + g++ -L"" -L/usr/lib32 -m32 -o"CommanderGenius" $(OBJS) $(USER_OBJS) $(LIBS) + @echo 'Finished building target: $@' + @echo ' ' + +# Other Targets +clean: + -$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) CommanderGenius + -@echo ' ' + +.PHONY: all clean dependents +.SECONDARY: + +-include ../makefile.targets diff --git a/Linux32/objects.mk b/Linux32/objects.mk new file mode 100644 index 000000000..cf802415e --- /dev/null +++ b/Linux32/objects.mk @@ -0,0 +1,7 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +USER_OBJS := + +LIBS := -lSDL-1.2 -lGL -lvorbisfile -lvorbis diff --git a/Linux32/sources.mk b/Linux32/sources.mk new file mode 100644 index 000000000..a7b453a24 --- /dev/null +++ b/Linux32/sources.mk @@ -0,0 +1,36 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +O_SRCS := +CPP_SRCS := +C_UPPER_SRCS := +C_SRCS := +S_SRCS := +OBJ_SRCS := +ASM_SRCS := +CXX_SRCS := +C++_SRCS := +CC_SRCS := +OBJS := +C++_DEPS := +C_DEPS := +CC_DEPS := +CPP_DEPS := +EXECUTABLES := +CXX_DEPS := +C_UPPER_DEPS := + +# Every subdirectory with source files must be described here +SUBDIRS := \ +src/vorticon \ +src/vorbis \ +src \ +src/sdl/video \ +src/sdl/sound \ +src/sdl \ +src/scale2x \ +src/hqp \ +src/fileio \ +src/ai \ + diff --git a/Linux32/src/ai/subdir.mk b/Linux32/src/ai/subdir.mk new file mode 100644 index 000000000..37d365b0f --- /dev/null +++ b/Linux32/src/ai/subdir.mk @@ -0,0 +1,102 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/ai/baby.cpp \ +../src/ai/balljack.cpp \ +../src/ai/bear.cpp \ +../src/ai/butler.cpp \ +../src/ai/door.cpp \ +../src/ai/earth.cpp \ +../src/ai/fireball.cpp \ +../src/ai/foob.cpp \ +../src/ai/garg.cpp \ +../src/ai/icebit.cpp \ +../src/ai/icechunk.cpp \ +../src/ai/meep.cpp \ +../src/ai/mother.cpp \ +../src/ai/nessie.cpp \ +../src/ai/ninja.cpp \ +../src/ai/platform.cpp \ +../src/ai/platvert.cpp \ +../src/ai/ray.cpp \ +../src/ai/rope.cpp \ +../src/ai/se.cpp \ +../src/ai/sndwave.cpp \ +../src/ai/tank.cpp \ +../src/ai/tankep2.cpp \ +../src/ai/teleport.cpp \ +../src/ai/vort.cpp \ +../src/ai/walker.cpp \ +../src/ai/yorp.cpp + +OBJS += \ +./src/ai/baby.o \ +./src/ai/balljack.o \ +./src/ai/bear.o \ +./src/ai/butler.o \ +./src/ai/door.o \ +./src/ai/earth.o \ +./src/ai/fireball.o \ +./src/ai/foob.o \ +./src/ai/garg.o \ +./src/ai/icebit.o \ +./src/ai/icechunk.o \ +./src/ai/meep.o \ +./src/ai/mother.o \ +./src/ai/nessie.o \ +./src/ai/ninja.o \ +./src/ai/platform.o \ +./src/ai/platvert.o \ +./src/ai/ray.o \ +./src/ai/rope.o \ +./src/ai/se.o \ +./src/ai/sndwave.o \ +./src/ai/tank.o \ +./src/ai/tankep2.o \ +./src/ai/teleport.o \ +./src/ai/vort.o \ +./src/ai/walker.o \ +./src/ai/yorp.o + +CPP_DEPS += \ +./src/ai/baby.d \ +./src/ai/balljack.d \ +./src/ai/bear.d \ +./src/ai/butler.d \ +./src/ai/door.d \ +./src/ai/earth.d \ +./src/ai/fireball.d \ +./src/ai/foob.d \ +./src/ai/garg.d \ +./src/ai/icebit.d \ +./src/ai/icechunk.d \ +./src/ai/meep.d \ +./src/ai/mother.d \ +./src/ai/nessie.d \ +./src/ai/ninja.d \ +./src/ai/platform.d \ +./src/ai/platvert.d \ +./src/ai/ray.d \ +./src/ai/rope.d \ +./src/ai/se.d \ +./src/ai/sndwave.d \ +./src/ai/tank.d \ +./src/ai/tankep2.d \ +./src/ai/teleport.d \ +./src/ai/vort.d \ +./src/ai/walker.d \ +./src/ai/yorp.d + + +# Each subdirectory must supply rules for building sources it contributes +src/ai/%.o: ../src/ai/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -D__i386__ -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux32/src/fileio/subdir.mk b/Linux32/src/fileio/subdir.mk new file mode 100644 index 000000000..acf6eb2a4 --- /dev/null +++ b/Linux32/src/fileio/subdir.mk @@ -0,0 +1,33 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/fileio/CParser.cpp \ +../src/fileio/lzexe.cpp \ +../src/fileio/rle.cpp \ +../src/fileio/story.cpp + +OBJS += \ +./src/fileio/CParser.o \ +./src/fileio/lzexe.o \ +./src/fileio/rle.o \ +./src/fileio/story.o + +CPP_DEPS += \ +./src/fileio/CParser.d \ +./src/fileio/lzexe.d \ +./src/fileio/rle.d \ +./src/fileio/story.d + + +# Each subdirectory must supply rules for building sources it contributes +src/fileio/%.o: ../src/fileio/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -D__i386__ -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux32/src/graphics.d b/Linux32/src/graphics.d new file mode 100644 index 000000000..3cb073a8c --- /dev/null +++ b/Linux32/src/graphics.d @@ -0,0 +1,99 @@ +src/graphics.d src/graphics.o: ../src/graphics.cpp ../src/keen.h \ + ../src/sounds.h ../src/funcdefs.h ../src/fileio.h ../src/CLatch.h \ + ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/include/graphics.h \ + ../src/sdl/video/colourtable.h ../src/sdl/CVideoDriver.h \ + ../src/sdl/../CSingleton.h ../src/CLogFile.h ../src/CSingleton.h + +../src/keen.h: + +../src/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/include/graphics.h: + +../src/sdl/video/colourtable.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/CLogFile.h: + +../src/CSingleton.h: diff --git a/Linux32/src/hqp/subdir.mk b/Linux32/src/hqp/subdir.mk new file mode 100644 index 000000000..df3069b81 --- /dev/null +++ b/Linux32/src/hqp/subdir.mk @@ -0,0 +1,33 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/hqp/CHQBitmap.cpp \ +../src/hqp/CMusic.cpp \ +../src/hqp/hq_sound.cpp \ +../src/hqp/musicdrv.cpp + +OBJS += \ +./src/hqp/CHQBitmap.o \ +./src/hqp/CMusic.o \ +./src/hqp/hq_sound.o \ +./src/hqp/musicdrv.o + +CPP_DEPS += \ +./src/hqp/CHQBitmap.d \ +./src/hqp/CMusic.d \ +./src/hqp/hq_sound.d \ +./src/hqp/musicdrv.d + + +# Each subdirectory must supply rules for building sources it contributes +src/hqp/%.o: ../src/hqp/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -D__i386__ -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux32/src/latch.d b/Linux32/src/latch.d new file mode 100644 index 000000000..dd509e175 --- /dev/null +++ b/Linux32/src/latch.d @@ -0,0 +1,97 @@ +src/latch.d src/latch.o: ../src/latch.cpp ../src/keen.h ../src/sounds.h \ + ../src/funcdefs.h ../src/latch.h ../src/include/playeraction.h \ + /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h \ + /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h \ + /usr/include/SDL/SDL_platform.h /usr/include/SDL/begin_code.h \ + /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h \ + /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h \ + /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h \ + /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h \ + /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h \ + /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h \ + /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h \ + /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h \ + /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h \ + /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h \ + ../src/include/declarations.h ../src/keenext.h \ + ../src/sdl/CVideoDriver.h ../src/sdl/../CSingleton.h \ + ../src/include/fileio.h ../src/sdl/video/colourtable.h \ + ../src/CLogFile.h ../src/CSingleton.h + +../src/keen.h: + +../src/sounds.h: + +../src/funcdefs.h: + +../src/latch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/include/fileio.h: + +../src/sdl/video/colourtable.h: + +../src/CLogFile.h: + +../src/CSingleton.h: diff --git a/Linux32/src/scale2x/subdir.mk b/Linux32/src/scale2x/subdir.mk new file mode 100644 index 000000000..4ae53e06a --- /dev/null +++ b/Linux32/src/scale2x/subdir.mk @@ -0,0 +1,36 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/scale2x/getopt.cpp \ +../src/scale2x/pixel.cpp \ +../src/scale2x/scale2x.cpp \ +../src/scale2x/scale3x.cpp \ +../src/scale2x/scalebit.cpp + +OBJS += \ +./src/scale2x/getopt.o \ +./src/scale2x/pixel.o \ +./src/scale2x/scale2x.o \ +./src/scale2x/scale3x.o \ +./src/scale2x/scalebit.o + +CPP_DEPS += \ +./src/scale2x/getopt.d \ +./src/scale2x/pixel.d \ +./src/scale2x/scale2x.d \ +./src/scale2x/scale3x.d \ +./src/scale2x/scalebit.d + + +# Each subdirectory must supply rules for building sources it contributes +src/scale2x/%.o: ../src/scale2x/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -D__i386__ -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux32/src/sdl/sound/subdir.mk b/Linux32/src/sdl/sound/subdir.mk new file mode 100644 index 000000000..e3a9811e4 --- /dev/null +++ b/Linux32/src/sdl/sound/subdir.mk @@ -0,0 +1,30 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/sdl/sound/CSound.cpp \ +../src/sdl/sound/CSoundChannel.cpp \ +../src/sdl/sound/CSoundSlot.cpp + +OBJS += \ +./src/sdl/sound/CSound.o \ +./src/sdl/sound/CSoundChannel.o \ +./src/sdl/sound/CSoundSlot.o + +CPP_DEPS += \ +./src/sdl/sound/CSound.d \ +./src/sdl/sound/CSoundChannel.d \ +./src/sdl/sound/CSoundSlot.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdl/sound/%.o: ../src/sdl/sound/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -D__i386__ -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux32/src/sdl/subdir.mk b/Linux32/src/sdl/subdir.mk new file mode 100644 index 000000000..f8b1235e6 --- /dev/null +++ b/Linux32/src/sdl/subdir.mk @@ -0,0 +1,33 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/sdl/CInput.cpp \ +../src/sdl/CTimer.cpp \ +../src/sdl/CVideoDriver.cpp \ +../src/sdl/joydrv.cpp + +OBJS += \ +./src/sdl/CInput.o \ +./src/sdl/CTimer.o \ +./src/sdl/CVideoDriver.o \ +./src/sdl/joydrv.o + +CPP_DEPS += \ +./src/sdl/CInput.d \ +./src/sdl/CTimer.d \ +./src/sdl/CVideoDriver.d \ +./src/sdl/joydrv.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdl/%.o: ../src/sdl/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -D__i386__ -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux32/src/sdl/video/subdir.mk b/Linux32/src/sdl/video/subdir.mk new file mode 100644 index 000000000..c492ee662 --- /dev/null +++ b/Linux32/src/sdl/video/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/sdl/video/colourconvert.cpp + +OBJS += \ +./src/sdl/video/colourconvert.o + +CPP_DEPS += \ +./src/sdl/video/colourconvert.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdl/video/%.o: ../src/sdl/video/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -D__i386__ -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux32/src/subdir.mk b/Linux32/src/subdir.mk new file mode 100644 index 000000000..4847eb190 --- /dev/null +++ b/Linux32/src/subdir.mk @@ -0,0 +1,81 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/CCGenius.cpp \ +../src/CGame.cpp \ +../src/CGraphics.cpp \ +../src/CLatch.cpp \ +../src/CLogFile.cpp \ +../src/eseq_ep1.cpp \ +../src/eseq_ep2.cpp \ +../src/eseq_ep3.cpp \ +../src/fileio.cpp \ +../src/finale.cpp \ +../src/game.cpp \ +../src/gamedo.cpp \ +../src/gamepdo.cpp \ +../src/gm_pdowm.cpp \ +../src/lz.cpp \ +../src/main.cpp \ +../src/map.cpp \ +../src/menu.cpp \ +../src/misc.cpp \ +../src/sgrle.cpp + +OBJS += \ +./src/CCGenius.o \ +./src/CGame.o \ +./src/CGraphics.o \ +./src/CLatch.o \ +./src/CLogFile.o \ +./src/eseq_ep1.o \ +./src/eseq_ep2.o \ +./src/eseq_ep3.o \ +./src/fileio.o \ +./src/finale.o \ +./src/game.o \ +./src/gamedo.o \ +./src/gamepdo.o \ +./src/gm_pdowm.o \ +./src/lz.o \ +./src/main.o \ +./src/map.o \ +./src/menu.o \ +./src/misc.o \ +./src/sgrle.o + +CPP_DEPS += \ +./src/CCGenius.d \ +./src/CGame.d \ +./src/CGraphics.d \ +./src/CLatch.d \ +./src/CLogFile.d \ +./src/eseq_ep1.d \ +./src/eseq_ep2.d \ +./src/eseq_ep3.d \ +./src/fileio.d \ +./src/finale.d \ +./src/game.d \ +./src/gamedo.d \ +./src/gamepdo.d \ +./src/gm_pdowm.d \ +./src/lz.d \ +./src/main.d \ +./src/map.d \ +./src/menu.d \ +./src/misc.d \ +./src/sgrle.d + + +# Each subdirectory must supply rules for building sources it contributes +src/%.o: ../src/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -D__i386__ -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux32/src/vorbis/subdir.mk b/Linux32/src/vorbis/subdir.mk new file mode 100644 index 000000000..94d6e5717 --- /dev/null +++ b/Linux32/src/vorbis/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/vorbis/oggsupport.cpp + +OBJS += \ +./src/vorbis/oggsupport.o + +CPP_DEPS += \ +./src/vorbis/oggsupport.d + + +# Each subdirectory must supply rules for building sources it contributes +src/vorbis/%.o: ../src/vorbis/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -D__i386__ -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux32/src/vorticon/subdir.mk b/Linux32/src/vorticon/subdir.mk new file mode 100644 index 000000000..ca7f2b518 --- /dev/null +++ b/Linux32/src/vorticon/subdir.mk @@ -0,0 +1,33 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/vorticon/CDialog.cpp \ +../src/vorticon/CHighScores.cpp \ +../src/vorticon/CObject.cpp \ +../src/vorticon/CPlayer.cpp + +OBJS += \ +./src/vorticon/CDialog.o \ +./src/vorticon/CHighScores.o \ +./src/vorticon/CObject.o \ +./src/vorticon/CPlayer.o + +CPP_DEPS += \ +./src/vorticon/CDialog.d \ +./src/vorticon/CHighScores.d \ +./src/vorticon/CObject.d \ +./src/vorticon/CPlayer.d + + +# Each subdirectory must supply rules for building sources it contributes +src/vorticon/%.o: ../src/vorticon/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -D__i386__ -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -m32 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux64/makefile b/Linux64/makefile new file mode 100644 index 000000000..1ac62e62f --- /dev/null +++ b/Linux64/makefile @@ -0,0 +1,68 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +-include ../makefile.init + +RM := rm -rf + +# All of the sources participating in the build are defined here +-include sources.mk +-include subdir.mk +-include src/vorticon/subdir.mk +-include src/vorbis/subdir.mk +-include src/subdir.mk +-include src/sdl/video/subdir.mk +-include src/sdl/sound/subdir.mk +-include src/sdl/subdir.mk +-include src/scale2x/subdir.mk +-include src/hqp/subdir.mk +-include src/fileio/subdir.mk +-include src/ai/subdir.mk +-include objects.mk + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(C++_DEPS)),) +-include $(C++_DEPS) +endif +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +ifneq ($(strip $(CC_DEPS)),) +-include $(CC_DEPS) +endif +ifneq ($(strip $(CPP_DEPS)),) +-include $(CPP_DEPS) +endif +ifneq ($(strip $(CXX_DEPS)),) +-include $(CXX_DEPS) +endif +ifneq ($(strip $(C_UPPER_DEPS)),) +-include $(C_UPPER_DEPS) +endif +endif + +-include ../makefile.defs + +# Add inputs and outputs from these tool invocations to the build variables + +# All Target +all: CommanderGenius + +# Tool invocations +CommanderGenius: $(OBJS) $(USER_OBJS) + @echo 'Building target: $@' + @echo 'Invoking: GCC C++ Linker' + g++ -o"CommanderGenius" $(OBJS) $(USER_OBJS) $(LIBS) + @echo 'Finished building target: $@' + @echo ' ' + +# Other Targets +clean: + -$(RM) $(OBJS)$(C++_DEPS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) CommanderGenius + -@echo ' ' + +.PHONY: all clean dependents +.SECONDARY: + +-include ../makefile.targets diff --git a/Linux64/objects.mk b/Linux64/objects.mk new file mode 100644 index 000000000..01f6ebe85 --- /dev/null +++ b/Linux64/objects.mk @@ -0,0 +1,7 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +USER_OBJS := + +LIBS := -lSDL -lGL -lvorbisfile -lvorbis diff --git a/Linux64/sources.mk b/Linux64/sources.mk new file mode 100644 index 000000000..a7b453a24 --- /dev/null +++ b/Linux64/sources.mk @@ -0,0 +1,36 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +O_SRCS := +CPP_SRCS := +C_UPPER_SRCS := +C_SRCS := +S_SRCS := +OBJ_SRCS := +ASM_SRCS := +CXX_SRCS := +C++_SRCS := +CC_SRCS := +OBJS := +C++_DEPS := +C_DEPS := +CC_DEPS := +CPP_DEPS := +EXECUTABLES := +CXX_DEPS := +C_UPPER_DEPS := + +# Every subdirectory with source files must be described here +SUBDIRS := \ +src/vorticon \ +src/vorbis \ +src \ +src/sdl/video \ +src/sdl/sound \ +src/sdl \ +src/scale2x \ +src/hqp \ +src/fileio \ +src/ai \ + diff --git a/Linux64/src/ai/subdir.mk b/Linux64/src/ai/subdir.mk new file mode 100644 index 000000000..3a68c626d --- /dev/null +++ b/Linux64/src/ai/subdir.mk @@ -0,0 +1,102 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/ai/baby.cpp \ +../src/ai/balljack.cpp \ +../src/ai/bear.cpp \ +../src/ai/butler.cpp \ +../src/ai/door.cpp \ +../src/ai/earth.cpp \ +../src/ai/fireball.cpp \ +../src/ai/foob.cpp \ +../src/ai/garg.cpp \ +../src/ai/icebit.cpp \ +../src/ai/icechunk.cpp \ +../src/ai/meep.cpp \ +../src/ai/mother.cpp \ +../src/ai/nessie.cpp \ +../src/ai/ninja.cpp \ +../src/ai/platform.cpp \ +../src/ai/platvert.cpp \ +../src/ai/ray.cpp \ +../src/ai/rope.cpp \ +../src/ai/se.cpp \ +../src/ai/sndwave.cpp \ +../src/ai/tank.cpp \ +../src/ai/tankep2.cpp \ +../src/ai/teleport.cpp \ +../src/ai/vort.cpp \ +../src/ai/walker.cpp \ +../src/ai/yorp.cpp + +OBJS += \ +./src/ai/baby.o \ +./src/ai/balljack.o \ +./src/ai/bear.o \ +./src/ai/butler.o \ +./src/ai/door.o \ +./src/ai/earth.o \ +./src/ai/fireball.o \ +./src/ai/foob.o \ +./src/ai/garg.o \ +./src/ai/icebit.o \ +./src/ai/icechunk.o \ +./src/ai/meep.o \ +./src/ai/mother.o \ +./src/ai/nessie.o \ +./src/ai/ninja.o \ +./src/ai/platform.o \ +./src/ai/platvert.o \ +./src/ai/ray.o \ +./src/ai/rope.o \ +./src/ai/se.o \ +./src/ai/sndwave.o \ +./src/ai/tank.o \ +./src/ai/tankep2.o \ +./src/ai/teleport.o \ +./src/ai/vort.o \ +./src/ai/walker.o \ +./src/ai/yorp.o + +CPP_DEPS += \ +./src/ai/baby.d \ +./src/ai/balljack.d \ +./src/ai/bear.d \ +./src/ai/butler.d \ +./src/ai/door.d \ +./src/ai/earth.d \ +./src/ai/fireball.d \ +./src/ai/foob.d \ +./src/ai/garg.d \ +./src/ai/icebit.d \ +./src/ai/icechunk.d \ +./src/ai/meep.d \ +./src/ai/mother.d \ +./src/ai/nessie.d \ +./src/ai/ninja.d \ +./src/ai/platform.d \ +./src/ai/platvert.d \ +./src/ai/ray.d \ +./src/ai/rope.d \ +./src/ai/se.d \ +./src/ai/sndwave.d \ +./src/ai/tank.d \ +./src/ai/tankep2.d \ +./src/ai/teleport.d \ +./src/ai/vort.d \ +./src/ai/walker.d \ +./src/ai/yorp.d + + +# Each subdirectory must supply rules for building sources it contributes +src/ai/%.o: ../src/ai/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux64/src/fileio/subdir.mk b/Linux64/src/fileio/subdir.mk new file mode 100644 index 000000000..d1c65773d --- /dev/null +++ b/Linux64/src/fileio/subdir.mk @@ -0,0 +1,33 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/fileio/CParser.cpp \ +../src/fileio/lzexe.cpp \ +../src/fileio/rle.cpp \ +../src/fileio/story.cpp + +OBJS += \ +./src/fileio/CParser.o \ +./src/fileio/lzexe.o \ +./src/fileio/rle.o \ +./src/fileio/story.o + +CPP_DEPS += \ +./src/fileio/CParser.d \ +./src/fileio/lzexe.d \ +./src/fileio/rle.d \ +./src/fileio/story.d + + +# Each subdirectory must supply rules for building sources it contributes +src/fileio/%.o: ../src/fileio/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux64/src/graphics.d b/Linux64/src/graphics.d new file mode 100644 index 000000000..3cb073a8c --- /dev/null +++ b/Linux64/src/graphics.d @@ -0,0 +1,99 @@ +src/graphics.d src/graphics.o: ../src/graphics.cpp ../src/keen.h \ + ../src/sounds.h ../src/funcdefs.h ../src/fileio.h ../src/CLatch.h \ + ../src/include/playeraction.h /usr/include/SDL/SDL.h \ + /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \ + /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \ + /usr/include/SDL/begin_code.h /usr/include/SDL/close_code.h \ + /usr/include/SDL/SDL_audio.h /usr/include/SDL/SDL_error.h \ + /usr/include/SDL/SDL_endian.h /usr/include/SDL/SDL_mutex.h \ + /usr/include/SDL/SDL_thread.h /usr/include/SDL/SDL_rwops.h \ + /usr/include/SDL/SDL_cdrom.h /usr/include/SDL/SDL_cpuinfo.h \ + /usr/include/SDL/SDL_events.h /usr/include/SDL/SDL_active.h \ + /usr/include/SDL/SDL_keyboard.h /usr/include/SDL/SDL_keysym.h \ + /usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \ + /usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \ + /usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \ + /usr/include/SDL/SDL_version.h ../src/include/declarations.h \ + ../src/keenext.h ../src/include/graphics.h \ + ../src/sdl/video/colourtable.h ../src/sdl/CVideoDriver.h \ + ../src/sdl/../CSingleton.h ../src/CLogFile.h ../src/CSingleton.h + +../src/keen.h: + +../src/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/include/graphics.h: + +../src/sdl/video/colourtable.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/CLogFile.h: + +../src/CSingleton.h: diff --git a/Linux64/src/hqp/subdir.mk b/Linux64/src/hqp/subdir.mk new file mode 100644 index 000000000..46430c647 --- /dev/null +++ b/Linux64/src/hqp/subdir.mk @@ -0,0 +1,33 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/hqp/CHQBitmap.cpp \ +../src/hqp/CMusic.cpp \ +../src/hqp/hq_sound.cpp \ +../src/hqp/musicdrv.cpp + +OBJS += \ +./src/hqp/CHQBitmap.o \ +./src/hqp/CMusic.o \ +./src/hqp/hq_sound.o \ +./src/hqp/musicdrv.o + +CPP_DEPS += \ +./src/hqp/CHQBitmap.d \ +./src/hqp/CMusic.d \ +./src/hqp/hq_sound.d \ +./src/hqp/musicdrv.d + + +# Each subdirectory must supply rules for building sources it contributes +src/hqp/%.o: ../src/hqp/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux64/src/latch.d b/Linux64/src/latch.d new file mode 100644 index 000000000..dd509e175 --- /dev/null +++ b/Linux64/src/latch.d @@ -0,0 +1,97 @@ +src/latch.d src/latch.o: ../src/latch.cpp ../src/keen.h ../src/sounds.h \ + ../src/funcdefs.h ../src/latch.h ../src/include/playeraction.h \ + /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h \ + /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h \ + /usr/include/SDL/SDL_platform.h /usr/include/SDL/begin_code.h \ + /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h \ + /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h \ + /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h \ + /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h \ + /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h \ + /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h \ + /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h \ + /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h \ + /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h \ + /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h \ + ../src/include/declarations.h ../src/keenext.h \ + ../src/sdl/CVideoDriver.h ../src/sdl/../CSingleton.h \ + ../src/include/fileio.h ../src/sdl/video/colourtable.h \ + ../src/CLogFile.h ../src/CSingleton.h + +../src/keen.h: + +../src/sounds.h: + +../src/funcdefs.h: + +../src/latch.h: + +../src/include/playeraction.h: + +/usr/include/SDL/SDL.h: + +/usr/include/SDL/SDL_main.h: + +/usr/include/SDL/SDL_stdinc.h: + +/usr/include/SDL/SDL_config.h: + +/usr/include/SDL/SDL_platform.h: + +/usr/include/SDL/begin_code.h: + +/usr/include/SDL/close_code.h: + +/usr/include/SDL/SDL_audio.h: + +/usr/include/SDL/SDL_error.h: + +/usr/include/SDL/SDL_endian.h: + +/usr/include/SDL/SDL_mutex.h: + +/usr/include/SDL/SDL_thread.h: + +/usr/include/SDL/SDL_rwops.h: + +/usr/include/SDL/SDL_cdrom.h: + +/usr/include/SDL/SDL_cpuinfo.h: + +/usr/include/SDL/SDL_events.h: + +/usr/include/SDL/SDL_active.h: + +/usr/include/SDL/SDL_keyboard.h: + +/usr/include/SDL/SDL_keysym.h: + +/usr/include/SDL/SDL_mouse.h: + +/usr/include/SDL/SDL_video.h: + +/usr/include/SDL/SDL_joystick.h: + +/usr/include/SDL/SDL_quit.h: + +/usr/include/SDL/SDL_loadso.h: + +/usr/include/SDL/SDL_timer.h: + +/usr/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/include/fileio.h: + +../src/sdl/video/colourtable.h: + +../src/CLogFile.h: + +../src/CSingleton.h: diff --git a/Linux64/src/scale2x/subdir.mk b/Linux64/src/scale2x/subdir.mk new file mode 100644 index 000000000..e1375fac0 --- /dev/null +++ b/Linux64/src/scale2x/subdir.mk @@ -0,0 +1,36 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/scale2x/getopt.cpp \ +../src/scale2x/pixel.cpp \ +../src/scale2x/scale2x.cpp \ +../src/scale2x/scale3x.cpp \ +../src/scale2x/scalebit.cpp + +OBJS += \ +./src/scale2x/getopt.o \ +./src/scale2x/pixel.o \ +./src/scale2x/scale2x.o \ +./src/scale2x/scale3x.o \ +./src/scale2x/scalebit.o + +CPP_DEPS += \ +./src/scale2x/getopt.d \ +./src/scale2x/pixel.d \ +./src/scale2x/scale2x.d \ +./src/scale2x/scale3x.d \ +./src/scale2x/scalebit.d + + +# Each subdirectory must supply rules for building sources it contributes +src/scale2x/%.o: ../src/scale2x/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux64/src/sdl/sound/subdir.mk b/Linux64/src/sdl/sound/subdir.mk new file mode 100644 index 000000000..e7f48ab32 --- /dev/null +++ b/Linux64/src/sdl/sound/subdir.mk @@ -0,0 +1,30 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/sdl/sound/CSound.cpp \ +../src/sdl/sound/CSoundChannel.cpp \ +../src/sdl/sound/CSoundSlot.cpp + +OBJS += \ +./src/sdl/sound/CSound.o \ +./src/sdl/sound/CSoundChannel.o \ +./src/sdl/sound/CSoundSlot.o + +CPP_DEPS += \ +./src/sdl/sound/CSound.d \ +./src/sdl/sound/CSoundChannel.d \ +./src/sdl/sound/CSoundSlot.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdl/sound/%.o: ../src/sdl/sound/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux64/src/sdl/subdir.mk b/Linux64/src/sdl/subdir.mk new file mode 100644 index 000000000..7cd0d07d4 --- /dev/null +++ b/Linux64/src/sdl/subdir.mk @@ -0,0 +1,33 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/sdl/CInput.cpp \ +../src/sdl/CTimer.cpp \ +../src/sdl/CVideoDriver.cpp \ +../src/sdl/joydrv.cpp + +OBJS += \ +./src/sdl/CInput.o \ +./src/sdl/CTimer.o \ +./src/sdl/CVideoDriver.o \ +./src/sdl/joydrv.o + +CPP_DEPS += \ +./src/sdl/CInput.d \ +./src/sdl/CTimer.d \ +./src/sdl/CVideoDriver.d \ +./src/sdl/joydrv.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdl/%.o: ../src/sdl/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux64/src/sdl/video/subdir.mk b/Linux64/src/sdl/video/subdir.mk new file mode 100644 index 000000000..f71f1e753 --- /dev/null +++ b/Linux64/src/sdl/video/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/sdl/video/colourconvert.cpp + +OBJS += \ +./src/sdl/video/colourconvert.o + +CPP_DEPS += \ +./src/sdl/video/colourconvert.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdl/video/%.o: ../src/sdl/video/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux64/src/subdir.mk b/Linux64/src/subdir.mk new file mode 100644 index 000000000..8048b8da1 --- /dev/null +++ b/Linux64/src/subdir.mk @@ -0,0 +1,81 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/CCGenius.cpp \ +../src/CGame.cpp \ +../src/CGraphics.cpp \ +../src/CLatch.cpp \ +../src/CLogFile.cpp \ +../src/eseq_ep1.cpp \ +../src/eseq_ep2.cpp \ +../src/eseq_ep3.cpp \ +../src/fileio.cpp \ +../src/finale.cpp \ +../src/game.cpp \ +../src/gamedo.cpp \ +../src/gamepdo.cpp \ +../src/gm_pdowm.cpp \ +../src/lz.cpp \ +../src/main.cpp \ +../src/map.cpp \ +../src/menu.cpp \ +../src/misc.cpp \ +../src/sgrle.cpp + +OBJS += \ +./src/CCGenius.o \ +./src/CGame.o \ +./src/CGraphics.o \ +./src/CLatch.o \ +./src/CLogFile.o \ +./src/eseq_ep1.o \ +./src/eseq_ep2.o \ +./src/eseq_ep3.o \ +./src/fileio.o \ +./src/finale.o \ +./src/game.o \ +./src/gamedo.o \ +./src/gamepdo.o \ +./src/gm_pdowm.o \ +./src/lz.o \ +./src/main.o \ +./src/map.o \ +./src/menu.o \ +./src/misc.o \ +./src/sgrle.o + +CPP_DEPS += \ +./src/CCGenius.d \ +./src/CGame.d \ +./src/CGraphics.d \ +./src/CLatch.d \ +./src/CLogFile.d \ +./src/eseq_ep1.d \ +./src/eseq_ep2.d \ +./src/eseq_ep3.d \ +./src/fileio.d \ +./src/finale.d \ +./src/game.d \ +./src/gamedo.d \ +./src/gamepdo.d \ +./src/gm_pdowm.d \ +./src/lz.d \ +./src/main.d \ +./src/map.d \ +./src/menu.d \ +./src/misc.d \ +./src/sgrle.d + + +# Each subdirectory must supply rules for building sources it contributes +src/%.o: ../src/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux64/src/vorbis/subdir.mk b/Linux64/src/vorbis/subdir.mk new file mode 100644 index 000000000..302b3dec0 --- /dev/null +++ b/Linux64/src/vorbis/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/vorbis/oggsupport.cpp + +OBJS += \ +./src/vorbis/oggsupport.o + +CPP_DEPS += \ +./src/vorbis/oggsupport.d + + +# Each subdirectory must supply rules for building sources it contributes +src/vorbis/%.o: ../src/vorbis/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Linux64/src/vorticon/subdir.mk b/Linux64/src/vorticon/subdir.mk new file mode 100644 index 000000000..a59b43ce3 --- /dev/null +++ b/Linux64/src/vorticon/subdir.mk @@ -0,0 +1,33 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/vorticon/CDialog.cpp \ +../src/vorticon/CHighScores.cpp \ +../src/vorticon/CObject.cpp \ +../src/vorticon/CPlayer.cpp + +OBJS += \ +./src/vorticon/CDialog.o \ +./src/vorticon/CHighScores.o \ +./src/vorticon/CObject.o \ +./src/vorticon/CPlayer.o + +CPP_DEPS += \ +./src/vorticon/CDialog.d \ +./src/vorticon/CHighScores.d \ +./src/vorticon/CObject.d \ +./src/vorticon/CPlayer.d + + +# Each subdirectory must supply rules for building sources it contributes +src/vorticon/%.o: ../src/vorticon/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_LNX -I/usr/include/SDL -I/usr/include/vorbis -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/SDL.dll b/SDL.dll new file mode 100644 index 000000000..3ce97a59d Binary files /dev/null and b/SDL.dll differ diff --git a/Windows/CGLog.html b/Windows/CGLog.html new file mode 100644 index 000000000..eeab7fee5 --- /dev/null +++ b/Windows/CGLog.html @@ -0,0 +1,11 @@ +LogFile + + + + +
+ +Logfile +
+
CloneKeenPlus Beta v0.2.7.1 (Commander Genius)
BUILD: RELEASE
PLATFORM: WINDOWS
Send E-Mail to me

Processing command-line options.
allocmem(): allocating 415744 bytes for scroll buffer...OK
allocmem(): allocating 73600 bytes for blit buffer...OK
Starting graphics driver...
blitsurface = creatergbsurfacefrom
Graphics_Start(): configuring palette.
Starting sound driver...
SDL_AudioSpec:
freq: 48000
channels: 2
audio buffer size: 2048
Using audio driver: dsound
SoundDrv_Start(): SDL sound system initialized.
Starting input driver...
JoyDrv_Start()0 joystick(s) were found.
+The names of the joysticks are:
loadResourcesforStartMenu(): "data/games.cfg" could not be read! Assure, that the directory can be accessed.
Error! Resources for start menu cannot be loaded! Maybe you need to copy the data files!

\ No newline at end of file diff --git a/Windows/SDL.dll b/Windows/SDL.dll new file mode 100644 index 000000000..3ce97a59d Binary files /dev/null and b/Windows/SDL.dll differ diff --git a/Windows/changelog.txt b/Windows/changelog.txt new file mode 100644 index 000000000..f917d9ab9 --- /dev/null +++ b/Windows/changelog.txt @@ -0,0 +1,238 @@ +Commander Genius v0.2.6 Alpha (Commander Genius): +------------------------------------------------- + +19-03-2009: After a long time +- Ported to Windows + +18-03-2009: After a long time +- This version is ported to C++ +- More Resolutions are now supported + +04-03-2009: Save me +- fixed some memory leaks +- improved joystick support +- menus can be controlled by the joystick again +- added analog feature which can be turned off + +03-03-2009: And once again! +- removed some useless code to save memory +- Items in all episodes are now processed together + in one function. +- Updated Scale2x functions. Added special SDL_scale2x + which boosts the performance a bit. + +02-03-2009: More and more! +- Changed SDL_SetTimer by SDL_AddTimer which improves + the programming flexibility and bit of performance. +- Added bump sound when you players try to walk into a wall +- Fixed a tile bug with the Vorticon Elder +- Fixed masked tile problem (Iv4n) + +01-03-2009: Improved Configuration! +- Now all the settings except game data are stored in ckp.cfg, + which also need less space. +- New-old feature "two-button-firing" +- New feature "keycard-stacking". Some mods need that + if there are multiple doors +- Some odd object bugs are fixed now. + (Objects which go out of the screen) + +21-02-2009: No Filter2x, please! +- 2x Scaling support without Filter is now supported +- Minor bug fixes + +20-02-2009: Other tiles, why not? +- Better Keyboard+Joystick Handling +- Changed the jump physics a bit again(Ceilik) +- Added the ability to load tiles.tli files. + +19-02-2009: hey cheater (or modder) +- LShift+Tab implemented (Ceilik) +- Less ingame inertia when jumping (Ceilik) + +18-02-2009: Same day, two versions +- CTSpace fix (Genius) +- walking in godmode on world now possible (Ceilik) + +17-02-2009: Same day, two versions +- more bugs resolved (Tulip) +- recovered and improved cheat mode (Tulip) + +16-02-2009: Same day, two versions +- improved physics and controls (Genius314) + +16-02-2009: More bugs fixed! +- improved physics (Genius314) + +15-02-2009: Axis at last! +- improved physics (Genius314) +- Support for axis mapping of joystick and analog sensitivity. Try it out! + +12-02-2009: Bugs and Beetles! +- Fixed wrong sprite positioning in some levels (Tulip) +- Some uncompressed mods exe-files are now supported. + Tested with yorpius II. (Tulip) + +12-02-2009: Now try it! +- imrproved jump/pogo physics! At least! (Forum-Team) + +09-02-2009: Bugs to eat! +- Fixed sound bug, when no card is detected +- Fixed a pogo problem +- Fixed Story bug, when mods are used + +08-02-2009: Jump it on! +- Implemented Story board. Isn't it nice? + +06-02-2009: Jump it on! +- Improved jump and walk physics + +05-02-2009: A small update! +- Improved Butlers AI (Tulip) +- Extrem loud gun sounds are removed! (Tulip) +- Gargs were too fast, when they saw you! (Tulip) +- Extra fix for undefined level start positions of the player (Tulip) +- Fixed stopping player animation, when Vorticon dies in Ep. 1 (Tulip) +- A small platform bug has been removed (Tulip) + +04-02-2009: More, more! +- Fixed Sounds playing in classical mode. Less memory is used now, and higher quality is achieved! +- Door animations are fixed now. (Tulip) +- Fixed some menu bugs. (Sciz CT) + +03-02-2009: It's coming! It's coming +- There was no sound effect for collecting the pogo. (Sciz CT) +- Yorp collision needed work. Walking directly into one just halted + your progress and played the sound effect repeatedly, rather than + bouncing you back as it should. (Sciz CT) +- Vortimoms needed 4 shots to kill. Now they need 5 like in the original game (Tulip) + +02-02-2009: Yorp don't do that! +- The ceiling height was too high, fixed (Sciz CT) +- Pogoing Problems fixed (Sciz CT) + +01-02-2009: Gonna be a remake! + +31-01-2009: Bug fixes and more! +- Now "controls" menu won't crash anymore in Windows +- Now all the Vorticons are more intelligent now (Tulip) +- Butlers can fall (Tulip) +- You can walk into butler from behind (Tulip) +- Vortimom shoots more often now +- Improved tile detection +- Imrpoved memory managment + +30-01-2009: More intelligence! +- Improved memory managment +- Keen dies when falling off the screen now! (Tulip) +- Keen cannot go out of maps anymore (Tulip) +- Keen can stand again on Vortacola in Episode 2 (Tulip) + + +28-01-2009: Isn't it hard enough? +- More intelligent tileset loading +- New Level loading and RLEW decompression. Now Mr. Blacks Levelpack of Keen 3 works very well! +- Fixed some memory problems under Windows (fixes 1 and 2 integrated) + + +28-01-2009: Isn't it hard enough? +- Now you can choose difficulty level when starting a new game +- Fixed Vortimom bug, when she fires to its left (Tulip) +- Reduced size of tile attributes file. They are only used for the change of tiles. + Everyone can now mod the tileinfo, load it with CKP and have fun +- Fixed more memory leaks and remove some obsolete variables +- Fixed other minor game bugs + + +27-01-2009: More new engine functions! +- Controls Config crash fixed for Windows Users! +- Tile properties are now read from the exe file, which make them shown behaved correctly +- Fixed some memory leaks +- Improved stereo sound when picking up items + +24-01-2009: Getting stable new engine! +- Now the old options work again. Some new options are shown, but still don't work! +- Fixed some segfault bugs + +23-01-2009: 3rd Prerelease of a new engine! +- Fixed reading keen?.exe problem in Windows (Thanks to Tulip for his support!!) +- Added fflush, so no more trimmed outputs under Windows (Thanks to Napalm) +- Improved dying animation speed and synchro with the sound +- Added some option menus, but they can't be seen. Please wait until next version. + +20-01-2009: 3rd Prerelease of a new engine! +- Fixed some bugs when load startmenu and crashes in Windows (Especially XP) +- Improved folder scanning +- Keen now walks at constant speed on the map +- "ckp.log" is the new log file. Useful for Windows users, when they want to report bugs + +19-01-2009: 2nd Prerelease of a new engine! +- Fixed bug when loading game sounds from other directories than "data/", being Ep 2 and 3 +- Improved consistency check. You really don't need ctlpanel.ck?, but keen?.exe. (Thanks to Tulip!) +- Games that will not run are marked gray now in the start menu +- Startmenu has the stars background from your episode 1 +- "New Game" added to Main Menu. Now you can switch back to the Start Menu +- Fullscreen bug fixed! +- Their was a bug with keycards which are removed now, when a level is exited (Thanks to Tulip!) + +18-01-2009: Prerelease of a new engine! +- Smoother scrolling +- Added 48Khz Sound. It hears nice! +- New driver engine. Should be more stable and no sounds are required to run the game +- Note: Some options are disabled. They will be enabled again, in the next release with better menus +- Files detection from the beginning +- Startmenu marks error if your games or mods are incomplete +- Fixed teleporting sound + +13-01-2009: Cross-compiling here we come! +- Separation of HQ Sounds. You now must download the extra package, + to use them. (Thanks to Hans de Goede for that idea) +- for the people who have to rename the data files caused by the new + convention. There is a renamer script in the data directory. +- lower-case naming convention (Thanks to Hans de Goede for that idea) +- Improved sound effects (Malvineous and Tulip) +- Windows version will be released in future as binary +- Cleaned a bit more the source code, but there are still bugs left. + + +09-01-2009: Only a small change! +- Games can be separated in directories and are shown with "games.cfg" + in a startmenu. (Commander Spleen) +- Cleaned a bit the source code. + +07-01-2009: Only a small change! +- You can choose between Stereo and Mono Sound now. + +06-01-2009: Play it louder! +- OGG File format supported. which makes the download file a bit smaller +- Better sound managment: Needs less memory for buffering. + +05-01-2009: Play it loud! +- Now CloneKeenPlus uses 8 internal sound channels, instead of 4. +- Cleaned up a bit more the source code. This still must be done. I will do it for every release +- High Quality Sounds! Now you can enjoy more your Sound Blaster playing Keen instead of hearing all the old choppy PC Speaker Sounds. + More of them will be implemented in the next version. The wave files are in the "data/hq/snd" directory. + + +03-01-2009: Mapping support finally! +- Now you can map your keyboard and joystick buttons for the first player. The support is limited to the actions, so movements + (up, down, right, left) cannot be mapped though. +- Cleaned up a bit the source code. Now the polled events memory is not reallocated anymore, which makes the game a bit faster (1 %). + +01-01-2009: Happy New year to all of you! We also have released a more promising version od CKP +- Better memory management. More unused variables are deallocated now and new type of variables organisation has been + implemented. + +31-12-2008: Code has been cleaned, ClonekeenPlus is even more stable now +- Early implementation of key and button mapping. However it is still unusable + +29-12-2008: First released version of the interpreter. It is nearly the same programme as CloneKeen 0.83 Beta with following exceptions: + +- Cleaned up the code. Many warnings won't appear anymore! +- Fixes that were written by Hans van de Goede (For Fedora Core) are implemented. Thank you very much! +- Hans van de Goede had created a program for extracting SOUNDS.CK2 and .CK3. This Code is implemented here. + When clonekeenplus is launched, these files are extracted from KEEN2.EXE or KEEN3.EXE +- Configuration settings are now saved automatically. +- When exiting, the program will not crash anymore! SDL_Double_Free problem fixed! +- Video memory instead of system memory will be used, when -ogl switch is used +- Early Joystick support implemented. Test it! It works very nice! diff --git a/Windows/ep1attr.dat b/Windows/ep1attr.dat new file mode 100644 index 000000000..eccb0fc2d Binary files /dev/null and b/Windows/ep1attr.dat differ diff --git a/Windows/ep2attr.dat b/Windows/ep2attr.dat new file mode 100644 index 000000000..825fac515 Binary files /dev/null and b/Windows/ep2attr.dat differ diff --git a/Windows/ep3attr.dat b/Windows/ep3attr.dat new file mode 100644 index 000000000..16be30d94 Binary files /dev/null and b/Windows/ep3attr.dat differ diff --git a/Windows/genius.cfg b/Windows/genius.cfg new file mode 100644 index 000000000..03ecffecd --- /dev/null +++ b/Windows/genius.cfg @@ -0,0 +1,15 @@ +[Video] +bpp= 0 +frameskip= 2 +fullscreen= 0 +width= 640 +height= 480 +mode= 2 +scale= 2 +filter= 1 + +[Audio] +channels= 2 +format= 8 +rate= 48000 +mixerch= 8 diff --git a/Windows/genius.log b/Windows/genius.log new file mode 100644 index 000000000..633db531b --- /dev/null +++ b/Windows/genius.log @@ -0,0 +1,203 @@ +Processing command-line options. +allocmem(): allocating 415744 bytes for scroll buffer...OK +allocmem(): allocating 73600 bytes for blit buffer...OK +Starting graphics driver... +blitsurface = creatergbsurfacefrom +Graphics_Start(): configuring palette. +Starting sound driver... +SDL_AudioSpec: + freq: 48000 + channels: 2 + audio buffer size: 2048 +Using audio driver: dsound +SoundDrv_Start(): SDL sound system initialized. +Starting input driver... +JoyDrv_Start() +1 joystick(s) were found. + +The names of the joysticks are: + THRUSTMASTER FireStorm Dual Pow +Game data of Episode 1 is complete. +Game data of Episode 1 is complete. +Game data of Episode 2 is complete. +Game data of Episode 3 is complete. +Game data of Episode 1 is complete. +Game data of Episode 3 is complete. +Game data of Episode 3 is complete. +Game data of Episode 1 is complete. +latch_loadheader(): reading main header from 'data/egahead.ck1'... + LatchPlaneSize = 0x74e0 + SpritePlaneSize = 0x18b0 + OffBitmapTable = 0x0030 + OffSpriteTable = 0x0150 + Num8Tiles = 256 + Off8Tiles = 0x0000 + Num32Tiles = 0 + Off32Tiles = 0x0000 + Num16Tiles = 611 + Off16Tiles = 0x0800 + NumBitmaps = 18 + OffBitmaps = 0x5460 + NumSprites = 119 + OffSprites = 0x0000 + Compressed = 3 +latch_loadheader(): Allocating 3840 bytes for sprite table. +latch_loadheader(): Reading sprite table from 'data/egahead.ck1'... +latch_loadheader(): Allocating 304 bytes for bitmap table. +latch_loadheader(): reading bitmap table from 'data/egahead.ck1'... + Bitmap 'TITLE': 264x112 at offset 0000. RAMAllocSize=0x7380 + Bitmap 'IDLOGO': 112x40 at offset 0e70. RAMAllocSize=0x8500 + Bitmap 'F1HELP': 64x16 at offset 10a0. RAMAllocSize=0x8900 + Bitmap 'HIGHSCOR': 136x24 at offset 1120. RAMAllocSize=0x95c0 + Bitmap 'NAME': 48x16 at offset 12b8. RAMAllocSize=0x98c0 + Bitmap 'SCORE': 48x16 at offset 1318. RAMAllocSize=0x9bc0 + Bitmap 'PARTS': 48x16 at offset 1378. RAMAllocSize=0x9ec0 + Bitmap 'GAMEOVER': 112x24 at offset 13d8. RAMAllocSize=0xa940 + Bitmap 'AN': 16x8 at offset 1528. RAMAllocSize=0xa9c0 + Bitmap 'PRESENT': 88x16 at offset 1538. RAMAllocSize=0xaf40 + Bitmap 'APOGEE': 120x32 at offset 15e8. RAMAllocSize=0xbe40 + Bitmap 'KEENSHIP': 120x40 at offset 17c8. RAMAllocSize=0xd100 + Bitmap 'WINDON': 56x32 at offset 1a20. RAMAllocSize=0xd800 + Bitmap 'WINDOFF': 56x32 at offset 1b00. RAMAllocSize=0xdf00 + Bitmap 'ONEMOMEN': 88x48 at offset 1be0. RAMAllocSize=0xef80 + Bitmap 'OFAN': 40x16 at offset 1df0. RAMAllocSize=0xf200 + Bitmap 'PRODUCT': 72x16 at offset 1e40. RAMAllocSize=0xf680 + Bitmap 'IDSOFT': 72x48 at offset 1ed0. RAMAllocSize=0x10400 +latch_loadlatch(): Opening file 'data/egalatch.ck1'. +latch_loadlatch(): Decompressing... +latch_loadlatch(): Decoding 8x8 tiles... +latch_loadlatch(): Decoding 16x16 tiles... +latch_loadlatch(): Allocating 66561 bytes for bitmap data... +latch_loadlatch(): Decoding bitmaps... +latch_loadsprites(): Opening file 'data/egasprit.ck1'. +latch_loadsprites(): Decompressing... +latch_loadsprites(): Decoding sprites... +loadtileattributes() : Trying to read the tiles from "data/tiles.tli" +loadtileattributes() : Extracting tile attributes from the exe file "data/keen1.exe" +Commander Keen Episode 1 (Version 1.31) was detected. +showmapatpos(90, 1008, 28, 0); +loadmap(): file data/level90.ck1 opened. Loading... +latch_loadheader(): reading main header from 'data/egahead.ck1'... + LatchPlaneSize = 0x74e0 + SpritePlaneSize = 0x18b0 + OffBitmapTable = 0x0030 + OffSpriteTable = 0x0150 + Num8Tiles = 256 + Off8Tiles = 0x0000 + Num32Tiles = 0 + Off32Tiles = 0x0000 + Num16Tiles = 611 + Off16Tiles = 0x0800 + NumBitmaps = 18 + OffBitmaps = 0x5460 + NumSprites = 119 + OffSprites = 0x0000 + Compressed = 3 +latch_loadheader(): Allocating 3840 bytes for sprite table. +latch_loadheader(): Reading sprite table from 'data/egahead.ck1'... +latch_loadheader(): Allocating 304 bytes for bitmap table. +latch_loadheader(): reading bitmap table from 'data/egahead.ck1'... + Bitmap 'TITLE': 264x112 at offset 0000. RAMAllocSize=0x7380 + Bitmap 'IDLOGO': 112x40 at offset 0e70. RAMAllocSize=0x8500 + Bitmap 'F1HELP': 64x16 at offset 10a0. RAMAllocSize=0x8900 + Bitmap 'HIGHSCOR': 136x24 at offset 1120. RAMAllocSize=0x95c0 + Bitmap 'NAME': 48x16 at offset 12b8. RAMAllocSize=0x98c0 + Bitmap 'SCORE': 48x16 at offset 1318. RAMAllocSize=0x9bc0 + Bitmap 'PARTS': 48x16 at offset 1378. RAMAllocSize=0x9ec0 + Bitmap 'GAMEOVER': 112x24 at offset 13d8. RAMAllocSize=0xa940 + Bitmap 'AN': 16x8 at offset 1528. RAMAllocSize=0xa9c0 + Bitmap 'PRESENT': 88x16 at offset 1538. RAMAllocSize=0xaf40 + Bitmap 'APOGEE': 120x32 at offset 15e8. RAMAllocSize=0xbe40 + Bitmap 'KEENSHIP': 120x40 at offset 17c8. RAMAllocSize=0xd100 + Bitmap 'WINDON': 56x32 at offset 1a20. RAMAllocSize=0xd800 + Bitmap 'WINDOFF': 56x32 at offset 1b00. RAMAllocSize=0xdf00 + Bitmap 'ONEMOMEN': 88x48 at offset 1be0. RAMAllocSize=0xef80 + Bitmap 'OFAN': 40x16 at offset 1df0. RAMAllocSize=0xf200 + Bitmap 'PRODUCT': 72x16 at offset 1e40. RAMAllocSize=0xf680 + Bitmap 'IDSOFT': 72x48 at offset 1ed0. RAMAllocSize=0x10400 +latch_loadlatch(): Opening file 'data/egalatch.ck1'. +latch_loadlatch(): Decompressing... +latch_loadlatch(): Decoding 8x8 tiles... +latch_loadlatch(): Decoding 16x16 tiles... +latch_loadlatch(): Allocating 66561 bytes for bitmap data... +latch_loadlatch(): Decoding bitmaps... +latch_loadsprites(): Opening file 'data/egasprit.ck1'. +latch_loadsprites(): Decompressing... +latch_loadsprites(): Decoding sprites... +loadstrings(): Opening string file 'strings.dat'. +loadstrings(): loaded 69 strings from 'strings.dat'. +sound_load_all(): loading all sounds... +Wave file could not be opened: "data/hqp/snd/KEENWALKSND.WAV". Trying to load the classical sound +sound_load(): loaded sound KEENWALKSND, 2 bytes. +Wave file could not be opened: "data/hqp/snd/KEENWLK2SND.WAV". Trying to load the classical sound +sound_load(): loaded sound KEENWLK2SND, 3 bytes. +File "data/hqp/snd/KEENJUMPSND.OGG" opened successfully! +File "data/hqp/snd/KEENPOGOSND.OGG" opened successfully! +File "data/hqp/snd/KEENLANDSND.OGG" opened successfully! +Wave file could not be opened: "data/hqp/snd/KEENBLOKSND.WAV". Trying to load the classical sound +sound_load(): loaded sound KEENBLOKSND, 9 bytes. +Wave file could not be opened: "data/hqp/snd/KEENDIESND.WAV". Trying to load the classical sound +sound_load(): loaded sound KEENDIESND, 222 bytes. +File "data/hqp/snd/PLUMMETSND.OGG" opened successfully! +OGG file could not be opened: "BUMPHEADSND". The file was detected, but appears to be damaged. Trying to load the classical sound +sound_load(): loaded sound BUMPHEADSND, 14 bytes. +File "data/hqp/snd/WLDENTERSND.OGG" opened successfully! +File "data/hqp/snd/keensleft.OGG" opened successfully! +File "data/hqp/snd/KEENFIRESND.OGG" opened successfully! +File "data/hqp/snd/GUNCLICK.OGG" opened successfully! +File "data/hqp/snd/SHOTHIT.OGG" opened successfully! +File "data/hqp/snd/GOTITEMSND.OGG" opened successfully! +File "data/hqp/snd/GOTBONUSSND.OGG" opened successfully! +File "data/hqp/snd/GOTPARTSND.OGG" opened successfully! +File "data/hqp/snd/LVLDONESND.OGG" opened successfully! +Wave file could not be opened: "data/hqp/snd/GAMEOVERSND.WAV". Trying to load the classical sound +sound_load(): loaded sound GAMEOVERSND, 280 bytes. +File "data/hqp/snd/TELEPORTSND.OGG" opened successfully! +File "data/hqp/snd/EXTRAMANSND.OGG" opened successfully! +Wave file could not be opened: "data/hqp/snd/CHUNKSMASH.WAV". Trying to load the classical sound +sound_load(): loaded sound CHUNKSMASH, 172 bytes. +Wave file could not be opened: "data/hqp/snd/GOINDOORSND.WAV". Trying to load the classical sound +sound_load(): loaded sound GOINDOORSND, 76 bytes. +File "data/hqp/snd/GETCARDSND.OGG" opened successfully! +Wave file could not be opened: "data/hqp/snd/USEKEYSND.WAV". Trying to load the classical sound +sound_load(): loaded sound USEKEYSND, 120 bytes. +Wave file could not be opened: "data/hqp/snd/CLICKSND.WAV". Trying to load the classical sound +sound_load(): loaded sound CLICKSND, 11 bytes. +Wave file could not be opened: "data/hqp/snd/DOOROPENSND.WAV". Trying to load the classical sound +sound_load(): loaded sound DOOROPENSND, 136 bytes. +Wave file could not be opened: "data/hqp/snd/YORPBUMPSND.WAV". Trying to load the classical sound +sound_load(): loaded sound YORPBUMPSND, 11 bytes. +Wave file could not be opened: "data/hqp/snd/YORPBOPSND.WAV". Trying to load the classical sound +sound_load(): loaded sound YORPBOPSND, 76 bytes. +Wave file could not be opened: "data/hqp/snd/YORPSCREAM.WAV". Trying to load the classical sound +sound_load(): loaded sound YORPSCREAM, 74 bytes. +Wave file could not be opened: "data/hqp/snd/GARGSCREAM.WAV". Trying to load the classical sound +sound_load(): loaded sound GARGSCREAM, 97 bytes. +Wave file could not be opened: "data/hqp/snd/vortscream.WAV". Trying to load the classical sound +sound_load(): loaded sound vortscream, 194 bytes. +Wave file could not be opened: "data/hqp/snd/TANKFIRE.WAV". Trying to load the classical sound +sound_load(): loaded sound TANKFIRE, 46 bytes. +loadtileattributes() : Trying to read the tiles from "data/tiles.tli" +loadtileattributes() : Extracting tile attributes from the exe file "data/keen1.exe" +Commander Keen Episode 1 (Version 1.31) was detected. +Game starting... +showmapatpos(90, 1664, 32, 0); +loadmap(): file data/level90.ck1 opened. Loading... +calling mainmenu() +showmapatpos(90, 32, 32, 0); +loadmap(): file data/level90.ck1 opened. Loading... +gcl: opt = 7 +bottom of game control loop opt=7 crashflag=0 + * Bitmap data released to system. + * Freed 69 strings. + * Joystick driver shut down. +SoundDrv_Stop(): shut down. + * Sound driver shut down. +freed screen +freed scrollsurface +freed blitsurface + * Graphics driver shut down. + * Scrollbuffer memory released to system. + * Blitbuffer memory released to system. + +freed screen diff --git a/Windows/makefile b/Windows/makefile new file mode 100644 index 000000000..24f58062e --- /dev/null +++ b/Windows/makefile @@ -0,0 +1,68 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +-include ../makefile.init + +RM := rm -rf + +# All of the sources participating in the build are defined here +-include sources.mk +-include subdir.mk +-include src/vorticon/subdir.mk +-include src/vorbis/subdir.mk +-include src/subdir.mk +-include src/sdl/video/subdir.mk +-include src/sdl/sound/subdir.mk +-include src/sdl/subdir.mk +-include src/scale2x/subdir.mk +-include src/hqp/subdir.mk +-include src/fileio/subdir.mk +-include src/ai/subdir.mk +-include objects.mk + +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(strip $(C++_DEPS)),) +-include $(C++_DEPS) +endif +ifneq ($(strip $(C_DEPS)),) +-include $(C_DEPS) +endif +ifneq ($(strip $(CC_DEPS)),) +-include $(CC_DEPS) +endif +ifneq ($(strip $(CPP_DEPS)),) +-include $(CPP_DEPS) +endif +ifneq ($(strip $(CXX_DEPS)),) +-include $(CXX_DEPS) +endif +ifneq ($(strip $(C_UPPER_DEPS)),) +-include $(C_UPPER_DEPS) +endif +endif + +-include ../makefile.defs + +# Add inputs and outputs from these tool invocations to the build variables + +# All Target +all: CGenius.exe + +# Tool invocations +CGenius.exe: $(OBJS) $(USER_OBJS) + @echo 'Building target: $@' + @echo 'Invoking: MinGW C++ Linker' + i586-mingw32msvc-g++ -L/usr/i586-mingw32msvc/lib -o"CGenius.exe" $(OBJS) $(USER_OBJS) $(LIBS) + @echo 'Finished building target: $@' + @echo ' ' + +# Other Targets +clean: + -$(RM) $(C++_DEPS)$(OBJS)$(C_DEPS)$(CC_DEPS)$(CPP_DEPS)$(EXECUTABLES)$(CXX_DEPS)$(C_UPPER_DEPS) CGenius.exe + -@echo ' ' + +.PHONY: all clean dependents +.SECONDARY: + +-include ../makefile.targets diff --git a/Windows/objects.mk b/Windows/objects.mk new file mode 100644 index 000000000..cddde049a --- /dev/null +++ b/Windows/objects.mk @@ -0,0 +1,7 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +USER_OBJS := + +LIBS := -lmingw32 -lSDLmain -lSDL -lglu32 -lopengl32 -lvorbisfile -lvorbis -logg diff --git a/Windows/readme.txt b/Windows/readme.txt new file mode 100644 index 000000000..d6eaa7c00 --- /dev/null +++ b/Windows/readme.txt @@ -0,0 +1,167 @@ +************************************* +* * +* C L O N E K E E N * +* PLUS * +* (Commander Genius) * +* * +* (c)2008-2009 Gerstrong * +* (c)2003-2005 Caitlin Shaw * +* Released under GNU/GPL * +* * +* Beta v0.2.6 * +* * +************************************* +Welcome to CloneKeenPlus (Commander Genius)! + +CloneKeenPlus is an almost complete open-source clone of +the old classic DOS game, Commander Keen: Invasion of the +Vorticons by ID Software. CloneKeenPlus requires the original game +data files to work. You can play all three episodes of the game and +some fanmade mods. + +CloneKeenPlus currently runs under Linux/X11 and Windows with SDL. +In Mac OS X it also might run, but this has not been tested. + +CloneKeenPlus tries to mostly replicate the original game, +however there are also a number of improvements, +including smoother scrolling, better graphic effects +in some parts of the game, 2-player support, high quality +packs, games menu, gamepad support (More than two joystick +buttons) and more. + +To my knowledge this is the only released attempt at +writing a third-party Keen game that has reached this +stage of completedness. + +Commander Genius is a new edition of CloneKeenPlus. +It will be the new game of the interpreter, but it is still +not sure. This edition is compiled with GNU C++. + +The CloneKeen source may be freely distributed and +modified as per the GPL, just please remember to give +credit to the original authors. + +CloneKeenPlus has been developed by Gerstrong implementing +mayor improvements basing on the original +source code of CloneKeen by Caitlin Shaw. Many +thanks to him, for bringing us this great program. + +Obviously it is not the original version of CloneKeen +or any update. It is another version from a different +author. Other guys and me had many improvements and +I tried to post them to the author. However, until +today he has not responded. It is also known, that there +have not been updates of CloneKeen since 2005. It stayed +in beta 0.83. + +I also would like to see those changes and improvements +(or some of them) in his original project. +So I hope he will contact me some day. Most of the code is +based on his work and I acknow him a lot for that! + + +Setting up the data of the game: + + * Copy all of the data files from the original game(s) into the + "./data" folder. This means all of the files with the extension + .ck?. If you have the registered versions, you can play the whole game, + otherwise download the shareware version and copy the data from it. + You also can use mods. + * If you want to use some patched mods, you can put them into subdirectories. + You only have modify the "games.cfg". + * Only Linux/Unix Users: If you have many data files which are not lower-case, + use "./data/renlower.sh" shell script to rename them. + * Go into the "Release" folder and drop to the command line. + * If you want better sounds and music, please download the high quality pack. + Extract its contents to the "data" directory together with your game data. + +Howto use CloneKeenPlus (If you didn't compile it): + * Under Windows you start "clonekeen.exe", under Linux "./clonekeen" + +Howto compile it under Ubuntu (testet on Intrepid): + * As I know which packages are needed, because I use Ubuntu, here is an extra guide. + * Install through Synaptic or "sudo apt-get install" following packages: + - build-essential + - libvorbis-dev + - libsdl1.2-dev + * extract my source code into "ckp". + * cd into the "cpk/Release" subdirectory. + * Run "make". + * Then, you can run "clonekeen". Copy the files, wherever you want them together + with the data directory. "make install" does not work though. + +Compiling CKP on Linux/UNIX (other than Ubuntu): + * If you want to compile the game, you need to have all the standard . + development libraries and GNU C Compiler (at least version 4) installed + on your system. + * You need to install the "vorbis" and "SDL" development libraries to get + it successfully compiled. + * extract my source code to "ckp". + * cd into the "ckp/Release" subdirectory. + * Run "make". + * Then, you can run "clonekeen". Copy the files, + wherever you want them together with the data directory. + "make install" does not work though. + +HINTS & SECRETS + + +- CHEAT CODES - + +There are a full assortment of cheat codes available. Some cheats must first +be enabled with -cheat or through the options->game menu. C+T+SPACE and G+O+D will +always work. + +KEY ACTION DESCRIPTION +G+O+D godmode In god mode you are invincible! +C+T+SPACE All Items Gives all items, similar to the original. +LSHIFT+TAB Skip Level Holding down this key you can skip levels and walk through tiles + on the map. +TAB No clipping If you hold down this key you will disable clipping. + However, you cannot fall though floors. + +- SAVE/LOAD GAME - + +The game can be saved by pressing F3 at any point during the game. The game will +be saved in the exact position it was left (unlike the original which only +allowed save at the map). + +- DEMO - + +Wait a while at the tile screen and the game will cycle through several +demos, an added feature not found on the original game. + +- BUG! - + +So you really found one or more bugs? Please report me those per e-mail +and they will be checked. If necesarry we are going to fix them as soon +as possible. + +- ACKNOWLEDGEMENTS - +Many thanks to people who has helped me so far in this project with their +suggestions: + + +Sciz CT +Commander Spleen +Malvineous +Tulip +Hans de Goede +Levelass (Keen EXE-Information) +ZidaneA (For his music tracks!) +Iv4n + +Special thanks to Tulip, who has been supporting me all the time in testing +the Windows version of CKP. Without you it wouldn't be so great now! + +I'm sure, there were more people who helped me and I forgot to mention, but +many thanks to them, too. + +Many thanks to all of you, the project has gone farther, and will be a nice +port to Commander Keen! + +**************************************************************************** +For questions, comments, or updates to the source tree +please contact: gerstrong@gmail.com or go thru +SourceForge at http://clonekeenplus.sourceforge.net/ +**************************************************************************** diff --git a/Windows/sources.mk b/Windows/sources.mk new file mode 100644 index 000000000..1ddad861b --- /dev/null +++ b/Windows/sources.mk @@ -0,0 +1,36 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +O_SRCS := +CPP_SRCS := +C_UPPER_SRCS := +C_SRCS := +S_SRCS := +OBJ_SRCS := +ASM_SRCS := +CXX_SRCS := +C++_SRCS := +CC_SRCS := +C++_DEPS := +OBJS := +C_DEPS := +CC_DEPS := +CPP_DEPS := +EXECUTABLES := +CXX_DEPS := +C_UPPER_DEPS := + +# Every subdirectory with source files must be described here +SUBDIRS := \ +src/vorticon \ +src/vorbis \ +src \ +src/sdl/video \ +src/sdl/sound \ +src/sdl \ +src/scale2x \ +src/hqp \ +src/fileio \ +src/ai \ + diff --git a/Windows/src/ai/subdir.mk b/Windows/src/ai/subdir.mk new file mode 100644 index 000000000..52f9c9cf9 --- /dev/null +++ b/Windows/src/ai/subdir.mk @@ -0,0 +1,102 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/ai/baby.cpp \ +../src/ai/balljack.cpp \ +../src/ai/bear.cpp \ +../src/ai/butler.cpp \ +../src/ai/door.cpp \ +../src/ai/earth.cpp \ +../src/ai/fireball.cpp \ +../src/ai/foob.cpp \ +../src/ai/garg.cpp \ +../src/ai/icebit.cpp \ +../src/ai/icechunk.cpp \ +../src/ai/meep.cpp \ +../src/ai/mother.cpp \ +../src/ai/nessie.cpp \ +../src/ai/ninja.cpp \ +../src/ai/platform.cpp \ +../src/ai/platvert.cpp \ +../src/ai/ray.cpp \ +../src/ai/rope.cpp \ +../src/ai/se.cpp \ +../src/ai/sndwave.cpp \ +../src/ai/tank.cpp \ +../src/ai/tankep2.cpp \ +../src/ai/teleport.cpp \ +../src/ai/vort.cpp \ +../src/ai/walker.cpp \ +../src/ai/yorp.cpp + +OBJS += \ +./src/ai/baby.o \ +./src/ai/balljack.o \ +./src/ai/bear.o \ +./src/ai/butler.o \ +./src/ai/door.o \ +./src/ai/earth.o \ +./src/ai/fireball.o \ +./src/ai/foob.o \ +./src/ai/garg.o \ +./src/ai/icebit.o \ +./src/ai/icechunk.o \ +./src/ai/meep.o \ +./src/ai/mother.o \ +./src/ai/nessie.o \ +./src/ai/ninja.o \ +./src/ai/platform.o \ +./src/ai/platvert.o \ +./src/ai/ray.o \ +./src/ai/rope.o \ +./src/ai/se.o \ +./src/ai/sndwave.o \ +./src/ai/tank.o \ +./src/ai/tankep2.o \ +./src/ai/teleport.o \ +./src/ai/vort.o \ +./src/ai/walker.o \ +./src/ai/yorp.o + +CPP_DEPS += \ +./src/ai/baby.d \ +./src/ai/balljack.d \ +./src/ai/bear.d \ +./src/ai/butler.d \ +./src/ai/door.d \ +./src/ai/earth.d \ +./src/ai/fireball.d \ +./src/ai/foob.d \ +./src/ai/garg.d \ +./src/ai/icebit.d \ +./src/ai/icechunk.d \ +./src/ai/meep.d \ +./src/ai/mother.d \ +./src/ai/nessie.d \ +./src/ai/ninja.d \ +./src/ai/platform.d \ +./src/ai/platvert.d \ +./src/ai/ray.d \ +./src/ai/rope.d \ +./src/ai/se.d \ +./src/ai/sndwave.d \ +./src/ai/tank.d \ +./src/ai/tankep2.d \ +./src/ai/teleport.d \ +./src/ai/vort.d \ +./src/ai/walker.d \ +./src/ai/yorp.d + + +# Each subdirectory must supply rules for building sources it contributes +src/ai/%.o: ../src/ai/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + i586-mingw32msvc-g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_WIN32 -I/usr/i586-mingw32msvc/include/SDL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Windows/src/fileio/subdir.mk b/Windows/src/fileio/subdir.mk new file mode 100644 index 000000000..c768e32fc --- /dev/null +++ b/Windows/src/fileio/subdir.mk @@ -0,0 +1,33 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/fileio/CParser.cpp \ +../src/fileio/lzexe.cpp \ +../src/fileio/rle.cpp \ +../src/fileio/story.cpp + +OBJS += \ +./src/fileio/CParser.o \ +./src/fileio/lzexe.o \ +./src/fileio/rle.o \ +./src/fileio/story.o + +CPP_DEPS += \ +./src/fileio/CParser.d \ +./src/fileio/lzexe.d \ +./src/fileio/rle.d \ +./src/fileio/story.d + + +# Each subdirectory must supply rules for building sources it contributes +src/fileio/%.o: ../src/fileio/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + i586-mingw32msvc-g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_WIN32 -I/usr/i586-mingw32msvc/include/SDL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Windows/src/graphics.d b/Windows/src/graphics.d new file mode 100644 index 000000000..242b305a8 --- /dev/null +++ b/Windows/src/graphics.d @@ -0,0 +1,112 @@ +src/graphics.d src/graphics.o: ../src/graphics.cpp ../src/keen.h \ + ../src/sounds.h ../src/funcdefs.h ../src/fileio.h ../src/CLatch.h \ + ../src/include/playeraction.h /usr/i586-mingw32msvc/include/SDL/SDL.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_main.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_stdinc.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_config.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_platform.h \ + /usr/i586-mingw32msvc/include/SDL/begin_code.h \ + /usr/i586-mingw32msvc/include/SDL/close_code.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_audio.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_error.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_endian.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_mutex.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_thread.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_rwops.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_cdrom.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_cpuinfo.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_events.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_active.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_keyboard.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_keysym.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_mouse.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_video.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_joystick.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_quit.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_loadso.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_timer.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_version.h \ + ../src/include/declarations.h ../src/keenext.h \ + ../src/include/graphics.h ../src/sdl/video/colourtable.h \ + ../src/sdl/CVideoDriver.h ../src/sdl/../CSingleton.h ../src/CLogFile.h \ + ../src/CSingleton.h + +../src/keen.h: + +../src/sounds.h: + +../src/funcdefs.h: + +../src/fileio.h: + +../src/CLatch.h: + +../src/include/playeraction.h: + +/usr/i586-mingw32msvc/include/SDL/SDL.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_main.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_stdinc.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_config.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_platform.h: + +/usr/i586-mingw32msvc/include/SDL/begin_code.h: + +/usr/i586-mingw32msvc/include/SDL/close_code.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_audio.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_error.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_endian.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_mutex.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_thread.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_rwops.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_cdrom.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_cpuinfo.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_events.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_active.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_keyboard.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_keysym.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_mouse.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_video.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_joystick.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_quit.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_loadso.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_timer.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/include/graphics.h: + +../src/sdl/video/colourtable.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/CLogFile.h: + +../src/CSingleton.h: diff --git a/Windows/src/hqp/subdir.mk b/Windows/src/hqp/subdir.mk new file mode 100644 index 000000000..51a245cab --- /dev/null +++ b/Windows/src/hqp/subdir.mk @@ -0,0 +1,30 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/hqp/CHQBitmap.cpp \ +../src/hqp/CMusic.cpp \ +../src/hqp/hq_sound.cpp + +OBJS += \ +./src/hqp/CHQBitmap.o \ +./src/hqp/CMusic.o \ +./src/hqp/hq_sound.o + +CPP_DEPS += \ +./src/hqp/CHQBitmap.d \ +./src/hqp/CMusic.d \ +./src/hqp/hq_sound.d + + +# Each subdirectory must supply rules for building sources it contributes +src/hqp/%.o: ../src/hqp/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + i586-mingw32msvc-g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_WIN32 -I/usr/i586-mingw32msvc/include/SDL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Windows/src/latch.d b/Windows/src/latch.d new file mode 100644 index 000000000..24ee18702 --- /dev/null +++ b/Windows/src/latch.d @@ -0,0 +1,110 @@ +src/latch.d src/latch.o: ../src/latch.cpp ../src/keen.h ../src/sounds.h \ + ../src/funcdefs.h ../src/latch.h ../src/include/playeraction.h \ + /usr/i586-mingw32msvc/include/SDL/SDL.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_main.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_stdinc.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_config.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_platform.h \ + /usr/i586-mingw32msvc/include/SDL/begin_code.h \ + /usr/i586-mingw32msvc/include/SDL/close_code.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_audio.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_error.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_endian.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_mutex.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_thread.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_rwops.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_cdrom.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_cpuinfo.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_events.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_active.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_keyboard.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_keysym.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_mouse.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_video.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_joystick.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_quit.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_loadso.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_timer.h \ + /usr/i586-mingw32msvc/include/SDL/SDL_version.h \ + ../src/include/declarations.h ../src/keenext.h \ + ../src/sdl/CVideoDriver.h ../src/sdl/../CSingleton.h \ + ../src/include/fileio.h ../src/sdl/video/colourtable.h \ + ../src/CLogFile.h ../src/CSingleton.h + +../src/keen.h: + +../src/sounds.h: + +../src/funcdefs.h: + +../src/latch.h: + +../src/include/playeraction.h: + +/usr/i586-mingw32msvc/include/SDL/SDL.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_main.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_stdinc.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_config.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_platform.h: + +/usr/i586-mingw32msvc/include/SDL/begin_code.h: + +/usr/i586-mingw32msvc/include/SDL/close_code.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_audio.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_error.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_endian.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_mutex.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_thread.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_rwops.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_cdrom.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_cpuinfo.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_events.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_active.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_keyboard.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_keysym.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_mouse.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_video.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_joystick.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_quit.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_loadso.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_timer.h: + +/usr/i586-mingw32msvc/include/SDL/SDL_version.h: + +../src/include/declarations.h: + +../src/keenext.h: + +../src/sdl/CVideoDriver.h: + +../src/sdl/../CSingleton.h: + +../src/include/fileio.h: + +../src/sdl/video/colourtable.h: + +../src/CLogFile.h: + +../src/CSingleton.h: diff --git a/Windows/src/scale2x/subdir.mk b/Windows/src/scale2x/subdir.mk new file mode 100644 index 000000000..559660451 --- /dev/null +++ b/Windows/src/scale2x/subdir.mk @@ -0,0 +1,36 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/scale2x/getopt.cpp \ +../src/scale2x/pixel.cpp \ +../src/scale2x/scale2x.cpp \ +../src/scale2x/scale3x.cpp \ +../src/scale2x/scalebit.cpp + +OBJS += \ +./src/scale2x/getopt.o \ +./src/scale2x/pixel.o \ +./src/scale2x/scale2x.o \ +./src/scale2x/scale3x.o \ +./src/scale2x/scalebit.o + +CPP_DEPS += \ +./src/scale2x/getopt.d \ +./src/scale2x/pixel.d \ +./src/scale2x/scale2x.d \ +./src/scale2x/scale3x.d \ +./src/scale2x/scalebit.d + + +# Each subdirectory must supply rules for building sources it contributes +src/scale2x/%.o: ../src/scale2x/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + i586-mingw32msvc-g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_WIN32 -I/usr/i586-mingw32msvc/include/SDL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Windows/src/sdl/sound/subdir.mk b/Windows/src/sdl/sound/subdir.mk new file mode 100644 index 000000000..83159e2b4 --- /dev/null +++ b/Windows/src/sdl/sound/subdir.mk @@ -0,0 +1,30 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/sdl/sound/CSound.cpp \ +../src/sdl/sound/CSoundChannel.cpp \ +../src/sdl/sound/CSoundSlot.cpp + +OBJS += \ +./src/sdl/sound/CSound.o \ +./src/sdl/sound/CSoundChannel.o \ +./src/sdl/sound/CSoundSlot.o + +CPP_DEPS += \ +./src/sdl/sound/CSound.d \ +./src/sdl/sound/CSoundChannel.d \ +./src/sdl/sound/CSoundSlot.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdl/sound/%.o: ../src/sdl/sound/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + i586-mingw32msvc-g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_WIN32 -I/usr/i586-mingw32msvc/include/SDL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Windows/src/sdl/subdir.mk b/Windows/src/sdl/subdir.mk new file mode 100644 index 000000000..68229e717 --- /dev/null +++ b/Windows/src/sdl/subdir.mk @@ -0,0 +1,36 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/sdl/CInput.cpp \ +../src/sdl/COpenGL.cpp \ +../src/sdl/CTimer.cpp \ +../src/sdl/CVideoDriver.cpp \ +../src/sdl/joydrv.cpp + +OBJS += \ +./src/sdl/CInput.o \ +./src/sdl/COpenGL.o \ +./src/sdl/CTimer.o \ +./src/sdl/CVideoDriver.o \ +./src/sdl/joydrv.o + +CPP_DEPS += \ +./src/sdl/CInput.d \ +./src/sdl/COpenGL.d \ +./src/sdl/CTimer.d \ +./src/sdl/CVideoDriver.d \ +./src/sdl/joydrv.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdl/%.o: ../src/sdl/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + i586-mingw32msvc-g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_WIN32 -I/usr/i586-mingw32msvc/include/SDL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Windows/src/sdl/video/subdir.mk b/Windows/src/sdl/video/subdir.mk new file mode 100644 index 000000000..7dedd0bf2 --- /dev/null +++ b/Windows/src/sdl/video/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/sdl/video/colourconvert.cpp + +OBJS += \ +./src/sdl/video/colourconvert.o + +CPP_DEPS += \ +./src/sdl/video/colourconvert.d + + +# Each subdirectory must supply rules for building sources it contributes +src/sdl/video/%.o: ../src/sdl/video/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + i586-mingw32msvc-g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_WIN32 -I/usr/i586-mingw32msvc/include/SDL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Windows/src/subdir.mk b/Windows/src/subdir.mk new file mode 100644 index 000000000..54b59655f --- /dev/null +++ b/Windows/src/subdir.mk @@ -0,0 +1,81 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/CCGenius.cpp \ +../src/CGame.cpp \ +../src/CGraphics.cpp \ +../src/CLatch.cpp \ +../src/CLogFile.cpp \ +../src/eseq_ep1.cpp \ +../src/eseq_ep2.cpp \ +../src/eseq_ep3.cpp \ +../src/fileio.cpp \ +../src/finale.cpp \ +../src/game.cpp \ +../src/gamedo.cpp \ +../src/gamepdo.cpp \ +../src/gm_pdowm.cpp \ +../src/lz.cpp \ +../src/main.cpp \ +../src/map.cpp \ +../src/menu.cpp \ +../src/misc.cpp \ +../src/sgrle.cpp + +OBJS += \ +./src/CCGenius.o \ +./src/CGame.o \ +./src/CGraphics.o \ +./src/CLatch.o \ +./src/CLogFile.o \ +./src/eseq_ep1.o \ +./src/eseq_ep2.o \ +./src/eseq_ep3.o \ +./src/fileio.o \ +./src/finale.o \ +./src/game.o \ +./src/gamedo.o \ +./src/gamepdo.o \ +./src/gm_pdowm.o \ +./src/lz.o \ +./src/main.o \ +./src/map.o \ +./src/menu.o \ +./src/misc.o \ +./src/sgrle.o + +CPP_DEPS += \ +./src/CCGenius.d \ +./src/CGame.d \ +./src/CGraphics.d \ +./src/CLatch.d \ +./src/CLogFile.d \ +./src/eseq_ep1.d \ +./src/eseq_ep2.d \ +./src/eseq_ep3.d \ +./src/fileio.d \ +./src/finale.d \ +./src/game.d \ +./src/gamedo.d \ +./src/gamepdo.d \ +./src/gm_pdowm.d \ +./src/lz.d \ +./src/main.d \ +./src/map.d \ +./src/menu.d \ +./src/misc.d \ +./src/sgrle.d + + +# Each subdirectory must supply rules for building sources it contributes +src/%.o: ../src/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + i586-mingw32msvc-g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_WIN32 -I/usr/i586-mingw32msvc/include/SDL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Windows/src/vorbis/subdir.mk b/Windows/src/vorbis/subdir.mk new file mode 100644 index 000000000..b520a1000 --- /dev/null +++ b/Windows/src/vorbis/subdir.mk @@ -0,0 +1,24 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/vorbis/oggsupport.cpp + +OBJS += \ +./src/vorbis/oggsupport.o + +CPP_DEPS += \ +./src/vorbis/oggsupport.d + + +# Each subdirectory must supply rules for building sources it contributes +src/vorbis/%.o: ../src/vorbis/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + i586-mingw32msvc-g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_WIN32 -I/usr/i586-mingw32msvc/include/SDL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Windows/src/vorticon/subdir.mk b/Windows/src/vorticon/subdir.mk new file mode 100644 index 000000000..404ff5817 --- /dev/null +++ b/Windows/src/vorticon/subdir.mk @@ -0,0 +1,33 @@ +################################################################################ +# Automatically-generated file. Do not edit! +################################################################################ + +# Add inputs and outputs from these tool invocations to the build variables +CPP_SRCS += \ +../src/vorticon/CDialog.cpp \ +../src/vorticon/CHighScores.cpp \ +../src/vorticon/CObject.cpp \ +../src/vorticon/CPlayer.cpp + +OBJS += \ +./src/vorticon/CDialog.o \ +./src/vorticon/CHighScores.o \ +./src/vorticon/CObject.o \ +./src/vorticon/CPlayer.o + +CPP_DEPS += \ +./src/vorticon/CDialog.d \ +./src/vorticon/CHighScores.d \ +./src/vorticon/CObject.d \ +./src/vorticon/CPlayer.d + + +# Each subdirectory must supply rules for building sources it contributes +src/vorticon/%.o: ../src/vorticon/%.cpp + @echo 'Building file: $<' + @echo 'Invoking: GCC C++ Compiler' + i586-mingw32msvc-g++ -DBUILD_SDL -DBUILD_WITH_OGG -DTARGET_WIN32 -I/usr/i586-mingw32msvc/include/SDL -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $<' + @echo ' ' + + diff --git a/Windows/stdout.txt b/Windows/stdout.txt new file mode 100644 index 000000000..bcf6f811b --- /dev/null +++ b/Windows/stdout.txt @@ -0,0 +1,7 @@ +CloneKeenPlus Beta v0.2.7.1 (Commander Genius) Windows build (32 bit) +by Caitlin Shaw, 2003-2005 +and Gerstrong 2008-2009 + +BY A FAN, FOR FANS. ALL "COMMANDER KEEN" GRAPHICS, +SOUND, AND LEVEL FILES ARE THE PROPERTY OF ID SOFTWARE. + diff --git a/Windows/strings.dat b/Windows/strings.dat new file mode 100644 index 000000000..05f5106f3 --- /dev/null +++ b/Windows/strings.dat @@ -0,0 +1,469 @@ +; ABOUT THIS FILE... +; +; This file contains string data for CloneKeen. +; Each string is prefaced with a string name, which is enclosed +; in square brackets. The next line after the string name +; is the first line of the string. The string data continues until +; another opening square bracket is seen. +; +; You can use a backslash to delimit special characters. A backslash +; followed by an open or close parenthese can be used to insert square +; brackets into the string text. A backslash followed by an uppercase H +; will turn on highlighting (text will appear red on a grey background). +; A lower case h will turn off highlighting (text will appear black on a +; white background). Two backslashes will result in a single backslash. +; +; You can specify numeric attributes for a string by adding them on to the +; same line as the string name after the closing bracket. For example this +; is used with strings defining text to go in dialog boxes to specify the +; dimensions of the dialog box. + +[MAIN_MENU] LEFT=11 TOP=9 WIDTH=17 HEIGHT=11 + 1-Player Game + 2-Player Game + Load Game + Story + Options + Controls + Demo + New Game + Quit +[Tribute_Page_1] ONTIME=200 OFFTIME=200 + + + +[Tribute_Page_2] ONTIME=1600 OFFTIME=500 +Thanks to ID Software +for the wonderful +"Commander Keen" series. +[Tribute_Page_3] ONTIME=1200 OFFTIME=500 Y1ADJ=3 Y2ADJ=3 +As a child, I spent way too +much time playing these games. + +[Tribute_Page_4] ONTIME=1200 OFFTIME=100 +And now I have spent way +too much time programming +this game. +[Tribute_Page_5] ONTIME=550 OFFTIME=200 SLOWPRINT=2 SLOWPRINTSPD=100 + +... + +[Tribute_Page_6] ONTIME=1200 OFFTIME=500 Y1ADJ=1 Y2ADJ=2 +Hmmm...History repeats itself? +;) + +[Tribute_Page_7] ONTIME=1200 OFFTIME=500 Y1ADJ=-1 Y2ADJ=1 +This is my tribute to +the "Keen legacy". + +[Tribute_Page_8] ONTIME=1700 OFFTIME=200 Y1ADJ=-5 LASTPAGE=1 + Enjoy the Game. \h + + -Katy and Gerstrong +[WhichSlotSave] LEFT=8 TOP=11 WIDTH=23 HEIGHT=4 +Which slot do you want +want to save (1-9)? +[WhichSlotLoad] LEFT=8 TOP=11 WIDTH=23 HEIGHT=4 +Which slot do you want +want to load (1-9)? +[SaveSlotOverwrite] LEFT=7 TOP=10 WIDTH=26 HEIGHT=6 +That slot already exists! + +Do you want to overwrite +the existing game \(Y/N\)? +[GameSaveSuccess] LEFT=7 TOP=9 WIDTH=26 HEIGHT=7 +Your game has been saved! + +You can continue this +game from the main menu +next time you play. +[LoadNoSuchSlot] LEFT=7 TOP=10 WIDTH=25 HEIGHT=5 +That game hasn't been +saved yet! Please select +a different slot. +[VerifyQuit] LEFT=7 TOP=10 WIDTH=26 HEIGHT=4 +(Q)uit entire program or +quit to (T)itle \(Q/T\)? +[EP1_SHIP] LEFT=5 TOP=9 WIDTH=29 HEIGHT=8 +Your ship needs these parts: + + + + + Go find them! +[EP1_StatusBox] LEFT=5 TOP=5 WIDTH=30 HEIGHT=15 +\H SCORE EXTRA LIFE AT \h +\h \H \h +\H LIVES SHIP PARTS \h +\h \H \h +\h \H \h +\h \H \h +\H RAYGUN POGO KEYCARDS \h +\h \H \h \H \h +\h \H \h \H \h +\h \H \h \H \h +\H CHARGE \h \H \h +\h \H \h \H \h +\H PLEASE PRESS A KEY \h +[EP2_StatusBox] LEFT=5 TOP=5 WIDTH=30 HEIGHT=15 +\H SCORE EXTRA LIFE AT \h +\h \H \h +\H LIVES RAY GUN \h +\h \H \h +\h \H \h +\h \H \h +\H TARGETS SAVED KEY CARDS \h +\h \H \h +\h \H \h +\h \H \h +\h \H \h +\h \H \h +\H PLEASE PRESS A KEY \h +[EP3_StatusBox] LEFT=5 TOP=6 WIDTH=30 HEIGHT=13 +\H SCORE EXTRA LIFE AT \h +\h \H \h +\H LIVES PISTOL \h +\h \H \h +\h \H \h +\h \H \h +\H ANKH TIME KEY CARDS \h +\h \H \h +\h \H \h +\h \H \h +\H PLEASE PRESS A KEY \h +[LIVES_LEFT_BACKGROUND] +\H \h +[LIVES_LEFT] +\HKEENS LEFT\h +[EP1_YSIYM_LVL2] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +You see in your +mind: + +It is too bad that +you can not read the +Standard Galatic +Alphabet, human. + + + PRESS ENTER: +[EP1_YSIYM_LVL6] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +A message echoes +in your head: + +The teleporter in +the ice will send +you to the dark side +of Mars. + + + PRESS ENTER: +[EP1_YSIYM_LVL9] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +You hear in your +mind: + +A secret city is +hidden in the dark +area of the city on +the dark side to the +south. + + PRESS ENTER: +[EP1_YSIYM_LVL10] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +You see these words +in your head: + +You will need a raygun +in the end, but not to +shoot the Vorticon... + + + + PRESS ENTER: +[EP1_YSIYM_LVL11] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +You hear in your +mind: + +GAAARRRRGG!!!! + + + + + + PRESS ENTER: +[EP1_YSIYM_LVL12] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +A Yorpish whisper +says: + +Huh? Oh, you thought +I was going to +dispense some wisdom +or something. I'm +sorry...it's my day +off. + PRESS ENTER: +[EP1_YSIYM_LVL15] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +A Yorpy mind-thought +bellows: + +You cannot kill the +Vorticon Commander +directly. + + + + PRESS ENTER: +[EP1_ESEQ_PART1] +Commander Keen returns to his ship +and quickly replaces the missing +parts. He must get home before his +parents do! +[EP1_ESEQ_PART2_PAGE1] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Keen makes it home and +rushes to beat his +parents upstairs. +[EP1_ESEQ_PART2_PAGE2] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Shhh, honey...let's +see if little Billy is +asleep. +[EP1_ESEQ_PART2_PAGE3] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Billy...? Are you a-- +WHAT IS THIS ONE-EYED +GREEN THING IN YOUR +ROOM!!!!??? +[EP1_ESEQ_PART2_PAGE4] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Ahhh, Mom, can't I keep +him? +[EP1_ESEQ_PART2_PAGE5] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Well, we'll talk about +that in the morning, son. +You get some rest. +[EP1_ESEQ_PART2_PAGE6] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Okay Mom; Goodnight. +[EP1_ESEQ_PART2_PAGE7] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Goodnight, dear. +[EP1_ESEQ_PART2_PAGE8] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +But there is no sleep +for Commander Keen! The +Vorticon Mothership +looms above, ready to +destroy Earth! + + + +[TO_BE_CONTINUED] LEFT=7 TOP=4 WIDTH=26 HEIGHT=3 +TO BE CONTINUED.......... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[EP2_VE_NOJUMPINDARK] LEFT=8 TOP=6 WIDTH=23 HEIGHT=14 TWIRLX=18 TWIRLY=12 +The Elder Vorticon +in the statis field +says: + +The wise Vorticon +never jumps in the +dark. In fact, even +unwise Vorticons will +not jump in darkness. + + + PRESS ENTER: +[EP2_VE_EVILBELTS] LEFT=8 TOP=5 WIDTH=23 HEIGHT=16 TWIRLX=18 TWIRLY=14 +The Vorticon Elder +says through the +statis field: + +The Grand Intellect +is not from Vorticon +VI--he is from the +planet Earth. His evil +Mind-Belts control +their minds. They are +not evil. Please do +not shoot them, human. + + PRESS ENTER: +[EP2_LVL4_TargetName] +London +[EP2_LVL6_TargetName] +Cairo +[EP2_LVL7_TargetName] +Sydney +[EP2_LVL9_TargetName] +New York +[EP2_LVL11_TargetName] +Paris +[EP2_LVL13_TargetName] +Moscow +[EP2_LVL15_TargetName] +Rome +[EP2_LVL16_TargetName] +Wash. DC +[EP2_AfterVibrateString] LEFT=17 TOP=11 WIDTH=7 HEIGHT=3 +Uh-oh. +[EP2_ESEQ_PART1] +After disabling the weaponry of +the Vorticon Mothership, Billy +heads for Earth. Even great +space heroes need a nap after +defeating a vicious horde of +violence-bent aliens! +[EP2_ESEQ_PART2] +The Vorticon ship limps back +towards Vorticon VI to tell of +their defeat at the hands of +Commander Keen. The Grand +Intellect will not be pleased. +[EP2_ESEQ_PART3_PAGE1] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Look honey it snowed +outside! There's no +school! +[EP2_ESEQ_PART3_PAGE2] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Wonderful. That gives me +time to travel to +Vorticon VI and solve the +mystery of the Grand +Intellect! +[EP2_ESEQ_PART3_PAGE3] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Ok, hun, but you'd better +eat a nourishing vitamin +fortified bowl of Sugar +Stoopies first. +[EP2_ESEQ_PART3_PAGE4] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 LASTPAGE=1 +Ok Mom... +[EP3_SHIP1] LEFT=3 TOP=9 WIDTH=33 HEIGHT=8 TWIRLX=21 TWIRLY=6 +You enter your ship, sit around +for a while, get bored, then +remember you have to find +the Grand Intellect! + + PRESS ENTER: +[EP3_SHIP2] LEFT=3 TOP=9 WIDTH=33 HEIGHT=8 TWIRLX=21 TWIRLY=6 +Into the ship you journey, lie +about a bit, then resume your +quest for the Grand Intellect! + + + PRESS ENTER: +[EP3_SHIP3] LEFT=3 TOP=9 WIDTH=33 HEIGHT=8 TWIRLX=21 TWIRLY=6 +You feel like entering the ship +and taking a rest, but the +mystery of the Grand Intellect's +identity changes your mind. + + PRESS ENTER: +[EP3_SHIP4] LEFT=3 TOP=9 WIDTH=33 HEIGHT=8 TWIRLX=21 TWIRLY=6 +Entering the ship might be a +fun thing to do, but right now, +you need to find the Grand +Intellect and vanquish him! + + PRESS ENTER: +[EP3_MORTIMER] LEFT=3 TOP=6 WIDTH=34 HEIGHT=9 +No. It can't be! + +Mortimer McMire! +[EP3_MORTIMER2] +Mortimer has been a thorn in your +side for as long as you can +remember. Your IQ test score was +314-Mortimer's was 315. He always +held that over you, never letting +you forget for one day. +[EP3_MORTIMER3] +All the practical jokes, the +mental cruelty, the swirlies-each +memory makes your teeth grit +harder. And now he's out to +destroy Earth! You have had +enough! +[EP3_MORTIMER4] +"Alright Mortimer, what's the +problem? Why destroy Earth?" + +"You and all those mental wimps +deserve to die! I'm the smartest +person in the galaxy. Aren't I +Mister THREE FOURTEEN! Ah,ha,ha!" +[EP3_MORTIMER5] +"I'll get you for that,Mortimer!" + + +"Come and try! You'll never get +past my hideous Mangling Machine! +Prepare to die, Commander Clown!" + + + + +[EP3_ESEQ_PAGE1] LEFT=0 TOP=18 WIDTH=39 HEIGHT=6 +With Mortimer McMire out of the +picture, and his brain-wave belts no +longer controlling them, the Vorticons +are freed of their mental enslavement. +[EP3_ESEQ_PAGE2] +"Commander Keen, in honor of your +meritorious service in freeing us from +the Grand Intellect's mental chains," +[EP3_ESEQ_PAGE3] +"I and the other Vorticons you haven't +slaughtered want to award you the +Big V, our highest honor." +[EP3_ESEQ_PAGE4] +"Thank you!" +[THE_END] LEFT=16 TOP=20 WIDTH=9 HEIGHT=3 +THE END? +[*] +This is a dummy string... +you must have a dummy string +at the end of this file. diff --git a/bugs.txt b/bugs.txt new file mode 100644 index 000000000..4ea165544 --- /dev/null +++ b/bugs.txt @@ -0,0 +1,2 @@ +Buglist of Commander Genius: +---------------------------- diff --git a/changelog.txt b/changelog.txt new file mode 100644 index 000000000..7b709396f --- /dev/null +++ b/changelog.txt @@ -0,0 +1,365 @@ +Commander Genius v0.2.9.0a Beta (CloneKeenPlus): +------------------------------------------------ + +05-06-2009 +- Fixed OpenGL slowdowns and bugs + +04-06-2009 +- Fixed a crash when loading game with Fullscreen settings +- Improved consistency of the Sound Class + +03-06-2009 +- Improved Scale2x and 3x algorithm +- Added special filter options for OpenGL +- First real implementation of OpenGL +- Improved Scale2x Speed! +- Added Scale4x Support (Only OpenGL) + +01-06-2009 +- Improved the CSound Class. Now the mixing of HQSounds use less memory, less code, and provides + even better quality. Also less processing. Isn't that neat? +- Cleaned out all the remaining C Warnings + +31-09-2009 +- Fixes some HQ Sound Leaks +- Corrected some bugs provoked crashes by some windows based systems. (Thanks to Tulip!) + +30-09-2009 +- New and improved CParser for the config-file. This one isn't buggy anymore! +- improved the stereo. It hears more like stereo and requires less operations. + Multiplications replaced by bit-shift-operators. +- Removed some old and obsolete files of the source code which weren't used anymore!! + +29-05-2009 +- 100% of the Sound classes finished +- Better memory handling of the sounds +- Sounds should be heard nicer. I hope so. Even the music. +- still testing thoses classes +- correction of minor bugs + +28-05-2009 +- 95% of the Sound classes finished +- still testing thoses classes +- An unknown bug which made CKP crash was discovered and fixed + +27-05-2009 +- 80% of the Sound classes finished + +24-05-2009 +- New Sound Model + +23-05-2009 +- Reduced the source code, deleting unused files +- Implementation of Sound Class. At last. + Reduced memory usage due stacking method + +22-05-2009 +- Some functions are classes now +- fixed some memory leaks and bugs + +19-05-2009 +- Reenabled and enhanced close button. + +14-05-2009 +- Paused Dialog implemented. Press p to pause the game +- Added cancel button to difficulty mode + +13-05-2009 +- Boosted up the 2x and 3x scaling without filter +- Fixed some collision issues + +12-05-2009 +- Fixed several bugs and broken + features since Commander Genius Edition (DaVince) + +10-05-2009 +- Added HQBitmap support! At last! + +08-05-2009 +- Removed a big memory leak (18 MB on my system)! +- Added menu opening effect, like the classical + Commander Keen game had. +- Improved performance +- Converted some more functions into classes and objects + +03-05-2009 +- Implemented some more classes +- Improved the performance a bit +- Playing music requires less resources now +- Fixed garg statue bug (Tulip) +- added opening animation in some menus + +27-04-2009 +- Log file now saved as html file. This will improve the +readability of the interpreters process +- Improved jump physics (Tulip) + +17-04-2009 +- Added 32-bit Linux version + +10-04-2009 +- High Score Table as promised +- improved some jump physics of the player (Tulip) + + +08-04-2009 +- Fixed BSOD Problem, when intro is starting + +06-04-2009 +- Fixed some jump bugs. (Tulip) + +31-03-2009 +- Little fix for switches in Ep. 2 + +29-03-2009: Fixed a blit error which made CKP in Win32 crash! +- This also helped to get the video faster! + +28-03-2009: Hope this is better! +- fixed other menu bugs +- fixed some memory leaks! + +26-03-2009: Feel the power of C++! +- Reenabled and improved joystick support +- Fix some remaining bugs +- Improved Dialogs, especially the Main and Options menu + +21-03-2009: For more Fans +- New Dialog Class with scroll support added! + +19-03-2009: For more Fans +- Ported to Windows +- Changed some files and directories + +18-03-2009: After a long time +- Added transparency feature +- This version is ported to C++ +- More Resolutions are now supported + +04-03-2009: Save me +- fixed some memory leaks +- improved joystick support +- menus can be controlled by the joystick again +- added analog feature which can be turned off + +03-03-2009: And once again! +- removed some useless code to save memory +- Items in all episodes are now processed together + in one function. +- Updated Scale2x functions. Added special SDL_scale2x + which boosts the performance a bit. + +02-03-2009: More and more! +- Changed SDL_SetTimer by SDL_AddTimer which improves + the programming flexibility and bit of performance. +- Added bump sound when you players try to walk into a wall +- Fixed a tile bug with the Vorticon Elder +- Fixed masked tile problem (Iv4n) + +01-03-2009: Improved Configuration! +- Now all the settings except game data are stored in ckp.cfg, + which also need less space. +- New-old feature "two-button-firing" +- New feature "keycard-stacking". Some mods need that + if there are multiple doors +- Some odd object bugs are fixed now. + (Objects which go out of the screen) + +21-02-2009: No Filter2x, please! +- 2x Scaling support without Filter is now supported +- Minor bug fixes + +20-02-2009: Other tiles, why not? +- Better Keyboard+Joystick Handling +- Changed the jump physics a bit again(Ceilik) +- Added the ability to load tiles.tli files. + +19-02-2009: hey cheater (or modder) +- LShift+Tab implemented (Ceilik) +- Less ingame inertia when jumping (Ceilik) + +18-02-2009: Same day, two versions +- CTSpace fix (Genius) +- walking in godmode on world now possible (Ceilik) + +17-02-2009: Same day, two versions +- more bugs resolved (Tulip) +- recovered and improved cheat mode (Tulip) + +16-02-2009: Same day, two versions +- improved physics and controls (Genius314) + +16-02-2009: More bugs fixed! +- improved physics (Genius314) + +15-02-2009: Axis at last! +- improved physics (Genius314) +- Support for axis mapping of joystick and analog sensitivity. Try it out! + +12-02-2009: Bugs and Beetles! +- Fixed wrong sprite positioning in some levels (Tulip) +- Some uncompressed mods exe-files are now supported. + Tested with yorpius II. (Tulip) + +12-02-2009: Now try it! +- imrproved jump/pogo physics! At least! (Forum-Team) + +09-02-2009: Bugs to eat! +- Fixed sound bug, when no card is detected +- Fixed a pogo problem +- Fixed Story bug, when mods are used + +08-02-2009: Jump it on! +- Implemented Story board. Isn't it nice? + +06-02-2009: Jump it on! +- Improved jump and walk physics + +05-02-2009: A small update! +- Improved Butlers AI (Tulip) +- Extrem loud gun sounds are removed! (Tulip) +- Gargs were too fast, when they saw you! (Tulip) +- Extra fix for undefined level start positions of the player (Tulip) +- Fixed stopping player animation, when Vorticon dies in Ep. 1 (Tulip) +- A small platform bug has been removed (Tulip) + +04-02-2009: More, more! +- Fixed Sounds playing in classical mode. Less memory is used now, and higher quality is achieved! +- Door animations are fixed now. (Tulip) +- Fixed some menu bugs. (Sciz CT) + +03-02-2009: It's coming! It's coming +- There was no sound effect for collecting the pogo. (Sciz CT) +- Yorp collision needed work. Walking directly into one just halted + your progress and played the sound effect repeatedly, rather than + bouncing you back as it should. (Sciz CT) +- Vortimoms needed 4 shots to kill. Now they need 5 like in the original game (Tulip) + +02-02-2009: Yorp don't do that! +- The ceiling height was too high, fixed (Sciz CT) +- Pogoing Problems fixed (Sciz CT) + +01-02-2009: Gonna be a remake! + +31-01-2009: Bug fixes and more! +- Now "controls" menu won't crash anymore in Windows +- Now all the Vorticons are more intelligent now (Tulip) +- Butlers can fall (Tulip) +- You can walk into butler from behind (Tulip) +- Vortimom shoots more often now +- Improved tile detection +- Imrpoved memory managment + +30-01-2009: More intelligence! +- Improved memory managment +- Keen dies when falling off the screen now! (Tulip) +- Keen cannot go out of maps anymore (Tulip) +- Keen can stand again on Vortacola in Episode 2 (Tulip) + + +28-01-2009: Isn't it hard enough? +- More intelligent tileset loading +- New Level loading and RLEW decompression. Now Mr. Blacks Levelpack of Keen 3 works very well! +- Fixed some memory problems under Windows (fixes 1 and 2 integrated) + + +28-01-2009: Isn't it hard enough? +- Now you can choose difficulty level when starting a new game +- Fixed Vortimom bug, when she fires to its left (Tulip) +- Reduced size of tile attributes file. They are only used for the change of tiles. + Everyone can now mod the tileinfo, load it with CKP and have fun +- Fixed more memory leaks and remove some obsolete variables +- Fixed other minor game bugs + + +27-01-2009: More new engine functions! +- Controls Config crash fixed for Windows Users! +- Tile properties are now read from the exe file, which make them shown behaved correctly +- Fixed some memory leaks +- Improved stereo sound when picking up items + +24-01-2009: Getting stable new engine! +- Now the old options work again. Some new options are shown, but still don't work! +- Fixed some segfault bugs + +23-01-2009: 3rd Prerelease of a new engine! +- Fixed reading keen?.exe problem in Windows (Thanks to Tulip for his support!!) +- Added fflush, so no more trimmed outputs under Windows (Thanks to Napalm) +- Improved dying animation speed and synchro with the sound +- Added some option menus, but they can't be seen. Please wait until next version. + +20-01-2009: 3rd Prerelease of a new engine! +- Fixed some bugs when load startmenu and crashes in Windows (Especially XP) +- Improved folder scanning +- Keen now walks at constant speed on the map +- "ckp.log" is the new log file. Useful for Windows users, when they want to report bugs + +19-01-2009: 2nd Prerelease of a new engine! +- Fixed bug when loading game sounds from other directories than "data/", being Ep 2 and 3 +- Improved consistency check. You really don't need ctlpanel.ck?, but keen?.exe. (Thanks to Tulip!) +- Games that will not run are marked gray now in the start menu +- Startmenu has the stars background from your episode 1 +- "New Game" added to Main Menu. Now you can switch back to the Start Menu +- Fullscreen bug fixed! +- Their was a bug with keycards which are removed now, when a level is exited (Thanks to Tulip!) + +18-01-2009: Prerelease of a new engine! +- Smoother scrolling +- Added 48Khz Sound. It hears nice! +- New driver engine. Should be more stable and no sounds are required to run the game +- Note: Some options are disabled. They will be enabled again, in the next release with better menus +- Files detection from the beginning +- Startmenu marks error if your games or mods are incomplete +- Fixed teleporting sound + +13-01-2009: Cross-compiling here we come! +- Separation of HQ Sounds. You now must download the extra package, + to use them. (Thanks to Hans de Goede for that idea) +- for the people who have to rename the data files caused by the new + convention. There is a renamer script in the data directory. +- lower-case naming convention (Thanks to Hans de Goede for that idea) +- Improved sound effects (Malvineous and Tulip) +- Windows version will be released in future as binary +- Cleaned a bit more the source code, but there are still bugs left. + + +09-01-2009: Only a small change! +- Games can be separated in directories and are shown with "games.cfg" + in a startmenu. (Commander Spleen) +- Cleaned a bit the source code. + +07-01-2009: Only a small change! +- You can choose between Stereo and Mono Sound now. + +06-01-2009: Play it louder! +- OGG File format supported. which makes the download file a bit smaller +- Better sound managment: Needs less memory for buffering. + +05-01-2009: Play it loud! +- Now CloneKeenPlus uses 8 internal sound channels, instead of 4. +- Cleaned up a bit more the source code. This still must be done. I will do it for every release +- High Quality Sounds! Now you can enjoy more your Sound Blaster playing Keen instead of hearing all the old choppy PC Speaker Sounds. + More of them will be implemented in the next version. The wave files are in the "data/hq/snd" directory. + + +03-01-2009: Mapping support finally! +- Now you can map your keyboard and joystick buttons for the first player. The support is limited to the actions, so movements + (up, down, right, left) cannot be mapped though. +- Cleaned up a bit the source code. Now the polled events memory is not reallocated anymore, which makes the game a bit faster (1 %). + +01-01-2009: Happy New year to all of you! We also have released a more promising version od CKP +- Better memory management. More unused variables are deallocated now and new type of variables organisation has been + implemented. + +31-12-2008: Code has been cleaned, ClonekeenPlus is even more stable now +- Early implementation of key and button mapping. However it is still unusable + +29-12-2008: First released version of the interpreter. It is nearly the same programme as CloneKeen 0.83 Beta with following exceptions: + +- Cleaned up the code. Many warnings won't appear anymore! +- Fixes that were written by Hans van de Goede (For Fedora Core) are implemented. Thank you very much! +- Hans van de Goede had created a program for extracting SOUNDS.CK2 and .CK3. This Code is implemented here. + When clonekeenplus is launched, these files are extracted from KEEN2.EXE or KEEN3.EXE +- Configuration settings are now saved automatically. +- When exiting, the program will not crash anymore! SDL_Double_Free problem fixed! +- Video memory instead of system memory will be used, when -ogl switch is used +- Early Joystick support implemented. Test it! It works very nice! diff --git a/demo.dat b/demo.dat new file mode 100644 index 000000000..654cc8b74 Binary files /dev/null and b/demo.dat differ diff --git a/ep1attr.dat b/ep1attr.dat new file mode 100644 index 000000000..eccb0fc2d Binary files /dev/null and b/ep1attr.dat differ diff --git a/ep1demo1.dat b/ep1demo1.dat new file mode 100644 index 000000000..69ec87967 Binary files /dev/null and b/ep1demo1.dat differ diff --git a/ep1demo2.dat b/ep1demo2.dat new file mode 100644 index 000000000..1e5dba98c Binary files /dev/null and b/ep1demo2.dat differ diff --git a/ep1save1.dat b/ep1save1.dat new file mode 100644 index 000000000..cccd76a3a Binary files /dev/null and b/ep1save1.dat differ diff --git a/ep1save2.dat b/ep1save2.dat new file mode 100644 index 000000000..ba7509fb6 Binary files /dev/null and b/ep1save2.dat differ diff --git a/ep1save3.dat b/ep1save3.dat new file mode 100644 index 000000000..f01930c87 Binary files /dev/null and b/ep1save3.dat differ diff --git a/ep1save5.dat b/ep1save5.dat new file mode 100644 index 000000000..70b9343bf Binary files /dev/null and b/ep1save5.dat differ diff --git a/ep1save8.dat b/ep1save8.dat new file mode 100644 index 000000000..f8dcf3528 Binary files /dev/null and b/ep1save8.dat differ diff --git a/ep2attr.dat b/ep2attr.dat new file mode 100644 index 000000000..825fac515 Binary files /dev/null and b/ep2attr.dat differ diff --git a/ep2demo2.dat b/ep2demo2.dat new file mode 100644 index 000000000..0306af549 Binary files /dev/null and b/ep2demo2.dat differ diff --git a/ep2demo3.dat b/ep2demo3.dat new file mode 100644 index 000000000..3603c233c Binary files /dev/null and b/ep2demo3.dat differ diff --git a/ep2save1.dat b/ep2save1.dat new file mode 100644 index 000000000..88f0354dd Binary files /dev/null and b/ep2save1.dat differ diff --git a/ep3attr.dat b/ep3attr.dat new file mode 100644 index 000000000..16be30d94 Binary files /dev/null and b/ep3attr.dat differ diff --git a/ep3demo2.dat b/ep3demo2.dat new file mode 100644 index 000000000..becd95ad3 Binary files /dev/null and b/ep3demo2.dat differ diff --git a/ep3demo3.dat b/ep3demo3.dat new file mode 100644 index 000000000..a3842085a Binary files /dev/null and b/ep3demo3.dat differ diff --git a/ep3save6.dat b/ep3save6.dat new file mode 100644 index 000000000..fa9488205 Binary files /dev/null and b/ep3save6.dat differ diff --git a/future.txt b/future.txt new file mode 100644 index 000000000..abf6b75a5 --- /dev/null +++ b/future.txt @@ -0,0 +1,18 @@ +Here are the features that I still want to implement: +----------------------------------------------------- + +until 0.3: +- alt+enter for fullscreen, alt+F4 and/or alt+Q can be used to quickly close the application? +- Controls selection for player 2 +- OpenGL new effects + +until 0.4: +- User folder detection and save the files there! +- Ubuntu debs +- New Games Menu. Should run without the need of an episode! +- Commander Keen 4-6 + +until 0.5: +- Maybe Keen Dreams +- No plans for now! + diff --git a/readme.txt b/readme.txt new file mode 100644 index 000000000..ea0f31366 --- /dev/null +++ b/readme.txt @@ -0,0 +1,181 @@ +************************************* +* * +* C L O N E K E E N * +* PLUS * +* (Commander Genius) * +* * +* (c)2008-2009 Gerstrong * +* (c)2003-2005 Caitlin Shaw * +* Released under GNU/GPL * +* * +* Beta v0.2.9.0 * +* * +************************************* +Welcome to CloneKeenPlus (Commander Genius)! + +CloneKeenPlus is an almost complete open-source clone of +the old classic DOS game, Commander Keen: Invasion of the +Vorticons by ID Software. CloneKeenPlus requires the original game +data files to work. You can play all three episodes of the game and +some fanmade mods. + +CloneKeenPlus currently runs under Linux/X11 and Windows with SDL. +In Mac OS X it also might run, but this has not been tested yet. + +CloneKeenPlus tries to mostly replicate the original game, +however there are also a number of improvements like: +- smoother scrolling +- MMX Support +- OpenGL Acceleration (through Hardware on many systems) +- better graphic effects (transparency, fading) +- 2-player support (still incomplete) +- high quality packs (for better sound and music) +- games menu +- gamepad support (More than two joystick buttons) + +and much more! + +To my knowledge this is the only released attempt at +writing a third-party Keen game that has reached this +stage of completedness. + +Commander Genius is a new edition of CloneKeenPlus. +The reason I call it that is because this version is compiled +with GNU C++ (Before it was C). Some functions are +now classes. The idea behind that, is to provide a faster +and more stable program. Features like resolution changes +implementation were achieved through classes. Although it looks +very similar, the structure of the program is a lot different +than in CloneKeen. + +The CloneKeenPlus source code may be freely distributed and +modified as per the GPL, just please remember to give +credit to the original authors. + +CloneKeenPlus has been developed by Gerstrong implementing +mayor improvements basing on the original +source code of CloneKeen by Caitlin Shaw. Many +thanks to him, for bringing us this great program. + +Obviously it is not the original version of CloneKeen +or any update. It is another version from a different +author. Other guys and me had many improvements and +I tried to post them to the author. However, until +today he has not responded. It is also known, that there +have not been updates of CloneKeen since 2005. It stayed +in beta 0.83. + +I also would like to see those changes and improvements +(or some of them) in his original project. +So I hope he will contact me some day. Most of the code is +based on his work and I acknowledge him a lot for that! + + +Setting up the data of the game: + + * Copy all of the data files from the original game(s) into the + "./data" folder. This means all of the files with the extension + .ck?. If you have the registered versions, you can play the whole game, + otherwise download the shareware version and copy the data from it. + You also can use mods. + * If you want to use some patched mods, you can put them into subdirectories. + You only have to modify the "games.cfg". + * Only Linux/Unix Users: If you have many data files which upper-case, + use the "./data/renlower.sh" shell script to rename them. + * Go into the "Release" folder and start the interpreter. + * If you want better sounds and music, please download the high quality pack. + Extract its contents to the "data" directory together with your game data. + +Howto use CloneKeenPlus (If you didn't compile it): + * Under Windows you start "cgenius.exe", under Linux "./CommanderGenius" + +Howto compile it under Ubuntu (testet on Intrepid): + * As I know which packages are needed, because I use Ubuntu, here is an extra guide. + * Install through Synaptic or "sudo apt-get install" following packages: + - build-essential + - libvorbis-dev + - libsdl1.2-dev + - libgl1-mesa-dev + * extract my source code into "ckp". + * cd into the "cpk/Release" subdirectory. + * Run "make". + * Then, you can run "CommanderGenius". Copy the files, wherever you want them together + with the data directory. "make install" does not work though. + +Compiling CKP on Linux/UNIX (other than Ubuntu): + * If you want to compile the game, you need to have all the standard . + development libraries and GNU C Compiler (at least version 4) installed + on your system. + * You need to install the "vorbis", "SDL" and "Mesa/OpenGL" development libraries to get + it successfully compiled. + * extract my source code to "ckp". + * cd into the "ckp/Release" subdirectory. + * Run "make". + * Then, you can run "CommanderGenius". Copy the files, + wherever you want them together with the data directory. + "make install" does not work though. + +HINTS & SECRETS + + +- CHEAT CODES - + +There are a full assortment of cheat codes available. Some cheats must first +be enabled with -cheat or through the options->game menu. C+T+SPACE and G+O+D will +always work. + +KEY ACTION DESCRIPTION +G+O+D godmode In god mode you are invincible! +C+T+SPACE All Items Gives all items, similar to the original. +LSHIFT+TAB Skip Level Holding down this key you can skip levels and walk through tiles + on the map. +TAB No clipping If you hold down this key you will disable clipping. + However, you cannot fall though floors. + +- SAVE/LOAD GAME - + +The game can be saved by pressing F3 at any point during the game. The game will +be saved in the exact position it was left (unlike the original which only +allowed save at the map). + +- DEMO - + +Wait a while at the tile screen and the game will cycle through several +demos, an added feature not found on the original game. + +- BUG! - + +So you really found one or more bugs? Please report me those per e-mail (gerstrong@gmail.com) +and they will be checked. You can also submit them through the bug tracker at Sourceforge.net. +Depending on the priority, I'm going to fix them as soon as possible. +Sending me the "CGLog.html" file might help tracking the error. + +- ACKNOWLEDGEMENTS - +Many thanks to people who has helped me so far in this project with their +suggestions: + + +Sciz CT +Commander Spleen +Malvineous +Tulip +DaVince +Hans de Goede +Levelass (Keen EXE-Information) +ZidaneA (For his music tracks!) +Iv4n + +Special thanks to Tulip, who has been supporting me all the time in testing +the Windows version of CKP. Without you it wouldn't be so great now! + +I'm sure, there were more people who helped me and I forgot to mention, but +many thanks to them, too. + +Many thanks to all of you, the project has gone farther, and will be a nice +port to Commander Keen! + +**************************************************************************** +For questions, comments, or updates to the source tree +please contact: gerstrong@gmail.com or go thru +SourceForge at http://clonekeenplus.sourceforge.net/ +**************************************************************************** diff --git a/src/.settings/org.eclipse.ltk.core.refactoring.prefs b/src/.settings/org.eclipse.ltk.core.refactoring.prefs new file mode 100644 index 000000000..d7586fd76 --- /dev/null +++ b/src/.settings/org.eclipse.ltk.core.refactoring.prefs @@ -0,0 +1,3 @@ +#Sat Jan 10 20:53:00 CET 2009 +eclipse.preferences.version=1 +org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false diff --git a/src/CCGenius.cpp b/src/CCGenius.cpp new file mode 100644 index 000000000..3866317d2 --- /dev/null +++ b/src/CCGenius.cpp @@ -0,0 +1,16 @@ +/* + * CCGenius.cpp + * + * Created on: 18.05.2009 + * Author: gerstrong + */ + +#include "CCGenius.h" + +CCGenius::CCGenius() { + +} + +CCGenius::~CCGenius() { + // TODO Auto-generated destructor stub +} diff --git a/src/CCGenius.h b/src/CCGenius.h new file mode 100644 index 000000000..a8ae87bbe --- /dev/null +++ b/src/CCGenius.h @@ -0,0 +1,24 @@ +/* + * CCGenius.h + * + * Created on: 18.05.2009 + * Author: gerstrong + */ + +#ifndef CCGENIUS_H_ +#define CCGENIUS_H_ + +#include "CSingleton.h" +#define g_pCGenius CCGenius::Get() + +class CCGenius : public CSingleton +{ +public: + CCGenius(); + virtual ~CCGenius(); + +private: + +}; + +#endif /* CCGENIUS_H_ */ diff --git a/src/CGame.cpp b/src/CGame.cpp new file mode 100644 index 000000000..290ef31ce --- /dev/null +++ b/src/CGame.cpp @@ -0,0 +1,48 @@ +/* + * CGame.cpp + * + * Created on: 01.05.2009 + * Author: gerstrong + */ + +#include + +#include "CGame.h" +#include "fileio.h" +#include "keen.h" +#include "sdl/sound/CSound.h" + +CGame::CGame() { + m_Episode = 0; + memset(m_DataDirectory,0,256); + Latch = new CLatch(); +} + +CGame::~CGame() { + if(Latch){ delete Latch; Latch = NULL;} +} + +void CGame::runCycle(void) +{ + // TODO: Code here!! +} + +int CGame::loadResources(unsigned short Episode, char *DataDirectory) +{ + m_Episode = Episode; + memcpy(m_DataDirectory, DataDirectory, 256); + + // Decode the graphics for the game (EGALATCH, EGASPRIT) + if (Latch->loadGraphics(Episode, DataDirectory)) return 1; + + loadstrings("strings.dat"); + + // Load the sound data + int ok; + ok = g_pSound->loadSoundData(m_Episode, DataDirectory); + if( ok ) return ok; + return 0; +} + +CLatch *CGame::getLatch(void) +{ return Latch; } diff --git a/src/CGame.h b/src/CGame.h new file mode 100644 index 000000000..f8759017f --- /dev/null +++ b/src/CGame.h @@ -0,0 +1,31 @@ +/* + * CGame.h + * + * Created on: 01.05.2009 + * Author: gerstrong + */ + +#ifndef CGAME_H_ +#define CGAME_H_ + +#include +#include "CLatch.h" + +class CGame { +public: + CGame(); + virtual ~CGame(); + + void runCycle(void); + int loadResources(unsigned short Episode, char *DataDirectory); + CLatch *getLatch(void); + +private: + static const unsigned short MAX_TEXT_LENGTH = 256; + unsigned short m_Episode; + char m_DataDirectory[MAX_TEXT_LENGTH]; + + CLatch *Latch; +}; + +#endif /* CGAME_H_ */ diff --git a/src/CGraphics.cpp b/src/CGraphics.cpp new file mode 100644 index 000000000..574a0883e --- /dev/null +++ b/src/CGraphics.cpp @@ -0,0 +1,758 @@ +/* + * CGraphics.cpp + * + * Created on: 03.05.2009 + * Author: gerstrong + * + * This file contains low- to mid-level graphics functions, + * which are NOT platform-specific. All the low-level stuff in + * here is stuff that draws to the scroll buffer (and so is + * not platform-specific). + */ + +#include "CGraphics.h" +#include "keen.h" +#include "sdl/CVideoDriver.h" +#include "sdl/video/colourtable.h" +#include "sdl/CVideoDriver.h" +#include "CLogFile.h" + +CGraphics::CGraphics() { + HQBitmap = NULL; + scrollbuffer=NULL; + scrollbuf_memsize = 0; + blitbuf_memsize = 0; +} + +CGraphics::~CGraphics() { + // TODO Auto-generated destructor stub +} + +bool CGraphics::allocScrollBufmem(void) +{ + scrollbuf_memsize = 512*(512+300); // First I have to check the resolution and then evaluate the scroll buffer size + blitbuf_memsize = (320)*(200+30); + g_pLogFile->ftextOut("allocmem(): allocating %d bytes for scroll buffer...", scrollbuf_memsize); + scrollbuffer = new Uint8[scrollbuf_memsize]; + memset(scrollbuffer,COLOUR_MASK,scrollbuf_memsize); + + if (!scrollbuffer) + { + g_pLogFile->textOut(RED,"Failure
"); + return false; + } else g_pLogFile->textOut("OK
"); + + if (g_pVideoDriver->getZoomValue() > 1) + { + g_pLogFile->ftextOut("allocmem(): allocating %d bytes for blit buffer...", blitbuf_memsize); + blitbuffer = (unsigned char*) malloc(blitbuf_memsize); + if (!blitbuffer) + { + g_pLogFile->ftextOut(RED,"Failure
"); + return false; + } else g_pLogFile->ftextOut("OK
"); + } + + return true; +} + +void CGraphics::freemem(void) +{ + if (scrollbuffer) + { + delete[] scrollbuffer; + g_pLogFile->ftextOut(BLACK,true," Scrollbuffer memory released to system.
"); + } + if (blitbuffer) + { + free(blitbuffer); + g_pLogFile->ftextOut(BLACK,true," Blitbuffer memory released to system.
"); + } +} + +void CGraphics::sb_setpixel(int x, int y, unsigned char c) +{ + scrollbuffer[(y<<9) + x] = c; +} + +unsigned char CGraphics::sb_getpixel(int x, int y) +{ + return scrollbuffer[(y<<9) + x]; +} + +// draw a tile directly to the display (bypass the scroll buffer) +void CGraphics::drawTile_direct(int x, int y, unsigned int t) +{ +unsigned char xa,ya; + for(ya=0;ya<16;ya++) + for(xa=0;xa<16;xa++) + g_pVideoDriver->setpixel(x+xa, y+ya, tiledata[t][ya][xa]); +} + +// draws a sprite directly to the display (only used by status window) +void CGraphics::drawSprite_direct(int x, int y, unsigned int t) +{ +unsigned char xa,ya; + for(ya=0;yasetpixel(x+xa, y+ya, sprites[t].imgdata[ya][xa]); +} + +void CGraphics::drawTile(int x, int y, unsigned int t) +{ + if(HQBitmap) + { + unsigned char *offset = &scrollbuffer[(y<<9)+x]; + unsigned char ya; + // Tile in which the player won't interact, are to be ignored! + if((TileProperty[t][BEHAVIOR] == 0 && TileProperty[t][ANIMATION] <= 1) || + (TileProperty[t][BEHAVIOR] > 30) ) + { + for(ya=0;ya<16;ya++) + { + memset(offset, COLOUR_MASK, 16); + offset+=512; + } + } + else + { + for(ya=0;ya<16;ya++) + { + memcpy(offset, &tiledata[t][ya][0], 16); + offset+=512; + } + } + } + else + { + unsigned char *offset = &scrollbuffer[(y<<9)+x]; + unsigned char ya; + + for(ya=0;ya<16;ya++) + { + memcpy(offset, &tiledata[t][ya][0], 16); + offset+=512; + } + } +} + +// draws a masked tile ("til") to the scrollbuffer. +// adjusts based on the X&Y scroll so that when the buffer is blitted +// the tile will appear at (x,y). only pixels which have a corresponding +// black pixel in tile "tmask" will be drawn. +void CGraphics::drawTilewithmask(int x, int y, unsigned int til, unsigned int tmask) +{ +unsigned char xa,ya; +unsigned int bufoffX,bufoffY; +unsigned int xstart,ystart; +// clip the tile + if (x>320 || y>200) return; + if (x<-16||y<-16) return; + if (x<0) xstart=-x; else xstart = 0; + if (y<0) ystart=-y; else ystart = 0; + + bufoffY = ((y+ystart+scrolly_buf)&511)<<9; // points to start of line + for(ya=ystart;ya<16;ya++) + { + bufoffX = (x+xstart+scrollx_buf)&511; // offset within line + for(xa=xstart;xa<16;xa++) + { + if (tiledata[tmask][ya][xa] != 15) + { + //scrollbuffer[bufoffY+bufoffX] = tiledata[til][ya][xa]; + } + bufoffX = (bufoffX+1)&511; + } + // move to next line and wrap to top of buffer if needed + bufoffY += 512; + if (bufoffY >= (512*512)) bufoffY = 0; + } +} + +// draws a tile ("til") to the scrollbuffer. adjusts based on the X&Y scroll +// so that when the buffer is blitted the tile will appear at (x,y). +// used for priority tiles (tiles[].priority) +void CGraphics::drawPrioritytile(int x, int y, unsigned int til) +{ +unsigned char xa,ya; +unsigned int bufoffX,bufoffY; +unsigned int xstart,ystart; +// clip the tile + if (x>320 || y>200) return; + if (x<-16 || y<-16) return; + if (x<0) xstart=-x; else xstart = 0; + if (y<0) ystart=-y; else ystart = 0; + + bufoffY = ((y+ystart+scrolly_buf)&511)<<9; // points to start of line + + if(HQBitmap) + { + for(ya=ystart;ya<16;ya++) + { + bufoffX = (x+xstart+scrollx_buf)&511; // offset within line + for(xa=xstart;xa<16;xa++) + { + scrollbuffer[bufoffY+bufoffX] = COLOUR_MASK; + bufoffX = (bufoffX+1)&511; + } + // move to next line and wrap to top of buffer if needed + bufoffY += 512; + if (bufoffY >= (512*512)) bufoffY = 0; + } + + return; + } + + for(ya=ystart;ya<16;ya++) + { + bufoffX = (x+xstart+scrollx_buf)&511; // offset within line + for(xa=xstart;xa<16;xa++) + { + scrollbuffer[bufoffY+bufoffX] = tiledata[til][ya][xa]; + bufoffX = (bufoffX+1)&511; + } + // move to next line and wrap to top of buffer if needed + bufoffY += 512; + if (bufoffY >= (512*512)) bufoffY = 0; + } +} + + +// draws a sprite to the scrollbuffer. +// adjusts based on the X&Y scroll so that when the buffer is blitted +// the sprite will appear at (x,y). saves the image beneath the sprite +// into the erasedata[] of object objectnum. +void CGraphics::drawSprite(int x, int y, unsigned int s, int objectnum) +{ +unsigned char xa,ya; +unsigned int bufoffX, bufoffY; +unsigned int xstart,ystart; + +// clip the sprite + if (x>320 || y>200) return; + if (x<-sprites[s].xsize||y<-sprites[s].ysize) return; + // if sprite is partially off the top or left of the screen, invert + // the sign on the coordinate to make it positive, and start drawing + // the sprite from there. + if (x<0) xstart=-x; else xstart = 0; + if (y<0) ystart=-y; else ystart = 0; + + bufoffY = ((y+ystart+scrolly_buf)&511)<<9; // points to start of line + for(ya=ystart;ya= (512*512)) bufoffY = 0; + } +} + +// complement of drawsprite(). uses the saved image in objectnum to erase +// a previously-drawn sprite. +void CGraphics::eraseSprite(int x, int y, unsigned int s, int objectnum) +{ +unsigned char xa,ya; +unsigned int bufoffX, bufoffY; +unsigned int xstart,ystart; + +// clip the sprite + if (x>320 || y>200) return; + if (x<-sprites[s].xsize||y<-sprites[s].ysize) return; + // if sprite is partially off the top or left of the screen, invert + // the sign on the coordinate to make it positive, and start drawing + // the sprite from there. + if (x<0) xstart=-x; else xstart = 0; + if (y<0) ystart=-y; else ystart = 0; + + bufoffY = ((y+ystart+scrolly_buf)&511)<<9; // points to start of line + for(ya=ystart;ya= (512*512)) bufoffY = 0; + } +} + +void CGraphics::drawCharacter(int x, int y, int f) +{ +unsigned char xa,ya; + + for(ya=0;ya<8;ya++) + { + for(xa=0;xa<8;xa++) + { + g_pVideoDriver->setpixel(x+xa, y+ya, font[f][ya][xa]); + } + } +} + +void CGraphics::sb_drawCharacter(int x, int y, int f) +{ + unsigned char xa,ya; + unsigned int yb; + + for(ya=0;ya<8;ya++) + { + yb = ((y+ya+scrolly_buf)&511)<<9; + for(xa=0;xa<8;xa++) + { + scrollbuffer[yb+((x+xa+scrollx_buf)&511)] = font[f][ya][xa]; + } + } +} + +void CGraphics::sb_drawCharacterwithmask(int x, int y, int f, char mask) +{ +unsigned char xa,ya; +unsigned int yb; + + for(ya=0;ya<8;ya++) + { + yb = ((y+ya+scrolly_buf)&511)<<9; + for(xa=0;xa<8;xa++) + { + if(font[f][ya][xa] != mask) + scrollbuffer[yb+((x+xa+scrollx_buf)&511)] = font[f][ya][xa]; + } + } +} + + +void CGraphics::sb_drawColorcharacter(int x, int y, int f, unsigned short colour, unsigned short bgcolour) +{ +unsigned char xa,ya; +unsigned int yb; + + for(ya=0;ya<8;ya++) + { + yb = ((y+ya+scrolly_buf)&511)<<9; + for(xa=0;xa<8;xa++) + { + if(font[f][ya][xa] == 16) + scrollbuffer[yb+((x+xa+scrollx_buf)&511)] = colour; + else if(bgcolour != COLOUR_MASK) + scrollbuffer[yb+((x+xa+scrollx_buf)&511)] = bgcolour; + } + } +} + +unsigned char savebuf[200][320]; +void CGraphics::saveArea(int x1, int y1, int x2, int y2) +{ +unsigned char xa,ya; +unsigned int yb; + + for(ya=0;yastart()) + { + printf("Graphics_Start(): VidDrv_Start() failed to initilize display
"); + return 1; + } + + // set up the palette + g_pLogFile->ftextOut("Graphics_Start(): configuring palette.
"); + initPalette(0); + fadePalette(0); + return 0; +} + +void CGraphics::stopGraphics(void) +{ + // shut down the video driver + g_pVideoDriver->stop(); +} + +void CGraphics::configPalette(int c, int r, int g, int b) +{ + palette[c].r = r; + palette[c].g = g; + palette[c].b = b; +} + +// loads the EGA palette into the palette[] array. if dark=1, loads in +// the palette used when the lights are off (in ep2) +void CGraphics::initPalette(int dark) +{ + if (!dark) + { + configPalette(0, 0x00,0x00,0x00); + configPalette(1, 0x00,0x00,0xa8); + configPalette(2, 0x00,0xa8,0x00); + configPalette(3, 0x00,0xa8,0xa8); + configPalette(4, 0xa8,0x00,0x00); + configPalette(5, 0xa8,0x00,0xa8); + configPalette(6, 0xa8,0x54,0x00); + configPalette(7, 0xa8,0xa8,0xa8); + configPalette(8, 0x54,0x54,0x54); + configPalette(9, 0x54,0x54,0xfc); + configPalette(10, 0x54,0xfc,0x54); + configPalette(11, 0x54,0xfc,0xfc); + configPalette(12, 0xfc,0x54,0x54); + configPalette(13, 0xfc,0x54,0xfc); + configPalette(14, 0xfc,0xfc,0x54); + configPalette(15, 0xfc,0xfc,0xfc); + } + else + { + configPalette(0, 0x00,0x00,0x00); + configPalette(1, 0x00,0x00,0x00); + configPalette(2, 0x00,0x00,0x00); + configPalette(3, 0x00,0x00,0x00); + configPalette(4, 0x00,0x00,0x00); + configPalette(5, 0x00,0x00,0x00); + configPalette(6, 0x00,0x00,0x00); + configPalette(7, 0x54,0x54,0x54); + configPalette(8, 0x00,0x00,0x00); + configPalette(9, 0x00,0x00,0xa8); + configPalette(10, 0x00,0xa8,0x00); + configPalette(11, 0x00,0xa8,0xa8); + configPalette(12, 0xa8,0x00,0x00); + configPalette(13, 0xa8,0x00,0xa8); + configPalette(14, 0xa8,0x54,0x00); + configPalette(15, 0xa8,0xa8,0xa8); + } + + // 16 is black, for flashing during vorticon death sequence + // (all black in the graphics is mapped to 16, then the border around + // the screen is the only thing left at color 0, so we can change 0's + // palette to change the border color) + configPalette(16,0x00,0x00,0x00); +} + +void CGraphics::fadePalette(int fadeamt) +{ +int c; +int r,g,b; +if (framebyframe) fadeamt = PAL_FADE_SHADES; + + for(c=0;c<17;c++) + { + r = palette[c].r; + g = palette[c].g; + b = palette[c].b; + + if (fadeamt != PAL_FADE_SHADES) + { + if ((c==0||c==16) && fadeamt > PAL_FADE_SHADES && fade_black) + { + r = 255 / (PAL_FADE_WHITEOUT - PAL_FADE_SHADES); + r = (r * (fadeamt - (PAL_FADE_WHITEOUT - PAL_FADE_SHADES))); + g = b = r; + } + else + { + r /= PAL_FADE_SHADES; + g /= PAL_FADE_SHADES; + b /= PAL_FADE_SHADES; + + r *= fadeamt; + g *= fadeamt; + b *= fadeamt; + } + + if (r > 0xff) r = 0xff; + if (g > 0xff) g = 0xff; + if (b > 0xff) b = 0xff; + } + g_pVideoDriver->pal_set(c, r, g, b); + } + if(HQBitmap) + HQBitmap->setAlphaBlend(static_cast (fadeamt)); + + g_pVideoDriver->pal_apply(); +} + +void CGraphics::drawBitmap(int xa, int ya, int b) +{ +int x,y; +unsigned char *bmdataptr; + + // for "b" arguments passed from GetBitmapNumberFromName(), + // in case the specified name was not found + if (b==-1) return; + + bmdataptr = bitmaps[b].bmptr; + for(y=0;yupdateHQBitmap(g_pVideoDriver->getBGLayerSurface(),scroll_x-32,scroll_y-32); +} + +void CGraphics::loadHQGraphics(unsigned char episode, unsigned char level, char *datadir) +{ + char buf[256]; + char buf2[256]; + SDL_Rect screen_rect; + + memset(buf,0,256); + memset(buf2,0,256); + + formatPathString(buf,datadir); + + sprintf(buf2,"%slevel%dep%d.bmp",buf,level,episode); + + screen_rect.x = 0; + screen_rect.y = 0; + screen_rect.w = g_pVideoDriver->getWidth(); + screen_rect.h = g_pVideoDriver->getHeight(); + + HQBitmap = new CHQBitmap(screen_rect); + if(!HQBitmap->loadImage(buf2)) + { + delete HQBitmap; + HQBitmap = NULL; + return; + } + + // Check if the tile have grey pixels in some tiles and remove them! + for(int t=0 ; t < numtiles ; t++) + { + if(TileProperty[t][BEHAVIOR] > 0) + { + for(int xa=0 ; xa < 16 ; xa++) + { + for(int ya=0 ; ya < 16 ; ya++) + { + if(tiledata[t][ya][xa] == COLOUR_GREY) // Which should be masked. In Episode 1 it is gray + { + tiledata[t][ya][xa] = COLOUR_MASK; + } + } + } + } + } + +} +void CGraphics::unloadHQGraphics() +{ + if(!HQBitmap) + return; + + delete HQBitmap; + HQBitmap = NULL; + + // Make unmask some tiles adding the original pixels back! + for(int t=0 ; t < numtiles ; t++) + { + if(TileProperty[t][BEHAVIOR] > 0) + { + for(int xa=0 ; xa < 16 ; xa++) + { + for(int ya=0 ; ya < 16 ; ya++) + { + if(tiledata[t][ya][xa] == COLOUR_MASK) // Which should be masked. In Episode 1 it is gray + { + tiledata[t][ya][xa] = COLOUR_GREY; + } + } + } + } + } +} diff --git a/src/CGraphics.h b/src/CGraphics.h new file mode 100644 index 000000000..84571d305 --- /dev/null +++ b/src/CGraphics.h @@ -0,0 +1,78 @@ +/* + * CGraphics.h + * + * Created on: 03.05.2009 + * Author: gerstrong + */ + +#ifndef CGRAPHICS_H_ +#define CGRAPHICS_H_ + +#include "CSingleton.h" +#define g_pGraphics CGraphics::Get() + +#include +#include "hqp/CHQBitmap.h" + +class CGraphics : public CSingleton +{ +public: + CGraphics(); + virtual ~CGraphics(); + bool allocScrollBufmem(void); + void freemem(void); + void sb_setpixel(int x, int y, unsigned char c); + unsigned char sb_getpixel(int x, int y); + void drawSprite_direct(int x, int y, unsigned int t); + void drawTile(int x, int y, unsigned int t); + void drawTilewithmask(int x, int y, unsigned int til, unsigned int tmask); + void drawPrioritytile(int x, int y, unsigned int til); + void drawSprite(int x, int y, unsigned int s, int objectnum); + void eraseSprite(int x, int y, unsigned int s, int objectnum); + void drawCharacter(int x, int y, int f); + void sb_drawCharacter(int x, int y, int f); + void sb_drawCharacterwithmask(int x, int y, int f, char mask); + void sb_drawColorcharacter(int x, int y, int f, unsigned short colour, unsigned short bgcolour); + void saveArea(int x1, int y1, int x2, int y2); + void restoreArea(int x1, int y1, int x2, int y2); + char startGraphics(void); + void stopGraphics(void); + void configPalette(int c, int r, int g, int b); + void initPalette(int dark); + void fadePalette(int fadeamt); + void drawBitmap(int xa, int ya, int b); + int getBitmapNumberFromName(const char *bmname); + void sb_drawCharacterinverse(int x, int y, int f); + void drawFont(unsigned char *text, int xoff, int yoff, int highlight); + void sb_font_draw(const unsigned char *text, int xoff, int yoff); + void sb_mask_font_draw(unsigned char *text, int xoff, int yoff, char mask); + void sb_color_font_draw(unsigned char *text, int xoff, int yoff, unsigned int colour, unsigned short bgcolour); + void sb_font_draw_inverse(unsigned char *text, int xoff, int yoff); + void drawTile_direct(int x, int y, unsigned int t); + void setFadeBlack(bool value); + + Uint8 *getScrollbuffer(void); + + void renderHQBitmap(); + void loadHQGraphics(unsigned char episode, unsigned char level, char *datadir); + void unloadHQGraphics(); + +private: + Uint32 scrollbuf_memsize; + Uint32 blitbuf_memsize; + + unsigned char *scrollbuffer; + unsigned char *blitbuffer; + + typedef struct stColour + { + int r,g,b; + } stColour; + stColour palette[256]; + + bool fade_black; + + CHQBitmap *HQBitmap; +}; + +#endif /* CGRAPHICS_H_ */ diff --git a/src/CLatch.cpp b/src/CLatch.cpp new file mode 100644 index 000000000..64e7cbae7 --- /dev/null +++ b/src/CLatch.cpp @@ -0,0 +1,557 @@ +/* + * CLatch.cpp + * + * Created on: 02.05.2009 + * Author: gerstrong + */ + +#include +#include +#include +#include "CLatch.h" +#include "fileio.h" +#include "keen.h" +#include "keenext.h" + +#include "CLogFile.h" + +CLatch::CLatch() { + SpriteTable = NULL; + BitmapTable = NULL; + BitmapData = NULL; + RawData = NULL; +} + +CLatch::~CLatch() { + + if (SpriteTable){ delete[] SpriteTable; SpriteTable = NULL;} + if (BitmapTable){ delete[] BitmapTable; BitmapTable = NULL;} + if (RawData){ delete[] RawData; RawData = NULL;} + if (BitmapData) + { + delete[] BitmapData; BitmapData = NULL; + g_pLogFile->textOut(BLACK," Bitmap data released to system.
"); + } +} + +char CLatch::loadGraphics(int episode, const char *path) +{ + int retval = 0; + + if (SpriteTable){ delete[] SpriteTable; SpriteTable = NULL;} + if (BitmapTable){ delete[] BitmapTable; BitmapTable = NULL;} + if (BitmapData){ delete[] BitmapData; BitmapData = NULL;} + if (RawData){ delete[] RawData; RawData = NULL;} + + if (loadHeader(episode, path)) { retval = 1; } + if (load(episode, path)) { retval = 1; } + if (loadSprites(episode, path)) { retval = 1; } + + return retval; +} + +// load the EGAHEAD file +char CLatch::loadHeader(int episode, const char *path) +{ + FILE *headfile; + unsigned long SpriteTableRAMSize; + unsigned long BitmapTableRAMSize; + char buf[12]; + int i,j,k; + char fname[80]; + char buffer[256]; + + memset(buffer,0,256); + memset(fname,0,80); + + formatPathString(buffer,path); + + strcat(buffer,"egahead.ck"); + + sprintf(fname, "%s%d", buffer,episode); + + + headfile = fopen(fname, "rb"); + if (!headfile) + { + g_pLogFile->ftextOut("latch_loadheader(): unable to open '%s'.
", fname); + return 1; + } + + g_pLogFile->ftextOut("latch_loadheader(): reading main header from '%s'...
", fname); + + // read the main header data from EGAHEAD + LatchHeader.LatchPlaneSize = fgetl(headfile); + LatchHeader.SpritePlaneSize = fgetl(headfile); + LatchHeader.OffBitmapTable = fgetl(headfile); + LatchHeader.OffSpriteTable = fgetl(headfile); + LatchHeader.Num8Tiles = fgeti(headfile); + LatchHeader.Off8Tiles = fgetl(headfile); + LatchHeader.Num32Tiles = fgeti(headfile); + LatchHeader.Off32Tiles = fgetl(headfile); + LatchHeader.Num16Tiles = fgeti(headfile); + LatchHeader.Off16Tiles = fgetl(headfile); + LatchHeader.NumBitmaps = fgeti(headfile); + LatchHeader.OffBitmaps = fgetl(headfile); + LatchHeader.NumSprites = fgeti(headfile); + LatchHeader.OffSprites = fgetl(headfile); + LatchHeader.Compressed = fgeti(headfile); + + g_pLogFile->ftextOut(" LatchPlaneSize = 0x%04x
", LatchHeader.LatchPlaneSize); + g_pLogFile->ftextOut(" SpritePlaneSize = 0x%04x
", LatchHeader.SpritePlaneSize); + g_pLogFile->ftextOut(" OffBitmapTable = 0x%04x
", LatchHeader.OffBitmapTable); + g_pLogFile->ftextOut(" OffSpriteTable = 0x%04x
", LatchHeader.OffSpriteTable); + g_pLogFile->ftextOut(" Num8Tiles = %d
", LatchHeader.Num8Tiles); + g_pLogFile->ftextOut(" Off8Tiles = 0x%04x
", LatchHeader.Off8Tiles); + g_pLogFile->ftextOut(" Num32Tiles = %d
", LatchHeader.Num32Tiles); + g_pLogFile->ftextOut(" Off32Tiles = 0x%04x
", LatchHeader.Off32Tiles); + g_pLogFile->ftextOut(" Num16Tiles = %d
", LatchHeader.Num16Tiles); + g_pLogFile->ftextOut(" Off16Tiles = 0x%04x
", LatchHeader.Off16Tiles); + g_pLogFile->ftextOut(" NumBitmaps = %d
", LatchHeader.NumBitmaps); + g_pLogFile->ftextOut(" OffBitmaps = 0x%04x
", LatchHeader.OffBitmaps); + g_pLogFile->ftextOut(" NumSprites = %d
", LatchHeader.NumSprites); + g_pLogFile->ftextOut(" OffSprites = 0x%04x
", LatchHeader.OffSprites); + g_pLogFile->ftextOut(" Compressed = %d
", LatchHeader.Compressed); + + /// read in the sprite table + + // allocate memory for the sprite table + SpriteTableRAMSize = sizeof(SpriteHead) * (LatchHeader.NumSprites + 1); + g_pLogFile->ftextOut("latch_loadheader(): Allocating %d bytes for sprite table.
", SpriteTableRAMSize); + + SpriteTable = new SpriteHead[SpriteTableRAMSize]; + if (!SpriteTable) + { + g_pLogFile->ftextOut("latch_loadheader(): Can't allocate sprite table!
"); + return 1; + } + + g_pLogFile->ftextOut("latch_loadheader(): Reading sprite table from '%s'...
", fname); + + fseek(headfile, LatchHeader.OffSpriteTable, SEEK_SET); + for(i=0;i> 8); + SpriteTable[i].Ry1 = (fgeti(headfile) >> 8); + SpriteTable[i].Rx2 = (fgeti(headfile) >> 8); + SpriteTable[i].Ry2 = (fgeti(headfile) >> 8); + for(j=0;j<16;j++) SpriteTable[i].Name[j] = fgetc(headfile); + // for some reason each sprite occurs 4 times in the table. + // we're only interested in the first occurance. + for(j=0;j<3;j++) + { + for(k=0;k < static_cast(sizeof(SpriteHead));k++) fgetc(headfile); + } + + } + + // read in the bitmap table + + // allocate memory for the bitmap table + BitmapTableRAMSize = sizeof(BitmapHead) * (LatchHeader.NumBitmaps + 1); + g_pLogFile->ftextOut("latch_loadheader(): Allocating %d bytes for bitmap table.
", BitmapTableRAMSize); + + BitmapTable = new BitmapHead[BitmapTableRAMSize]; + if (!BitmapTable) + { + g_pLogFile->ftextOut("latch_loadheader(): Can't allocate bitmap table!
"); + return 1; + } + + g_pLogFile->ftextOut("latch_loadheader(): reading bitmap table from '%s'...
", fname); + + fseek(headfile, LatchHeader.OffBitmapTable, SEEK_SET); + + BitmapBufferRAMSize = 0; + for(i=0;iftextOut(" Bitmap '%s': %dx%d at offset %04x. RAMAllocSize=0x%04x
", buf,BitmapTable[i].Width,BitmapTable[i].Height,BitmapTable[i].Offset,BitmapBufferRAMSize); + } + BitmapBufferRAMSize++; + + fclose(headfile); + return 0; +} + + +// load the EGAHEAD file + +char CLatch::load(int episode, const char *path) +{ +FILE *latchfile; +unsigned long plane1, plane2, plane3, plane4; +char fname[80]; +int x,y,t,b,c,p; +char *bmdataptr; +unsigned long RawDataSize; +//unsigned char ch; + +char buffer[256]; + + + formatPathString(buffer,path); + + strcat(buffer,"egalatch.ck"); + + sprintf(fname, "%s%c", buffer,episode + '0'); + + g_pLogFile->ftextOut("latch_loadlatch(): Opening file '%s'.
", fname); + + latchfile = fopen(fname, "rb"); + if (!latchfile) + { + g_pLogFile->ftextOut("latch_loadlatch(): Unable to open '%s'!
", fname); + return 1; + } + + // figure out how much RAM we'll need to read all 4 planes of + // latch data into memory. + RawDataSize = (LatchHeader.LatchPlaneSize * 4); + RawData = new char[RawDataSize]; + if (!RawData) + { + g_pLogFile->ftextOut("latch_loadlatch(): Unable to allocate RawData buffer!
"); + return 1; + } + + // get the data out of the file into memory, decompressing if necessary. + if (LatchHeader.Compressed) + { + g_pLogFile->ftextOut("latch_loadlatch(): Decompressing...
"); + fseek(latchfile, 6, SEEK_SET); + if (lz_decompress(latchfile, (unsigned char*) RawData)) return 1; + } + else + { + g_pLogFile->ftextOut("latch_loadlatch(): Reading %d bytes...
", RawDataSize); + fread(RawData, RawDataSize, 1, latchfile); + } + fclose(latchfile); + + // these are the offsets of the different video planes as + // relative to each other--that is if a pixel in plane1 + // is at N, the byte for that same pixel in plane3 will be + // at (N + plane3). + plane1 = 0; + plane2 = (LatchHeader.LatchPlaneSize * 1); + plane3 = (LatchHeader.LatchPlaneSize * 2); + plane4 = (LatchHeader.LatchPlaneSize * 3); + + // ** read the 8x8 tiles ** + g_pLogFile->ftextOut("latch_loadlatch(): Decoding 8x8 tiles...
", fname); + + // set up the getbit() function + setplanepositions(plane1 + LatchHeader.Off8Tiles, \ + plane2 + LatchHeader.Off8Tiles, \ + plane3 + LatchHeader.Off8Tiles, \ + plane4 + LatchHeader.Off8Tiles, \ + 0); + + for(p=0;p<4;p++) + { + for(t=0;tftextOut("latch_loadlatch(): Decoding 16x16 tiles...
", fname); + + // set up the getbit() function + setplanepositions(plane1 + LatchHeader.Off16Tiles, \ + plane2 + LatchHeader.Off16Tiles, \ + plane3 + LatchHeader.Off16Tiles, \ + plane4 + LatchHeader.Off16Tiles, \ + 0); + + for(p=0;p<4;p++) + { + for(t=0;tftextOut("latch_loadlatch(): Allocating %d bytes for bitmap data...
", BitmapBufferRAMSize); + BitmapData = new char[BitmapBufferRAMSize]; + if (!BitmapData) + { + g_pLogFile->ftextOut("Cannot allocate memory for bitmaps.
"); + return 1; + } + + g_pLogFile->ftextOut("latch_loadlatch(): Decoding bitmaps...
", fname); + + // set up the getbit() function + setplanepositions(plane1 + LatchHeader.OffBitmaps, \ + plane2 + LatchHeader.OffBitmaps, \ + plane3 + LatchHeader.OffBitmaps, \ + plane4 + LatchHeader.OffBitmaps, \ + 0); + + // decode bitmaps into the BitmapData structure. The bitmaps are + // loaded into one continous stream of image data, with the bitmaps[] + // array giving pointers to where each bitmap starts within the stream. + + for(p=0;p<4;p++) + { + // this points to the location that we're currently + // decoding bitmap data to + bmdataptr = &BitmapData[0]; + + for(b=0;b>= 1; + + return retval; +} + + +char CLatch::loadSprites(int episode, const char *path) +{ +FILE *spritfile; +unsigned long plane1, plane2, plane3, plane4, plane5; +char fname[80]; +int x,y,s,c,p; +unsigned long RawDataSize; +/*int i; +unsigned char ch;*/ + +char buffer[256]; + + formatPathString(buffer,path); + + strcat(buffer,"egasprit.ck"); + + sprintf(fname, "%s%c", buffer,episode + '0'); + + g_pLogFile->ftextOut("latch_loadsprites(): Opening file '%s'.
", fname); + + spritfile = fopen(fname, "rb"); + if (!spritfile) + { + g_pLogFile->ftextOut("latch_loadsprites(): Unable to open '%s'!
", fname); + return 1; + } + + RawDataSize = (LatchHeader.SpritePlaneSize * 5); + RawData = new char[RawDataSize]; + if (!RawData) + { + g_pLogFile->ftextOut("latch_loadlatch(): Unable to allocate RawData buffer!
"); + return 1; + } + + if (LatchHeader.Compressed) + { + g_pLogFile->ftextOut("latch_loadsprites(): Decompressing...
"); + fseek(spritfile, 6, SEEK_SET); + if (lz_decompress(spritfile, (unsigned char*) RawData)) return 1; + } + else + { + g_pLogFile->ftextOut("latch_loadsprites(): Reading %d bytes...
", RawDataSize); + fread(RawData, RawDataSize, 1, spritfile); + } + fclose(spritfile); + + // these are the offsets of the different video planes as + // relative to each other--that is if a pixel in plane1 + // is at N, the byte for that same pixel in plane3 will be + // at (N + plane3). + plane1 = 0; + plane2 = (LatchHeader.SpritePlaneSize * 1); + plane3 = (LatchHeader.SpritePlaneSize * 2); + plane4 = (LatchHeader.SpritePlaneSize * 3); + plane5 = (LatchHeader.SpritePlaneSize * 4); + + // ** read the sprites ** + g_pLogFile->ftextOut("latch_loadsprites(): Decoding sprites...
", fname); + + // set up the getbit() function + setplanepositions(plane1 + LatchHeader.OffSprites, \ + plane2 + LatchHeader.OffSprites, \ + plane3 + LatchHeader.OffSprites, \ + plane4 + LatchHeader.OffSprites, \ + plane5 + LatchHeader.OffSprites); + + // load the image data + for(p=0;p<4;p++) + { + for(s=0;s +#include +#include +#include "CLogFile.h" +#include + +CLogFile::CLogFile() {} + +CLogFile::~CLogFile() { + // Logfile End + textOut ("

End of logfile
"); + fclose (m_Logfile); +} + +void CLogFile::CreateLogfile(const char *LogName) +{ + // Open and empty the log file + m_Logfile = fopen(LogName, "wt"); + + // Write the head + textOut("LogFile"); + textOut(""); + WriteTopic("Logfile", 3); + textOut(BLUE,REVISION); + + // Mark the Build and Platform + #ifdef DEBUG + textOut("BUILD: DEBUG
"); + #else + textOut("BUILD: RELEASE
"); + #endif + + #ifdef TARGET_LNX + textOut("PLATFORM: LINUX
"); + #elif TARGET_WIN32 + textOut("PLATFORM: WINDOWS
"); + #else + textOut("PLATFORM: UNKNOWN
"); + #endif + + // Show my e-mail adress + textOut(""); + textOut("Send E-Mail to me

"); + + fclose(m_Logfile); + m_Logfile = fopen(LogName, "at"); +} + +// Function for writing the topic +void CLogFile::WriteTopic(const char *Topic, int Size) +{ + textOut("\n\n\n\n\n
\n\n", Size); + textOut(Topic); + textOut("\n
\n
"); + fflush(m_Logfile); +} + +// The main textOut function +// Standard textOut (Black color) + + +// Now with colors +void CLogFile::textOut(int Color, const char *Text) +{ + textOut(Color, false, Text); +} + +// Now the entire definition (with list and color) +void CLogFile::textOut(int Color, bool List, const char *Text) +{ + if(List == true) + textOut("
  • "); + + // write color tag + switch(Color) + { + case BLACK: + textOut(""); break; + case RED: + textOut(""); break; + case GREEN: + textOut(""); break; + case BLUE: + textOut(""); break; + case PURPLE: + textOut(""); break; + }; + + // Write the text + textOut(Text); + textOut(""); + + if (List == false) + textOut("
    "); + else + textOut("
  • "); + +} + + +void CLogFile::textOut(const char *Text) +{ + fprintf(m_Logfile,"%s",Text); + fflush(m_Logfile); +} + +void CLogFile::ftextOut(const char *Text, ...) +{ + char buffer[MAX_BUFFER]; + va_list pArgList; + + va_start(pArgList, Text); + vsprintf(buffer, Text, pArgList); + va_end(pArgList); + + textOut(buffer); +} + +void CLogFile::ftextOut(int Color, bool List, const char *Text, ...) +{ + char buffer[MAX_BUFFER]; + va_list pArgList; + + va_start(pArgList, Text); + vsprintf(buffer, Text, pArgList); + va_end(pArgList); + + textOut(Color, List, buffer); +} + +void CLogFile::ftextOut(int Color, const char *Text, ...) +{ + char buffer[MAX_BUFFER]; + va_list pArgList; + + va_start(pArgList, Text); + vsprintf(buffer, Text, pArgList); + va_end(pArgList); + + textOut(Color, buffer); +} + +void CLogFile::FunctionResult (const char *Name,bool Result) +{ + if (Result == true) + { + textOut(""); + textOut(" border='0' bgcolor='C0C0C0'>", Name); + textOut("
    %sOK-/-
    "); + } + else + { + textOut(""); + textOut(" border='0' bgcolor='C0C0C0'>", Name); + textOut("
    %sERROR-/-
    "); + } +} diff --git a/src/CLogFile.h b/src/CLogFile.h new file mode 100644 index 000000000..ae733eb16 --- /dev/null +++ b/src/CLogFile.h @@ -0,0 +1,50 @@ +/* + * CLogFile.h + * + * Created on: 20.04.2009 + * Author: gerstrong + */ + +#ifndef CLOGFILE_H_ +#define CLOGFILE_H_ + +#define REVISION "CloneKeenPlus Beta v0.2.9.0 (Commander Genius)" + +#include +#include "CSingleton.h" +#define g_pLogFile CLogFile::Get() + +#define MAX_BUFFER 1024 + +enum FONTCOLORS +{ + BLACK, + RED, + GREEN, + BLUE, + PURPLE +}; + +class CLogFile : public CSingleton +{ +public: + + CLogFile(); + virtual ~CLogFile(); + + void CreateLogfile (const char *LogName); + void WriteTopic (const char *Topic, int Size); + void textOut (const char *Text); + void textOut (int Color, const char *Text); + void textOut (int Color, bool List, const char *Text); + void ftextOut (const char *Text, ...); + void ftextOut (int Color, const char *Text, ...); + void ftextOut (int Color, bool List, const char *Text, ...); + void FunctionResult (const char *Name, bool Result); + +private: + + FILE *m_Logfile; +}; + +#endif /* CLOGFILE_H_ */ diff --git a/src/CSingleton.h b/src/CSingleton.h new file mode 100644 index 000000000..3dfdbfc5e --- /dev/null +++ b/src/CSingleton.h @@ -0,0 +1,48 @@ +/* + * CSingleton.h + * + * Created on: 19.04.2009 + * Author: gerstrong + */ + +#ifndef CSINGLETON_H_ +#define CSINGLETON_H_ + +#include + +template +class CSingleton { + + +protected: + static T *m_pSingleton; // Static Object + + +public: + //CSingleton(); + virtual ~CSingleton() + { + } + + inline static T* Get() + { + if(!m_pSingleton) + m_pSingleton = new T; + + return (m_pSingleton); + } + + static void Del() + { + if(m_pSingleton) + { + delete (m_pSingleton); + m_pSingleton = NULL; + } + } +}; + +template +T* CSingleton::m_pSingleton = 0; + +#endif /* CSINGLETON_H_ */ diff --git a/src/ai/baby.cpp b/src/ai/baby.cpp new file mode 100644 index 000000000..bbc835d86 --- /dev/null +++ b/src/ai/baby.cpp @@ -0,0 +1,236 @@ +#include "../sdl/sound/CSound.h" + +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// Baby Vorticon (the superfast little blue creatures that knock you down) +// (ep 2 & 3) + +#define BABY_RUN 0 +#define BABY_DYING 1 +#define BABY_DEAD 2 + +#define BABY_WALK_SPEED 15 + +#define BABY_WALK_ANIM_RATE 20 + +#define BABY_WALK_LEFT_FRAME 48 +#define BABY_WALK_RIGHT_FRAME 52 +#define BABY_FRY_FRAME 56 +#define BABY_DEAD_FRAME 57 + +#define BABY_SMALLJUMP_PROB 20 + +#define BABY_FRY_TIME 80 +#define BABY_DIE_INERTIA 20 + +#define BABY_JUMP_BIG 1 +#define BABY_JUMP_SMALL 0 +void baby_jump(int o, int big); + +void baby_ai(int o, stLevelControl levelcontrol) +{ +unsigned int ep3; + + if (objects[o].needinit) + { + objects[o].ai.baby.state = BABY_RUN; + objects[o].ai.baby.dir = RIGHT; + objects[o].ai.baby.walkframe = 0; + objects[o].ai.baby.walktimer = 0; + objects[o].ai.baby.inertia_x = 0; + objects[o].ai.baby.inertia_y = 0; + objects[o].canbezapped = 1; + objects[o].needinit = 0; + objects[o].blockedl = objects[o].blockedr = objects[o].blockedu = objects[o].blockedd = 1; + + if (levelcontrol.episode==3) ep3 = 1; else ep3 = 0; + objects[o].sprite = BABY_WALK_RIGHT_FRAME - ep3; + return; + } + if (objects[o].ai.baby.state==BABY_DEAD) + { + objects[o].inhibitfall = 0; + return; + } + + // need to -1 on the animation frames when in ep3 + if (levelcontrol.episode==3) ep3 = 1; else ep3 = 0; + + /* jumping */ + if (objects[o].ai.baby.inertia_y < 0 || !objects[o].blockedd) + { + if (objects[o].blockedu && objects[o].ai.baby.inertia_y < 0) + { + objects[o].ai.baby.inertia_y = 0; + } + + objects[o].y += objects[o].ai.baby.inertia_y; + + if (objects[o].ai.baby.jumpdectimer >= objects[o].ai.baby.jumpdecrate) + { + if (objects[o].ai.baby.inertia_y < (1< 0 + objects[o].ai.baby.inertia_y = 0; + if (objects[o].ai.baby.state == BABY_RUN) + { + if (rand()%BABY_SMALLJUMP_PROB == (BABY_SMALLJUMP_PROB/2)) + { + baby_jump(o, BABY_JUMP_SMALL); + } + } + } + + + // got hit? + if (objects[o].zapped) + { + if (objects[o].zapped > 1 || !options[OPT_MEAN].value) + { // we're fried!! + if (objects[o].ai.baby.state != BABY_DYING) + { + objects[o].ai.baby.dietimer = 0; + objects[o].ai.baby.state = BABY_DYING; + objects[o].ai.baby.jumpdecrate = 5; + objects[o].sprite = BABY_FRY_FRAME - ep3; + objects[o].zapped = 0; + objects[o].canbezapped = 0; + + if (objects[o].onscreen && !g_pSound->isPlaying(SOUND_VORT_DIE)) + { + g_pSound->playStereofromCoord(SOUND_VORT_DIE, PLAY_NOW, objects[o].scrx); + + } + + if (objects[o].ai.baby.dir == RIGHT) + { + objects[o].ai.baby.inertia_x = BABY_DIE_INERTIA; + } + else + { + objects[o].ai.baby.inertia_x = -BABY_DIE_INERTIA; + } + } + } + } + + // touched player + if (objects[o].touchPlayer && objects[o].ai.baby.state!=BABY_DYING && !player[objects[o].touchedBy].pfrozentime) + { + player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = objects[o].ai.baby.dir; + freezeplayer(objects[o].touchedBy); + } + + switch(objects[o].ai.baby.state) + { + case BABY_DYING: + if ((objects[o].ai.baby.inertia_x < 0 && objects[o].blockedl) ||\ + (objects[o].ai.baby.inertia_x > 0 && objects[o].blockedr)) + { + objects[o].ai.baby.inertia_x = 0; + } + + objects[o].x += objects[o].ai.baby.inertia_x; + if (objects[o].ai.baby.xdectimer >= 10) + { + if (objects[o].ai.baby.inertia_x < 0) + { + objects[o].ai.baby.inertia_x++; + } + else if (objects[o].ai.baby.inertia_x > 0) + { + objects[o].ai.baby.inertia_x--; + } + + if (objects[o].ai.baby.inertia_x == 0 &&\ + objects[o].ai.baby.inertia_y == 0 &&\ + objects[o].sprite==(BABY_DEAD_FRAME-ep3)) + { + objects[o].ai.baby.state = BABY_DEAD; + } + objects[o].ai.baby.xdectimer = 0; + } + else objects[o].ai.baby.xdectimer++; + + if (objects[o].ai.baby.dietimer > BABY_FRY_TIME) + { + objects[o].sprite = BABY_DEAD_FRAME-ep3; + } + else objects[o].ai.baby.dietimer++; + break; + case BABY_RUN: + /* run in appropriate direction */ + if (objects[o].ai.baby.dir==RIGHT) + { // running right + objects[o].sprite = BABY_WALK_RIGHT_FRAME + objects[o].ai.baby.walkframe - ep3; + if (objects[o].blockedr) + { + objects[o].ai.baby.dir = LEFT; + if (rand()&1) baby_jump(o, BABY_JUMP_BIG); + } + else + { + objects[o].x += BABY_WALK_SPEED; + } + } + else + { // running left + objects[o].sprite = BABY_WALK_LEFT_FRAME + objects[o].ai.baby.walkframe - ep3; + if (objects[o].blockedl) + { + objects[o].ai.baby.dir = RIGHT; + if (rand()&1) baby_jump(o, BABY_JUMP_BIG); + } + else + { + objects[o].x -= BABY_WALK_SPEED; + objects[o].inhibitfall = 1; + } + } + + /* run animation */ + if (objects[o].ai.baby.walktimer > BABY_WALK_ANIM_RATE) + { + objects[o].ai.baby.walkframe++; + if (objects[o].ai.baby.walkframe > 3) objects[o].ai.baby.walkframe = 0; + objects[o].ai.baby.walktimer = 0; + } else objects[o].ai.baby.walktimer++; + break; + } +} + +#define BABY_BIGJUMP 25 +#define BABY_BIGJUMP_DEC_RATE 20 + +#define BABY_MIN_SMALLJUMP 23 +#define BABY_SMALLJUMP_MIN_DEC_RATE 18 +#define BABY_MAX_SMALLJUMP 30 +#define BABY_SMALLJUMP_MAX_DEC_RATE 20 +void baby_jump(int o, int big) +{ + if ((rand()&2)==0) big = 1-big; + if (big==BABY_JUMP_BIG) + { + objects[o].ai.baby.inertia_y = -BABY_BIGJUMP; + objects[o].ai.baby.jumpdecrate = BABY_BIGJUMP_DEC_RATE; + } + else + { + objects[o].ai.baby.inertia_y = -20;//(rand()%(BABY_MAX_SMALLJUMP-BABY_MIN_SMALLJUMP))+BABY_MIN_SMALLJUMP; + objects[o].ai.baby.jumpdecrate = 10;//(rand()%(BABY_SMALLJUMP_MAX_DEC_RATE-BABY_SMALLJUMP_MIN_DEC_RATE))+BABY_SMALLJUMP_MIN_DEC_RATE; + } + + + objects[o].ai.baby.jumpdectimer = 0; +} diff --git a/src/ai/balljack.cpp b/src/ai/balljack.cpp new file mode 100644 index 000000000..a038cd144 --- /dev/null +++ b/src/ai/balljack.cpp @@ -0,0 +1,138 @@ +// ai for the ball and the jack in ep3 +#include "../keen.h" + +#include "../include/enemyai.h" + +#include "../include/game.h" + +#define BALL_FRAME 109 +#define JACK_FRAME 110 + +#define BALL_SPEED 15 +#define JACK_SPEED 10 +#define JACK_ANIM_RATE 50 + +#define BALLPUSHAMOUNT 20 + +char BJ_BlockedD(int o); + +void ballandjack_ai(int o, stCloneKeenPlus *pCKP) +{ + if (objects[o].needinit) + { + objects[o].ai.bj.dir = DUPLEFT; + objects[o].ai.bj.animframe = 0; + objects[o].ai.bj.animtimer = 0; + objects[o].blockedl = 0; + objects[o].blockedr = 0; + objects[o].blockedu = 0; + objects[o].blockedd = 0; + objects[o].inhibitfall = 1; + + if (objects[o].type==OBJ_BALL) + { + objects[o].sprite = BALL_FRAME; + objects[o].ai.bj.speed = BALL_SPEED; + } + else + { + objects[o].sprite = JACK_FRAME; + objects[o].ai.bj.speed = JACK_SPEED; + } + objects[o].needinit = 0; + } + + if (objects[o].touchPlayer) + { + if (objects[o].type==OBJ_BALL) + { + if (player[objects[o].touchedBy].x < objects[o].x) + { + player[objects[o].touchedBy].playpushed_x = -BALLPUSHAMOUNT; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + } + else + { + player[objects[o].touchedBy].playpushed_x = BALLPUSHAMOUNT; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + } + } + else killplayer(objects[o].touchedBy, pCKP); + } + + switch(objects[o].ai.bj.dir) + { + case DUPLEFT: + if (objects[o].blockedu) { objects[o].ai.bj.dir = DDOWNLEFT; } + else objects[o].y -= objects[o].ai.bj.speed; + + if (objects[o].blockedl) { objects[o].ai.bj.dir = DUPRIGHT; } + else objects[o].x -= objects[o].ai.bj.speed; + break; + case DUPRIGHT: + if (objects[o].blockedu) { objects[o].ai.bj.dir = DDOWNRIGHT; } + else objects[o].y -= objects[o].ai.bj.speed; + + if (objects[o].blockedr) { objects[o].ai.bj.dir = DUPLEFT; } + else objects[o].x += objects[o].ai.bj.speed; + break; + case DDOWNLEFT: + if (BJ_BlockedD(o)) { objects[o].ai.bj.dir = DUPLEFT; } + else objects[o].y += objects[o].ai.bj.speed; + + if (objects[o].blockedl) { objects[o].ai.bj.dir = DDOWNRIGHT; } + else objects[o].x -= objects[o].ai.bj.speed; + break; + case DDOWNRIGHT: + if (BJ_BlockedD(o)) { objects[o].ai.bj.dir = DUPRIGHT; } + else objects[o].y += objects[o].ai.bj.speed; + + if (objects[o].blockedr) { objects[o].ai.bj.dir = DDOWNLEFT; } + else objects[o].x += objects[o].ai.bj.speed; + break; + } + + if (objects[o].type==OBJ_BALL) + { + objects[o].sprite = BALL_FRAME; + } + else + { + objects[o].sprite = JACK_FRAME + objects[o].ai.bj.animframe; + if (objects[o].ai.bj.animtimer > JACK_ANIM_RATE) + { + objects[o].ai.bj.animframe++; + if (objects[o].ai.bj.animframe>3) objects[o].ai.bj.animframe=0; + objects[o].ai.bj.animtimer = 0; + } + else objects[o].ai.bj.animtimer++; + } +} + +char BJ_BlockedD(int o) +{ + // we do our own blockedd, because we don't want the ball/jack to + // bounce off the top of platforms that have only solidfall set-- + // so we test blockedd against solidl/r instead + + if (objects[o].blockedd) + { + // ensure that the tile common_enemy_ai said we hit also has + // solid l/r set + + if (TileProperty[getmaptileat((objects[o].x>>CSF)+2, (objects[o].y>>CSF)+sprites[objects[o].sprite].ysize)][BLEFT]) + //if (tiles[getmaptileat((objects[o].x>>CSF)+2, (objects[o].y>>CSF)+sprites[objects[o].sprite].ysize)].solidl) + { return 1; } + if (TileProperty[getmaptileat((objects[o].x>>CSF)+(sprites[objects[o].sprite].xsize-2), (objects[o].y>>CSF)+sprites[objects[o].sprite].ysize)][BLEFT]) + //if (tiles[getmaptileat((objects[o].x>>CSF)+(sprites[objects[o].sprite].xsize-2), (objects[o].y>>CSF)+sprites[objects[o].sprite].ysize)].solidl) + { return 1; } + } + + // ensure it's not a ball no-pass point + if (getlevelat((objects[o].x>>CSF)+2, (objects[o].y>>CSF)+sprites[objects[o].sprite].ysize)==BALL_NOPASSPOINT) + { return 1; } + if (getlevelat((objects[o].x>>CSF)+(sprites[objects[o].sprite].xsize-2), (objects[o].y>>CSF)+sprites[objects[o].sprite].ysize)==BALL_NOPASSPOINT) + { return 1; } + + return 0; +} diff --git a/src/ai/bear.cpp b/src/ai/bear.cpp new file mode 100644 index 000000000..4c1f5edd0 --- /dev/null +++ b/src/ai/bear.cpp @@ -0,0 +1,329 @@ +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +#include "../sdl/sound/CSound.h" + +// the "bear" enemies in ep2 +// (I think the actual name for them is Vorticon Elite) +#define BEAR_WALK 0 +#define BEAR_JUMP 1 +#define BEAR_ABOUTTOFIRE 2 +#define BEAR_FIRED 3 +#define BEAR_DYING 4 +#define BEAR_DEAD 5 + +#define BEAR_JUMP_PROB 450 +#define BEAR_FIRE_PROB 400 + +#define BEAR_MIN_TIME_BETWEEN_FIRE 100 +#define BEAR_HOLD_GUN_OUT_TIME 80 +#define BEAR_HOLD_GUN_AFTER_FIRE_TIME 70 + +#define BEAR_MIN_JUMP_HEIGHT 15 +#define BEAR_MAX_JUMP_HEIGHT 25 +#define BEAR_MAX_FALL_SPEED 20 +#define BEAR_JUMP_FRICTION 5 +#define BEAR_JUMP_SPEED 0 + +#define BEAR_WALK_SPEED 5 +#define BEAR_WALK_ANIM_TIME 60 + +// number of shots to kill +#define BEAR_HP 4 + +#define BEAR_DIE_ANIM_TIME 180 + +#define BEAR_LOOK_ANIM_TIME 60 + +#define BEAR_WALK_LEFT_FRAME 88 +#define BEAR_WALK_RIGHT_FRAME 92 +#define BEAR_JUMP_RIGHT_FRAME 98 +#define BEAR_JUMP_LEFT_FRAME 99 +#define BEAR_DYING_FRAME 100 +#define BEAR_DEAD_FRAME 101 +#define BEAR_FIRE_LEFT_FRAME 96 +#define BEAR_FIRE_RIGHT_FRAME 97 + +#define BEAR_PALETTE_FLASH_TIME 5 + +#define BEAR_TRAPPED_DIST 150 + +int bear_walk_speed; + +void bear_initiatejump(int o); + +void bear_ai(int o, stLevelControl levelcontrol, stCloneKeenPlus *pCKP) +{ +int bonk; +int newobject; + + if (objects[o].needinit) + { // first time initilization + objects[o].ai.bear.state = BEAR_WALK; + objects[o].ai.bear.movedir = LEFT; + objects[o].sprite = BEAR_WALK_LEFT_FRAME; + objects[o].ai.bear.frame = 0; + objects[o].ai.bear.animtimer = 0; + objects[o].ai.bear.timer = 0; + objects[o].ai.bear.timesincefire = 0; + objects[o].ai.bear.dist_traveled = BEAR_TRAPPED_DIST+1; + objects[o].ai.bear.running = 0; + objects[o].canbezapped = 1; + objects[o].needinit = 0; + } + if (objects[o].ai.bear.state==BEAR_DEAD) + { + objects[o].hasbeenonscreen = 0; + return; + } + + if (objects[o].canbezapped) + { + // if we touch a glowcell, we die! + if (getmaptileat((objects[o].x>>CSF)+12, (objects[o].y>>CSF)+16)==TILE_GLOWCELL) + { + objects[o].zapped += BEAR_HP; + } + + if (objects[o].zapped >= BEAR_HP) + { + objects[o].inhibitfall = 0; + objects[o].canbezapped = 0; + objects[o].ai.bear.animtimer = 0; + objects[o].ai.bear.frame = 0; + objects[o].ai.bear.state = BEAR_DYING; + if (objects[o].onscreen) g_pSound->playStereofromCoord(SOUND_VORT_DIE, PLAY_NOW, objects[o].scrx); + } + } + // deadly to the touch + if (objects[o].touchPlayer && objects[o].canbezapped) + { + killplayer(objects[o].touchedBy, pCKP); + } + +bear_reprocess: ; + switch(objects[o].ai.bear.state) + { + case BEAR_WALK: + objects[o].ai.bear.dist_traveled++; + + if (rand()%BEAR_JUMP_PROB == (BEAR_JUMP_PROB/2) && !levelcontrol.dark && !objects[o].blockedu) + { // let's jump. + bear_initiatejump(o); + goto bear_reprocess; + } + else + { + if (objects[o].ai.bear.timesincefire > BEAR_MIN_TIME_BETWEEN_FIRE) + { + if (rand()%BEAR_FIRE_PROB == (BEAR_FIRE_PROB/2)) + { // let's fire + // usually shoot toward keen + if (rand()%5 != 0) + { + if (objects[o].x < (objects[player[primaryplayer].useObject].x)) + { + objects[o].ai.bear.movedir = RIGHT; + objects[o].ai.bear.running = 2; + } + else + { + objects[o].ai.bear.movedir = LEFT; + objects[o].ai.bear.running = 2; + } + } + objects[o].ai.bear.timer = 0; + objects[o].ai.bear.state = BEAR_ABOUTTOFIRE; + } + } + else objects[o].ai.bear.timesincefire++; + } + + if (objects[o].ai.bear.movedir==LEFT) + { // move left + objects[o].sprite = BEAR_WALK_LEFT_FRAME + objects[o].ai.bear.frame; + if (!objects[o].blockedl) + { + objects[o].x -= ((BEAR_WALK_SPEED)*(1 + objects[o].ai.bear.running)); + objects[o].ai.bear.running = 0; + } + else + { + objects[o].ai.bear.movedir = RIGHT; + + // if we only traveled a tiny amount before hitting a wall, we've + // probably fallen into a small narrow area, and we need to try + // to jump out of it + if (objects[o].ai.bear.dist_traveled < BEAR_TRAPPED_DIST && !levelcontrol.dark && objects[o].blockedd) + { + bear_initiatejump(o); + goto bear_reprocess; + } + else objects[o].ai.bear.dist_traveled = 0; + } + } + else + { // move right + objects[o].sprite = BEAR_WALK_RIGHT_FRAME + objects[o].ai.bear.frame; + if (!objects[o].blockedr) + { + objects[o].x += ((BEAR_WALK_SPEED)*(1 + objects[o].ai.bear.running)); + objects[o].ai.bear.running = 0; + } + else + { + objects[o].ai.bear.movedir = LEFT; + + // if we only traveled a tiny amount before hitting a wall, we've + // probably fallen into a small narrow area, and we need to try + // to jump out of it + if (objects[o].ai.bear.dist_traveled < BEAR_TRAPPED_DIST && !levelcontrol.dark && objects[o].blockedd) + { + bear_initiatejump(o); + goto bear_reprocess; + } + else objects[o].ai.bear.dist_traveled = 0; + } + } + + // walk animation + if (objects[o].ai.bear.animtimer > BEAR_WALK_ANIM_TIME) + { + if (objects[o].ai.bear.frame>=3) objects[o].ai.bear.frame=0; + else objects[o].ai.bear.frame++; + objects[o].ai.bear.animtimer = 0; + } else objects[o].ai.bear.animtimer++; + break; + case BEAR_JUMP: + if (objects[o].ai.bear.movedir == RIGHT) + { if (!objects[o].blockedr) objects[o].x += ((BEAR_WALK_SPEED)*(1 + objects[o].ai.bear.running)); } + else + { if (!objects[o].blockedl) objects[o].x -= ((BEAR_WALK_SPEED)*(1 + objects[o].ai.bear.running)); } + + if (objects[o].ai.bear.inertiay>0 && objects[o].blockedd) + { // the bear has landed + objects[o].inhibitfall = 0; + objects[o].ai.bear.state = BEAR_WALK; + goto bear_reprocess; + } + // check if the bear has bonked into a ceiling, if so, + // immediately terminate the jump + bonk = 0; + if (TileProperty[getmaptileat((objects[o].x>>CSF)+1, (objects[o].y>>CSF))][BDOWN]) bonk = 1; + else if (TileProperty[getmaptileat((objects[o].x>>CSF)+16, (objects[o].y>>CSF))][BDOWN]) bonk = 1; + else if (TileProperty[getmaptileat((objects[o].x>>CSF)+23, (objects[o].y>>CSF))][BDOWN]) bonk = 1; + + /* + if (tiles[getmaptileat((objects[o].x>>CSF)+1, (objects[o].y>>CSF))].solidceil) bonk = 1; + else if (tiles[getmaptileat((objects[o].x>>CSF)+16, (objects[o].y>>CSF))].solidceil) bonk = 1; + else if (tiles[getmaptileat((objects[o].x>>CSF)+23, (objects[o].y>>CSF))].solidceil) bonk = 1; + */ + if (bonk && objects[o].ai.bear.inertiay < 0) + { + objects[o].ai.bear.inertiay = 0; + } + + // apply Y inertia + objects[o].y += objects[o].ai.bear.inertiay; + + if (objects[o].ai.bear.timer > BEAR_JUMP_FRICTION) + { // slowly decrease upgoing rate + if (objects[o].ai.bear.inertiay BEAR_HOLD_GUN_OUT_TIME) + { + objects[o].ai.bear.timer = 0; + objects[o].ai.bear.state = BEAR_FIRED; + if (objects[o].ai.bear.movedir==RIGHT) + { + newobject = spawn_object(objects[o].x+(sprites[BEAR_FIRE_RIGHT_FRAME].xsize<playStereofromCoord(SOUND_KEEN_FIRE, PLAY_NOW, objects[o].scrx); + } + else objects[o].ai.bear.timer++; + break; + case BEAR_FIRED: + if (objects[o].ai.bear.movedir==RIGHT) + { objects[o].sprite = BEAR_FIRE_RIGHT_FRAME; } + else + { objects[o].sprite = BEAR_FIRE_LEFT_FRAME; } + + if (objects[o].ai.bear.timer > BEAR_HOLD_GUN_AFTER_FIRE_TIME) + { + objects[o].ai.bear.timer = 0; + objects[o].ai.bear.frame = 0; + objects[o].ai.bear.timesincefire = 0; + objects[o].ai.bear.state = BEAR_WALK; + // head toward keen + if (objects[o].x < player[primaryplayer].x) + { + objects[o].ai.bear.movedir = RIGHT; + } + else + { + objects[o].ai.bear.movedir = LEFT; + } + } + else objects[o].ai.bear.timer++; + break; + case BEAR_DYING: + objects[o].sprite = BEAR_DYING_FRAME; + if (objects[o].ai.bear.animtimer > BEAR_DIE_ANIM_TIME) + { + objects[o].sprite = BEAR_DEAD_FRAME; + objects[o].ai.bear.state = BEAR_DEAD; + } + else + { + objects[o].ai.bear.animtimer++; + } + break; + default: break; + } +} + + +void bear_initiatejump(int o) +{ + if (objects[o].ai.bear.state==BEAR_JUMP) return; + + objects[o].ai.bear.frame = 0; + objects[o].ai.bear.animtimer = 0; + objects[o].ai.bear.inertiay = \ + -((rand()%(BEAR_MAX_JUMP_HEIGHT-BEAR_MIN_JUMP_HEIGHT))+BEAR_MIN_JUMP_HEIGHT); + + if (objects[o].ai.bear.movedir==RIGHT) + { + objects[o].sprite = BEAR_JUMP_RIGHT_FRAME; + } + else + { + objects[o].sprite = BEAR_JUMP_LEFT_FRAME; + } + + objects[o].inhibitfall = 1; + objects[o].ai.bear.state = BEAR_JUMP; +} diff --git a/src/ai/butler.cpp b/src/ai/butler.cpp new file mode 100644 index 000000000..9e211da01 --- /dev/null +++ b/src/ai/butler.cpp @@ -0,0 +1,140 @@ +#include "../keen.h" + +#include "../include/game.h" + +#include "../include/enemyai.h" + +#include "../sdl/sound/CSound.h" + +// AI for "butler" robot (ep1) + +#define BUTLER_TURN 0 +#define BUTLER_WALK 1 + +#define BUTLER_WALK_SPEED 7 +#define BUTLER_WALK_SPEED_FAST 11 +#define BUTLER_WALK_ANIM_TIME 35 +#define BUTLER_WALK_ANIM_TIME_FAST 25 +#define BUTLER_TURN_TIME 50 + +#define BUTLERPUSHAMOUNT 22 +#define BUTLERPUSHAMOUNTFAST 15 + +// distance in pixels butler should look ahead to avoid falling +// off an edge +#define BUTLER_LOOK_AHEAD_DIST 1 + +// frames +#define BUTLER_WALK_LEFT_FRAME 92 +#define BUTLER_WALK_RIGHT_FRAME 88 +#define BUTLER_TURNLEFT_FRAME 96 +#define BUTLER_TURNRIGHT_FRAME 97 + +void butler_ai(int o) +{ +char not_about_to_fall; + if (objects[o].needinit) + { + objects[o].ai.butler.state = BUTLER_WALK; + objects[o].ai.butler.movedir = RIGHT; + objects[o].ai.butler.animtimer = 0; + objects[o].canbezapped = 1; // will stop bullets but are not harmed + objects[o].needinit = 0; + objects[o].x -= 16; + } + // push keen + if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie) + { + if(!((player[primaryplayer].pdir == objects[o].ai.butler.movedir) && (player[primaryplayer].pwalking))) + { + g_pSound->playStereofromCoord(SOUND_YORP_BUMP, PLAY_NORESTART, objects[o].scrx); + + short butlerpushamount; + + butlerpushamount = BUTLERPUSHAMOUNT; + + if(player[primaryplayer].pwalking) butlerpushamount = 3*BUTLERPUSHAMOUNT/2; + + if (player[primaryplayer].x < objects[o].x) + { + player[objects[o].touchedBy].playpushed_x = -butlerpushamount; + if (options[OPT_MEAN].value) player[objects[o].touchedBy].playpushed_x -= BUTLERPUSHAMOUNTFAST; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = LEFT; + } + else + { + player[objects[o].touchedBy].playpushed_x = butlerpushamount; + if (options[OPT_MEAN].value) player[objects[o].touchedBy].playpushed_x += BUTLERPUSHAMOUNTFAST; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = RIGHT; + } + } + } + + switch(objects[o].ai.butler.state) + { + case BUTLER_TURN: + if (objects[o].ai.butler.timer > BUTLER_TURN_TIME) + { + objects[o].ai.butler.movedir ^= 1; + objects[o].ai.butler.animtimer = 0; + objects[o].ai.butler.state = BUTLER_WALK; + } else objects[o].ai.butler.timer++; + break; + case BUTLER_WALK: + if (objects[o].ai.butler.movedir==LEFT) + { // move left + + not_about_to_fall = TileProperty[getmaptileat((objects[o].x>>CSF)-BUTLER_LOOK_AHEAD_DIST, (objects[o].y>>CSF)+sprites[BUTLER_WALK_LEFT_FRAME].ysize)][BUP]; + //not_about_to_fall = tiles[getmaptileat((objects[o].x>>CSF)-BUTLER_LOOK_AHEAD_DIST, (objects[o].y>>CSF)+sprites[BUTLER_WALK_LEFT_FRAME].ysize)].solidfall; + objects[o].sprite = BUTLER_WALK_LEFT_FRAME + objects[o].ai.butler.frame; + if (!objects[o].blockedl && not_about_to_fall) + { + if (options[OPT_MEAN].value) + objects[o].x -= BUTLER_WALK_SPEED_FAST; + else + objects[o].x -= BUTLER_WALK_SPEED; + } + else + { + objects[o].sprite = BUTLER_TURNRIGHT_FRAME; + objects[o].ai.butler.frame = 0; + objects[o].ai.butler.timer = 0; + objects[o].ai.butler.animtimer = 0; + objects[o].ai.butler.state = BUTLER_TURN; + } + } + else + { // move right + + not_about_to_fall = TileProperty[getmaptileat((objects[o].x>>CSF)+sprites[BUTLER_WALK_RIGHT_FRAME].xsize+BUTLER_LOOK_AHEAD_DIST, (objects[o].y>>CSF)+sprites[BUTLER_WALK_RIGHT_FRAME].ysize)][BUP]; + //not_about_to_fall = tiles[getmaptileat((objects[o].x>>CSF)+sprites[BUTLER_WALK_RIGHT_FRAME].xsize+BUTLER_LOOK_AHEAD_DIST, (objects[o].y>>CSF)+sprites[BUTLER_WALK_RIGHT_FRAME].ysize)].solidfall; + objects[o].sprite = BUTLER_WALK_RIGHT_FRAME + objects[o].ai.butler.frame; + if (!objects[o].blockedr && not_about_to_fall) + { + if (options[OPT_MEAN].value) + objects[o].x += BUTLER_WALK_SPEED_FAST; + else + objects[o].x += BUTLER_WALK_SPEED; + } + else + { + objects[o].sprite = BUTLER_TURNLEFT_FRAME; + objects[o].ai.butler.frame = 0; + objects[o].ai.butler.timer = 0; + objects[o].ai.butler.animtimer = 0; + objects[o].ai.butler.state = BUTLER_TURN; + } + } + // walk animation + if (objects[o].ai.butler.animtimer > BUTLER_WALK_ANIM_TIME || \ + (objects[o].ai.butler.animtimer > BUTLER_WALK_ANIM_TIME_FAST && options[OPT_MEAN].value)) + { + if (objects[o].ai.butler.frame>=3) objects[o].ai.butler.frame=0; + else objects[o].ai.butler.frame++; + objects[o].ai.butler.animtimer = 0; + } else objects[o].ai.butler.animtimer++; + break; + } +} diff --git a/src/ai/door.cpp b/src/ai/door.cpp new file mode 100644 index 000000000..286cc2da9 --- /dev/null +++ b/src/ai/door.cpp @@ -0,0 +1,33 @@ +#include "../keen.h" + +#include "../include/enemyai.h" + +// "AI" for the door object (to do the animation when a door +// opens, the door tiles are removed and replaced with a sprite +// that looks exactly the old tiles, which then moves down into +// the floor) + +#define DOOR_OPEN_SPEED 10 + +void door_ai(int o) +{ + if (objects[o].needinit) + { + objects[o].ai.door.timer = 0; + objects[o].ai.door.distance_traveled = 0; + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + } + + if (objects[o].ai.door.timer > DOOR_OPEN_SPEED) + { + objects[o].y += (1<31) + { + objects[o].exists = 0; + } + else objects[o].ai.door.distance_traveled++; + objects[o].ai.door.timer = 0; + } else objects[o].ai.door.timer++; +} diff --git a/src/ai/earth.cpp b/src/ai/earth.cpp new file mode 100644 index 000000000..017a49b6d --- /dev/null +++ b/src/ai/earth.cpp @@ -0,0 +1,118 @@ +#include "../keen.h" + +#include "../include/enemyai.h" + +// explosion and earth chunk objects, used for the "earth explodes" +// sequence when you press the switch on a Tantalus Ray in ep2. + +#define EXPLODESPRITE 60 +#define EXPLODE_ANIM_RATE 80 + +#define SPACETILE 155 + +void explosion_ai(int o) +{ + if (objects[o].needinit) + { + objects[o].ai.ray.animframe = 0; + objects[o].ai.ray.animtimer = 0; + objects[o].ai.ray.direction = 1; // frame forward + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + } + + objects[o].sprite = EXPLODESPRITE + objects[o].ai.ray.animframe; + if (objects[o].ai.ray.animtimer > EXPLODE_ANIM_RATE) + { + if (objects[o].ai.ray.direction==-1 && objects[o].ai.ray.animframe==0) + { + objects[o].exists = 0; + } + else + { + objects[o].ai.ray.animframe += objects[o].ai.ray.direction; + if (objects[o].ai.ray.direction==1 && objects[o].ai.ray.animframe==3) + { + objects[o].ai.ray.direction = -1; + map_chgtile(((objects[o].x>>CSF)+8)>>4,((objects[o].y>>CSF)+8)>>4,SPACETILE); + } + } + objects[o].ai.ray.animtimer = 0; + } + else objects[o].ai.ray.animtimer++; +} + +#define EARTHCHUNK_ANIM_RATE 5 + +#define CHUNKSPD 20 +#define HALFCHUNKSPD (CHUNKSPD/2) +#define BIGCHUNKSPD 14 + +void earthchunk_ai(int o) +{ + if (objects[o].needinit) + { + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + } + if (!objects[o].onscreen) objects[o].exists = 0; + + switch(objects[o].ai.ray.direction) + { + case EC_UPLEFTLEFT: + objects[o].x -= CHUNKSPD; + objects[o].y -= HALFCHUNKSPD; + break; + case EC_UPUPLEFT: + objects[o].x -= HALFCHUNKSPD; + objects[o].y -= CHUNKSPD; + break; + case EC_UP: + objects[o].y -= CHUNKSPD; + break; + case EC_UPUPRIGHT: + objects[o].x += HALFCHUNKSPD; + objects[o].y -= CHUNKSPD; + break; + case EC_UPRIGHTRIGHT: + objects[o].x += CHUNKSPD; + objects[o].y -= HALFCHUNKSPD; + break; + case EC_DOWNRIGHTRIGHT: + objects[o].x += CHUNKSPD; + objects[o].y += HALFCHUNKSPD; + break; + case EC_DOWNDOWNRIGHT: + objects[o].x += HALFCHUNKSPD; + objects[o].y += CHUNKSPD; + break; + case EC_DOWN: + objects[o].y += CHUNKSPD; + break; + case EC_DOWNDOWNLEFT: + objects[o].x -= HALFCHUNKSPD; + objects[o].y += CHUNKSPD; + break; + case EC_DOWNLEFTLEFT: + objects[o].x -= CHUNKSPD; + objects[o].y += HALFCHUNKSPD; + break; + + case EC_UPLEFT: + objects[o].x -= BIGCHUNKSPD; + objects[o].y -= BIGCHUNKSPD; + break; + case EC_UPRIGHT: + objects[o].x += BIGCHUNKSPD; + objects[o].y -= BIGCHUNKSPD; + break; + case EC_DOWNLEFT: + objects[o].x -= BIGCHUNKSPD; + objects[o].y += BIGCHUNKSPD; + break; + case EC_DOWNRIGHT: + objects[o].x += BIGCHUNKSPD; + objects[o].y += BIGCHUNKSPD; + break; + } +} diff --git a/src/ai/fireball.cpp b/src/ai/fireball.cpp new file mode 100644 index 000000000..111958f32 --- /dev/null +++ b/src/ai/fireball.cpp @@ -0,0 +1,125 @@ +#include "../keen.h" +#include "ray.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +#include "../sdl/sound/CSound.h" + +// fireball projectile shot out by Vorticon Mother (Ep3) + +#define FIREBALL_SPEED 5 + +#define FIREBALL_ANIM_RATE 80 + +#define FIREBALL_LEFT_FRAME 57 +#define FIREBALL_RIGHT_FRAME 59 + +#define FIREBALL_OFFSCREEN_KILL_TIME 100 + +void fireball_ai(int o, stCloneKeenPlus *pCKP) +{ + int i; + if (objects[o].needinit) + { + objects[o].ai.ray.animframe = 0; + objects[o].ai.ray.animtimer = 0; + objects[o].inhibitfall = 1; + objects[o].blockedl = objects[o].blockedr = 0; + objects[o].canbezapped = 1; + objects[o].needinit = 0; + } + + // test if it hit a baddie + for(i=1;iplayStereofromCoord(SOUND_SHOT_HIT, PLAY_NOW, objects[o].scrx); + objects[o].type = OBJ_RAY; + objects[o].ai.ray.state = RAY_STATE_SETZAPZOT; + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + return; + } + + // destroy the sound wave if it's been offscreen for a good amount + // of time. this is to prevent a massive buildup of soundwaves + // slowly traveling through walls all the way across the level + // (which can crash the game due to running out of object slots). + if (!objects[o].onscreen) + { + if (objects[o].ai.ray.offscreentime > FIREBALL_OFFSCREEN_KILL_TIME) + { + objects[o].exists = 0; + return; + } + else objects[o].ai.ray.offscreentime++; + } + else objects[o].ai.ray.offscreentime = 0; + + // fly through the air + if (objects[o].ai.ray.direction == RIGHT) + { + objects[o].sprite = FIREBALL_RIGHT_FRAME + objects[o].ai.ray.animframe; + if (objects[o].blockedr || objects[o].blockedl) + { + objects[o].type = OBJ_RAY; + objects[o].ai.ray.state = RAY_STATE_SETZAPZOT; + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + return; + } + else objects[o].x += FIREBALL_SPEED; + } + else + { + objects[o].sprite = FIREBALL_LEFT_FRAME + objects[o].ai.ray.animframe; + if (objects[o].blockedr || objects[o].blockedl) + { + objects[o].type = OBJ_RAY; + objects[o].ai.ray.state = RAY_STATE_SETZAPZOT; + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + return; + } + else objects[o].x -= FIREBALL_SPEED; + } + + // animation + if (objects[o].ai.ray.animtimer > FIREBALL_ANIM_RATE) + { + objects[o].ai.ray.animframe ^= 1; + objects[o].ai.ray.animtimer = 0; + } + else objects[o].ai.ray.animtimer++; +} + diff --git a/src/ai/foob.cpp b/src/ai/foob.cpp new file mode 100644 index 000000000..9f0d3d07c --- /dev/null +++ b/src/ai/foob.cpp @@ -0,0 +1,207 @@ +#include "../sdl/sound/CSound.h" +#include "../keen.h" +#include "../include/game.h" + +// AI for the foobs (yellow "scaredy cat" creatures) (ep3) +#define FOOB_WALK 0 +#define FOOB_SPOOK 1 +#define FOOB_FLEE 2 +#define FOOB_EXPLODE 3 +#define FOOB_DEAD 4 + +#define FOOB_WALK_SPEED 2 +#define FOOB_WALK_ANIM_RATE 80 + +#define FOOB_FLEE_SPEED 20 +#define FOOB_FLEE_ANIM_RATE 16 + +#define FOOB_SPOOK_SHOW_TIME 50 + +#define FOOB_EXPLODE_ANIM_RATE 35 + +#define FOOB_SPOOK_TIME 150 +#define FOOB_RELAX_TIME 800 + +#define FOOB_WALK_LEFT_FRAME 93 +#define FOOB_WALK_RIGHT_FRAME 95 +#define FOOB_SPOOK_FRAME 97 +#define FOOB_EXPLODE_FRAME 97 +#define FOOB_DEAD_FRAME 101 + +void foob_ai(int o, stCloneKeenPlus *pCKP) +{ +int onsamelevel; +unsigned int i; + if (objects[o].needinit) + { + objects[o].ai.foob.state = FOOB_WALK; + objects[o].ai.foob.dir = RIGHT; + objects[o].ai.foob.animframe = 0; + objects[o].ai.foob.animtimer = 0; + objects[o].ai.foob.OnSameLevelTime = 0; + objects[o].blockedr = 0; + objects[o].canbezapped = 1; + objects[o].needinit = 0; + } + if (objects[o].ai.foob.state==FOOB_DEAD) return; + + if (objects[o].zapped || objects[o].touchPlayer) + { + if (objects[o].ai.foob.state != FOOB_EXPLODE) + { + objects[o].ai.foob.animframe = 0; + objects[o].ai.foob.animtimer = 0; + objects[o].ai.foob.state = FOOB_EXPLODE; + objects[o].canbezapped = 0; + if (objects[o].onscreen) g_pSound->playStereofromCoord(SOUND_YORP_DIE, PLAY_NOW, objects[o].scrx); + if (options[OPT_MEAN].value && objects[o].touchPlayer) + { + killplayer(objects[o].touchedBy, pCKP); + } + } + } + + // find out if a player is on the same level as the foob cat + onsamelevel = 0; + for(i=0;i= objects[o].y-(24<>CSF)+sprites[0].ysize <= (objects[o].y>>CSF)+sprites[objects[o].sprite].ysize+24)) + { + onsamelevel = 1; + objects[o].ai.foob.SpookedByWho = i; + break; + } + } + } + + switch(objects[o].ai.foob.state) + { + case FOOB_WALK: + // if player is on the same level for FOOB_SPOOK_TIME, run away + if (onsamelevel) + { + if (objects[o].ai.foob.OnSameLevelTime > FOOB_SPOOK_TIME) + { + objects[o].ai.foob.state = FOOB_SPOOK; + objects[o].ai.foob.spooktimer = 0; + if (objects[o].onscreen) g_pSound->playStereofromCoord(SOUND_YORP_DIE, PLAY_NOW, objects[o].scrx); + } + else objects[o].ai.foob.OnSameLevelTime++; + } + else objects[o].ai.foob.OnSameLevelTime = 0; + + if (objects[o].ai.foob.dir == RIGHT) + { // walking right + objects[o].sprite = FOOB_WALK_RIGHT_FRAME + objects[o].ai.foob.animframe; + if (objects[o].blockedr) + { + objects[o].ai.foob.dir = LEFT; + } + else + { + objects[o].x += FOOB_WALK_SPEED; + } + } + else + { // walking left + objects[o].sprite = FOOB_WALK_LEFT_FRAME + objects[o].ai.foob.animframe; + if (objects[o].blockedl) + { + objects[o].ai.foob.dir = RIGHT; + } + else + { + objects[o].x -= FOOB_WALK_SPEED; + } + } + + /* walk animation */ + if (objects[o].ai.foob.animtimer > FOOB_WALK_ANIM_RATE) + { + objects[o].ai.foob.animframe ^= 1; + objects[o].ai.foob.animtimer = 0; + } + else objects[o].ai.foob.animtimer++; + break; + + case FOOB_SPOOK: + objects[o].sprite = FOOB_SPOOK_FRAME; + + if (objects[o].ai.foob.spooktimer > FOOB_SPOOK_SHOW_TIME) + { + objects[o].ai.foob.state = FOOB_FLEE; + objects[o].ai.foob.OffOfSameLevelTime = 0; + // run away from the offending player + if (player[objects[o].ai.foob.SpookedByWho].x < objects[o].x) + { + objects[o].ai.foob.dir = RIGHT; + } + else + { + objects[o].ai.foob.dir = LEFT; + } + } + else objects[o].ai.foob.spooktimer++; + break; + + case FOOB_FLEE: + // if player is off of the same level for FOOB_RELAX_TIME, + // we can stop fleeing + if (!onsamelevel) + { + if (objects[o].ai.foob.OffOfSameLevelTime > FOOB_RELAX_TIME) + { + objects[o].ai.foob.state = FOOB_WALK; + objects[o].ai.foob.OnSameLevelTime = 0; + } + else objects[o].ai.foob.OffOfSameLevelTime++; + } + else objects[o].ai.foob.OffOfSameLevelTime = 0; + + if (objects[o].ai.foob.dir == RIGHT) + { // walking right + objects[o].sprite = FOOB_WALK_RIGHT_FRAME + objects[o].ai.foob.animframe; + if (!objects[o].blockedr) + { + objects[o].x += FOOB_FLEE_SPEED; + } + } + else + { // walking left + objects[o].sprite = FOOB_WALK_LEFT_FRAME + objects[o].ai.foob.animframe; + if (!objects[o].blockedl) + { + objects[o].x -= FOOB_FLEE_SPEED; + } + } + + /* walk animation */ + if (objects[o].ai.foob.animtimer > FOOB_FLEE_ANIM_RATE) + { + objects[o].ai.foob.animframe ^= 1; + objects[o].ai.foob.animtimer = 0; + } + else objects[o].ai.foob.animtimer++; + break; + + case FOOB_EXPLODE: + // ahhhhh; I'm sorry.....you poor little thing...... + objects[o].sprite = FOOB_EXPLODE_FRAME + objects[o].ai.foob.animframe; + if (objects[o].sprite==FOOB_DEAD_FRAME) + { + objects[o].ai.foob.state = FOOB_DEAD; + } + else + { + if (objects[o].ai.foob.animtimer > FOOB_EXPLODE_ANIM_RATE) + { + objects[o].ai.foob.animframe++; + objects[o].ai.foob.animtimer = 0; + } + else objects[o].ai.foob.animtimer++; + } + break; + } +} diff --git a/src/ai/garg.cpp b/src/ai/garg.cpp new file mode 100644 index 000000000..a2a028230 --- /dev/null +++ b/src/ai/garg.cpp @@ -0,0 +1,316 @@ +#include "../sdl/sound/CSound.h" + +#include "../keen.h" +#include "../include/game.h" + +#define GARG_LOOK 0 +#define GARG_MOVE 1 +#define GARG_CHARGE 2 +#define GARG_DYING 3 +#define GARG_DEAD 4 + +#define GARG_MINTRAVELDIST 1000 +#define GARG_LOOK_PROB 800 +#define GARG_WALK_SPEED 2 +#define GARG_WALK_ANIM_TIME 50 +#define GARG_WALK_SPEED_FAST 5 + + +#define GARG_WALK_ANIM_TIME_FAST 30 +#define GARG_CHARGE_SPEED 14 +#define GARG_CHARGE_ANIM_TIME 30 + +#define GARG_LOOK_TIME 70 +#define GARG_NUM_LOOKS 3 + +// amount of time keen must be on same level before garg will charge +#define GARG_SAME_LEVEL_TIME 200 + +#define GARG_STAND 60 +#define GARG_WALK_RIGHT 64 +#define GARG_WALK_LEFT 66 +#define GARG_DYING_FRAME 68 +#define GARG_DEAD_FRAME 69 + +#define GARGDIE_START_INERTIA -10 +#define GARGDIE_INERTIA_DECREASE 2 + +char garg_CanWalkLeft(int o); +char garg_CanWalkRight(int o); + +void garg_ai(int o, stCloneKeenPlus *pCKP) +{ +unsigned int i; + + if (objects[o].needinit) + { // first time initilization + objects[o].ai.garg.state = GARG_LOOK; + objects[o].ai.garg.looktimes = GARG_NUM_LOOKS+1; + objects[o].ai.garg.timer = 0; + objects[o].ai.garg.lookframe = 0; + objects[o].ai.garg.keenonsameleveltimer = 0; + objects[o].ai.garg.about_to_charge = 0; + objects[o].ai.garg.detectedPlayer = 0; + objects[o].ai.garg.detectedPlayerIndex = primaryplayer; + objects[o].canbezapped = 1; + objects[o].needinit = 0; + } + if (objects[o].ai.garg.state==GARG_DEAD) return; + + // kill player on touch + if (objects[o].ai.garg.state!=GARG_DYING && objects[o].touchPlayer) + { + killplayer(objects[o].touchedBy, pCKP); + } + + // did the garg get shot? + if (objects[o].zapped) + { + // die, you stupid garg, die! + objects[o].ai.garg.state = GARG_DYING; + objects[o].ai.garg.dietimer = 0; + objects[o].canbezapped = 0; + objects[o].sprite = GARG_DYING_FRAME; + objects[o].zapped--; + objects[o].ai.garg.gargdie_inertia_y = GARGDIE_START_INERTIA; + objects[o].y -= 10; + objects[o].inhibitfall = 1; + g_pSound->playStereofromCoord(SOUND_GARG_DIE, PLAY_NOW, objects[o].scrx); + } + + switch(objects[o].ai.garg.state) + { + case GARG_DYING: + objects[o].y += objects[o].ai.garg.gargdie_inertia_y; + if (objects[o].ai.garg.dietimer>GARGDIE_INERTIA_DECREASE) + { + objects[o].ai.garg.gargdie_inertia_y++; + objects[o].ai.garg.dietimer = 0; + } + else objects[o].ai.garg.dietimer++; + if (objects[o].ai.garg.gargdie_inertia_y >= 0 && objects[o].blockedd) + { + objects[o].sprite = GARG_DEAD_FRAME; + objects[o].ai.garg.state = GARG_DEAD; + } + break; + case GARG_LOOK: + if (objects[o].ai.garg.looktimes>GARG_NUM_LOOKS) + { + // try to head towards Keen... + if (player[objects[o].ai.garg.detectedPlayerIndex].x < objects[o].x) + { + objects[o].ai.garg.movedir = LEFT; + } + else + { + objects[o].ai.garg.movedir = RIGHT; + } + + if (!objects[o].ai.garg.about_to_charge && rand()%3==1) + { // 25% prob, go the other way (but always charge towards player) + objects[o].ai.garg.movedir ^= 1; + } + // however if we're blocked on one side we must go the other way + if (!garg_CanWalkLeft(o)) objects[o].ai.garg.movedir = RIGHT; + else if (!garg_CanWalkRight(o)) objects[o].ai.garg.movedir = LEFT; + + objects[o].ai.garg.timer = 0; + objects[o].ai.garg.walkframe = 0; + objects[o].ai.garg.dist_traveled = 0; + if (objects[o].ai.garg.about_to_charge) + { + objects[o].ai.garg.state = GARG_CHARGE; + objects[o].ai.garg.about_to_charge = 0; + } + else objects[o].ai.garg.state = GARG_MOVE; + } + + /* look animation */ + if (!objects[o].ai.garg.timer) + { + objects[o].sprite = GARG_STAND + objects[o].ai.garg.lookframe; + objects[o].ai.garg.looktimes++; + + if (++objects[o].ai.garg.lookframe>3) + { + objects[o].ai.garg.lookframe=0; + } + objects[o].ai.garg.timer = GARG_LOOK_TIME; + } else objects[o].ai.garg.timer--; + break; + case GARG_MOVE: + // is keen on same level? + objects[o].ai.garg.detectedPlayer = 0; + for(i=0;i= objects[o].y-(8<>CSF)+sprites[0].ysize <= (objects[o].y>>CSF)+sprites[objects[o].sprite].ysize+16) + { + objects[o].ai.garg.detectedPlayer = 1; + objects[o].ai.garg.detectedPlayerIndex = i; + break; + } + } + } + + if (objects[o].ai.garg.detectedPlayer) + { + objects[o].ai.garg.keenonsameleveltimer++; + if (objects[o].ai.garg.keenonsameleveltimer > GARG_SAME_LEVEL_TIME) + { // charge!! + objects[o].ai.garg.keenonsameleveltimer = 0; + objects[o].ai.garg.timer = 0; + objects[o].ai.garg.looktimes = 1; + objects[o].ai.garg.about_to_charge = 1; + objects[o].ai.garg.state = GARG_LOOK; + } + } else objects[o].ai.garg.keenonsameleveltimer = 0; + + // every now and then go back to look state + if (objects[o].ai.garg.dist_traveled > GARG_MINTRAVELDIST) + { + if (rand()%GARG_LOOK_PROB==(GARG_LOOK_PROB/2)) + { + objects[o].ai.garg.looktimes = 0; + objects[o].ai.garg.timer = 0; + objects[o].ai.garg.state = GARG_LOOK; + break; + } + } + + if (objects[o].ai.garg.movedir==LEFT) + { // garg is walking left + objects[o].sprite = GARG_WALK_LEFT + objects[o].ai.garg.walkframe; + + // do not go left if: + // * we are blockedl, or + // * there is empty space for two tiles ahead at floor level, + // and there is not a solid block 1-2 tiles ahead at wall level +/* not_about_to_fall1 = tiles[getmaptileat((objects[o].x>>CSF)-1, (objects[o].y>>CSF)+sprites[GARG_WALK_LEFT].ysize+2)].solidfall; + not_about_to_fall2 = tiles[getmaptileat((objects[o].x>>CSF)-17, (objects[o].y>>CSF)+sprites[GARG_WALK_LEFT].ysize+2)].solidfall; + GotoLook = 0; + if (objects[o].blockedl) GotoLook = 1; + else if (!(not_about_to_fall1 || not_about_to_fall2)) + { + blocked_ahead1 = tiles[getmaptileat((objects[o].x>>CSF)-16, (objects[o].y>>CSF)+20)].solidr; + blocked_ahead2 = tiles[getmaptileat((objects[o].x>>CSF)-28, (objects[o].y>>CSF)+20)].solidr; + if (!blocked_ahead1 && !blocked_ahead2) + { + GotoLook = 1; + } + } + */ + + if (garg_CanWalkLeft(o)) + { + if (options[OPT_MEAN].value) + objects[o].x -= GARG_WALK_SPEED_FAST; + else + objects[o].x -= GARG_WALK_SPEED; + objects[o].ai.garg.dist_traveled++; + } + else + { + objects[o].ai.garg.looktimes = 0; + objects[o].ai.garg.timer = 0; + objects[o].ai.garg.state = GARG_LOOK; + } + } + else + { // garg is walking right + objects[o].sprite = GARG_WALK_RIGHT + objects[o].ai.garg.walkframe; + if (garg_CanWalkRight(o)) + { + if (options[OPT_MEAN].value) + objects[o].x += GARG_WALK_SPEED_FAST; + else + objects[o].x += GARG_WALK_SPEED; + objects[o].ai.garg.dist_traveled++; + } + else + { + objects[o].ai.garg.looktimes = 0; + objects[o].ai.garg.timer = 0; + objects[o].ai.garg.state = GARG_LOOK; + } + } + + /* walk animation */ + if (objects[o].ai.garg.timer > GARG_WALK_ANIM_TIME || \ + (objects[o].ai.garg.timer > GARG_WALK_ANIM_TIME && options[OPT_MEAN].value)) + { + objects[o].ai.garg.walkframe ^= 1; + objects[o].ai.garg.timer = 0; + } else objects[o].ai.garg.timer++; + break; + case GARG_CHARGE: + + if (objects[o].ai.garg.movedir==LEFT) + { // garg is charging left + objects[o].sprite = GARG_WALK_LEFT + objects[o].ai.garg.walkframe; + if (garg_CanWalkLeft(o)) + { + objects[o].x -= GARG_CHARGE_SPEED; + objects[o].ai.garg.dist_traveled++; + } + else + { + objects[o].ai.garg.looktimes = 0; + objects[o].ai.garg.timer = 0; + objects[o].ai.garg.state = GARG_LOOK; + } + } + else + { // garg is charging right + objects[o].sprite = GARG_WALK_RIGHT + objects[o].ai.garg.walkframe; + if (garg_CanWalkRight(o)) + { + objects[o].x += GARG_CHARGE_SPEED; + objects[o].ai.garg.dist_traveled++; + } + else + { + objects[o].ai.garg.looktimes = 0; + objects[o].ai.garg.timer = 0; + objects[o].ai.garg.state = GARG_LOOK; + } + } + + // walk animation + if (objects[o].ai.garg.timer > GARG_CHARGE_ANIM_TIME) + { + objects[o].ai.garg.walkframe ^= 1; + objects[o].ai.garg.timer = 0; + } else objects[o].ai.garg.timer++; + break; + } +} + +// determines if the garg can walk left +// gargs will not pass a object marker of GARG_STOPPOINT +char garg_CanWalkLeft(int o) +{ +int objtile; + + if (objects[o].blockedl) return 0; + + objtile = map.objectlayer[((objects[o].x>>CSF)-1)>>4][((objects[o].y>>CSF)+2)>>4]; + if (objtile == GARG_STOPPOINT) return 0; + + return 1; +} + +// determines if the garg can walk right +char garg_CanWalkRight(int o) +{ +int objtile; + + if (objects[o].blockedr) return 0; + + objtile = map.objectlayer[((objects[o].x>>CSF)+sprites[GARG_WALK_RIGHT].xsize+1)>>4][((objects[o].y>>CSF)+2)>>4]; + if (objtile == GARG_STOPPOINT) return 0; + + return 1; +} diff --git a/src/ai/icebit.cpp b/src/ai/icebit.cpp new file mode 100644 index 000000000..5e48a2afb --- /dev/null +++ b/src/ai/icebit.cpp @@ -0,0 +1,39 @@ +#include "../keen.h" + +#include "../include/enemyai.h" + +// the little pieces that break off of an OBJ_ICECHUNK when it hits +// a wall or a player. (Ep1) + +#define ICEBIT_SPEED 20 + +void icebit_ai(int o) +{ + if (objects[o].needinit) + { // first time initilization + objects[o].inhibitfall = 1; + objects[o].canbezapped = 0; + objects[o].needinit = 0; + } + + switch(objects[o].ai.icechunk.movedir) + { + case DUPRIGHT: + objects[o].x += ICEBIT_SPEED; + objects[o].y -= ICEBIT_SPEED; + break; + case DUPLEFT: + objects[o].x -= ICEBIT_SPEED; + objects[o].y -= ICEBIT_SPEED; + break; + case DDOWNRIGHT: + objects[o].x += ICEBIT_SPEED; + objects[o].y += ICEBIT_SPEED; + break; + case DDOWNLEFT: + objects[o].x -= ICEBIT_SPEED; + objects[o].y += ICEBIT_SPEED; + break; + break; + } +} diff --git a/src/ai/icechunk.cpp b/src/ai/icechunk.cpp new file mode 100644 index 000000000..ee82d7b6a --- /dev/null +++ b/src/ai/icechunk.cpp @@ -0,0 +1,102 @@ +#include "../sdl/sound/CSound.h" + +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// the chunks of ice shot out by an ice cannon (ep1) + +#define ICECHUNK_FLY 0 + +#define ICECHUNK_SPEED 15 +#define ICECHUNK_WAIT_TIME 150 + +void icechunk_ai(int o) +{ +int newobject,blockedlr; + if (objects[o].needinit) + { // first time initilization + objects[o].ai.icechunk.state = ICECHUNK_FLY; + objects[o].ai.icechunk.timer = 0; + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + objects[o].canbezapped = 0; + } + + if (objects[o].touchPlayer && objects[o].ai.icechunk.state==ICECHUNK_FLY &&\ + !player[objects[o].touchedBy].pfrozentime) + { + switch(objects[o].ai.icechunk.movedir) + { + case DUPRIGHT: + case DDOWNRIGHT: + player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = RIGHT; + player[objects[o].touchedBy].pinertia_x = PMAXSPEED; + break; + case DUPLEFT: + case DDOWNLEFT: + player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = LEFT; + player[objects[o].touchedBy].pinertia_x = -PMAXSPEED; + break; + } + freezeplayer(objects[o].touchedBy); + goto smash; + } + + switch(objects[o].ai.icechunk.state) + { + case ICECHUNK_FLY: + blockedlr = 0; + if (objects[o].ai.icechunk.movedir==DUPRIGHT || objects[o].ai.icechunk.movedir==DDOWNRIGHT) + { + if (objects[o].blockedr) blockedlr = 1; + } + if (objects[o].ai.icechunk.movedir==DUPLEFT || objects[o].ai.icechunk.movedir==DDOWNLEFT) + { + if (objects[o].blockedl) blockedlr = 1; + } + + if (blockedlr) + { + smash: ; + if (objects[o].onscreen) + { + g_pSound->playStereofromCoord(SOUND_CHUNKSMASH, PLAY_NOW, objects[o].scrx); + newobject = spawn_object(objects[o].x, objects[o].y, OBJ_ICEBIT); + objects[newobject].ai.icechunk.movedir = DUPLEFT; + newobject = spawn_object(objects[o].x, objects[o].y, OBJ_ICEBIT); + objects[newobject].ai.icechunk.movedir = DUPRIGHT; + newobject = spawn_object(objects[o].x, objects[o].y, OBJ_ICEBIT); + objects[newobject].ai.icechunk.movedir = DDOWNLEFT; + newobject = spawn_object(objects[o].x, objects[o].y, OBJ_ICEBIT); + objects[newobject].ai.icechunk.movedir = DDOWNRIGHT; + } + + objects[o].exists = 0; + return; + } + + switch(objects[o].ai.icechunk.movedir) + { + case DUPRIGHT: + objects[o].x += ICECHUNK_SPEED; + objects[o].y -= ICECHUNK_SPEED; + break; + case DUPLEFT: + objects[o].x -= ICECHUNK_SPEED; + objects[o].y -= ICECHUNK_SPEED; + break; + case DDOWNLEFT: + objects[o].x -= ICECHUNK_SPEED; + objects[o].y += ICECHUNK_SPEED; + break; + case DDOWNRIGHT: + objects[o].x += ICECHUNK_SPEED; + objects[o].y += ICECHUNK_SPEED; + break; + break; + } + break; + } +} diff --git a/src/ai/meep.cpp b/src/ai/meep.cpp new file mode 100644 index 000000000..015632bbe --- /dev/null +++ b/src/ai/meep.cpp @@ -0,0 +1,179 @@ +#include "../sdl/sound/CSound.h" + +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +#define MEEP_WALK 0 +#define MEEP_SING 1 +#define MEEP_DYING 2 +#define MEEP_DEAD 3 + +#define MEEP_WALK_ANIM_RATE 80 +#define MEEP_WALK_SPD 2 + +#define MEEP_SING_PROB 500 +#define MEEP_SING_SHOW_TIME 100 + +#define MEEP_DYING_SHOW_TIME 100 + +#define MEEP_WALK_RIGHT_FRAME 118 +#define MEEP_WALK_LEFT_FRAME 120 +#define MEEP_SING_RIGHT_FRAME 122 +#define MEEP_SING_LEFT_FRAME 123 +#define MEEP_DYING_FRAME 124 +#define MEEP_DEAD_FRAME 125 + +#define SNDWAVE_LEFT_FRAME 128 + +void meep_ai(int o, stLevelControl levelcontrol) +{ +int newobject; +int not_about_to_fall; + if (objects[o].needinit) + { + objects[o].ai.meep.state = MEEP_WALK; + objects[o].ai.meep.animframe = 0; + objects[o].ai.meep.animtimer = 0; + + if (player[primaryplayer].x > objects[o].x) + objects[o].ai.meep.dir = RIGHT; + else + objects[o].ai.meep.dir = LEFT; + + objects[o].blockedr = objects[o].blockedl = 0; + objects[o].canbezapped = 1; + objects[o].needinit = 0; + } + if (objects[o].ai.meep.state==MEEP_DEAD) return; + + if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie) + { + /* don't push the player as he's walking through the exit door */ + if (!levelcontrol.level_done || levelcontrol.level_finished_by != objects[o].touchedBy) + { + if (player[objects[o].touchedBy].x < objects[o].x) + { + player[objects[o].touchedBy].playpushed_x = -MEEP_WALK_SPD; + if (player[objects[o].touchedBy].pinertia_x > 0) player[objects[o].touchedBy].pinertia_x = 0; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + } + else + { + player[objects[o].touchedBy].playpushed_x = MEEP_WALK_SPD; + if (player[objects[o].touchedBy].pinertia_x < 0) player[objects[o].touchedBy].pinertia_x = 0; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + } + } + } + + if (objects[o].zapped) + { + objects[o].zapped = 0; + objects[o].canbezapped = 0; + objects[o].ai.meep.timer = 0; + objects[o].ai.meep.state = MEEP_DYING; + g_pSound->playStereofromCoord(SOUND_SHOT_HIT, PLAY_NOW, objects[o].scrx); + } + + switch(objects[o].ai.meep.state) + { + case MEEP_WALK: + if (rand()%MEEP_SING_PROB==(MEEP_SING_PROB/2)) + { + if (objects[o].onscreen) + { + objects[o].ai.meep.state = MEEP_SING; + objects[o].ai.meep.timer = 0; + } + else + { + // try to get onscreen by heading towards the player + if (player[primaryplayer].x > objects[o].x) + objects[o].ai.meep.dir = RIGHT; + else + objects[o].ai.meep.dir = LEFT; + } + } + + if (objects[o].ai.meep.dir==RIGHT) + { + objects[o].sprite = MEEP_WALK_RIGHT_FRAME + objects[o].ai.meep.animframe; + + not_about_to_fall = TileProperty[getmaptileat((objects[o].x>>CSF)+sprites[MEEP_WALK_RIGHT_FRAME].xsize, (objects[o].y>>CSF)+sprites[MEEP_WALK_RIGHT_FRAME].ysize)][BUP]; + //not_about_to_fall = tiles[getmaptileat((objects[o].x>>CSF)+sprites[MEEP_WALK_RIGHT_FRAME].xsize, (objects[o].y>>CSF)+sprites[MEEP_WALK_RIGHT_FRAME].ysize)].solidfall; + + if (objects[o].blockedr || !not_about_to_fall) + { + objects[o].ai.meep.dir = LEFT; + } + else + { + objects[o].x += MEEP_WALK_SPD; + } + } + else + { + objects[o].sprite = MEEP_WALK_LEFT_FRAME + objects[o].ai.meep.animframe; + //not_about_to_fall = tiles[getmaptileat((objects[o].x>>CSF)-1, (objects[o].y>>CSF)+sprites[MEEP_WALK_RIGHT_FRAME].ysize)].solidfall; + not_about_to_fall = TileProperty[getmaptileat((objects[o].x>>CSF)-1, (objects[o].y>>CSF)+sprites[MEEP_WALK_RIGHT_FRAME].ysize)][BUP]; + + if (objects[o].blockedl || !not_about_to_fall) + { + objects[o].ai.meep.dir = RIGHT; + } + else + { + objects[o].x -= MEEP_WALK_SPD; + } + } + + /* walk animation */ + if (objects[o].ai.meep.animtimer > MEEP_WALK_ANIM_RATE) + { + objects[o].ai.meep.animframe ^= 1; + objects[o].ai.meep.animtimer = 0; + } + else objects[o].ai.meep.animtimer++; + + break; + case MEEP_SING: + if (objects[o].ai.meep.dir==RIGHT) + { + objects[o].sprite = MEEP_SING_RIGHT_FRAME; + } + else + { + objects[o].sprite = MEEP_SING_LEFT_FRAME; + } + + if (objects[o].ai.meep.timer > MEEP_SING_SHOW_TIME) + { + if (objects[o].ai.meep.dir==RIGHT) + { + newobject = spawn_object(objects[o].x+(sprites[MEEP_SING_RIGHT_FRAME].xsize<playStereofromCoord(SOUND_MEEP, PLAY_NOW, objects[o].scrx); + objects[o].ai.meep.state = MEEP_WALK; + } + else objects[o].ai.meep.timer++; + break; + case MEEP_DYING: + objects[o].sprite = MEEP_DYING_FRAME; + if (objects[o].ai.meep.timer > MEEP_DYING_SHOW_TIME) + { + objects[o].sprite = MEEP_DEAD_FRAME; + objects[o].ai.meep.state = MEEP_DEAD; + objects[o].ai.meep.timer = 0; + } + else objects[o].ai.meep.timer++; + break; + } +} diff --git a/src/ai/mother.cpp b/src/ai/mother.cpp new file mode 100644 index 000000000..5576fffd4 --- /dev/null +++ b/src/ai/mother.cpp @@ -0,0 +1,190 @@ +#include "../sdl/sound/CSound.h" +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// Vorticon Mother AI (ep3) + +#define MOTHER_WALK 0 +#define MOTHER_SPIT 1 +#define MOTHER_HURT 2 +#define MOTHER_DEAD 3 + +#define MOTHER_WALK_ANIM_RATE 70 +#define MOTHER_WALK_SPD 1 + +#define MOTHER_SPIT_PROB 1000 +#define MOTHER_SPIT_SHOW_TIME 100 + +#define MOTHER_HP 5 + +#define MOTHER_HURT_SHOW_TIME 100 + +#define SNDWAVE_LEFT_FRAME 128 + +#define MOTHER_WALK_LEFT_FRAME 85 +#define MOTHER_WALK_RIGHT_FRAME 87 +#define MOTHER_SPIT_LEFT_FRAME 89 +#define MOTHER_SPIT_RIGHT_FRAME 90 +#define MOTHER_HURT_FRAME 91 +#define MOTHER_DEAD_FRAME 92 + +void mother_ai(int o, stLevelControl levelcontrol) +{ +int newobject; +//int not_about_to_fall; + if (objects[o].needinit) + { + objects[o].ai.mother.state = MOTHER_WALK; + objects[o].ai.mother.hittimes = 0; + objects[o].ai.mother.animframe = 0; + objects[o].ai.mother.animtimer = 0; + + if (player[primaryplayer].x > objects[o].x) + objects[o].ai.mother.dir = RIGHT; + else + objects[o].ai.mother.dir = LEFT; + + objects[o].blockedr = objects[o].blockedl = 0; + objects[o].canbezapped = 1; + objects[o].needinit = 0; + } + if (objects[o].ai.mother.state==MOTHER_DEAD) return; + + if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie) + { + /* don't push the player as he's walking through the exit door */ + if (!levelcontrol.level_done || levelcontrol.level_finished_by != objects[o].touchedBy) + { + if (player[objects[o].touchedBy].x < objects[o].x) + { + player[objects[o].touchedBy].playpushed_x = -MOTHER_WALK_SPD; + if (player[objects[o].touchedBy].pinertia_x > 0) player[objects[o].touchedBy].pinertia_x = 0; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + } + else + { + player[objects[o].touchedBy].playpushed_x = MOTHER_WALK_SPD; + if (player[objects[o].touchedBy].pinertia_x < 0) player[objects[o].touchedBy].pinertia_x = 0; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + } + } + } + + + if (objects[o].zapped) + { + objects[o].zapped = 0; + objects[o].ai.mother.hittimes++; + if (objects[o].ai.mother.state != MOTHER_HURT || + objects[o].ai.mother.hittimes < MOTHER_HP) + { + objects[o].ai.mother.timer = 0; + objects[o].ai.mother.state = MOTHER_HURT; + } + } + + switch(objects[o].ai.mother.state) + { + case MOTHER_WALK: + if (rand()%MOTHER_SPIT_PROB == (MOTHER_SPIT_PROB/2)) + { + if (objects[o].ai.mother.dir == RIGHT) // turn around before spitting + objects[o].ai.mother.dir = LEFT; + else + objects[o].ai.mother.dir = RIGHT; + + objects[o].ai.mother.state = MOTHER_SPIT; + objects[o].ai.mother.timer = 0; + } + + if (objects[o].ai.mother.dir==RIGHT) + { + objects[o].sprite = MOTHER_WALK_RIGHT_FRAME + objects[o].ai.mother.animframe; + + if (objects[o].blockedr) + { + objects[o].ai.mother.dir = LEFT; + } + else + { + objects[o].x += MOTHER_WALK_SPD; + } + } + else + { + objects[o].sprite = MOTHER_WALK_LEFT_FRAME + objects[o].ai.mother.animframe; +// not_about_to_fall = tiles[getmaptileat((objects[o].x>>CSF)-1, (objects[o].y>>CSF)+sprites[MOTHER_WALK_RIGHT_FRAME].ysize)].solidfall; + + if (objects[o].blockedl)// || !not_about_to_fall) + { + objects[o].ai.mother.dir = RIGHT; + } + else + { + objects[o].x -= MOTHER_WALK_SPD; + } + } + + /* walk animation */ + if (objects[o].ai.mother.animtimer > MOTHER_WALK_ANIM_RATE) + { + objects[o].ai.mother.animframe ^= 1; + objects[o].ai.mother.animtimer = 0; + } + else objects[o].ai.mother.animtimer++; + + break; + case MOTHER_SPIT: + if (objects[o].ai.mother.dir==RIGHT) + { + objects[o].sprite = MOTHER_SPIT_RIGHT_FRAME; + } + else + { + objects[o].sprite = MOTHER_SPIT_LEFT_FRAME; + } + + if (objects[o].ai.mother.timer > MOTHER_SPIT_SHOW_TIME) + { + if (objects[o].ai.mother.dir==RIGHT) + { + newobject = spawn_object(objects[o].x+(sprites[MOTHER_SPIT_RIGHT_FRAME].xsize<playStereofromCoord(SOUND_TANK_FIRE, PLAY_NOW, objects[o].scrx); + objects[o].ai.mother.state = MOTHER_WALK; + } + else objects[o].ai.mother.timer++; + break; + case MOTHER_HURT: + objects[o].sprite = MOTHER_HURT_FRAME; + if (objects[o].ai.mother.timer > MOTHER_HURT_SHOW_TIME) + { + if (objects[o].ai.mother.hittimes >= MOTHER_HP) + { + objects[o].sprite = MOTHER_DEAD_FRAME; + objects[o].ai.mother.state = MOTHER_DEAD; + objects[o].canbezapped = 0; + objects[o].ai.mother.timer = 0; + if (objects[o].onscreen) g_pSound->playStereofromCoord(SOUND_VORT_DIE, PLAY_NOW, objects[o].scrx); + } + else + { + objects[o].ai.mother.state = MOTHER_WALK; + if (player[primaryplayer].x > objects[o].x) + objects[o].ai.mother.dir = RIGHT; + else + objects[o].ai.mother.dir = LEFT; + } + } + else objects[o].ai.mother.timer++; + break; + } +} diff --git a/src/ai/nessie.cpp b/src/ai/nessie.cpp new file mode 100644 index 000000000..35fe2cf64 --- /dev/null +++ b/src/ai/nessie.cpp @@ -0,0 +1,329 @@ +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// Nessie (in ep3) (on the world map) + +#define NESSIE_SWIMNORMAL 0 +#define NESSIE_SWIMUPTOMORTIMER 1 +#define NESSIE_PAUSE_MORTIMER 2 +#define NESSIE_SWIMAWAY_MORTIMER 3 + +#define NESSIE_PAUSE_TIME 1000 + +#define NESSIE_ANIM_RATE 25 + +#define NESSIE_DOWNLEFT_FRAME 130 +#define NESSIE_DOWNRIGHT_FRAME 132 +#define NESSIE_UPRIGHT_FRAME 134 +#define NESSIE_UPLEFT_FRAME 136 + +#define NESSIE_SPEED 4 + +#define NESSIE_MORTIMER_SWIM_AMT ((8<>4>>CSF); + objects[o].ai.nessie.tiletrailY[0] = (objects[o].y>>4>>CSF); + objects[o].ai.nessie.tiletrailX[1] = (objects[o].x>>4>>CSF)+1; + objects[o].ai.nessie.tiletrailY[1] = (objects[o].y>>4>>CSF); + objects[o].ai.nessie.tiletrailhead = 2; + + for(i=0;i NESSIE_ANIM_RATE) + { + objects[o].ai.nessie.animframe ^= 1; + objects[o].ai.nessie.animtimer = 0; + } + else objects[o].ai.nessie.animtimer++; + + switch(objects[o].ai.nessie.state) + { + case NESSIE_SWIMUPTOMORTIMER: + if (!objects[o].ai.nessie.mortimer_swim_amt) + { + objects[o].ai.nessie.state = NESSIE_PAUSE_MORTIMER; + objects[o].ai.nessie.pausetimer = NESSIE_PAUSE_TIME; + objects[o].ai.nessie.baseframe = NESSIE_DOWNRIGHT_FRAME; + } + else + { + objects[o].y -= NESSIE_SPEED; + objects[o].ai.nessie.mortimer_swim_amt--; + } + break; + + case NESSIE_PAUSE_MORTIMER: + if (!objects[o].ai.nessie.pausetimer) + { +// objects[o].ai.nessie.state = NESSIE_SWIMAWAY_MORTIMER; + // objects[o].ai.nessie.mortimer_swim_amt = NESSIE_MORTIMER_SWIMAWAY_AMT; + objects[o].ai.nessie.state = NESSIE_SWIMNORMAL; + } + else objects[o].ai.nessie.pausetimer--; + break; + + case NESSIE_SWIMAWAY_MORTIMER: + if (!objects[o].ai.nessie.mortimer_swim_amt) + { + objects[o].ai.nessie.state = NESSIE_SWIMNORMAL; + } + else + { + objects[o].x += NESSIE_SPEED; + objects[o].y += NESSIE_SPEED; + objects[o].ai.nessie.mortimer_swim_amt--; + } + break; + + case NESSIE_SWIMNORMAL: + + /* arrived at destination? */ + if (objects[o].x>>CSF==objects[o].ai.nessie.destx>>CSF && \ + objects[o].y>>CSF==objects[o].ai.nessie.desty>>CSF) + { + // if we're approaching the mount point by Mortimer's castle + // go into a special state that aligns her properly with the island + // (i couldn't get this to work right any other way) + if (objects[o].ai.nessie.desty>>CSF>>4 < map.ysize>>2) + { + if (map.objectlayer[(objects[o].ai.nessie.destx>>CSF>>4)+2][(((objects[o].ai.nessie.desty>>CSF)+8)>>4)-1]==NESSIE_PAUSE) + { + objects[o].ai.nessie.state = NESSIE_SWIMUPTOMORTIMER; + objects[o].ai.nessie.mortimer_swim_amt = NESSIE_MORTIMER_SWIM_AMT; + } + } + + nessie_find_next_checkpoint(o); + + /* set up/down and left/right direction flags for frame selection */ + if (objects[o].ai.nessie.destx > objects[o].x) + { + objects[o].ai.nessie.leftrightdir = RIGHT; + } + else if (objects[o].ai.nessie.destx < objects[o].x) + { + objects[o].ai.nessie.leftrightdir = LEFT; + } + + if (objects[o].ai.nessie.desty < objects[o].y) + { + objects[o].ai.nessie.updowndir = UP; + } + else + { + objects[o].ai.nessie.updowndir = DOWN; + } + } + + if (objects[o].ai.nessie.pausetimer) + { + objects[o].ai.nessie.updowndir = DOWN; + } + + /* select proper frame based on up/down and left/right direction flags */ + if (objects[o].ai.nessie.updowndir==DOWN && objects[o].ai.nessie.leftrightdir==LEFT) + { + objects[o].ai.nessie.baseframe = NESSIE_DOWNLEFT_FRAME; + } + else if (objects[o].ai.nessie.updowndir==DOWN && objects[o].ai.nessie.leftrightdir==RIGHT) + { + objects[o].ai.nessie.baseframe = NESSIE_DOWNRIGHT_FRAME; + } + else if (objects[o].ai.nessie.updowndir==UP && objects[o].ai.nessie.leftrightdir==LEFT) + { + objects[o].ai.nessie.baseframe = NESSIE_UPLEFT_FRAME; + } + else if (objects[o].ai.nessie.updowndir==UP && objects[o].ai.nessie.leftrightdir==RIGHT) + { + objects[o].ai.nessie.baseframe = NESSIE_UPRIGHT_FRAME; + } + + /* pause if needed */ + if (objects[o].ai.nessie.pausetimer) + { + objects[o].ai.nessie.pausetimer--; + return; + } + + /* head to destination */ + if (objects[o].x < objects[o].ai.nessie.destx) + { + if (objects[o].ai.nessie.destx - objects[o].x > NESSIE_SPEED) + { + objects[o].x += NESSIE_SPEED; + } + else + { + objects[o].x++; + } + } + else if (objects[o].x > objects[o].ai.nessie.destx) + { + if (objects[o].x - objects[o].ai.nessie.destx > NESSIE_SPEED) + { + objects[o].x -= NESSIE_SPEED; + } + else + { + objects[o].x--; + } + } + + if (objects[o].y < objects[o].ai.nessie.desty) + { + if (objects[o].ai.nessie.desty - objects[o].y > NESSIE_SPEED) + { + objects[o].y += NESSIE_SPEED; + } + else + { + objects[o].y++; + } + } + else if (objects[o].y > objects[o].ai.nessie.desty) + { + if (objects[o].y - objects[o].ai.nessie.desty > NESSIE_SPEED) + { + objects[o].y -= NESSIE_SPEED; + } + else + { + objects[o].y--; + } + } + + break; + } +} + +void nessie_find_next_checkpoint(int o) +{ +int x,y,i; +int xa,ya; +unsigned int destx, desty; +int obj; +int oneoflasttiles; + + // search in the 8 surrounding tiles and head to the first pathtile + // we find that's not one of the last 5 we've been to + x = (objects[o].x>>CSF>>4)-1; + y = (((objects[o].y>>CSF)+8)>>4)-1; + destx = desty = 0; + for(ya=0;ya<3;ya++) + { + for(xa=0;xa<3;xa++) + { + destx = x+xa; + desty = y+ya; + + obj = map.objectlayer[destx][desty]; + if (obj==NESSIE_PATH || obj==NESSIE_PAUSE) + { + // find out if this is one of the last tiles we've been to + oneoflasttiles = 0; + for(i=0;i=NESSIETRAILLEN) + { + objects[o].ai.nessie.tiletrailhead = 0; + } + goto foundtile; + } // end if (!oneoflasttiles) + } // end if(obj==8192 ... + + } // end for(xa... + } // end for(ya... +foundtile: ; + + objects[o].ai.nessie.destx = (destx<<4< map.ysize>>2) + { + if (map.objectlayer[destx][desty]==NESSIE_PAUSE) + { + // make nessie pause + objects[o].ai.nessie.pausetimer = NESSIE_PAUSE_TIME; + objects[o].ai.nessie.pausex = destx; + objects[o].ai.nessie.pausey = desty; + } + } + +} + diff --git a/src/ai/ninja.cpp b/src/ai/ninja.cpp new file mode 100644 index 000000000..a4266a3af --- /dev/null +++ b/src/ai/ninja.cpp @@ -0,0 +1,240 @@ +#include "../sdl/sound/CSound.h" +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// Ninja AI (the black, bear-like karate-kicking creature in ep3) + +#define NINJA_STAND 0 +#define NINJA_KICK 1 +#define NINJA_DYING 2 +#define NINJA_DEAD 3 + +#define NINJA_STAND_ANIM_RATE 100 +#define NINJA_DYING_SHOW_TIME 100 + +#define NINJA_MIN_TIME_TILL_KICK 500 +#define NINJA_MAX_TIME_TILL_KICK 1000 + +#define NINJA_KICK_MOVE_RATE 1 + +#define NINJA_STAND_LEFT_FRAME 77 +#define NINJA_STAND_RIGHT_FRAME 79 +#define NINJA_KICK_LEFT_FRAME 81 +#define NINJA_KICK_RIGHT_FRAME 82 +#define NINJA_DYING_FRAME 83 +#define NINJA_DEAD_FRAME 84 + +void ninja_ai(int o, stCloneKeenPlus *pCKP) +{ +unsigned int i; +int onsamelevel; + + if (objects[o].needinit) + { + objects[o].ai.ninja.state = NINJA_STAND; + objects[o].ai.ninja.timetillkick = (rand()%(NINJA_MAX_TIME_TILL_KICK-NINJA_MIN_TIME_TILL_KICK))+NINJA_MIN_TIME_TILL_KICK; + if (options[OPT_MEAN].value) objects[o].ai.ninja.timetillkick /= 3; + + if (player[primaryplayer].x < objects[o].x) + { objects[o].ai.ninja.dir = LEFT; } + else + { objects[o].ai.ninja.dir = RIGHT; } + + objects[o].ai.ninja.animtimer = 0; + objects[o].ai.ninja.animframe = 0; + objects[o].ai.ninja.isdying = 0; + objects[o].canbezapped = 1; + objects[o].inhibitfall = 0; + objects[o].needinit = 0; + } + if (objects[o].ai.ninja.state==NINJA_DEAD) return; + + if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie && \ + objects[o].ai.ninja.state != NINJA_DYING) + { + killplayer(objects[o].touchedBy, pCKP); + } + + if (objects[o].zapped >= 4) + { + objects[o].ai.ninja.isdying = 1; + objects[o].ai.ninja.dietimer = 0; + objects[o].ai.ninja.YFrictionRate = 1; + if (objects[o].ai.ninja.YInertia < 0) objects[o].ai.ninja.YInertia = 0; + objects[o].zapped = 0; + objects[o].canbezapped = 0; + g_pSound->playStereofromCoord(SOUND_VORT_DIE, PLAY_NOW, objects[o].scrx); + } + + + if (objects[o].ai.ninja.isdying) + { + if (objects[o].ai.ninja.state == NINJA_STAND) + { + objects[o].ai.ninja.state = NINJA_DYING; + } + objects[o].ai.ninja.dietimer++; + if (objects[o].ai.ninja.dietimer > NINJA_DYING_SHOW_TIME) + { + objects[o].sprite = NINJA_DEAD_FRAME; + } + } + + switch(objects[o].ai.ninja.state) + { + case NINJA_STAND: + if (player[primaryplayer].x < objects[o].x+(8<= objects[o].y-(96<>CSF)+sprites[0].ysize <= (objects[o].y>>CSF)+sprites[objects[o].sprite].ysize+96)) + { + onsamelevel = 1; + break; + } + } + } + + if (onsamelevel) + { + objects[o].ai.ninja.timetillkick--; + } + } + + if (objects[o].ai.ninja.dir==LEFT) + { + objects[o].sprite = NINJA_STAND_LEFT_FRAME + objects[o].ai.ninja.animframe; + } + else + { + objects[o].sprite = NINJA_STAND_RIGHT_FRAME + objects[o].ai.ninja.animframe; + } + + if (objects[o].ai.ninja.animtimer > NINJA_STAND_ANIM_RATE) + { + objects[o].ai.ninja.animframe ^= 1; + objects[o].ai.ninja.animtimer = 0; + } + else objects[o].ai.ninja.animtimer++; + break; + case NINJA_KICK: + if (objects[o].blockedu && objects[o].ai.ninja.YInertia < 0) objects[o].ai.ninja.YInertia *= 0.5; + + if (!objects[o].ai.ninja.isdying) + { + if (objects[o].ai.ninja.dir==LEFT) + { objects[o].sprite = NINJA_KICK_LEFT_FRAME; } + else + { objects[o].sprite = NINJA_KICK_RIGHT_FRAME; } + } + else + { + objects[o].sprite = NINJA_DYING_FRAME; + } + + if (objects[o].ai.ninja.KickMoveTimer < NINJA_KICK_MOVE_RATE) + { + objects[o].ai.ninja.KickMoveTimer++; + break; + } + objects[o].ai.ninja.KickMoveTimer = 0; + + if (objects[o].ai.ninja.YInertia > 0 && objects[o].blockedd) + { + if (!objects[o].ai.ninja.isdying) + { + objects[o].needinit = 1; + } + else + { + objects[o].ai.ninja.state = NINJA_DYING; + } + break; + } + else + { + if ((objects[o].ai.ninja.XInertia > 0 && !objects[o].blockedr) || \ + (objects[o].ai.ninja.XInertia < 0 && !objects[o].blockedl)) + { + if (!objects[o].ai.ninja.isdying) + objects[o].x += objects[o].ai.ninja.XInertia; + } + + if (objects[o].ai.ninja.YInertia > 0 || !objects[o].blockedu) + { + objects[o].y += objects[o].ai.ninja.YInertia; + } + } + + if (objects[o].ai.ninja.XFrictionTimer > objects[o].ai.ninja.XFrictionRate) + { + if (objects[o].ai.ninja.XInertia>0) + { objects[o].ai.ninja.XInertia--; } + else + { objects[o].ai.ninja.XInertia++; } + + objects[o].ai.ninja.XFrictionTimer = 0; + } + else objects[o].ai.ninja.XFrictionTimer++; + + if (objects[o].ai.ninja.YFrictionTimer > objects[o].ai.ninja.YFrictionRate) + { + objects[o].ai.ninja.YInertia++; + objects[o].ai.ninja.YFrictionTimer = 0; + } + else objects[o].ai.ninja.YFrictionTimer++; + + break; + case NINJA_DYING: + objects[o].sprite = NINJA_DYING_FRAME; + + if (objects[o].ai.ninja.dietimer > NINJA_DYING_SHOW_TIME) + { + objects[o].sprite = NINJA_DEAD_FRAME; + objects[o].ai.ninja.state = NINJA_DEAD; + } + break; + } +} diff --git a/src/ai/platform.cpp b/src/ai/platform.cpp new file mode 100644 index 000000000..496342bd1 --- /dev/null +++ b/src/ai/platform.cpp @@ -0,0 +1,124 @@ +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// horizontally-moving platform (ep2 & 3) + +#define PLATFORM_MOVE 0 +#define PLATFORM_WAIT 1 + +#define PLATFORM_WAITTIME 150 +#define PLATFORM_MOVE_SPD 3 + +#define PLATFORM_ANIM_RATE 60 + +#define PLATFORMPUSHAMOUNT 10 + +void platform_ai(int o, stLevelControl levelcontrol) +{ +unsigned int i; + + if (objects[o].needinit) + { // first time initilization + objects[o].ai.platform.animframe = 0; + objects[o].ai.platform.animtimer = 0; + objects[o].ai.platform.movedir = RIGHT; + objects[o].ai.platform.state = PLATFORM_MOVE; + + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + objects[o].canbezapped = 1; + SetAllCanSupportPlayer(o, 1); + } + + // push player horizontally + if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie && player[objects[o].touchedBy].psupportingobject!=o) + { + if (player[objects[o].touchedBy].x < objects[o].x) + { + player[objects[o].touchedBy].playpushed_x = -PLATFORMPUSHAMOUNT; + if (player[objects[o].touchedBy].pinertia_x > 0) player[objects[o].touchedBy].pinertia_x = 0; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + } + else + { + player[objects[o].touchedBy].playpushed_x = PLATFORMPUSHAMOUNT; + if (player[objects[o].touchedBy].pinertia_x < 0) player[objects[o].touchedBy].pinertia_x = 0; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + } + } + + if (levelcontrol.episode==2) + { + objects[o].sprite = OBJ_PLATFORM_DEFSPRITE_EP2 + objects[o].ai.platform.animframe; + } + else + { + objects[o].sprite = OBJ_PLATFORM_DEFSPRITE_EP3 + objects[o].ai.platform.animframe; + } + + if (objects[o].ai.platform.animtimer > PLATFORM_ANIM_RATE) + { + objects[o].ai.platform.animframe ^= 1; + objects[o].ai.platform.animtimer = 0; + } + else objects[o].ai.platform.animtimer++; + + switch(objects[o].ai.platform.state) + { + case PLATFORM_MOVE: + + if (objects[o].ai.platform.movedir==RIGHT) + { + if (objects[o].blockedr) + { + objects[o].ai.platform.movedir = LEFT; + objects[o].ai.platform.waittimer = 0; + objects[o].ai.platform.state = PLATFORM_WAIT; + } + else + { + objects[o].x += PLATFORM_MOVE_SPD; + for(i=0;i PLATFORM_WAITTIME) + { + objects[o].ai.platform.state = PLATFORM_MOVE; + } + else objects[o].ai.platform.waittimer++; + break; + } +} + diff --git a/src/ai/platvert.cpp b/src/ai/platvert.cpp new file mode 100644 index 000000000..abbbf992f --- /dev/null +++ b/src/ai/platvert.cpp @@ -0,0 +1,164 @@ +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// vertically-moving platform (ep3) + +#define PLATVERT_MOVE 0 +#define PLATVERT_WAIT 1 + +#define PLATVERT_WAITTIME 150 +#define PLATVERT_MOVE_SPD 3 + +#define PLATVERT_ANIM_RATE 60 + +#define PLATVERTPUSHAMOUNT 10 + +void platvert_ai(int o) +{ +unsigned int i,p; +//int needtokick; + + if (objects[o].needinit) + { // first time initilization + objects[o].ai.platform.animframe = 0; + objects[o].ai.platform.animtimer = 0; + objects[o].ai.platform.movedir = UP; + objects[o].ai.platform.state = PLATVERT_MOVE; + + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + objects[o].canbezapped = 1; + SetAllCanSupportPlayer(o, 1); + for(i=0;i objects[o].y || (!player[p].pfalling && !player[p].pjumping)) + { + objects[o].cansupportplayer[p] = 1; + objects[o].ai.platform.kickedplayer[p] = 0; + } + } + } + + // push player horizontally + if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie && player[objects[o].touchedBy].psupportingobject!=o) + { + if (objects[o].cansupportplayer[objects[o].touchedBy]) + { + // if player is standing around minding his own business and we + // come down on his head, change direction. if player is trying + // to walk/jump into us horizontally, push him away. + if (player[objects[o].touchedBy].y > objects[o].y && \ + (player[objects[o].touchedBy].pjumping==PNOJUMP || \ + player[objects[o].touchedBy].pjumping==PPREPAREJUMP ||\ + player[objects[o].touchedBy].pjumping==PPREPAREPOGO) &&\ + objects[o].ai.platform.movedir==DOWN &&\ + !player[objects[o].touchedBy].pfalling) + { + // change direction + //objects[o].ai.platform.movedir = UP; + } + else + { + // push him away + if (player[objects[o].touchedBy].x < objects[o].x) + { + player[objects[o].touchedBy].playpushed_x = -PLATVERTPUSHAMOUNT; + if (player[objects[o].touchedBy].pinertia_x > 0) player[objects[o].touchedBy].pinertia_x = 0; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + } + else + { + player[objects[o].touchedBy].playpushed_x = PLATVERTPUSHAMOUNT; + if (player[objects[o].touchedBy].pinertia_x < 0) player[objects[o].touchedBy].pinertia_x = 0; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + } + } + } + } + + objects[o].sprite = OBJ_PLATFORM_DEFSPRITE_EP3 + objects[o].ai.platform.animframe; + + if (objects[o].ai.platform.animtimer > PLATVERT_ANIM_RATE) + { + objects[o].ai.platform.animframe ^= 1; + objects[o].ai.platform.animtimer = 0; + } + else objects[o].ai.platform.animtimer++; + + switch(objects[o].ai.platform.state) + { + case PLATVERT_MOVE: + + if (objects[o].ai.platform.movedir==UP) + { + if (objects[o].blockedu) + { + objects[o].ai.platform.movedir = DOWN; + objects[o].ai.platform.waittimer = 0; + objects[o].ai.platform.state = PLATVERT_WAIT; + } + else + { + objects[o].y -= PLATVERT_MOVE_SPD; + for(i=0;i PLATVERT_WAITTIME) + { + objects[o].ai.platform.state = PLATVERT_MOVE; + } + else objects[o].ai.platform.waittimer++; + break; + } +} diff --git a/src/ai/ray.cpp b/src/ai/ray.cpp new file mode 100644 index 000000000..bfe0be0bb --- /dev/null +++ b/src/ai/ray.cpp @@ -0,0 +1,168 @@ +#include "../sdl/sound/CSound.h" +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// raygun blast, shot by keen, and by the tank robots in ep1&2. +#include "ray.h" + +void ray_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol) +{ +int i; +int hitlethal; + if (objects[o].needinit) + { + objects[o].ai.ray.state = RAY_STATE_FLY; + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + + // if we shoot directly up against a wall have + // the ZAP appear next to the wall, not in it + if (objects[o].ai.ray.direction==RIGHT && objects[o].blockedr) + { + objects[o].x = (objects[o].x >> 4 >> CSF) << 4 << CSF; + if (TileProperty[getmaptileat(objects[o].x>>CSF,objects[o].y>>CSF)][BLEFT]) objects[o].x -= (16<>CSF,objects[o].y>>CSF)].solidl) objects[o].x -= (16<playStereofromCoord(SOUND_SHOT_HIT, PLAY_NOW, objects[o].scrx); + } + else if (objects[o].ai.ray.direction==LEFT && objects[o].blockedl) + { + objects[o].x = (objects[o].x >> 4 >> CSF) << 4 << CSF; + if (TileProperty[getmaptileat(objects[o].x>>CSF,objects[o].y>>CSF)][BRIGHT]) objects[o].x += (16<>CSF,objects[o].y>>CSF)].solidl) objects[o].x -= (16<playStereofromCoord(SOUND_SHOT_HIT, PLAY_NOW, objects[o].scrx); + } + } + + switch(objects[o].ai.ray.state) + { + case RAY_STATE_FLY: + // test if it hit a baddie + for(i=1;i PFROZEN_THAW && \ + levelcontrol.episode==1) + { + // shot a frozen player--melt the ice + player[objects[o].touchedBy].pfrozentime = PFROZEN_THAW; + objects[o].ai.ray.state = RAY_STATE_SETZAPZOT; + } + else + { + if (objects[o].ai.ray.dontHitEnable==0 || objects[o].ai.ray.dontHit!=OBJ_PLAYER) + { + killplayer(objects[o].touchedBy, pCKP); + objects[o].ai.ray.state = RAY_STATE_SETZAPZOT; + } + } + } + + if (objects[o].ai.ray.direction == RIGHT) + { + // don't go through bonklethal tiles, even if they're not solid + // (for the arms on mortimer's machine) + /* if (tiles[getmaptileat((objects[o].x>>CSF)+sprites[objects[o].sprite].xsize, (objects[o].y>>CSF)+1)].bonklethal) + hitlethal = 1; + else if (tiles[getmaptileat((objects[o].x>>CSF)+sprites[objects[o].sprite].xsize, (objects[o].y>>CSF)+(sprites[objects[o].sprite].ysize-1))].bonklethal) + hitlethal = 1;*/ + /*else*/ hitlethal = 0; + + if (objects[o].blockedr || hitlethal) + { + objects[o].ai.ray.state = RAY_STATE_SETZAPZOT; + if (objects[o].onscreen) g_pSound->playStereofromCoord(SOUND_SHOT_HIT, PLAY_NOW, objects[o].scrx); + } + + objects[o].x += RAY_SPEED; + } + else if (objects[o].ai.ray.direction == LEFT) + { + /*if (tiles[getmaptileat((objects[o].x>>CSF)-1, (objects[o].y>>CSF)+1)].bonklethal) + hitlethal = 1; + else if (tiles[getmaptileat((objects[o].x>>CSF)-1, (objects[o].y>>CSF)+(sprites[objects[o].sprite].ysize-1))].bonklethal) + hitlethal = 1;*/ + /*else*/ hitlethal = 0; + + if (objects[o].blockedl || hitlethal) + { + objects[o].ai.ray.state = RAY_STATE_SETZAPZOT; + if (objects[o].onscreen) g_pSound->playStereofromCoord(SOUND_SHOT_HIT, PLAY_NOW, objects[o].scrx); + } + + objects[o].x -= RAY_SPEED; + } + else if (objects[o].ai.ray.direction == DOWN) + { + if (objects[o].blockedd || objects[o].blockedu) + { + objects[o].ai.ray.state = RAY_STATE_SETZAPZOT; + if (objects[o].onscreen) g_pSound->playStereofromCoord(SOUND_SHOT_HIT, PLAY_NOW, objects[o].scrx); + } + + objects[o].y += RAY_SPEED; + } + break; + case RAY_STATE_SETZAPZOT: + objects[o].ai.ray.state = RAY_STATE_ZAPZOT; + objects[o].ai.ray.zapzottimer = RAY_ZAPZOT_TIME; + + if (levelcontrol.episode==1) + { + if (rand()&1) + { objects[o].sprite = RAY_FRAME_ZAP_EP1; } + else + { objects[o].sprite = RAY_FRAME_ZOT_EP1; } + } + else if (levelcontrol.episode==2) + { + if (rand()&1) + { objects[o].sprite = RAY_FRAME_ZAP_EP2; } + else + { objects[o].sprite = RAY_FRAME_ZOT_EP2; } + } + else + { + if (rand()&1) + { objects[o].sprite = RAY_FRAME_ZAP_EP3; } + else + { objects[o].sprite = RAY_FRAME_ZOT_EP3; } + } + + if (objects[o].ai.ray.direction==LEFT || objects[o].ai.ray.direction==RIGHT) + { + objects[o].y -= (2<> CSF >> 4) - 4; + objects[o].ai.rope.stoneY = (objects[o].y >> CSF >> 4) + 1; + // hide the rope + objects[o].sprite = BlankSprite; + } + break; + case ROPE_DROP: + if (objects[o].ai.rope.droptimer > STONE_DROP_RATE) + { + rope_movestone(o); + objects[o].ai.rope.droptimer = 0; + + objects[o].ai.rope.droptimes++; + if (objects[o].ai.rope.droptimes >= STONE_DROP_TIMES) + { + // just to make sure the boss is dead +// killboss(o); + objects[o].exists = 0; + } + } + else objects[o].ai.rope.droptimer++; + break; + } +} + +void rope_movestone(int o) +{ +int xa,ya; +int x,y; +unsigned int xpix,ypix,vb; + xa = objects[o].ai.rope.stoneX; + ya = objects[o].ai.rope.stoneY; + + // move the stone down one space + for(y=STONE_HEIGHT;y>0;y--) + { + for(x=0;x= objects[vb].x) + { + if (ypix <= objects[vb].y && ypix+(16<= objects[vb].y) + { + killboss(o); + } + } + } + } + // clear the space at the top with black + for(x=0;xplayStereofromCoord(SOUND_VORT_DIE, PLAY_NOW, objects[o].scrx); + } +} diff --git a/src/ai/se.cpp b/src/ai/se.cpp new file mode 100644 index 000000000..a4b5fb589 --- /dev/null +++ b/src/ai/se.cpp @@ -0,0 +1,1128 @@ +#include "../sdl/sound/CSound.h" +#include "../keen.h" +#include "ray.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +char PlatExtending=0; + +// "Sector Effector" object (The name comes from D3D)...it's basically +// an object which can do a number of different things depending on it's +// .ai.se.type attribute, usually it affects the map or the enviorment +// around it. Used where it wasn't worth it to create a whole new object +// (or where I was too lazy to do it). + +void se_extend_plat(int o); // extends a platform (ep2) +void se_spark(int o, stLevelControl *p_levelcontrol); // spark in Tantalus Ray (ep2) +void se_gun(int o); // periodically-firing guns (ep3) +void se_ankhshield(int o); // Ankh Shield (ep3) +void se_icecannon(int o); // ice cannon (ep1) +void se_mortimer_arm(int o); // Mortimer's arms (ep3) +void se_mortimer_leg_left(int o); // Mortimer's left leg (ep3) +void se_mortimer_leg_right(int o, stCloneKeenPlus *pCKP); // Mortimer's right leg (ep3) +void se_mortimer_spark(int o, stCloneKeenPlus *pCKP); // spark in Mortimer's machine (ep3) +void se_mortimer_heart(int o); // Mortimer's "heart" (ep3) +void se_mortimer_zapsup(int o, stCloneKeenPlus *pCKP); // causes zaps to roll up Mortimer's machine (ep3) +void se_mortimer_randomzaps(int o); // spawns random zaps on Mortimer's machine (ep3) +void se_retract_plat(int o); + +void set_mortimer_surprised(int yes); +int mortimer_surprisedcount=0; + +void se_ai(int o, stCloneKeenPlus *pCKP) +{ + + switch(objects[o].ai.se.type) + { + case SE_EXTEND_PLATFORM: se_extend_plat(o); break; + case SE_RETRACT_PLATFORM: se_retract_plat(o); break; + case SE_SPARK: se_spark(o, (&pCKP->Control.levelcontrol)); break; + case SE_GUN_VERT: se_gun(o); break; + case SE_GUN_RIGHT: se_gun(o); break; + case SE_ANKHSHIELD: se_ankhshield(o); break; + case SE_ICECANNON: se_icecannon(o); break; + case SE_MORTIMER_ARM: se_mortimer_arm(o); break; + case SE_MORTIMER_LEG_LEFT: se_mortimer_leg_left(o); break; + case SE_MORTIMER_LEG_RIGHT: se_mortimer_leg_right(o, pCKP); break; + case SE_MORTIMER_SPARK: se_mortimer_spark(o, pCKP); break; + case SE_MORTIMER_HEART: se_mortimer_heart(o); break; + case SE_MORTIMER_ZAPSUP: se_mortimer_zapsup(o, pCKP); break; + case SE_MORTIMER_RANDOMZAPS: se_mortimer_randomzaps(o); break; + + default: crashflag = 1; + crashflag2 = objects[o].ai.se.type; + why_term_ptr = "Invalid sector effector type (shown in flag2)"; + break; + } + +} + + +void se_extend_plat(int o) +{ +//char buf[80]; + #define PLAT_EXTEND_RATE 30 + + if (objects[o].needinit) + { + objects[o].ai.se.timer = 0; + objects[o].inhibitfall = 1; + objects[o].canbezapped = 0; + objects[o].sprite = BlankSprite; + objects[o].needinit = 0; + + // figure out which direction the bridge is supposed to go + if (!TileProperty[map.mapdata[objects[o].ai.se.platx+1][objects[o].ai.se.platy]][BLEFT]) + //if (!tiles[map.mapdata[objects[o].ai.se.platx+1][objects[o].ai.se.platy]].solidl) + objects[o].ai.se.dir = RIGHT; + else + objects[o].ai.se.dir = LEFT; + } + + if (!objects[o].ai.se.timer) + { + if (!TileProperty[map.mapdata[objects[o].ai.se.platx][objects[o].ai.se.platy]][BUP]) + //if (!tiles[map.mapdata[objects[o].ai.se.platx][objects[o].ai.se.platy]].solidfall) + { + map_chgtile(objects[o].ai.se.platx, objects[o].ai.se.platy, TILE_EXTENDING_PLATFORM); + + if (objects[o].ai.se.dir==RIGHT) + objects[o].ai.se.platx++; + else + objects[o].ai.se.platx--; + + objects[o].ai.se.timer = PLAT_EXTEND_RATE; + } + else + { + objects[o].exists = 0; + PlatExtending = 0; + } + } + else objects[o].ai.se.timer--; + +} + +void se_retract_plat(int o) +{ + if (objects[o].needinit) + { + objects[o].ai.se.timer = PLAT_EXTEND_RATE; + objects[o].inhibitfall = 1; + objects[o].canbezapped = 0; + objects[o].sprite = BlankSprite; + objects[o].needinit = 0; + + // get the background tile from the tile above the starting point + objects[o].ai.se.bgtile = map.mapdata[objects[o].ai.se.platx][objects[o].ai.se.platy-1]; + // figure out which direction the bridge is supposed to go + if (map.mapdata[objects[o].ai.se.platx-1][objects[o].ai.se.platy] != TILE_EXTENDING_PLATFORM) + objects[o].ai.se.dir = LEFT; + else + objects[o].ai.se.dir = RIGHT; + + // scan across until we find the end of the platform--that will + // be where we will start (remove platform in oppisote direction + // it was extended) + do + { + if (map.mapdata[objects[o].ai.se.platx][objects[o].ai.se.platy] != TILE_EXTENDING_PLATFORM) + { // we've found the end of the platform + break; + } + if (objects[o].ai.se.dir==LEFT) + { + if (objects[o].ai.se.platx==map.xsize) + { + crashflag = 1; + why_term_ptr = "SE_RETRACT_PLATFORM: Failed to find end of platform when scanning right."; + return; + } + objects[o].ai.se.platx++; + } + else + { // platform will be removed in a right-going direction + if (objects[o].ai.se.platx==0) + { + crashflag = 1; + why_term_ptr = "SE_RETRACT_PLATFORM: Failed to find end of platform when scanning left."; + return; + } + objects[o].ai.se.platx--; + } + } while(1); + + // when we were scanning we went one tile too far, go back one + if (objects[o].ai.se.dir==LEFT) objects[o].ai.se.platx--; + else objects[o].ai.se.platx++; + } + + if (objects[o].ai.se.timer >= PLAT_EXTEND_RATE) + { + if (map.mapdata[objects[o].ai.se.platx][objects[o].ai.se.platy]==TILE_EXTENDING_PLATFORM) + { + map_chgtile(objects[o].ai.se.platx, objects[o].ai.se.platy, objects[o].ai.se.bgtile); + + if (objects[o].ai.se.dir==RIGHT) + objects[o].ai.se.platx++; + else + objects[o].ai.se.platx--; + + objects[o].ai.se.timer = 0; + } + else + { + objects[o].exists = 0; + PlatExtending = 0; + } + } + else objects[o].ai.se.timer++; + +} + + +void se_spark(int o, stLevelControl *p_levelcontrol) +{ +int newobject; +int mx,my,x,y; + + #define SPARK_BASEFRAME 128 + #define SPARK_ANIMRATE 20 + + #define SPARK_ANIMATE 0 + #define SPARK_BLOWUP1 1 + #define SPARK_BLOWUP2 2 + #define SPARK_BLOWUP3 3 + + #define SPARK_BLOW_DELAY 100 + + if (objects[o].needinit) + { + objects[o].ai.se.state = SPARK_ANIMATE; + objects[o].ai.se.timer = 0; + objects[o].canbezapped = 1; + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + + objects[o].ai.se.mx = objects[o].x >> CSF >> 4; + objects[o].ai.se.my = objects[o].y >> CSF >> 4; + } + + if (objects[o].ai.se.state==SPARK_ANIMATE) + { + objects[o].sprite = SPARK_BASEFRAME + objects[o].ai.se.frame; + } + else + { + objects[o].sprite = BlankSprite; + } + + switch(objects[o].ai.se.state) + { + case SPARK_ANIMATE: + if (objects[o].ai.se.timer > SPARK_ANIMRATE) + { + objects[o].ai.se.frame++; + if (objects[o].ai.se.frame > 3) objects[o].ai.se.frame = 0; + objects[o].ai.se.timer = 0; + } else objects[o].ai.se.timer++; + + if (objects[o].zapped) + { + g_pSound->playStereofromCoord(SOUND_SHOT_HIT, PLAY_NOW, objects[o].scrx); + // break the glass and blow out the electric arcs + map_chgtile(objects[o].ai.se.mx - 2, objects[o].ai.se.my, 492); + map_chgtile(objects[o].ai.se.mx - 1, objects[o].ai.se.my, 546); + map_chgtile(objects[o].ai.se.mx, objects[o].ai.se.my, 547); + map_chgtile(objects[o].ai.se.mx + 1, objects[o].ai.se.my, 548); + map_chgtile(objects[o].ai.se.mx + 2, objects[o].ai.se.my, 492); + map_deanimate(objects[o].ai.se.mx - 2, objects[o].ai.se.my); + map_deanimate(objects[o].ai.se.mx + 2, objects[o].ai.se.my); + // remove the unneeded dome tiles + map_chgtile(objects[o].ai.se.mx - 1, objects[o].ai.se.my-1, BG_GRAY); + map_chgtile(objects[o].ai.se.mx, objects[o].ai.se.my-1, BG_GRAY); + map_chgtile(objects[o].ai.se.mx + 1, objects[o].ai.se.my-1, BG_GRAY); + // break the switch + map_chgtile(objects[o].ai.se.mx - 3, objects[o].ai.se.my + 4, 506); + + // meltdown! + objects[o].ai.se.state = SPARK_BLOWUP1; + objects[o].ai.se.timer = 0; + objects[o].ai.se.blowy = 0; + + fade.mode = FADE_GO; + fade.dir = FADE_IN; + fade.curamt = PAL_FADE_WHITEOUT; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + } + break; + case SPARK_BLOWUP1: + // one by one blow out the purple thingies below the device + if (objects[o].ai.se.timer > SPARK_BLOW_DELAY) + { + objects[o].ai.se.timer = 0; + mx = objects[o].ai.se.mx; + my = objects[o].ai.se.my+3+objects[o].ai.se.blowy; + map_chgtile(mx, my, 505); + map_deanimate(mx, my); + // spawn a ZAP! or a ZOT! + newobject = spawn_object(mx<<4<playStereofromCoord(SOUND_SHOT_HIT, PLAY_NOW, objects[o].scrx); + + objects[o].ai.se.blowy++; + if (objects[o].ai.se.blowy >= 3) + { + objects[o].ai.se.state = SPARK_BLOWUP2; + objects[o].ai.se.blowx = 0; + } + } + else objects[o].ai.se.timer++; + break; + case SPARK_BLOWUP2: + // blow out the glowing cells + if (objects[o].ai.se.timer > SPARK_BLOW_DELAY) + { + if (objects[o].ai.se.blowx >= 4) + { + // done blowing up the glowcells + // static the targeting display + mx = objects[o].ai.se.mx - 7; + my = objects[o].ai.se.my + 2; + for(y=0;y<3;y++) + { + for(x=0;x<3;x++) + { + map_chgtile(mx+x,my+y,533); + map_animate(mx+x,my+y); + } + } + objects[o].exists = 0; + p_levelcontrol->canexit = 1; // ok, you can exit now + return; + } + + objects[o].ai.se.timer = 0; + mx = objects[o].ai.se.mx + objects[o].ai.se.blowx + 3; + for(y=0;y<3;y++) + { + my = objects[o].ai.se.my+3+y; + map_chgtile(mx, my, 549); + map_deanimate(mx, my); + // spawn a ZAP! or a ZOT! + newobject = spawn_object(mx<<4<playStereofromCoord(SOUND_SHOT_HIT, PLAY_NOW, objects[o].scrx); + objects[o].ai.se.blowx++; + } + else objects[o].ai.se.timer++; + break; + } // end of state switch for SE_SPARK + +} + +void se_gun(int o) +{ +int newobject; + if (objects[o].needinit) + { + objects[o].ai.se.timer = 0; + objects[o].sprite = BlankSprite; + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + } + + if (!gunfiretimer) + { + if (objects[o].ai.se.type==SE_GUN_VERT) + { + newobject = spawn_object(objects[o].x+(4< 0) && (objects[o].scrx < 255)) + g_pSound->playStereofromCoord(SOUND_TANK_FIRE, PLAY_NOW, objects[o].scrx); + } + } + +void se_ankhshield(int o) +{ + #define ANKH_FLICKER_FREQ 12 + + if (objects[o].needinit) + { + objects[o].ai.se.frame = 0; + objects[o].ai.se.timer = 0; + objects[o].inhibitfall = 1; + objects[o].canbezapped = 0; + objects[o].needinit = 0; + + objects[o].ai.se.state = ANKH_STATE_NOFLICKER; + } + + switch(objects[o].ai.se.state) + { + case ANKH_STATE_NOFLICKER: + objects[o].sprite = ANKH_SHIELD_FRAME + (objects[o].ai.se.frame&1); + break; + case ANKH_STATE_FLICKERFAST: + if (objects[o].ai.se.frame&1) + objects[o].sprite = BlankSprite; + else + { + if (objects[o].ai.se.frame&2) + objects[o].sprite = ANKH_SHIELD_FRAME+1; + else + objects[o].sprite = ANKH_SHIELD_FRAME; + } + break; + case ANKH_STATE_FLICKERSLOW: + if (objects[o].ai.se.frame>4) + objects[o].sprite = BlankSprite; + else + objects[o].sprite = ANKH_SHIELD_FRAME; + break; + } + + if (objects[o].ai.se.timer > ANKH_FLICKER_FREQ) + { + objects[o].ai.se.frame++; + if (objects[o].ai.se.frame>8) objects[o].ai.se.frame = 0; + objects[o].ai.se.timer = 0; + } + else objects[o].ai.se.timer++; + + +} + + +void se_icecannon(int o) +{ +int newobject; + + if (!gunfiretimer) + { + newobject = spawn_object(objects[o].x, objects[o].y, OBJ_ICECHUNK); + objects[newobject].ai.icechunk.movedir = objects[o].ai.se.dir; + } +} + +#define ARM_GO 0 +#define ARM_WAIT 1 + +#define ARM_MOVE_SPEED 50 +#define ARM_WAIT_TIME 70 +void se_mortimer_arm(int o) +{ +int mx,my; + if (objects[o].needinit) + { + objects[o].ai.se.dir = DOWN; + objects[o].ai.se.state = ARM_GO; + objects[o].ai.se.timer = 0; + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + } + + switch(objects[o].ai.se.state) + { + case ARM_GO: + // vertical arm 618 620 619 + // pole 597 + // polka dot background 169 + if (objects[o].ai.se.timer > ARM_MOVE_SPEED) + { + mx = objects[o].x >> CSF >> 4; + my = objects[o].y >> CSF >> 4; + + if (objects[o].ai.se.dir==DOWN) + { + // reached bottom? + if (map.mapdata[mx][my+3]==471) + { + objects[o].ai.se.timer = 0; + objects[o].ai.se.state = ARM_WAIT; + } + else + { + // add to the pole + map_chgtile(mx, my+1, 597); + // create left side of pincher + map_chgtile(mx-1, my+1, 618); + map_chgtile(mx-1, my+2, 620); + map_chgtile(mx-1, my+3, 619); + // create right side of pincher + map_chgtile(mx+1, my+1, 618); + map_chgtile(mx+1, my+2, 620); + map_chgtile(mx+1, my+3, 619); + // erase the top of the pincher we don't need anymore + map_chgtile(mx-1, my, 169); + map_chgtile(mx+1, my, 169); + objects[o].y += (16< ARM_WAIT_TIME) + { + if (objects[o].ai.se.dir==DOWN) + { + objects[o].ai.se.dir = UP; + objects[o].y -= (32< SPARK_ANIMRATE) + { + objects[o].ai.se.frame++; + if (objects[o].ai.se.frame > 3) objects[o].ai.se.frame = 0; + objects[o].ai.se.timer = 0; + } + else objects[o].ai.se.timer++; + + if (objects[o].zapped) + { + set_mortimer_surprised(1); + + // if there are any sparks left, destroy the spark, + // else destroy mortimer's arms + for(i=0;i 1) + { + map_deanimate(mx, objects[o].ai.se.my); + } + map_chgtile(mx, objects[o].ai.se.my, 169); + // spawn a ZAP! or a ZOT! + newobject = spawn_object(((mx<<4)+4)< 1) + { + map_deanimate(mx, objects[o].ai.se.my); + } + map_chgtile(mx, objects[o].ai.se.my, 169); + // spawn a ZAP! or a ZOT! + newobject = spawn_object(((mx<<4)+4)< MORTIMER_ARMS_YEND) + { + objects[o].exists = 0; + set_mortimer_surprised(0); + } + } + else objects[o].ai.se.timer--; + break; + } +} + +#define MORTIMER_HEART_BASEFRAME 146 +#define HEART_ANIMRATE 60 + +#define HEART_IDLE 0 +#define HEART_ZAPSRUNUP 1 +#define HEART_ZAPSRUNDOWN 2 + +#define MORTIMER_MACHINE_YSTART 3 +#define MORTIMER_MACHINE_YEND 18 +#define MORTIMER_MACHINE_YENDNOLEGS 14 + +#define MORTIMER_MACHINE_XSTART 8 +#define MORTIMER_MACHINE_XEND 17 + +#define MACHINE_DESTROY_RATE 50 +#define MORTIMER_ZAPWAVESPACING 200 +#define MORTIMER_NUMZAPWAVES 5 + +#define ZAPSUP_NORMAL 0 +#define ZAPSUP_ABOUTTOFADEOUT 1 +void se_mortimer_heart(int o) +{ +int i,x; +int newobject; + + if (objects[o].needinit) + { + objects[o].ai.se.timer = 0; + objects[o].ai.se.frame = 0; + objects[o].ai.se.state = HEART_IDLE; + objects[o].inhibitfall = 1; + objects[o].canbezapped = 1; + objects[o].needinit = 0; + mortimer_surprisedcount = 0; + } + + switch(objects[o].ai.se.state) + { + case HEART_IDLE: + objects[o].sprite = MORTIMER_HEART_BASEFRAME + objects[o].ai.se.frame; + + if (objects[o].ai.se.timer > HEART_ANIMRATE) + { + objects[o].ai.se.frame ^= 1; + objects[o].ai.se.timer = 0; + } + else objects[o].ai.se.timer++; + + if (objects[o].zapped) + { + objects[o].sprite = BlankSprite; + set_mortimer_surprised(1); + + /* destroy Mortimer's machine */ + + // kill all enemies + for(i=0;i MORTIMER_NUMZAPWAVES) + { + objects[newobject].ai.se.destroytiles = 1; + objects[o].exists = 0; + } + else objects[o].ai.se.counter++; + } + else objects[o].ai.se.timer--; + break; + case HEART_ZAPSRUNDOWN: + if (!objects[o].ai.se.timer) + { + for(x=MORTIMER_MACHINE_XSTART;x MORTIMER_MACHINE_YEND) + { + objects[o].exists = 0; + } + else objects[o].ai.se.my++; + } + else objects[o].ai.se.timer--; + break; + } +} + +#define TIME_AFTER_DESTROY_BEFORE_FADEOUT 500 +void se_mortimer_zapsup(int o, stCloneKeenPlus *pCKP) +{ +int x, newobject; + + if (!objects[o].ai.se.timer) + { + if (objects[o].ai.se.state==ZAPSUP_ABOUTTOFADEOUT) + { + pCKP->Control.levelcontrol.level_done = LEVEL_DONE_FADEOUT; + endlevel(1,pCKP); + objects[o].exists = 0; + return; + } + + for(x=MORTIMER_MACHINE_XSTART;x LEFTLEG_MOVE_SPEED) + { + mx = objects[o].x >> CSF >> 4; + my = objects[o].y >> CSF >> 4; + + if (objects[o].ai.se.dir==DOWN) + { + // reached bottom? + if (map.mapdata[mx][my+1]==430) + { + objects[o].ai.se.timer = 0; + objects[o].ai.se.state = LEG_WAIT; + g_pSound->playStereofromCoord(SOUND_FOOTSLAM, PLAY_NOW, objects[o].scrx); + } + else + { + // create the leg + map_chgtile(mx-3,my+1,621); + map_chgtile(mx-2,my+1,623); + map_chgtile(mx-1,my+1,623); + map_chgtile(mx-0,my+1,622); + // erase the tiles above us that used to be the leg + map_chgtile(mx-3,my,169); + map_chgtile(mx-2,my,169); + map_chgtile(mx-1,my,169); + map_chgtile(mx-0,my,597); // add to pole + + objects[o].y += (16< LEFTLEG_WAIT_TIME) + { + if (objects[o].ai.se.dir==DOWN) + { + objects[o].ai.se.dir = UP; + } + else + { + objects[o].ai.se.dir = DOWN; + } + + objects[o].ai.se.state = LEG_GO; + objects[o].ai.se.timer = 0; + } + else objects[o].ai.se.timer++; + break; + } +} + +void se_mortimer_leg_right(int o, stCloneKeenPlus *pCKP) +{ +int mx,my; + if (objects[o].touchPlayer) + { + killplayer(objects[o].touchedBy, pCKP); + } + if (objects[o].needinit) + { + objects[o].ai.se.dir = UP; + objects[o].ai.se.state = LEG_GO; + objects[o].ai.se.timer = 0; + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + } + + switch(objects[o].ai.se.state) + { + case LEG_GO: + // leg tiles 621 623 622 + // pole 597 + // polka dot background 169 + // bottom marker for leg 430 + // top marker for leg 420 + if (objects[o].ai.se.timer > RIGHTLEG_MOVE_SPEED) + { + mx = objects[o].x >> CSF >> 4; + my = objects[o].y >> CSF >> 4; + + if (objects[o].ai.se.dir==DOWN) + { + // reached bottom? + if (map.mapdata[mx][my+1]==430) + { + objects[o].ai.se.timer = 0; + objects[o].ai.se.state = LEG_WAIT; + g_pSound->playStereofromCoord(SOUND_FOOTSLAM, PLAY_NOW, objects[o].scrx); + } + else + { + // create the leg + map_chgtile(mx+3,my+1,622); + map_chgtile(mx+2,my+1,623); + map_chgtile(mx+1,my+1,623); + map_chgtile(mx+0,my+1,621); + // erase the tiles above us that used to be the leg + map_chgtile(mx+3,my,169); + map_chgtile(mx+2,my,169); + map_chgtile(mx+1,my,169); + map_chgtile(mx+0,my,597); // add to pole + + objects[o].y += (16< RIGHTLEG_WAIT_TIME) + { + if (objects[o].ai.se.dir==DOWN) + { + objects[o].ai.se.dir = UP; + } + else + { + objects[o].ai.se.dir = DOWN; + } + + objects[o].ai.se.state = LEG_GO; + objects[o].ai.se.timer = 0; + } + else objects[o].ai.se.timer++; + break; + } +} + +#define NUM_RANDOM_ZAPS 30 +#define TIME_BETWEEN_ZAPS 10 +void se_mortimer_randomzaps(int o) +{ +int x,y; +int newobject; + if (objects[o].needinit) + { + objects[o].sprite = BlankSprite; + objects[o].ai.se.counter = 0; + objects[o].ai.se.timer = 0; + objects[o].needinit = 0; + } + + if (!objects[o].ai.se.timer) + { + x = rand()%((MORTIMER_MACHINE_XEND*16)-(MORTIMER_MACHINE_XSTART*16))+(MORTIMER_MACHINE_XSTART*16); + y = rand()%((MORTIMER_MACHINE_YENDNOLEGS*16)-(MORTIMER_MACHINE_YSTART*16))+(MORTIMER_MACHINE_YSTART*16); + + // spawn a ZAP! or a ZOT! + newobject = spawn_object(x< NUM_RANDOM_ZAPS) + { + set_mortimer_surprised(0); + objects[o].exists = 0; + } + else objects[o].ai.se.counter++; + } + else objects[o].ai.se.timer--; +} + +void set_mortimer_surprised(int yes) +{ + if (yes) + { + mortimer_surprisedcount++; + } + else + { + if (mortimer_surprisedcount>0) mortimer_surprisedcount--; + } + + if (mortimer_surprisedcount) + { + //12,6 -> 610 -- give mortimer his "surprised" face + map_chgtile(12,6,610); + map_deanimate(12,6); + // deanimate mortimer's hands + map_chgtile(11,6,613); + map_deanimate(11,6); + map_chgtile(13,6,615); + map_deanimate(13,6); + } + else + { + // give mortimer his normal face + map_chgtile(12,6,607); + map_animate(12,6); + // reanimate things + map_animate(11,6); + map_chgtile(13,6,616); + map_animate(13,6); + } +} diff --git a/src/ai/sndwave.cpp b/src/ai/sndwave.cpp new file mode 100644 index 000000000..31190f4a8 --- /dev/null +++ b/src/ai/sndwave.cpp @@ -0,0 +1,90 @@ +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// Sound Wave projectile, emitted by Meeps (ep3) + +#define SNDWAVE_SPEED 10 +#define SNDWAVE_SPEED_FAST 20 + +#define SNDWAVE_ANIM_RATE 80 + +#define SNDWAVE_LEFT_FRAME 128 +#define SNDWAVE_RIGHT_FRAME 126 + +#define SNDWAVE_OFFSCREEN_KILL_TIME 100 + +void sndwave_ai(int o, stCloneKeenPlus *pCKP) +{ +//int i; + if (objects[o].needinit) + { + objects[o].ai.ray.animframe = 0; + objects[o].ai.ray.animtimer = 0; + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + } + + // check if it hit keen + if (objects[o].touchPlayer) + { + killplayer(objects[o].touchedBy, pCKP); + } + + // destroy the sound wave if it's been offscreen for a good amount + // of time. this is to prevent a massive buildup of soundwaves + // slowly traveling through walls all the way across the level + // (which can crash the game due to running out of object slots). + if (!objects[o].onscreen) + { + if (objects[o].ai.ray.offscreentime > SNDWAVE_OFFSCREEN_KILL_TIME) + { + objects[o].exists = 0; + return; + } + else objects[o].ai.ray.offscreentime++; + } + else objects[o].ai.ray.offscreentime = 0; + + // fly through the air + if (objects[o].ai.ray.direction == RIGHT) + { + objects[o].sprite = SNDWAVE_RIGHT_FRAME + objects[o].ai.ray.animframe; + if (objects[o].x>>CSF>>4 > map.xsize-2) + { + objects[o].exists = 0; + } + else + { + if (options[OPT_MEAN].value) + objects[o].x += SNDWAVE_SPEED_FAST; + else + objects[o].x += SNDWAVE_SPEED; + } + } + else + { + objects[o].sprite = SNDWAVE_LEFT_FRAME + objects[o].ai.ray.animframe; + if (objects[o].x>>CSF>>4 < 2) + { + objects[o].exists = 0; + } + else + { + if (options[OPT_MEAN].value) + objects[o].x -= SNDWAVE_SPEED_FAST; + else + objects[o].x -= SNDWAVE_SPEED; + } + } + + // animation + if (objects[o].ai.ray.animtimer > SNDWAVE_ANIM_RATE) + { + objects[o].ai.ray.animframe ^= 1; + objects[o].ai.ray.animtimer = 0; + } + else objects[o].ai.ray.animtimer++; +} + diff --git a/src/ai/tank.cpp b/src/ai/tank.cpp new file mode 100644 index 000000000..437af0146 --- /dev/null +++ b/src/ai/tank.cpp @@ -0,0 +1,277 @@ +#include "../sdl/sound/CSound.h" +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// Tank Robot (ep1) + +#define TANK_LOOK 0 +#define TANK_WALK 1 +#define TANK_FIRE 2 + +#define TANK_SAME_LEVEL_TIME 400 +#define TANK_REPEAT_FIRE_TIME 800 + +#define TANK_SAME_LEVEL_TIME_FAST 50 +#define TANK_REPEAT_FIRE_TIME_FAST 300 + +// when this probability is satisfied, there is 50% probability +// of a look, 50% probability of a fire. +#define TANK_LOOKFIRE_PROB 500 +#define TANK_MINTRAVELDIST 200 + +#define TANK_WALK_SPEED 4 +#define TANK_WALK_ANIM_TIME 60 +#define TANK_LOOK_ANIM_TIME 70 +#define TANK_LOOK_TOTALTIME 180 +#define TANK_PREPAREFIRE_TIME 180 +#define TANK_PREPAREFIRE_TIME_FAST 80 + +// frames +#define TANK_WALK_LEFT_FRAME 102 +#define TANK_WALK_RIGHT_FRAME 98 +#define TANK_LOOK_FRAME 106 + +#define TANKPUSHAMOUNT 16 + +char tank_CanMoveLeft(int o); +char tank_CanMoveRight(int o); + +void tank_ai(int o) +{ +int newobject; +unsigned int i; + if (objects[o].needinit) + { // first time initilization + objects[o].ai.tank.state = TANK_WALK; + objects[o].ai.tank.movedir = RIGHT; + objects[o].ai.tank.fireafterlook = 0; + objects[o].ai.tank.animtimer = 0; + objects[o].ai.tank.frame = 0; + objects[o].ai.tank.timer = 0; + objects[o].ai.tank.ponsameleveltime = 0; + objects[o].ai.tank.alreadyfiredcauseonsamelevel = 0; + objects[o].ai.tank.dist_traveled = 0; + objects[o].ai.tank.detectedPlayer = 0; + objects[o].ai.tank.detectedPlayerIndex = primaryplayer; + objects[o].canbezapped = 1; // will stop bullets but are not harmed + objects[o].needinit = 0; + } + // stop keen from walking through our sprite + if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie) + { + g_pSound->playStereofromCoord(SOUND_YORP_BUMP, PLAY_NORESTART, objects[o].scrx); + + if (!((player[objects[o].touchedBy].y) < (objects[o].y - 300))) // give the player a little jump-over room + { + if (player[objects[o].touchedBy].x < objects[o].x) + { + player[objects[o].touchedBy].playpushed_x = -TANKPUSHAMOUNT; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = LEFT; + } + else + { + player[objects[o].touchedBy].playpushed_x = TANKPUSHAMOUNT; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = RIGHT; + } + } + } + + switch(objects[o].ai.tank.state) + { + case TANK_LOOK: + objects[o].sprite = TANK_LOOK_FRAME + objects[o].ai.tank.frame; + // animation + if (objects[o].ai.tank.animtimer > TANK_LOOK_ANIM_TIME) + { + objects[o].ai.tank.frame ^= 1; + objects[o].ai.tank.animtimer = 0; + } else objects[o].ai.tank.animtimer++; + + // when time is up go back to moving + if (objects[o].ai.tank.timer > TANK_LOOK_TOTALTIME) + { + // decide what direction to go + // did we go into this state for the purpose of turning and firing? + if (!objects[o].ai.tank.fireafterlook) + { // no + if (!tank_CanMoveRight(o)) + { objects[o].ai.tank.movedir = LEFT; } + else if (!tank_CanMoveLeft(o)) + { objects[o].ai.tank.movedir = RIGHT; } + else if (player[objects[o].ai.tank.detectedPlayerIndex].x < objects[o].x) // turn towards player + { objects[o].ai.tank.movedir = LEFT; } + else + { objects[o].ai.tank.movedir = RIGHT; } + + objects[o].ai.tank.state = TANK_WALK; + objects[o].ai.tank.frame = 0; + objects[o].ai.tank.animtimer = 0; + objects[o].ai.tank.timer = 0; + objects[o].ai.tank.dist_traveled = 0; + } + else + { // yes, face towards player and fire. + if (player[objects[o].ai.tank.detectedPlayerIndex].x < objects[o].x) + { + objects[o].ai.tank.movedir = LEFT; + objects[o].sprite = TANK_WALK_LEFT_FRAME; + } + else + { + objects[o].ai.tank.movedir = RIGHT; + objects[o].sprite = TANK_WALK_RIGHT_FRAME; + } + objects[o].ai.tank.timer = 0; + objects[o].ai.tank.fireafterlook = 0; + objects[o].ai.tank.state = TANK_FIRE; + } + } else objects[o].ai.tank.timer++; + break; + case TANK_WALK: + // is keen on same level? + objects[o].ai.tank.detectedPlayer = 0; + for(i=0;i= objects[o].y-(48<>CSF)+sprites[0].ysize <= (objects[o].y>>CSF)+sprites[objects[o].sprite].ysize+48) + { + objects[o].ai.tank.detectedPlayer = 1; + objects[o].ai.tank.detectedPlayerIndex = i; + break; + } + } + } + + if (objects[o].ai.tank.detectedPlayer) + { + objects[o].ai.tank.ponsameleveltime++; + if (objects[o].ai.tank.ponsameleveltime > TANK_SAME_LEVEL_TIME_FAST && options[OPT_MEAN].value) + { // keen would be a good target now. (hard mode) + if (!objects[o].ai.tank.alreadyfiredcauseonsamelevel ||\ + objects[o].ai.tank.ponsameleveltime > TANK_REPEAT_FIRE_TIME || \ + (objects[o].ai.tank.ponsameleveltime > TANK_REPEAT_FIRE_TIME_FAST && options[OPT_MEAN].value)) + { + // facing keen? + objects[o].ai.tank.alreadyfiredcauseonsamelevel = 1; + if (((player[objects[o].ai.tank.detectedPlayerIndex].x < objects[o].x) && objects[o].ai.tank.movedir==LEFT) || \ + ((player[objects[o].ai.tank.detectedPlayerIndex].x > objects[o].x) && objects[o].ai.tank.movedir==RIGHT)) + { // yes, we're facing him, we see him, we fire! + objects[o].ai.tank.timer = 0; + objects[o].ai.tank.state = TANK_FIRE; + objects[o].ai.tank.ponsameleveltime = 0; + } + else + { // no, we're not facing him. turn and fire! + objects[o].ai.tank.timer = 0; + objects[o].ai.tank.frame = 0; + objects[o].ai.tank.fireafterlook = 1; + objects[o].ai.tank.state = TANK_LOOK; + } + } + } + } + else + { // no, not on same level + objects[o].ai.tank.ponsameleveltime = 0; + objects[o].ai.tank.alreadyfiredcauseonsamelevel = 0; + } + + if (objects[o].ai.tank.dist_traveled > TANK_MINTRAVELDIST && objects[o].onscreen) + { + if (rand()%TANK_LOOKFIRE_PROB==(TANK_LOOKFIRE_PROB/2)) + { + objects[o].ai.tank.timer = 0; + objects[o].ai.tank.state = TANK_FIRE; + } + } + + if (objects[o].ai.tank.movedir==LEFT) + { // move left + objects[o].sprite = TANK_WALK_LEFT_FRAME + objects[o].ai.tank.frame; + if (tank_CanMoveLeft(o)) + { + objects[o].x -= TANK_WALK_SPEED; + objects[o].ai.tank.dist_traveled++; + } + else + { + objects[o].ai.tank.frame = 0; + objects[o].ai.tank.timer = 0; + objects[o].ai.tank.animtimer = 0; + objects[o].ai.tank.state = TANK_LOOK; + } + } + else + { // move right + objects[o].sprite = TANK_WALK_RIGHT_FRAME + objects[o].ai.tank.frame; + if (tank_CanMoveRight(o)) + { + objects[o].x += TANK_WALK_SPEED; + objects[o].ai.tank.dist_traveled++; + } + else + { + objects[o].ai.tank.frame = 0; + objects[o].ai.tank.timer = 0; + objects[o].ai.tank.animtimer = 0; + objects[o].ai.tank.state = TANK_LOOK; + } + } + // walk animation + if (objects[o].ai.tank.animtimer > TANK_WALK_ANIM_TIME) + { + if (objects[o].ai.tank.frame>=3) objects[o].ai.tank.frame=0; + else objects[o].ai.tank.frame++; + objects[o].ai.tank.animtimer = 0; + } else objects[o].ai.tank.animtimer++; + break; + case TANK_FIRE: + if (objects[o].ai.tank.timer > TANK_PREPAREFIRE_TIME || \ + (objects[o].ai.tank.timer > TANK_PREPAREFIRE_TIME_FAST && options[OPT_MEAN].value)) + { + if (objects[o].onscreen) g_pSound->playStereofromCoord(SOUND_TANK_FIRE, PLAY_NOW, objects[o].scrx); + if (objects[o].ai.tank.movedir==RIGHT) + { + newobject = spawn_object(objects[o].x+(sprites[TANK_WALK_RIGHT_FRAME].xsize<>CSF)-1, (objects[o].y>>CSF)+sprites[TANK_WALK_LEFT_FRAME].ysize)][BUP]; + //not_about_to_fall = tiles[getmaptileat((objects[o].x>>CSF)-1, (objects[o].y>>CSF)+sprites[TANK_WALK_LEFT_FRAME].ysize)].solidfall; + if (!objects[o].blockedl && not_about_to_fall) return 1; + return 0; +} + +char tank_CanMoveRight(int o) +{ +int not_about_to_fall; + //not_about_to_fall = tiles[getmaptileat((objects[o].x>>CSF)+sprites[TANK_WALK_RIGHT_FRAME].xsize+1, (objects[o].y>>CSF)+sprites[TANK_WALK_RIGHT_FRAME].ysize)].solidfall; + not_about_to_fall = TileProperty[getmaptileat((objects[o].x>>CSF)+sprites[TANK_WALK_RIGHT_FRAME].xsize+1, (objects[o].y>>CSF)+sprites[TANK_WALK_RIGHT_FRAME].ysize)][BUP]; + if (!objects[o].blockedr && not_about_to_fall) return 1; + return 0; +} diff --git a/src/ai/tankep2.cpp b/src/ai/tankep2.cpp new file mode 100644 index 000000000..e39be1937 --- /dev/null +++ b/src/ai/tankep2.cpp @@ -0,0 +1,246 @@ +#include "../sdl/sound/CSound.h" +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// Tank Robot (Ep2) + +#define TANK_LOOK 0 +#define TANK_WALK 1 + +#define TANK2_SAME_LEVEL_TIME 150 +#define TANK_REPEAT_FIRE_TIME 800 + +// when this probability is satisfied, there is 50% probability +// of a look, 50% probability of a fire. +#define TANK_LOOKFIRE_PROB 500 +#define TANK_MINTRAVELDIST 200 + +#define TANK_WALK_SPEED 4 +#define TANK_WALK_ANIM_TIME 60 +#define TANK_LOOK_ANIM_TIME 110 +#define TANK_LOOK_TOTALTIME 250 +#define TANK2_PREPAREFIRE_TIME 80 + +// frames +#define TANK2_WALK_LEFT_FRAME 116 +#define TANK2_WALK_RIGHT_FRAME 112 +#define TANK2_LOOK_FRAME 120 + +#define TANKPUSHAMOUNT 16 + + +#define TANK2_SHOTS_PER_VOLLEY 4 +#define TANK2_MIN_TIME_TILL_CAN_FIRE 600 +#define TANK2_MAX_TIME_TILL_CAN_FIRE 1000 +#define TANK2_PAUSE_BEFORE_FIRST_SHOT 150 +#define TANK2_TIME_BETWEEN_SHOTS 50 +#define TANK2_TIME_BEFORE_FIRE_WHEN_SEE 100 +#define TANK2_TIME_BETWEEN_FIRE_CAUSE_LEVEL 400 + +void tankep2_ai(int o, stCloneKeenPlus *pCKP) +{ +int newobject; +//int not_about_to_fall; +unsigned int i; + if (objects[o].needinit) + { // first time initilization + objects[o].ai.tank.state = TANK_WALK; + objects[o].ai.tank.movedir = RIGHT; + objects[o].ai.tank.fireafterlook = 0; + objects[o].ai.tank.animtimer = 0; + objects[o].ai.tank.timer = 0; + objects[o].ai.tank.dist_traveled = 0; + objects[o].ai.tank.timetillcanfire = TANK2_MAX_TIME_TILL_CAN_FIRE; + objects[o].ai.tank.firetimes = 0; + objects[o].ai.tank.detectedPlayer = 0; + objects[o].ai.tank.detectedPlayerIndex = primaryplayer; + + objects[o].canbezapped = 1; // will stop bullets but is not harmed + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + } + // touched player? + if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie) + { + killplayer(objects[o].touchedBy, pCKP); + } + + switch(objects[o].ai.tank.state) + { + case TANK_LOOK: + objects[o].sprite = TANK2_LOOK_FRAME + objects[o].ai.tank.frame; + // animation + if (objects[o].ai.tank.animtimer > TANK_LOOK_ANIM_TIME) + { + objects[o].ai.tank.frame ^= 1; + objects[o].ai.tank.animtimer = 0; + } else objects[o].ai.tank.animtimer++; + + // when time is up go back to moving + if (objects[o].ai.tank.timer > TANK_LOOK_TOTALTIME) + { + // decide what direction to go + if (objects[o].blockedr) + { objects[o].ai.tank.movedir = LEFT; } + else if (objects[o].blockedl) + { objects[o].ai.tank.movedir = RIGHT; } + else if (objects[o].x > player[0].x) + { objects[o].ai.tank.movedir = LEFT; } + else + { objects[o].ai.tank.movedir = RIGHT; } + + objects[o].ai.tank.alreadyfiredcauseonsamelevel = 0; + objects[o].ai.tank.timetillcanfire = (rand()%(TANK2_MAX_TIME_TILL_CAN_FIRE-TANK2_MIN_TIME_TILL_CAN_FIRE))+TANK2_MIN_TIME_TILL_CAN_FIRE; + objects[o].ai.tank.timetillcanfirecauseonsamelevel = TANK2_TIME_BEFORE_FIRE_WHEN_SEE; + objects[o].ai.tank.firetimes = 0; + objects[o].ai.tank.state = TANK_WALK; + objects[o].ai.tank.frame = 0; + objects[o].ai.tank.animtimer = 0; + objects[o].ai.tank.timer = 0; + objects[o].ai.tank.dist_traveled = 0; + } else objects[o].ai.tank.timer++; + break; + case TANK_WALK: + // is keen on same level? + objects[o].ai.tank.detectedPlayer = 0; + for(i=0;i= objects[o].y-(12<>CSF)+sprites[0].ysize <= (objects[o].y>>CSF)+sprites[objects[o].sprite].ysize+12) + { + objects[o].ai.tank.detectedPlayer = 1; + objects[o].ai.tank.detectedPlayerIndex = i; + break; + } + } + } + + if (objects[o].ai.tank.detectedPlayer) + { + // facing keen? + objects[o].ai.tank.alreadyfiredcauseonsamelevel = 1; + // are we facing him? + if (((player[objects[o].ai.tank.detectedPlayerIndex].x < objects[o].x) && objects[o].ai.tank.movedir==LEFT) || \ + ((player[objects[o].ai.tank.detectedPlayerIndex].x > objects[o].x) && objects[o].ai.tank.movedir==RIGHT)) + { // yes, we're facing him! FIRE!!! + if (!objects[o].ai.tank.firetimes) + { + if (!objects[o].ai.tank.timetillcanfirecauseonsamelevel) + { + objects[o].ai.tank.firetimes = TANK2_SHOTS_PER_VOLLEY; + objects[o].ai.tank.timetillnextshot = TANK2_PAUSE_BEFORE_FIRST_SHOT; + objects[o].ai.tank.timetillcanfire = (rand()%(TANK2_MAX_TIME_TILL_CAN_FIRE-TANK2_MIN_TIME_TILL_CAN_FIRE))+TANK2_MIN_TIME_TILL_CAN_FIRE; + objects[o].ai.tank.timetillcanfirecauseonsamelevel = TANK2_TIME_BETWEEN_FIRE_CAUSE_LEVEL; + } + else objects[o].ai.tank.timetillcanfirecauseonsamelevel--; + } + } + else + { + // no we're not facing him, on hard difficulty turn around + if (options[OPT_MEAN].value) + { + objects[o].ai.tank.frame = 0; + objects[o].ai.tank.timer = 0; + objects[o].ai.tank.animtimer = 0; + objects[o].ai.tank.state = TANK_LOOK; + } + } + } + else + { // no, not on same level + objects[o].ai.tank.alreadyfiredcauseonsamelevel = 0; + } + + // are we firing a volley? + if (objects[o].ai.tank.firetimes) + { + // is it time to fire the next shot in the volley? + if (!objects[o].ai.tank.timetillnextshot) + { + if (objects[o].onscreen) g_pSound->playStereofromCoord(SOUND_TANK_FIRE, PLAY_NOW, objects[o].scrx); + if (objects[o].ai.tank.movedir==RIGHT) + { + newobject = spawn_object(objects[o].x+(sprites[TANK2_WALK_RIGHT_FRAME].xsize< TANK_WALK_ANIM_TIME) + { + if (objects[o].ai.tank.frame>=3) objects[o].ai.tank.frame=0; + else objects[o].ai.tank.frame++; + objects[o].ai.tank.animtimer = 0; + } else objects[o].ai.tank.animtimer++; + break; + + } +} diff --git a/src/ai/teleport.cpp b/src/ai/teleport.cpp new file mode 100644 index 000000000..c218f473d --- /dev/null +++ b/src/ai/teleport.cpp @@ -0,0 +1,124 @@ +#include "../sdl/sound/CSound.h" +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +#include "../sdl/sound/CSound.h" + + +// Teleporter on world map +// (animates the teleporter and moves the player) +// (ep1&3) + +// rate at which the frame will change +//#define TELEPORTER_ANIM_RATE_EP3 35 //original speed +#define TELEPORTER_ANIM_RATE_EP3 16 +// number of times to change the frame before stopping +#define TELEPORTER_NUMFRAMES_EP3 16 + +#define TELEPORTER_ANIM_RATE_EP1 16 +#define TELEPORTER_NUMFRAMES_EP1 20 + +void teleporter_ai(int o, stLevelControl levelcontrol) +{ +int mx,my; +int timeout; +int animrate, numframes; + if (levelcontrol.episode!=3) + { + animrate = TELEPORTER_ANIM_RATE_EP1; + numframes = TELEPORTER_NUMFRAMES_EP1; + } + else + { + animrate = TELEPORTER_ANIM_RATE_EP3; + numframes = TELEPORTER_NUMFRAMES_EP3; + } + + if (objects[o].needinit) + { // first time initialization + objects[o].needinit = 0; + objects[o].canbezapped = 0; + objects[o].inhibitfall = 1; + + objects[o].sprite = BlankSprite; + objects[o].ai.teleport.animtimer = animrate + 1; + objects[o].ai.teleport.animframe = 0; + objects[o].ai.teleport.numframechanges = 0; + } + + if (objects[o].ai.teleport.animtimer > animrate) + { + mx = objects[o].x >> CSF >> 4; + my = objects[o].y >> CSF >> 4; + + objects[o].ai.teleport.animframe++; + objects[o].ai.teleport.animframe &= 3; + objects[o].ai.teleport.numframechanges++; + objects[o].ai.teleport.animtimer = 0; + + if (objects[o].ai.teleport.numframechanges > numframes) + { // animation and sound are done + map_chgtile(mx, my, objects[o].ai.teleport.idleframe); + if (objects[o].ai.teleport.direction==TELEPORTING_OUT) + { // teleporting out, go to new teleporter and new teleport in anim + objects[o].x = objects[o].ai.teleport.destx; + objects[o].y = objects[o].ai.teleport.desty; + player[objects[o].ai.teleport.whichplayer].x = objects[o].ai.teleport.destx; + player[objects[o].ai.teleport.whichplayer].y = objects[o].ai.teleport.desty; + player[objects[o].ai.teleport.whichplayer].pdir = DOWN; + objects[o].ai.teleport.direction = TELEPORTING_IN; + objects[o].needinit = 1; + g_pSound->playStereofromCoord(SOUND_TELEPORT, PLAY_NOW, objects[o].scrx); + // if we were told to snap the screen to the new position instead + // of scrolling over to it, do that. + if (objects[o].ai.teleport.snap) + { + timeout = 0; + while(gamedo_ScrollTriggers(primaryplayer)) + { + if (++timeout>10000) + { + crashflag = 1; + why_term_ptr = "teleport_ai(): timed out snapping screen to new position."; + return; + } + } + // white-out teleport flash + fade.mode = FADE_GO; + fade.dir = FADE_IN; + fade.curamt = PAL_FADE_WHITEOUT; + fade.fadetimer = 0; + fade.rate = FADE_FAST; + } + if (objects[o].ai.teleport.NoExitingTeleporter) + { // for the teleporter to exit the bonus area in ep1 + // which has no teleporter animation on the destination + goto tport_done; + } + } + else + { // tport in and anim end: teleport complete so destroy tport object +tport_done: ; + player[objects[o].ai.teleport.whichplayer].hideplayer = 0; + if (levelcontrol.tobonuslevel) + { + player[objects[o].ai.teleport.whichplayer].pdir = UP; + levelcontrol.tobonuslevel = 0; + } + objects[o].exists = 0; + } + return; + } + else + { // teleport animation is not done. show the next frame + map_chgtile(mx, my, objects[o].ai.teleport.baseframe + objects[o].ai.teleport.animframe); + } + } + else + { + objects[o].ai.teleport.animtimer++; + } + +} diff --git a/src/ai/vort.cpp b/src/ai/vort.cpp new file mode 100644 index 000000000..139927ccf --- /dev/null +++ b/src/ai/vort.cpp @@ -0,0 +1,354 @@ +#include "../sdl/sound/CSound.h" +#include "../keen.h" +#include "vort.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// Vorticon (all episodes, albeit the behavior changes slightly +// depending on levelcontrol.episode). + +// the color of the screen's border (for the flashing during the +// death sequence in ep1) +#ifdef TARGET_DOS + // for the DOS port, all the color "0"'s in the graphics + // are changed to 16's, which is set black, then the only + // thing on the screen that's color 0 is the VGA border. + #define BORDER_COLOR 0 + #define BORDER_R 0 + #define BORDER_G 0 + #define BORDER_B 0 + #define PAL_FLASH_DEC_AMT 48 +#else + // for the SDL ports, there is no border so we'll + // flash the grey background instead. + #define BORDER_COLOR 7 + #define BORDER_R 0xA8 + #define BORDER_G 0xA8 + #define BORDER_B 0xA8 + #define PAL_FLASH_DEC_AMT 32 +#endif + +void vort_initiatejump(int o); + +void vort_ai(int o, stCloneKeenPlus *pCKP, stLevelControl levelcontrol) +{ +int bonk,kill; + if (objects[o].needinit) + { // first time initilization + objects[o].ai.vort.frame = 0; + objects[o].ai.vort.animtimer = 0; + objects[o].ai.vort.state = VORT_LOOK; + objects[o].ai.vort.timer = 0; + objects[o].ai.vort.dist_traveled = VORT_TRAPPED_DIST+1; + objects[o].canbezapped = 1; + objects[o].needinit = 0; + + if (options[OPT_MEAN].value) + { + objects[o].ai.vort.ep1style = 1; + } + else objects[o].ai.vort.ep1style = 0; + + // copy in animation frame indexes for the current ep + if (levelcontrol.episode==1) + { + objects[o].ai.vort.WalkLeftFrame = VORT1_WALK_LEFT_FRAME; + objects[o].ai.vort.WalkRightFrame = VORT1_WALK_RIGHT_FRAME; + objects[o].ai.vort.LookFrame = VORT1_LOOK_FRAME; + objects[o].ai.vort.JumpRightFrame = VORT1_JUMP_RIGHT_FRAME; + objects[o].ai.vort.JumpLeftFrame = VORT1_JUMP_LEFT_FRAME; + objects[o].ai.vort.DyingFrame = VORT1_DYING_FRAME; + objects[o].ai.vort.ep1style = 1; + } + else if (levelcontrol.episode==2) + { + objects[o].ai.vort.WalkLeftFrame = VORT2_WALK_LEFT_FRAME; + objects[o].ai.vort.WalkRightFrame = VORT2_WALK_RIGHT_FRAME; + objects[o].ai.vort.LookFrame = VORT2_LOOK_FRAME; + objects[o].ai.vort.JumpRightFrame = VORT2_JUMP_RIGHT_FRAME; + objects[o].ai.vort.JumpLeftFrame = VORT2_JUMP_LEFT_FRAME; + objects[o].ai.vort.DyingFrame = VORT2_DYING_FRAME; + objects[o].ai.vort.DeadFrame = VORT2_DEAD_FRAME; + } + else if (levelcontrol.episode==3) + { + objects[o].ai.vort.WalkLeftFrame = VORT3_WALK_LEFT_FRAME; + objects[o].ai.vort.WalkRightFrame = VORT3_WALK_RIGHT_FRAME; + objects[o].ai.vort.LookFrame = VORT3_LOOK_FRAME; + objects[o].ai.vort.JumpRightFrame = VORT3_JUMP_RIGHT_FRAME; + objects[o].ai.vort.JumpLeftFrame = VORT3_JUMP_LEFT_FRAME; + objects[o].ai.vort.DyingFrame = VORT3_DYING_FRAME; + objects[o].ai.vort.DeadFrame = VORT3_DEAD_FRAME; + } + } + if (objects[o].ai.vort.state==VORT_DEAD) return; + + if (objects[o].canbezapped) + { + kill = 0; + // if we touch a glowcell, we die! + + if (objects[o].zapped >= VORT_HP && !levelcontrol.isfinallevel) kill = 1; + else if (objects[o].zapped >= VORT_COMMANDER_HP && levelcontrol.isfinallevel) kill = 1; + else if (objects[o].zapped && !objects[o].ai.vort.ep1style) kill = 1; + else if (levelcontrol.episode==2 && getmaptileat((objects[o].x>>CSF)+12, (objects[o].y>>CSF)+16)==TILE_GLOWCELL) + { + kill = 1; + } + if (kill) + { + objects[o].inhibitfall = 0; + objects[o].canbezapped = 0; + objects[o].ai.vort.animtimer = 0; + objects[o].ai.vort.frame = 0; + objects[o].ai.vort.palflashtimer = VORT_PALETTE_FLASH_TIME + 1; + objects[o].ai.vort.palflashamt = 255; + if (levelcontrol.episode == 1) + { + objects[o].ai.vort.state = VORT_DYING; + //pal_set(BORDER_COLOR, 255, objects[o].ai.vort.palflashamt, objects[o].ai.vort.palflashamt); + //pal_apply(); + fade.mode = FADE_GO; + fade.dir = FADE_IN; + fade.curamt = PAL_FADE_WHITEOUT; + fade.fadetimer = 0; + fade.rate = FADE_SLOW; + } + else + { + objects[o].ai.vort.state = VORT2_DYING; + if (options[OPT_MEAN].value) + { + fade.mode = FADE_GO; + fade.dir = FADE_IN; + fade.curamt = PAL_FADE_WHITEOUT; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + } + } + g_pSound->playStereofromCoord(SOUND_VORT_DIE, PLAY_NOW, objects[o].scrx); + } + } + // deadly to the touch + if (objects[o].touchPlayer && objects[o].canbezapped) + { + killplayer(objects[o].touchedBy, pCKP); + } + +vort_reprocess: ; + switch(objects[o].ai.vort.state) + { + case VORT_JUMP: + if (objects[o].ai.vort.movedir == RIGHT) + { + if (!objects[o].blockedr) objects[o].x += VORT_WALK_SPEED; + } + else + { + if (!objects[o].blockedl) objects[o].x -= VORT_WALK_SPEED; + } + + if (objects[o].ai.vort.inertiay>0 && objects[o].blockedd) + { // The Vorticon Has Landed! + objects[o].inhibitfall = 0; + objects[o].ai.vort.state = VORT_LOOK; + goto vort_reprocess; + } + // check if the vorticon has bonked into a ceiling, if so, + // immediately terminate the jump + bonk = 0; + + if (TileProperty[getmaptileat((objects[o].x>>CSF)+1, (objects[o].y>>CSF))][BDOWN]) bonk = 1; + else if (TileProperty[getmaptileat((objects[o].x>>CSF)+16, (objects[o].y>>CSF))][BDOWN]) bonk = 1; + else if (TileProperty[getmaptileat((objects[o].x>>CSF)+23, (objects[o].y>>CSF))][BDOWN]) bonk = 1; + + + if (bonk && objects[o].ai.vort.inertiay < 0) + { + objects[o].ai.vort.inertiay = 0; + } + + // apply Y inertia + objects[o].y += objects[o].ai.vort.inertiay; + + if (objects[o].ai.vort.timer > VORT_JUMP_FRICTION) + { // slowly decrease upgoing rate + if (objects[o].ai.vort.inertiay VORT_LOOK_ANIM_TIME) + { + if (objects[o].ai.vort.frame>0) + { + if (objects[o].blockedl) + { objects[o].ai.vort.movedir = RIGHT; } + else if (objects[o].blockedr) + { objects[o].ai.vort.movedir = LEFT; } + else + { // not blocked on either side, head towards player + // player[primaryplayer].useObject!!! + + if ((objects[player[primaryplayer].useObject].x) < (objects[o].x)) + { objects[o].ai.vort.movedir = LEFT; } + else + { objects[o].ai.vort.movedir = RIGHT; } + } + objects[o].ai.vort.timer = 0; + objects[o].ai.vort.frame = 0; + objects[o].ai.vort.state = VORT_WALK; + } else objects[o].ai.vort.frame++; + objects[o].ai.vort.animtimer = 0; + } else objects[o].ai.vort.animtimer++; + break; + case VORT_WALK: + objects[o].ai.vort.dist_traveled++; + + if (rand()%VORT_JUMP_PROB == (VORT_JUMP_PROB/2)) + { // let's jump. + if (!levelcontrol.dark && !objects[o].blockedu) + { + vort_initiatejump(o); + goto vort_reprocess; + } + } + if (objects[o].ai.vort.movedir==LEFT) + { // move left + objects[o].sprite = objects[o].ai.vort.WalkLeftFrame + objects[o].ai.vort.frame; + + if (!objects[o].blockedl) + { + objects[o].x -= VORT_WALK_SPEED; + } + else + { + objects[o].ai.vort.frame = 0; + objects[o].ai.vort.animtimer = 0; + objects[o].ai.vort.state = VORT_LOOK; + + // if we only traveled a tiny amount before hitting a wall, we've + // probably fallen into a small narrow area, and we need to try + // to jump out of it + if (objects[o].ai.vort.dist_traveled < VORT_TRAPPED_DIST && !levelcontrol.dark && objects[o].blockedd && !objects[o].blockedu) + { + vort_initiatejump(o); + if (rand()&1) + { + objects[o].ai.vort.inertiay = -VORT_MAX_JUMP_HEIGHT; + } + else + { + objects[o].ai.vort.inertiay = -VORT_MIN_JUMP_HEIGHT; + } + goto vort_reprocess; + } + else objects[o].ai.vort.dist_traveled = 0; + } + } + else + { // move right + objects[o].sprite = objects[o].ai.vort.WalkRightFrame + objects[o].ai.vort.frame; + + if (!objects[o].blockedr) + { + objects[o].x += VORT_WALK_SPEED; + } + else + { + objects[o].ai.vort.frame = 0; + objects[o].ai.vort.animtimer = 0; + objects[o].ai.vort.state = VORT_LOOK; + + if (objects[o].ai.vort.dist_traveled < VORT_TRAPPED_DIST && !levelcontrol.dark && objects[o].blockedd && !objects[o].blockedu) + { + vort_initiatejump(o); + if (rand()&1) + { + objects[o].ai.vort.inertiay = -VORT_MAX_JUMP_HEIGHT; + } + else + { + objects[o].ai.vort.inertiay = -VORT_MIN_JUMP_HEIGHT; + } + goto vort_reprocess; + } + else objects[o].ai.vort.dist_traveled = 0; + } + } + // walk animation + if (objects[o].ai.vort.animtimer > VORT_WALK_ANIM_TIME) + { + if (objects[o].ai.vort.frame>=3) objects[o].ai.vort.frame=0; + else objects[o].ai.vort.frame++; + objects[o].ai.vort.animtimer = 0; + } else objects[o].ai.vort.animtimer++; + break; + case VORT_DYING: + objects[o].sprite = objects[o].ai.vort.DyingFrame + objects[o].ai.vort.frame; + + if (levelcontrol.isfinallevel&&levelcontrol.episode==1) + { + pCKP->Control.levelcontrol.canexit = 1; + } + + if (objects[o].ai.vort.animtimer > VORT_DIE_ANIM_TIME) + { + objects[o].ai.vort.palflashamt -= PAL_FLASH_DEC_AMT; + if (levelcontrol.episode!=2) + { +// pal_set(BORDER_COLOR, 212, objects[o].ai.vort.palflashamt, objects[o].ai.vort.palflashamt); +// pal_apply(); + } + + objects[o].ai.vort.frame++; + if (objects[o].ai.vort.frame>=6) + { +// pal_set(BORDER_COLOR, BORDER_R, BORDER_G, BORDER_B); +// pal_apply(); + objects[o].ai.vort.state = VORT_DEAD; + } + objects[o].ai.vort.animtimer = 0; + } else objects[o].ai.vort.animtimer++; + break; + case VORT2_DYING: + objects[o].sprite = objects[o].ai.vort.DyingFrame; + if (objects[o].ai.vort.animtimer > VORT2_DIE_ANIM_TIME) + { + objects[o].sprite = objects[o].ai.vort.DeadFrame; + objects[o].ai.vort.state = VORT_DEAD; + } + else + { + objects[o].ai.vort.animtimer++; + } + break; + default: break; + } +} + +void vort_initiatejump(int o) +{ + // must be standing on floor to jump + if (!objects[o].blockedd) return; + + objects[o].ai.vort.frame = 0; + objects[o].ai.vort.animtimer = 0; + objects[o].ai.vort.inertiay = \ + -((rand()%(VORT_MAX_JUMP_HEIGHT-VORT_MIN_JUMP_HEIGHT))+VORT_MIN_JUMP_HEIGHT); + + if (objects[o].ai.vort.movedir==RIGHT) + objects[o].sprite = objects[o].ai.vort.JumpRightFrame; + else + objects[o].sprite = objects[o].ai.vort.JumpLeftFrame; + + objects[o].inhibitfall = 1; + objects[o].ai.vort.state = VORT_JUMP; +} diff --git a/src/ai/vort.h b/src/ai/vort.h new file mode 100644 index 000000000..ec9bb4410 --- /dev/null +++ b/src/ai/vort.h @@ -0,0 +1,54 @@ +#define VORT_WALK 0 +#define VORT_JUMP 1 +#define VORT_LOOK 2 +#define VORT_DYING 3 +#define VORT_DEAD 4 +// die animation for ep2 +#define VORT2_DYING 5 + +#define VORT_JUMP_PROB 450 + +#define VORT_MIN_JUMP_HEIGHT 15 +#define VORT_MAX_JUMP_HEIGHT 25 +#define VORT_MAX_FALL_SPEED 20 +#define VORT_JUMP_FRICTION 5 +#define VORT_JUMP_SPEED 0 + +#define VORT_WALK_SPEED 5 +#define VORT_WALK_ANIM_TIME 60 + +// number of shots to kill +#define VORT_HP 4 +#define VORT_COMMANDER_HP 99 + +#define VORT_DIE_ANIM_TIME 125 +#define VORT2_DIE_ANIM_TIME 125 + +#define VORT_LOOK_ANIM_TIME 60 + +#define VORT1_WALK_LEFT_FRAME 70 +#define VORT1_WALK_RIGHT_FRAME 74 +#define VORT1_LOOK_FRAME 78 +#define VORT1_JUMP_RIGHT_FRAME 80 +#define VORT1_JUMP_LEFT_FRAME 81 +#define VORT1_DYING_FRAME 82 + +#define VORT2_WALK_LEFT_FRAME 74 +#define VORT2_WALK_RIGHT_FRAME 78 +#define VORT2_LOOK_FRAME 82 +#define VORT2_JUMP_RIGHT_FRAME 84 +#define VORT2_JUMP_LEFT_FRAME 85 +#define VORT2_DYING_FRAME 86 +#define VORT2_DEAD_FRAME 87 + +#define VORT3_WALK_LEFT_FRAME 63 +#define VORT3_WALK_RIGHT_FRAME 67 +#define VORT3_LOOK_FRAME 71 +#define VORT3_JUMP_RIGHT_FRAME 73 +#define VORT3_JUMP_LEFT_FRAME 74 +#define VORT3_DYING_FRAME 75 +#define VORT3_DEAD_FRAME 76 + +#define VORT_PALETTE_FLASH_TIME 5 + +#define VORT_TRAPPED_DIST 150 diff --git a/src/ai/walker.cpp b/src/ai/walker.cpp new file mode 100644 index 000000000..8c5070d6f --- /dev/null +++ b/src/ai/walker.cpp @@ -0,0 +1,390 @@ +#include "../sdl/sound/CSound.h" +#include "../keen.h" +#include "../include/game.h" + +#include "../include/enemyai.h" + +// The red creatures that follow the wall (ep2) + +#define WALKER_WALK 0 // walking +#define WALKER_FALLING 1 // oops, we fell off! +#define WALKER_DYING 2 // getting fried! +#define WALKER_DEAD 3 // dead walker! here's a dead walker! + +#define WALKER_WALK_ANIM_TIME 50 +#define WALKER_WALK_SPEED 4 + +#define WALKER_FALLSPDINCRATE 2 +#define WALKER_MIN_FALL_SPEED 10 +#define WALKER_MAX_FALL_SPEED 25 + +#define WALKERDIE_START_INERTIA -10 +#define WALKERDIE_INERTIA_DECREASE 2 + +#define WALKERPUSHAMOUNT 7 + +// frames +#define WALKER_WALK_LEFT 102 +#define WALKER_WALK_UP 104 +#define WALKER_WALK_RIGHT 106 +#define WALKER_WALK_DOWN 108 +#define WALKER_FRY_FRAME 110 +#define WALKER_DEAD_FRAME 111 + +void Walker_TurnOnCansupportWhereNotKicked(int o); + +void walker_ai(int o, stLevelControl levelcontrol) +{ +unsigned int p; +unsigned int i=0; +//int supportingsomebody; +int nopush; +int /*til,*/floor; + + if (objects[o].needinit) + { // first time initilization + objects[o].ai.walker.walkdir = LEFT; + objects[o].ai.walker.state = WALKER_WALK; + objects[o].ai.walker.walkframe = 0; + objects[o].ai.walker.animtimer = 0; + objects[o].inhibitfall = 1; + objects[o].needinit = 0; + objects[o].canbezapped = 1; + objects[o].y = (objects[o].y>>CSF>>4)<<4< objects[o].y || !player[p].pfalling || player[p].pjumping) + { + objects[o].cansupportplayer[p] = 1; + objects[o].ai.walker.kickedplayer[p] = 0; + } + } + } + + // push player horizontally + if (objects[o].touchPlayer && !player[objects[o].touchedBy].pdie &&\ + player[i].psupportingobject!=o) + { + nopush = 0; + /* don't push the player if he's standing on top of the walker */ + if (player[objects[o].touchedBy].pfalling) + { + if (objects[0].scry+sprites[0].ysize >\ + objects[o].scry+(sprites[objects[o].sprite].ysize>>1)) + { + nopush = 1; + } + } + /* don't push the player as he falls through us during a kick-off */ + else if (objects[o].ai.walker.kickedplayer[objects[o].touchedBy]) + { + nopush = 1; + } + /* don't push the player as he's walking through the exit door */ + else if (levelcontrol.level_done && levelcontrol.level_finished_by == objects[o].touchedBy) + { + nopush = 1; + } + + if (!nopush) + { + if (player[objects[o].touchedBy].x < objects[o].x) + { + player[objects[o].touchedBy].playpushed_x = -WALKERPUSHAMOUNT; + if (player[objects[o].touchedBy].pinertia_x > 0) player[objects[o].touchedBy].pinertia_x = 0; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + } + else + { + player[objects[o].touchedBy].playpushed_x = WALKERPUSHAMOUNT; + if (player[objects[o].touchedBy].pinertia_x < 0) player[objects[o].touchedBy].pinertia_x = 0; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + } + } + } + + if (objects[o].canbezapped) + { + // if we touch a glowcell, we die! + if (getmaptileat((objects[o].x>>CSF)+8, (objects[o].y>>CSF)+8)==TILE_GLOWCELL) + { + objects[o].ai.walker.state = WALKER_DYING; + objects[o].ai.walker.dietimer = 0; + objects[o].zapped = 0; + objects[o].canbezapped = 0; + } + // die if shot + if (objects[o].zapped) + { + objects[o].ai.walker.state = WALKER_DYING; + objects[o].ai.walker.dietimer = 0; + objects[o].zapped = 0; + objects[o].canbezapped = 0; + objects[o].y -= 10; + objects[o].ai.walker.walkerdie_inertia_y = WALKERDIE_START_INERTIA; + g_pSound->playStereofromCoord(SOUND_SHOT_HIT, PLAY_NOW, objects[o].scrx); + } + } + + switch(objects[o].ai.walker.state) + { + case WALKER_DYING: + SetAllCanSupportPlayer(o, 0); + objects[o].sprite = WALKER_FRY_FRAME; + objects[o].y += objects[o].ai.walker.walkerdie_inertia_y; + if (objects[o].ai.walker.dietimer>WALKERDIE_INERTIA_DECREASE) + { + if (objects[o].ai.walker.walkerdie_inertia_y < WALKER_MAX_FALL_SPEED) + { + objects[o].ai.walker.walkerdie_inertia_y++; + } + objects[o].ai.walker.dietimer = 0; + } + else objects[o].ai.walker.dietimer++; + if (objects[o].ai.walker.walkerdie_inertia_y >= 0 && objects[o].blockedd) + { + objects[o].sprite = WALKER_DEAD_FRAME; + objects[o].ai.walker.state = WALKER_DEAD; + objects[o].y = (objects[o].y>>CSF>>4)<<4<>CSF)+4, (player[i].y>>CSF)+sprites[0].ysize)][BUP]) + //if (!tiles[getmaptileat((player[i].x>>CSF)+4, (player[i].y>>CSF)+sprites[0].ysize)].solidfall) + { // lower-left isn't solid + if (TileProperty[getmaptileat((player[i].x>>CSF)+12, (player[i].y>>CSF)+sprites[0].ysize)][BUP]) + //if (tiles[getmaptileat((player[i].x>>CSF)+12, (player[i].y>>CSF)+sprites[0].ysize)].solidfall) + { + floor = 1; + } + } + else floor = 1; + + if (!floor) + { + player[i].y += WALKER_WALK_SPEED; + } + } + } + } + break; + case UP: + objects[o].sprite = WALKER_WALK_UP + objects[o].ai.walker.walkframe; + if (!objects[o].blockedl) + { + objects[o].ai.walker.walkdir = LEFT; + objects[o].sprite = WALKER_WALK_LEFT + objects[o].ai.walker.walkframe; + Walker_TurnOnCansupportWhereNotKicked(o); + objects[o].x -= (2<>CSF>>4)<<4)+1)< WALKER_WALK_ANIM_TIME) + { + objects[o].ai.walker.walkframe ^= 1; + objects[o].ai.walker.animtimer = 0; + } else objects[o].ai.walker.animtimer++; + break; + case WALKER_FALLING: + objects[o].sprite = WALKER_WALK_DOWN; + if (objects[o].blockedd) + { + objects[o].ai.walker.walkdir = LEFT; + objects[o].ai.walker.state = WALKER_WALK; + objects[o].ai.walker.walkframe = 0; + objects[o].ai.walker.animtimer = 0; + Walker_TurnOnCansupportWhereNotKicked(o); + } + else + { + if (objects[o].ai.walker.fallinctimer > WALKER_FALLSPDINCRATE) + { + if (objects[o].ai.walker.fallspeed < WALKER_MAX_FALL_SPEED) + { + objects[o].ai.walker.fallspeed++; + } + objects[o].ai.walker.fallinctimer = 0; + } else objects[o].ai.walker.fallinctimer++; + + objects[o].y += objects[o].ai.walker.fallspeed; + } + break; + } + + // sometimes it's possible for a walker to fall off, for example + // if it's walking left on a platform that has solidfall but not solidlr, + // then turns to walk down. in this case we need to go into a falling + // state and fall until we reach solid ground again. this keeps it from + // freaking out and going flying across the screen. + if (!objects[o].blockedl && !objects[o].blockedr &&\ + !objects[o].blockedu && !objects[o].blockedd) + { + if (objects[o].ai.walker.state!=WALKER_FALLING) + { + objects[o].ai.walker.fallinctimer = 0; + objects[o].ai.walker.fallspeed = WALKER_MIN_FALL_SPEED; + objects[o].ai.walker.state = WALKER_FALLING; + SetAllCanSupportPlayer(o, 0); + } + } +} + +void Walker_TurnOnCansupportWhereNotKicked(int o) +{ +unsigned int i; + for(i=0;i>CSF)+16 < (objects[o].y>>CSF)+12) + { + player[objects[o].touchedBy].ppogostick = 0; // No pogo, You get it disabled at this point + g_pSound->playStereofromCoord(SOUND_YORP_STUN, PLAY_NOW, objects[o].scrx); + objects[o].ai.yorp.state = YORP_STUNNED; + objects[o].ai.yorp.looktimes = 0; + objects[o].ai.yorp.timer = 0; + objects[o].ai.yorp.lookposition = 0; + // make the yorp look a little less "soft" by + // offering a bit of resistance + // (actually, having keen do a small jump) + player[objects[o].touchedBy].pjumptime = 0; + player[objects[o].touchedBy].pjumpupdecreaserate = 0; + player[objects[o].touchedBy].pjumpupspeed = 7; + player[objects[o].touchedBy].pjumping = PJUMPUP; + player[objects[o].touchedBy].pjumpupspeed_decreasetimer = 0; + player[objects[o].touchedBy].pjustjumped = 1; + } + } + else + { + if (!levelcontrol.level_done || levelcontrol.level_finished_by != objects[o].touchedBy) + { + // if yorp is moving, also push in direction he's moving + // in. this allows walking through a yorp if he is walking + // away from Keen + if (objects[o].ai.yorp.state==YORP_MOVE) + { + g_pSound->playStereofromCoord(SOUND_YORP_BUMP, PLAY_NOW, objects[o].scrx); + if (player[objects[o].touchedBy].pshowdir==objects[o].ai.yorp.movedir) + pushamt = 12; + else + pushamt = YORPPUSHAMOUNT+player[objects[o].touchedBy].pwalking*8; + + if (objects[o].ai.yorp.movedir==LEFT) + goto bump_left; + else + goto bump_right; + } + // else, always push keen away from the yorp + + g_pSound->playStereofromCoord(SOUND_YORP_BUMP, PLAY_NORESTART, objects[o].scrx); + pushamt = YORPPUSHAMOUNT; + if (player[objects[o].touchedBy].x < objects[o].x) + { + bump_left: ; + player[objects[o].touchedBy].playpushed_x = -pushamt; + if (options[OPT_MEAN].value) player[objects[o].touchedBy].playpushed_x -= YORPPUSHAMOUNT_FAST; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + if (!player[objects[o].touchedBy].pjumping) + { + player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = LEFT; + } + } + else + { + bump_right: ; + player[objects[o].touchedBy].playpushed_x = pushamt; + if (options[OPT_MEAN].value) player[objects[o].touchedBy].playpushed_x += YORPPUSHAMOUNT_FAST; + player[objects[o].touchedBy].playpushed_decreasetimer = 0; + if (!player[objects[o].touchedBy].pjumping) + { + player[objects[o].touchedBy].pdir = player[objects[o].touchedBy].pshowdir = RIGHT; + } + } + } + } + } + } + +#define YORPDIE_START_INERTIA -10 +#define YORPDIE_MAX_INERTIA 32 +#define YORPDIE_INERTIA_DECREASE 2 + // did the yorp get shot? + if (objects[o].zapped) + { + // what'd you kill an innocent yorp for, you emotionless bastard! + objects[o].ai.yorp.state = YORP_DYING; + objects[o].ai.yorp.dietimer = 0; + objects[o].canbezapped = 0; + objects[o].sprite = YORP_DYING_FRAME; + objects[o].zapped--; + objects[o].ai.yorp.yorpdie_inertia_y = YORPDIE_START_INERTIA; + objects[o].y -= 10; + objects[o].inhibitfall = 1; + g_pSound->playStereofromCoord(SOUND_VORT_DIE, PLAY_NOW, objects[o].scrx); + } + + switch(objects[o].ai.yorp.state) + { + case YORP_DYING: + objects[o].y += objects[o].ai.yorp.yorpdie_inertia_y; + if (objects[o].ai.yorp.dietimer>YORPDIE_INERTIA_DECREASE) + { + if (objects[o].ai.yorp.yorpdie_inertia_y < YORPDIE_MAX_INERTIA) + objects[o].ai.yorp.yorpdie_inertia_y++; + objects[o].ai.yorp.dietimer = 0; + } + else objects[o].ai.yorp.dietimer++; + if (objects[o].ai.yorp.yorpdie_inertia_y >= 0 && objects[o].blockedd) + { + objects[o].sprite = YORP_DEAD_FRAME; + objects[o].ai.yorp.state = YORP_DEAD; + } + break; + case YORP_LOOK: + if (options[OPT_MEAN].value) numlooks = YORP_NUM_LOOKS_FAST; else numlooks = YORP_NUM_LOOKS; + if (objects[o].ai.yorp.looktimes>numlooks &&\ + objects[o].ai.yorp.timer==YORP_LOOK_TIME-(YORP_LOOK_TIME/4)) + { + // 75% prob, try to head towards Keen... + if (player[primaryplayer].x < objects[o].x) + { objects[o].ai.yorp.movedir = LEFT; } + else + { objects[o].ai.yorp.movedir = RIGHT; } + if (rand()%3==1) + { // 25% prob go the other way + objects[o].ai.yorp.movedir ^= 1; + } + // unless we're can't go that way + if (objects[o].blockedl) objects[o].ai.yorp.movedir = RIGHT; + if (objects[o].blockedr) objects[o].ai.yorp.movedir = LEFT; + + objects[o].ai.yorp.timer = 0; + objects[o].ai.yorp.walkframe = 0; + objects[o].ai.yorp.dist_traveled = 0; + objects[o].ai.yorp.state = YORP_MOVE; + } + + if (!objects[o].ai.yorp.timer) + { + switch(objects[o].ai.yorp.lookposition) + { + case 0: objects[o].sprite = YORP_LOOK_LEFT; break; + case 1: objects[o].sprite = YORP_STAND; break; + case 2: objects[o].sprite = YORP_LOOK_RIGHT; break; + case 3: objects[o].sprite = YORP_STAND; break; + } + objects[o].ai.yorp.looktimes++; + + if (++objects[o].ai.yorp.lookposition>3) + objects[o].ai.yorp.lookposition=0; + objects[o].ai.yorp.timer=YORP_LOOK_TIME; + } else objects[o].ai.yorp.timer--; + break; + case YORP_MOVE: + #define YORP_LOOK_PROB 1000 + #define YORP_MINTRAVELDIST 1000 + if (objects[o].ai.yorp.dist_traveled > YORP_MINTRAVELDIST) + { + if (rand()%YORP_LOOK_PROB==(YORP_LOOK_PROB/2)) + { + objects[o].ai.yorp.looktimes = 0; + objects[o].ai.yorp.timer = 0; + objects[o].ai.yorp.lookposition = 1; + objects[o].ai.yorp.state = YORP_LOOK; + break; + } + } + + if (objects[o].blockedd) + if (rand()%YORP_JUMP_PROB==1) + { + objects[o].yinertia = YORP_JUMP_HEIGHT - (rand()%3); + objects[o].y--; + } + + if (objects[o].ai.yorp.movedir==LEFT) + { // yorp is walking left + objects[o].sprite = YORP_WALK_LEFT + objects[o].ai.yorp.walkframe; + if (!objects[o].blockedl) + { + if (options[OPT_MEAN].value) + objects[o].x -= YORP_WALK_SPEED_FAST; + else + objects[o].x -= YORP_WALK_SPEED; + + objects[o].ai.yorp.dist_traveled++; + } + else + { + objects[o].ai.yorp.looktimes = 4; + objects[o].ai.yorp.timer = 0; + objects[o].ai.yorp.lookposition = 1; + objects[o].ai.yorp.state = YORP_LOOK; + } + } + else + { // yorp is walking right + objects[o].sprite = YORP_WALK_RIGHT + objects[o].ai.yorp.walkframe; + if (!objects[o].blockedr) + { + if (options[OPT_MEAN].value) + objects[o].x += YORP_WALK_SPEED_FAST; + else + objects[o].x += YORP_WALK_SPEED; + objects[o].ai.yorp.dist_traveled++; + } + else + { + objects[o].ai.yorp.looktimes = 4; + objects[o].ai.yorp.timer = 0; + objects[o].ai.yorp.lookposition = 1; + objects[o].ai.yorp.state = YORP_LOOK; + } + } + // walk animation + if (objects[o].ai.yorp.timer > YORP_WALK_ANIM_TIME || \ + (objects[o].ai.yorp.timer > YORP_WALK_ANIM_TIME_FAST && options[OPT_MEAN].value)) + { + objects[o].ai.yorp.walkframe ^= 1; + objects[o].ai.yorp.timer = 0; + } else objects[o].ai.yorp.timer++; + break; + case YORP_STUNNED: + objects[o].sprite = YORP_STUNFRAME + objects[o].ai.yorp.walkframe; + if (objects[o].ai.yorp.timer > YORP_STUN_ANIM_TIME) + { + if (options[OPT_MEAN].value) numlooks = YORP_STUNTIME_FAST; else numlooks = YORP_STUNTIME; + if (objects[o].ai.yorp.looktimes>numlooks) + { + objects[o].ai.yorp.looktimes = 0; + objects[o].ai.yorp.timer = 0; + objects[o].ai.yorp.lookposition = 1; + objects[o].ai.yorp.state = YORP_LOOK; + } else objects[o].ai.yorp.looktimes++; + objects[o].ai.yorp.walkframe ^= 1; + objects[o].ai.yorp.timer = 0; + } else objects[o].ai.yorp.timer++; + break; + } +} diff --git a/src/demobox.h b/src/demobox.h new file mode 100644 index 000000000..47ada6c9a --- /dev/null +++ b/src/demobox.h @@ -0,0 +1,50 @@ +/* demobox.h */ +// This file contains the image data for the 'demo' box +// shown on the screen while a demo is in progress. +// This is stored seperatly from the rest of the graphics +// because the original keen games did not have a demo and +// so EGALATCH contains no 'DEMO' graphics. + +// Created by MAKEDMOH.BAS 03-22-2004 14:57:54 + +#define DEMOBOX_WIDTH 48 +#define DEMOBOX_HEIGHT 16 + +unsigned char demobox_image[768] = { \ + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, \ + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, \ + 15,15,15,12,12,12,12,12,12,15,15,15,15,12,12,12,12,12,12,12,15,15,12,15,15,15,15,15,15,15,12,15,15,15,15,12,12,12,12,15,15,15,15,15,15,15,15,15,15, \ + 15,15,12,12,15,15,15,12,12,15,15,15,12,12,15,15,15,15,15,15,15,12,12,15,15,15,15,15,12,12,15,15,15,12,12,15,15,12,12,15,15,15,15,15,15,15,15,15,15, \ + 15,12,12,15,15,15,15,12,12,15,15,12,12,15,15,15,15,15,15,15,12,12,12,15,15,15,12,12,12,15,15,12,12,15,15,15,15,12,12,15,15,15,15,15,15,15,15,15,15, \ + 12,12,15,15,15,15,12,12,15,15,12,12,12,12,12,12,15,15,15,12,12,15,12,15,12,15,12,12,15,15,12,12,15,15,15,15,12,12,15,15,15,15,15,15,15,15,15,15,12, \ + 12,15,15,15,15,12,12,15,15,12,12,15,15,15,15,15,15,15,12,12,15,15,12,15,15,12,12,15,15,12,12,15,15,15,15,12,12,15,15,15,15,15,15,15,15,15,15,12,12, \ + 15,15,15,15,12,12,15,15,12,12,15,15,15,15,15,15,15,12,12,15,15,12,15,15,12,12,15,15,12,12,15,15,15,15,12,12,15,15,15,15,15,15,15,15,15,15,12,12,15, \ + 15,15,12,12,15,15,15,12,12,15,15,15,15,15,15,15,12,12,15,15,15,15,15,12,12,15,15,15,12,12,15,15,12,12,15,15,15,15,15,15,15,15,15,15,15,12,12,12,12, \ + 12,12,15,15,15,15,12,12,12,12,12,12,12,15,15,12,12,15,15,15,15,15,12,12,15,15,15,15,12,12,12,12,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, \ + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4, \ + 4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,15,4 ,4 ,12,12,12,12,12,12,12,12,12,12, \ + 12,12,12,12,12,12,15,12,12,15,15,15,15,15,15,12,12,15,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,4 ,4 ,15,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4, \ + 4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 ,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, \ + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, \ + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, \ +}; + +char demobox_mask[768] = { \ + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , \ + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , \ + 0 ,0 ,0 ,0 ,0 ,15,15,15,15,15,15,0 ,0 ,0 ,0 ,15,15,15,15,15,15,15,0 ,0 ,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,0 ,0 ,0 ,0 ,15,15,15,15,0 ,0 ,0 ,0 ,0 ,0 ,0 , \ + 0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,15,15,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,15,15,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 ,0 , \ + 0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,15,15,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,15,15,0 ,0 ,0 ,15,15,15,0 ,0 ,15,15,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 , \ + 0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,15,15,0 ,0 ,15,15,15,15,15,15,0 ,0 ,0 ,15,15,0 ,15,0 ,15,0 ,15,15,0 ,0 ,15,15,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 , \ + 0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,15,15,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,15,0 ,0 ,15,15,0 ,0 ,15,15,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 , \ + 0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,15,15,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,15,0 ,0 ,15,15,0 ,0 ,15,15,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 , \ + 0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,15,15,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,15,15,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 ,0 , \ + 0 ,0 ,0 ,0 ,0 ,15,15,15,15,15,15,0 ,0 ,0 ,0 ,15,15,15,15,15,15,15,0 ,0 ,15,15,0 ,0 ,0 ,0 ,0 ,15,15,0 ,0 ,0 ,0 ,15,15,15,15,0 ,0 ,0 ,0 ,0 ,0 ,0 , \ + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , \ + 0 ,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,0 , \ + 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, \ + 0 ,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,0 , \ + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , \ + 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , \ +}; + diff --git a/src/eseq_ep1.cpp b/src/eseq_ep1.cpp new file mode 100644 index 000000000..5f31058aa --- /dev/null +++ b/src/eseq_ep1.cpp @@ -0,0 +1,442 @@ +/* ESEQ_EP1.C + Ending sequence for Episode 1. +*/ + +#include "keen.h" +#include "include/game.h" +#include "include/gamedo.h" +#include "include/gamepdo.h" +#include "sdl/CInput.h" +#include "sdl/CTimer.h" +#include "include/eseq_ep1.h" +#include "include/eseq_ep2.h" +#include "include/menu.h" +#include "CGraphics.h" + +#define CMD_MOVE 0 +#define CMD_WAIT 1 +#define CMD_SPAWNSPR 2 +#define CMD_REMOVESPR 3 +#define CMD_FADEOUT 4 +#define CMD_ENDOFQUEUE 5 +#define CMD_ENABLESCROLLING 6 +#define CMD_DISABLESCROLLING 7 + + +// start x,y map scroll position for eseq1_ShipFlys() +#define SHIPFLY_X 32 +#define SHIPFLY_Y 0 + +// worldmap scroll position for eseq1_ReturnsToShip() +#define WM_X 40 +#define WM_Y 540 + +#define LETTER_SHOW_SPD 30 +#define RETURNTOSHIP_WAIT_TIME 600 + +#define SPR_SHIP_RIGHT 115 +#define SPR_SHIP_LEFT 116 +#define SPR_EXCLAMATION 117 +#define SPR_QUESTION 118 +#define SHIPSPD 4 + +#define BACKHOME_SHORT_WAIT_TIME 250 + +int eseq1_ReturnsToShip(stCloneKeenPlus *pCKP) +{ +int i; + + for(i=0;iControl.levelcontrol.levels_completed[i] = 0; + + showmapatpos(80, WM_X, WM_Y, 0, pCKP); + + // draw keen next to his ship + g_pGraphics->drawSprite(168, 85, PMAPLEFTFRAME, 0); + // do not show player when we render the screen + numplayers = 1; + player[0].x = 0; + player[0].y = 0; + player[0].playframe = BlankSprite; + // all objects -> nonexistant + for(i=0;ipollEvents(); + g_pTimer->SpeedThrottle(); + } while(fade.mode != FADE_COMPLETE && !g_pInput->getPressedKey(KQUIT)); + + return 0; +} + + +void addshipqueue(int cmd, int time, int flag1) +{ + shipqueue[ShipQueuePtr].cmd = cmd; + shipqueue[ShipQueuePtr].time = time; + shipqueue[ShipQueuePtr].flag1 = flag1; + ShipQueuePtr++; +} + +int eseq1_ShipFlys(stCloneKeenPlus *pCKP) +{ +char enter,lastenterstate; +int x, y; +int scrollingon; + + scrollingon = 1; + + #define MARK_SPR_NUM 5 + initgame(pCKP); + + // set up the ship's route + ShipQueuePtr = 0; + addshipqueue(CMD_MOVE, 230, DUP); + addshipqueue(CMD_WAIT, 50, 0); + addshipqueue(CMD_MOVE, 2690, DDOWNRIGHT); + addshipqueue(CMD_WAIT, 100, 0); + addshipqueue(CMD_MOVE, 480, DDOWN); + addshipqueue(CMD_WAIT, 150, 0); + addshipqueue(CMD_SPAWNSPR, 0, SPR_QUESTION); + addshipqueue(CMD_DISABLESCROLLING, 0, 0); + addshipqueue(CMD_WAIT, 350, 0); + addshipqueue(CMD_REMOVESPR, 0, 0); + addshipqueue(CMD_WAIT, 50, 0); + addshipqueue(CMD_MOVE, 700, DLEFT); + addshipqueue(CMD_WAIT, 150, 0); + addshipqueue(CMD_SPAWNSPR, 0, SPR_EXCLAMATION); + addshipqueue(CMD_WAIT, 500, 0); + addshipqueue(CMD_REMOVESPR, 0, 0); + addshipqueue(CMD_WAIT, 50, 0); + addshipqueue(CMD_MOVE, 700, DRIGHT); + addshipqueue(CMD_WAIT, 25, 0); + addshipqueue(CMD_ENABLESCROLLING, 0, 0); + addshipqueue(CMD_MOVE, 465, DDOWN); + addshipqueue(CMD_FADEOUT, 0, 0); + addshipqueue(CMD_MOVE, 100, DDOWN); + addshipqueue(CMD_ENDOFQUEUE, 0, 0); + + showmapatpos(81, SHIPFLY_X, SHIPFLY_Y, 0, pCKP); + + objects[MARK_SPR_NUM].type = OBJ_YORP; // doesn't matter + objects[MARK_SPR_NUM].exists = 0; + objects[MARK_SPR_NUM].sprite = SPR_QUESTION; + + numplayers = 1; + // place the player at the center of mars + if (map_findtile(593, &x, &y)) + { // found the tile at the center of mars + player[0].x = ((x<<4)+1)<>CSF)-scroll_x; + objects[MARK_SPR_NUM].scry = (objects[MARK_SPR_NUM].y>>CSF)-scroll_y; + + // execute the current command in the queue + if (fade.dir != FADE_OUT) + { + switch(shipqueue[ShipQueuePtr].cmd) + { + case CMD_MOVE: + switch(shipqueue[ShipQueuePtr].flag1) + { + case DUP: + player[0].y-=SHIPSPD; + player[0].playframe = SPR_SHIP_RIGHT; + break; + case DDOWN: + player[0].y+=SHIPSPD/2; + player[0].playframe = SPR_SHIP_RIGHT; + break; + case DLEFT: + player[0].x-=SHIPSPD; + player[0].playframe = SPR_SHIP_LEFT; + break; + case DRIGHT: + player[0].x+=SHIPSPD; + player[0].playframe = SPR_SHIP_RIGHT; + break; + case DDOWNRIGHT: + player[0].x+=SHIPSPD*2; + player[0].y+=SHIPSPD*0.8; + player[0].playframe = SPR_SHIP_RIGHT; + break; + } + break; + case CMD_SPAWNSPR: + objects[MARK_SPR_NUM].sprite = shipqueue[ShipQueuePtr].flag1; + objects[MARK_SPR_NUM].exists = 1; + break; + case CMD_REMOVESPR: + objects[MARK_SPR_NUM].sprite = shipqueue[ShipQueuePtr].flag1; + objects[MARK_SPR_NUM].exists = 0; + break; + case CMD_ENABLESCROLLING: + scrollingon = 1; + break; + case CMD_DISABLESCROLLING: + scrollingon = 0; + break; + case CMD_WAIT: + break; + case CMD_FADEOUT: + if (fade.dir!=FADE_OUT) + { + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + } + break; + default: break; + } + // decrease the time remaining + if (shipqueue[ShipQueuePtr].time) + { + shipqueue[ShipQueuePtr].time--; + } + else + { // no time left on this command, go to next cmd + ShipQueuePtr++; + } + } + + if (fade.dir==FADE_OUT && fade.mode==FADE_COMPLETE) + { // we're done + return 0; + } + + enter = ( g_pInput->getPressedKey(KENTER) || g_pInput->getPressedKey(KCTRL) || g_pInput->getPressedKey(KALT) ); + if (enter) + { + if (fade.dir!=FADE_OUT) + { + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + } + } + lastenterstate = enter; + + gamedo_fades(); + gamedo_AnimatedTiles(); + + gamedo_frameskipping(pCKP); + if (scrollingon) gamedo_ScrollTriggers(0); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(!g_pInput->getPressedKey(KQUIT)); + return 1; +} + +int eseq1_BackAtHome(stCloneKeenPlus *pCKP) +{ +/*int draw;*/ +int i; +char *text[10]; +char strname[40]; +char tempbuf[200]; +short textline, showtimer; +unsigned short amountshown; +signed int waittimer; +int state; +int enter, lastenterstate; +int dlgX, dlgY, dlgW, dlgH; + + #define STATE_TEXTAPPEARING 0 + #define STATE_WAITASEC 1 + #define STATE_FADING 2 + + // get pointers to all the strings we're going to be using + for(i=0;i<8;i++) + { + sprintf(strname, "EP1_ESEQ_PART2_PAGE%d", i+1); + text[i] = getstring(strname); + } + + textline = 0; + amountshown = 0; + showtimer = 0; + state = STATE_TEXTAPPEARING; + lastenterstate = 1; + waittimer = 0; + + finale_draw("finale.ck1", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory); + scrollx_buf = scroll_x = 0; + scrolly_buf = scroll_y = 0; + + numplayers = 1; + player[0].x = 16; + player[0].y = 16; + player[0].playframe = BlankSprite; + + dlgX = GetStringAttribute("EP1_ESEQ_PART2_PAGE1", "LEFT"); + dlgY = GetStringAttribute("EP1_ESEQ_PART2_PAGE1", "TOP"); + dlgW = GetStringAttribute("EP1_ESEQ_PART2_PAGE1", "WIDTH"); + dlgH = GetStringAttribute("EP1_ESEQ_PART2_PAGE1", "HEIGHT"); + + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + fade.dir = FADE_IN; + fade.curamt = 0; + fade.fadetimer = 0; + do + { + enter = ( g_pInput->getPressedKey(KENTER) || g_pInput->getPressedKey(KCTRL) || g_pInput->getPressedKey(KALT) ); + + sb_dialogbox(dlgX, dlgY, dlgW, dlgH); + + // draw the current text line up to the amount currently shown + strcpy(tempbuf, text[textline]); + tempbuf[amountshown] = 0; + g_pGraphics->sb_font_draw( (unsigned char*) tempbuf, (dlgX+1)*8, (dlgY+1)*8); + + if (state==STATE_TEXTAPPEARING) + { + if (enter) goto fullshow; + if (showtimer > LETTER_SHOW_SPD) + { // it's time to show a new letter + amountshown++; + if (amountshown > strlen(text[textline])) + { // reached end of line + state = STATE_WAITASEC; +// if (textline==8) + // waittimer = -BACKHOME_SHORT_WAIT_TIME*3; + // else + waittimer = -BACKHOME_SHORT_WAIT_TIME*2; + } + // if the last letter shown is a dash/cr ('Billy...are you a-'), + // show the rest of the text immediately + // (for when the mom shouts "WHAT IS THIS ONE-EYED GREEN THING..." + if (text[textline][amountshown]==13 && \ + text[textline][amountshown-1]=='-') + { + fullshow: ; + amountshown = strlen(text[textline]); + state = STATE_WAITASEC; + waittimer = -BACKHOME_SHORT_WAIT_TIME*3; + } + showtimer = 0; + } else showtimer++; + + // user pressed enter + if (enter) + { // show all text immediately + + } + } + else if (state==STATE_WAITASEC) + { + if (enter) goto nextline; + if (waittimer7) + { // end of text + break; + } + } + } + } + + if (fade.dir==FADE_OUT && fade.mode==FADE_COMPLETE) + return 0; + + gamedo_fades(); + gamedo_frameskipping_blitonly(pCKP); + + lastenterstate = enter; + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + if (g_pInput->getPressedKey(KQUIT)) return 1; + } while(1); + + finale_draw("finale.ck1", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory); + eseq_ToBeContinued(pCKP); + return 1; +} + +void eseq_ToBeContinued(stCloneKeenPlus *pCKP) +{ +int i; +char *text; +int dlgX, dlgY, dlgW, dlgH; + + // remove all objects because eseq_showmsg will call drawobjects + for(i=0;igetPressedKey(KQUIT)) return; + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(fade.mode == FADE_GO); +} diff --git a/src/eseq_ep2.cpp b/src/eseq_ep2.cpp new file mode 100644 index 000000000..2adc988db --- /dev/null +++ b/src/eseq_ep2.cpp @@ -0,0 +1,712 @@ +/* ESEQ_EP2.C + Ending sequence for Episode 2. +*/ + +#include "keen.h" +#include "include/game.h" +#include "include/gamedo.h" +#include "include/gamepdo.h" +#include "sdl/CTimer.h" +#include "sdl/CInput.h" +#include "sdl/sound/CSound.h" +#include "include/eseq_ep2.h" +#include "include/eseq_ep1.h" +#include "include/menu.h" +#include "include/enemyai.h" +#include "CGraphics.h" + +#define CMD_MOVE 0 +#define CMD_WAIT 1 +#define CMD_SPAWNSPR 2 +#define CMD_REMOVESPR 3 +#define CMD_FADEOUT 4 +#define CMD_ENDOFQUEUE 5 +#define CMD_ENABLESCROLLING 6 +#define CMD_DISABLESCROLLING 7 + +stShipQueue shipqueue[32]; +int ShipQueuePtr; + +#define LETTER_SHOW_SPD 30 + +// start x,y map scroll position for eseq2_TantalusRay() +#define TANTALUS_X 0 +#define TANTALUS_Y 0 + +#define TANTALUS_SPD_X 21 +#define TANTALUS_SPD_Y 9 + +#define TANTALUS_SPRITE 58 + +#define TAN_DELAY_BEFORE_FIRE 500 + +#define TAN_STATE_WAITBEFOREFIRE 0 +#define TAN_STATE_FIRING 1 +#define TAN_STATE_EARTH_EXPLODING 2 +#define TAN_STATE_CHUNKS_FLYING 3 +#define TAN_STATE_GAMEOVER 4 + +#define EARTHCHUNK_BIG_UP 64 +#define EARTHCHUNK_BIG_DN 66 +#define EARTHCHUNK_SMALL_UP 68 +#define EARTHCHUNK_SMALL_DN 70 + +int eseq2_TantalusRay(stCloneKeenPlus *pCKP) +{ +char enter,lastenterstate; +int x, y, t, o, i; +int tantalus_animframe, tantalus_animtimer; +int state, timer, spawnedcount; + + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + do + { + gamedo_fades(); + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); } while(fade.mode!=FADE_COMPLETE); + + pCKP->Control.levelcontrol.dark = 0; + g_pGraphics->initPalette(pCKP->Control.levelcontrol.dark); + + initgame(pCKP); + state = TAN_STATE_WAITBEFOREFIRE; + + showmapatpos(81,TANTALUS_X, TANTALUS_Y, 0, pCKP); + + AllPlayersInvisible(); + numplayers = 1; + player[0].hideplayer = 0; + objects[player[0].useObject].onscreen = 1; + + // place the player (which is actually the tantalus ray) at the mouth + // of the vorticon mothership + if (map_findtile(593, &x, &y)) + { // found the tile + player[0].x = ((x<<4)-1)< TAN_DELAY_BEFORE_FIRE) + { + g_pSound->playStereofromCoord(SOUND_KEEN_FIRE, PLAY_NOW, objects[o].scrx); + state = TAN_STATE_FIRING; + timer = 0; + } + else timer++; + break; + case TAN_STATE_FIRING: + + if (tantalus_animtimer>5) + { + tantalus_animframe ^= 1; + player[0].playframe = TANTALUS_SPRITE + tantalus_animframe; + } + else tantalus_animtimer++; + + player[0].x += TANTALUS_SPD_X; + player[0].y += TANTALUS_SPD_Y; + + t = getmaptileat((player[0].x>>CSF)+(sprites[TANTALUS_SPRITE].xsize/2), (player[0].y>>CSF)+(sprites[TANTALUS_SPRITE].ysize/2)); + if (t==586) + { // hit center of earth + state = TAN_STATE_EARTH_EXPLODING; + player[0].playframe = BlankSprite; + timer = 0; + spawnedcount = 0; + srand(300); + o = spawn_object(player[0].x+(24<playSound(SOUND_EARTHPOW, PLAY_NOW); + } + break; + case TAN_STATE_EARTH_EXPLODING: + if (!timer) + { + if (spawnedcount<16) o = spawn_object(player[0].x+((rand()%32)< 4) + { + objects[o].sprite = EARTHCHUNK_SMALL_DN; + } + else + { + objects[o].sprite = EARTHCHUNK_SMALL_UP; + } + } + + break; + case 6: + o = spawn_object(player[0].x+(16<playSound(SOUND_GAME_OVER, PLAY_NOW); + SetGameOver(pCKP); + break; + } + spawnedcount++; + timer = 60; + } + else timer--; + break; + case TAN_STATE_GAMEOVER: + break; + } + + if (fade.dir==FADE_OUT && fade.mode==FADE_COMPLETE) + { // we're done + return 0; + } + + enter = (g_pInput->getPressedCommand(KENTER) || g_pInput->getPressedCommand(KCTRL) || g_pInput->getPressedCommand(KALT) ); + if (enter && state==TAN_STATE_GAMEOVER) + { + if (fade.dir!=FADE_OUT) + { + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + fade.mode = FADE_GO; + } + } + lastenterstate = enter; + + gamedo_fades(); + if (state!=TAN_STATE_GAMEOVER) gamedo_AnimatedTiles(); + + gamedo_frameskipping(pCKP); + gamedo_enemyai(pCKP); + + if(((player[0].x>>CSF)-scroll_x) > 160-16) map_scroll_right(); + if (((player[0].y>>CSF)-scroll_y) > 100) + { + map_scroll_down(); + } + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(!g_pInput->getPressedCommand(KQUIT)); + return 1; +} + +void eseq2_vibrate(stCloneKeenPlus *pCKP) +{ +int xamt, yamt; +int xdir, ydir; +int vibratetimes; +//int enter,lastenterstate; +int i; +int x,y,w,h; + + vibratetimes = 0; + + #define VIBRATE_AMT 16 + #define VIBRATE_NUM_FRAMES 500 + + xamt = yamt = 0; + xdir = 0; ydir = 0; + do + { + + // undo the scroll from last time + if (!xdir) + { + for(i=0;i>CSF)-scroll_x; + objects[i].scry = (objects[i].y>>CSF)-scroll_y; + } + } + + // show the frame + gamedo_frameskipping(pCKP); + vibratetimes++; + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(!g_pInput->getPressedCommand(KQUIT) && vibratetimes < VIBRATE_NUM_FRAMES); + + // display the "uh-oh." + x = GetStringAttribute("EP2_AfterVibrateString", "LEFT"); + y = GetStringAttribute("EP2_AfterVibrateString", "TOP"); + w = GetStringAttribute("EP2_AfterVibrateString", "WIDTH"); + h = GetStringAttribute("EP2_AfterVibrateString", "HEIGHT"); + + eseq_showmsg(getstring("EP2_AfterVibrateString"),x,y,w,h,1, pCKP); +} + + +#define HEADFOREARTH_X 0 +#define HEADFOREARTH_Y 0 + +#define HEADFOREARTH_WAIT_TIME 600 + +#define SPR_SHIP_RIGHT_EP2 132 +#define SPR_SHIP_LEFT_EP2 133 +#define SPR_VORTICON_MOTHERSHIP 72 + +#define HEADSFOREARTH_X 3 +#define HEADSFOREARTH_Y 15 +#define HEADSFOREARTH_W 33 +#define HEADSFOREARTH_H 8 + +void eseq_showmsg(char *text, int boxleft, int boxtop, int boxwidth, int boxheight, char autodismiss, stCloneKeenPlus *pCKP) +{ +//int draw; +//int i; + +char tempbuf[1024]; +char textline, showtimer; +unsigned int amountshown; +int waittimer; +int cancel, lastcancelstate; + + textline = 0; + amountshown = 0; + showtimer = 0; + lastcancelstate = 1; + waittimer = 0; + + do + { + gamedo_fades(); + gamedo_AnimatedTiles(); + gamedo_render_drawobjects(pCKP); + + cancel = (g_pInput->getPressedCommand(KENTER) || g_pInput->getPressedCommand(KCTRL) || g_pInput->getPressedCommand(KALT)); + + // draw the text up to the amount currently shown + strcpy(tempbuf, text); + tempbuf[amountshown] = 0; + sb_dialogbox(boxleft,boxtop,boxwidth,boxheight); + g_pGraphics->sb_font_draw( (unsigned char*)tempbuf, (boxleft+1)*8, (boxtop+1+textline)*8); + + gamedo_frameskipping_blitonly(pCKP); + gamedo_render_eraseobjects(); + + if (showtimer > LETTER_SHOW_SPD) + { // it's time to show a new letter + if (amountshown < strlen(text)) + { + amountshown++; + } + showtimer = 0; + } else showtimer++; + + // user pressed enter or some other key + if (cancel && !lastcancelstate) + { + if (amountshown < strlen(text)) + { + amountshown = strlen(text); + } + else return; + } + + // when all text is shown wait a sec then return + if (autodismiss) + { + if (amountshown >= strlen(text)) + { + if (waittimer > HEADFOREARTH_WAIT_TIME) return; + waittimer++; + } + } + + + lastcancelstate = cancel; + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(!g_pInput->getPressedCommand(KQUIT)); + return; +} + +int eseq2_HeadsForEarth(stCloneKeenPlus *pCKP) +{ +char enter,lastenterstate; +int x, y; +int downtimer; +int afterfadewaittimer; + + initgame(pCKP); + + // set up the ship's route + ShipQueuePtr = 0; + addshipqueue(CMD_WAIT, 10, 0); + addshipqueue(CMD_MOVE, 2360, DDOWNRIGHT); + addshipqueue(CMD_FADEOUT, 0, 0); + + showmapatpos(81, HEADFOREARTH_X, HEADFOREARTH_Y, 0, pCKP); + + numplayers = 1; + // place the player near the vorticon mothership + if (map_findtile(593, &x, &y)) + { + player[0].x = ((x<<4)+2)< 6) + { + player[0].y++; + downtimer = 0; + } + else downtimer++; + break; + case CMD_WAIT: + break; + case CMD_FADEOUT: + if (fade.dir!=FADE_OUT) + { + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + fade.mode = FADE_GO; + } + break; + default: break; + } + // decrease the time remaining + if (shipqueue[ShipQueuePtr].time) + { + shipqueue[ShipQueuePtr].time--; + } + else + { // no time left on this command, go to next cmd + ShipQueuePtr++; + } + } + + if (fade.dir==FADE_OUT && fade.mode==FADE_COMPLETE) + { + if (afterfadewaittimer > 80) + { + return 0; + } + else afterfadewaittimer++; + } + + enter = (g_pInput->getPressedCommand(KENTER)||g_pInput->getPressedCommand(KCTRL)||g_pInput->getPressedCommand(KALT)); + if (enter && !lastenterstate) + { + if (fade.dir!=FADE_OUT) + { + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + fade.mode = FADE_GO; + } + } + lastenterstate = enter; + + gamedo_fades(); + gamedo_AnimatedTiles(); + + gamedo_frameskipping(pCKP); + gamedo_ScrollTriggers(0); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(!g_pInput->getPressedCommand(KQUIT)); + return 1; +} + +#define LIMPSHOME_X 0 +#define LIMPSHOME_Y 344 + +int eseq2_LimpsHome(stCloneKeenPlus *pCKP) +{ +char enter,lastenterstate; +//int x, y; +int downtimer; +int afterfadewaittimer = 0; + + initgame(pCKP); + + // set up the ship's route + ShipQueuePtr = 0; + addshipqueue(CMD_WAIT, 10, 0); + addshipqueue(CMD_MOVE, 1600, DUPLEFT); + addshipqueue(CMD_FADEOUT, 0, 0); + + showmapatpos(81, LIMPSHOME_X, LIMPSHOME_Y, 0, pCKP); + + numplayers = 1; + player[0].x = (10 <<4< 80) + { + return 0; + } + else afterfadewaittimer++; + } + + enter = (g_pInput->getPressedCommand(KENTER)||g_pInput->getPressedCommand(KCTRL)||g_pInput->getPressedCommand(KALT)); + if (enter && !lastenterstate) + { + if (fade.dir!=FADE_OUT) + { + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + fade.mode = FADE_GO; + } + } + lastenterstate = enter; + + gamedo_fades(); + gamedo_AnimatedTiles(); + + gamedo_frameskipping(pCKP); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(!g_pInput->getPressedCommand(KQUIT)); + return 1; +} + +int eseq2_SnowedOutside(stCloneKeenPlus *pCKP) +{ +int curpage; +int lastpage; +char tempstr[80]; +char *text; +//int enter, lastenterstate; +int dlgX, dlgY, dlgW, dlgH; + + scrollx_buf = scroll_x = 0; + scrolly_buf = scroll_y = 0; + finale_draw("finale.ck2", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory); + + curpage = 1; + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + fade.dir = FADE_IN; + fade.curamt = 0; + fade.fadetimer = 0; + + numplayers = 1; + player[0].x = player[0].y = 0; + player[0].playframe = BlankSprite; + + do + { + sprintf(tempstr, "EP2_ESEQ_PART3_PAGE%d", curpage); + text = getstring(tempstr); + dlgX = GetStringAttribute(tempstr, "LEFT"); + dlgY = GetStringAttribute(tempstr, "TOP"); + dlgW = GetStringAttribute(tempstr, "WIDTH"); + dlgH = GetStringAttribute(tempstr, "HEIGHT"); + lastpage = GetStringAttribute(tempstr, "LASTPAGE"); + + eseq_showmsg(text, dlgX, dlgY, dlgW, dlgH, 1, pCKP); + if (lastpage==1) break; + + curpage++; + } while(!g_pInput->getPressedCommand(KQUIT)); + + finale_draw("finale.ck2", pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory); + eseq_ToBeContinued(pCKP); + + return 0; +} diff --git a/src/eseq_ep3.cpp b/src/eseq_ep3.cpp new file mode 100644 index 000000000..281ced1c4 --- /dev/null +++ b/src/eseq_ep3.cpp @@ -0,0 +1,117 @@ +/* ESEQ_EP3.C + Ending sequence for Episode 3. + I never bothered to completely finish it...things like + the Vorticon's camera flashes and stuff aren't implemented. +*/ + +#include "keen.h" +#include "include/game.h" +#include "include/gamedo.h" +#include "sdl/CTimer.h" +#include "sdl/CInput.h" +#include "sdl/sound/CSound.h" +#include "include/eseq_ep3.h" +#include "include/eseq_ep2.h" +#include "include/menu.h" + +void eseq3_Mortimer(stCloneKeenPlus *pCKP) +{ +int x,y,w,h; + g_pSound->playSound(SOUND_MORTIMER, PLAY_FORCE); + + x = GetStringAttribute("EP3_MORTIMER", "LEFT"); + y = GetStringAttribute("EP3_MORTIMER", "TOP"); + w = GetStringAttribute("EP3_MORTIMER", "WIDTH"); + h = GetStringAttribute("EP3_MORTIMER", "HEIGHT"); + + eseq_showmsg(getstring("EP3_MORTIMER"),x,y,w,h,0, pCKP); + eseq_showmsg(getstring("EP3_MORTIMER2"),x,y,w,h,0, pCKP); + eseq_showmsg(getstring("EP3_MORTIMER3"),x,y,w,h,0, pCKP); + eseq_showmsg(getstring("EP3_MORTIMER4"),x,y,w,h,0, pCKP); + eseq_showmsg(getstring("EP3_MORTIMER5"),x,y,w,h,0, pCKP); + + map_redraw(); + g_pSound->playSound(SOUND_FOOTSLAM, PLAY_NOW); +} + +char eseq3_AwardBigV(stCloneKeenPlus *pCKP) +{ + int x,y,w,h; + int c; + initgame(pCKP); + + showmapatpos(81, 32, 32, 0, pCKP); + + numplayers = 1; + player[0].x = 244<GameData[pCKP->Resources.GameSelected-1].DataDirectory); + scrollx_buf = scrolly_buf = 0; + player[0].hideplayer = 1; + + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + do + { + gamedo_fades(); + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(fade.mode==FADE_GO); + + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + fade.dir = FADE_IN; + fade.curamt = 0; + fade.fadetimer = 0; + + x = GetStringAttribute("THE_END", "LEFT"); + y = GetStringAttribute("THE_END", "TOP"); + w = GetStringAttribute("THE_END", "WIDTH"); + h = GetStringAttribute("THE_END", "HEIGHT"); + + eseq_showmsg(getstring("THE_END"),x,y,w,h,0, pCKP); + + // wait for enter pressed + c = 0; + do + { + gamedo_fades(); + if (c==0 && !g_pInput->getPressedCommand(IC_STATUS)) c++; + if (c==1 && g_pInput->getPressedCommand(IC_STATUS)) c++; + if (c==2 && fade.dir==FADE_IN) + { + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + } + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + if (g_pInput->getPressedKey(KQUIT) && fade.mode==FADE_COMPLETE) break; + } while(fade.mode!=FADE_COMPLETE || fade.dir!=FADE_OUT); + + if (g_pInput->getPressedKey(KQUIT)) return 1; + return 0; +} diff --git a/src/fileio.cpp b/src/fileio.cpp new file mode 100644 index 000000000..7f2ca2d0d --- /dev/null +++ b/src/fileio.cpp @@ -0,0 +1,1187 @@ +/* FILEIO.C + Functions responsible for loading data from files, such as the one that + decodes the level map files (loadmap()) and the one that loads in the + tile attribute data contained in ep?attr.dat (loadtileattributes()). + The functions for loading the graphics (EGALATCH&EGASPRIT) are in latch.c. +*/ + +#include "keen.h" +#include "sdl/CVideoDriver.h" +#include "sdl/sound/CSound.h" +#include "hqp/CMusic.h" +#include "include/fileio.h" +#include "include/fileio/lzexe.h" +#include "include/fileio/rle.h" +#include "vorticon/CPlayer.h" +#include "CLogFile.h" +#include "CGraphics.h" +#include + +extern CPlayer *Player; + +int numtiles; +int **TileProperty; // This version will replace the old stTile Structure and save memory + +unsigned int curmapx, curmapy; +unsigned char mapdone; +void addmaptile(unsigned int t) +{ + map.mapdata[curmapx][curmapy] = t; + curmapx++; + if (curmapx >= map.xsize) + { + curmapx = 0; + curmapy++; + + if (curmapy >= map.ysize) mapdone = 1; + } +} + +short checkConsistencyofGameData(stGameData *p_GameData) +{ + short ok = 0; + + FILE *fp; + + // Let's define which files need to be read! + memset(p_GameData->FileList,0,MAX_NUMBER_OF_FILES*MAX_STRING_LENGTH); + if(p_GameData->Episode >= 1 && p_GameData->Episode <= 3) + { + sprintf(p_GameData->FileList[1],"keen%d.exe",p_GameData->Episode); + sprintf(p_GameData->FileList[2],"egahead.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[3],"egasprit.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[4],"egalatch.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[5],"finale.ck%d",p_GameData->Episode); + + // Levels! + sprintf(p_GameData->FileList[6],"level01.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[7],"level02.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[8],"level03.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[9],"level04.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[10],"level05.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[11],"level06.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[12],"level07.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[13],"level08.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[14],"level09.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[15],"level10.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[16],"level11.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[17],"level12.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[18],"level13.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[19],"level14.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[20],"level15.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[21],"level16.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[22],"level80.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[23],"level81.ck%d",p_GameData->Episode); + sprintf(p_GameData->FileList[24],"level90.ck%d",p_GameData->Episode); + + // Other + if(p_GameData->Episode == 1) + sprintf(p_GameData->FileList[24],"sounds.ck%d",p_GameData->Episode); + } + + // Now check if they really exist! + char buf[MAX_STRING_LENGTH]; + int c=0; + for(c = 0 ; c < MAX_NUMBER_OF_FILES ; c++) + { + if(p_GameData->FileList[c][0] == 0) // If there are no more files! + break; + + memset(buf,0,MAX_STRING_LENGTH*sizeof(char)); + strcat(buf,"data/"); + strcat(buf,p_GameData->DataDirectory); + if(*(p_GameData->DataDirectory) != 0) + strcat(buf,"/"); + strcat(buf,p_GameData->FileList[c]); + + + if((fp = fopen(buf,"r")) != NULL) + { + fclose(fp); + } + else + { + g_pLogFile->ftextOut("Error! File \"%s\" was not found! Please add it to the configured directory.
    ", p_GameData->FileList[c]); + p_GameData->Episode = -1; + ok++; + } + } + + if(ok==0) + g_pLogFile->ftextOut("Game data of Episode %d is complete.
    ", p_GameData->Episode); + + return ok; +} + +char NessieAlreadySpawned; +void addobjectlayertile(unsigned int t, stCloneKeenPlus *pCKP) +{ +int o; + switch(t) + { + case 0: break; // blank + case 255: // player start + + //Player[0].setCoord(curmapx << 4 << CSF, curmapy << 4 << CSF); + + player[0].x = curmapx << 4 << CSF; + player[0].y = curmapy << 4 << CSF; + map.objectlayer[curmapx][curmapy] = 0; + break; + case NESSIE_PATH: // spawn nessie at first occurance of her path + if (pCKP->Control.levelcontrol.episode==3) + { + if (!NessieAlreadySpawned) + { + o = spawn_object(curmapx<<4<Control.levelcontrol.levels_completed[t&0x00ff]) + { + map.objectlayer[curmapx][curmapy] = 0; + map.mapdata[curmapx][curmapy] = tiles[map.mapdata[curmapx][curmapy]].chgtile; + } + else + { + map.objectlayer[curmapx][curmapy] = t; + } + break; + } + + curmapx++; + if (curmapx >= map.xsize) + { + curmapx = 0; + curmapy++; + if (curmapy >= map.ysize) mapdone = 1; + } +} + +void addenemytile(unsigned int t, stCloneKeenPlus *pCKP) +{ +int o,x; + map.objectlayer[curmapx][curmapy] = t; + + if (t) + { + if (t==255) + { + if(curmapx >= map.xsize-2) // Edge bug. Keen would fall in some levels without this. + curmapx = 4; + + if(curmapy >= map.ysize-2) // Edge bug. Keen would fall in some levels without this. + curmapx = 4; + + //Player[0].setCoord(curmapx << 4 << CSF, ((curmapy << 4) + 8) << CSF); + + player[0].x = curmapx << 4 << CSF; + player[0].y = ((curmapy << 4) + 8) << CSF; + } + else + { + switch(t) + { + case 0: break; + case -1: break; + case 1: // yorp (ep1) vort (ep2&3) + if (pCKP->Control.levelcontrol.episode==1) + { + x = curmapx; + + if (TileProperty[map.mapdata[x][curmapy+1]][BLEFT]) x--; + //if (tiles[map.mapdata[x][curmapy+1]].solidl) x--; + spawn_object(x<<4<Control.levelcontrol.episode==1) + { + // those bastards. sometimes embedding garg's in the floor in + // the original maps. + if(TileProperty[map.mapdata[curmapx+1][curmapy+1]][BLEFT]) + { + if (pCKP->Control.levelcontrol.chglevelto==7) + { + spawn_object(curmapx<<4<Control.levelcontrol.episode==1) + { + spawn_object(curmapx<<4<Control.levelcontrol.episode==2) + { + spawn_object(curmapx<<4<Control.levelcontrol.episode==3) + { + spawn_object(curmapx<<4<Control.levelcontrol.episode==1) + spawn_object(curmapx<<4<Control.levelcontrol.episode==2) + spawn_object(curmapx<<4<Control.levelcontrol.episode==3) + spawn_object(curmapx<<4<Control.levelcontrol.episode==1) + { + o = spawn_object(curmapx<<4<Control.levelcontrol.chglevelto==13) + { + objects[o].hasbeenonscreen = 1; + } + } + else if (pCKP->Control.levelcontrol.episode==2) + spawn_object(curmapx<<4<Control.levelcontrol.episode==3) + { + if(TileProperty[map.mapdata[curmapx][curmapy+1]][BLEFT]) + //if (tiles[map.mapdata[curmapx][curmapy+1]].solidl) + { + spawn_object(curmapx<<4<Control.levelcontrol.episode==1) + { + o = spawn_object((((curmapx+1)<<4)+4)<Control.levelcontrol.episode==2) + { + o = spawn_object(curmapx<<4<Control.levelcontrol.episode==3) + { + o = spawn_object(curmapx<<4<Control.levelcontrol.episode==2) + { + o = spawn_object(curmapx<<4<Control.levelcontrol.canexit = 0; // can't exit till spark is shot + } + else + { + o = spawn_object(curmapx<<4<Control.levelcontrol.episode==3) + { + o = spawn_object(curmapx<<4<Control.levelcontrol.episode==1) + { + o = spawn_object(((curmapx<<4)-4)<Control.levelcontrol.episode==3) + { + o = spawn_object(curmapx<<4<Control.levelcontrol.episode==1) + { + spawn_object(curmapx<<4<Control.levelcontrol.episode==3) + { + spawn_object(curmapx<<4<Control.levelcontrol.episode==3) + { + spawn_object(curmapx<<4<Control.levelcontrol.episode==3) + { + o = spawn_object(curmapx<<4<Control.levelcontrol.episode==3) + { + o = spawn_object(curmapx<<4<fadePalette(20); + g_pLogFile->ftextOut(PURPLE,"unknown enemy type %d at (%d,%d)
    ", t, curmapx, curmapy); + //while(g_pInput->getPressedCommand(KENTER)); + + break; + } + } + } + curmapx++; + if (curmapx >= map.xsize) + { + curmapx = 0; + curmapy++; + if (curmapy >= map.ysize) mapdone = 1; + } +} + +unsigned int fgeti(FILE *fp) { +unsigned int temp1, temp2; + temp1 = fgetc(fp); + temp2 = fgetc(fp); + return (temp2<<8) | temp1; +} + +unsigned long fgetl(FILE *fp) { +unsigned int temp1, temp2, temp3, temp4; + temp1 = fgetc(fp); + temp2 = fgetc(fp); + temp3 = fgetc(fp); + temp4 = fgetc(fp); + return (temp4<<24) | (temp3<<16) | (temp2<<8) | temp1; +} + +unsigned int loadmap(char filename[MAX_STRING_LENGTH], char *path, int lvlnum, int isworldmap, stCloneKeenPlus *pCKP) +{ +FILE *fp; +char fname[256]; +int t; +unsigned int c; +int numruns = 0; +int gottenazero; +int resetcnt, resetpt; + + NessieAlreadySpawned = 0; + map.isworldmap = isworldmap; + + char buffer[256]; + + formatPathString(buffer, path); + + sprintf(fname, "%s%s", buffer, filename); + fp = fopen(fname, "rb"); + if (!fp) + { + // only record this error message on build platforms that log errors + // to a file and not to the screen. + g_pLogFile->ftextOut("loadmap(): unable to open file %s
    ", fname); + return 1; + } + g_pLogFile->ftextOut("loadmap(): file %s opened. Loading...
    ", fname); + + // decompress map RLEW data + curmapx = curmapy = mapdone = 0; + + unsigned int *filebuf; // big File Buffer for the uncompression + filebuf = (unsigned int*) malloc(500000*sizeof(int)); + + if(filebuf == NULL) + { + g_pLogFile->ftextOut("loadmap(): unable to allocate memory for unpacking the level file
    ", fname); + return 1; + } + + int finsize; // Final size + + finsize = unRLEW(fp, filebuf); + + c=0; + + if(finsize == -1) + { + rewind(fp); + while(!feof(fp)) + { + filebuf[c] = fgeti(fp); + c++; + } + } + + + map.xsize = filebuf[2]; + map.ysize = filebuf[3]; + + if (map.xsize > 260 || map.ysize > 260) + { + g_pLogFile->textOut(RED,"loadmap(): level is too big
    "); + return 1; + } + + c=18; + + //while(!mapdone) + while(c < ((filebuf[9] / 2)+18)) // Check against Tilesize + { + t = filebuf[c]; + if(!mapdone) + addmaptile(t); + + if(t > 255) + { + t=0; // If there are some invalid values in the file + } + + c++; + } + + + // now do the enemies + gottenazero = 0; + + // get enemy/objectlayer data + curmapx = curmapy = mapdone = numruns = 0; + resetcnt = resetpt = 0; + + while(!mapdone) + { + t = filebuf[c]; + + if (t==0 && !gottenazero) + { + curmapx = curmapy = 0; + gottenazero = 1; + } + if (map.isworldmap) addobjectlayertile(t, pCKP); else addenemytile(t, pCKP); + if (++resetcnt==resetpt) curmapx=curmapy=0; + + c++; + } + + free(filebuf); + + fclose(fp); + + // HQ Sounds. Load Music for a level if you have HQP + g_pMusicPlayer->stop(); + + if((fp=fopen("data/hqp/music/table.cfg","rt")) != NULL) + { + char buf1[MAX_STRING_LENGTH]; + char buf2[MAX_STRING_LENGTH]; + + memset(buf1,0,sizeof(char)*MAX_STRING_LENGTH); + memset(buf2,0,sizeof(char)*MAX_STRING_LENGTH); + + while(!feof(fp)) + { + fscanf(fp,"%s",buf1); + + if(strcmp(buf1,filename) == 0) + { + fscanf(fp,"%s",buf2); + break; + } + else + fgets(buf1,MAX_STRING_LENGTH,fp); + } + + + fclose(fp); + + if(*buf2 != 0) + { + strcpy(buf1,"data/hqp/music/"); + strcat(buf1,buf2); + g_pMusicPlayer->load(g_pSound->getAudioSpec(),buf1); + g_pMusicPlayer->play(); + } + } + + // Didn't it work? Don't matter. HQP is optional, so continue + + // install enemy stoppoints as needed + if (pCKP->Control.levelcontrol.episode==1 && lvlnum==13) + { + map.objectlayer[94][13] = GARG_STOPPOINT; + map.objectlayer[113][13] = GARG_STOPPOINT; + map.objectlayer[48][6] = GARG_STOPPOINT; + map.objectlayer[80][5] = GARG_STOPPOINT; + map.objectlayer[87][5] = GARG_STOPPOINT; + map.objectlayer[39][18] = GARG_STOPPOINT; + } + else if (pCKP->Control.levelcontrol.episode==3 && lvlnum==6) + { + map.objectlayer[40][7] = BALL_NOPASSPOINT; + map.objectlayer[50][7] = BALL_NOPASSPOINT; + } + else if (pCKP->Control.levelcontrol.episode==3 && lvlnum==9) + { + map.objectlayer[45][106] = BALL_NOPASSPOINT; + + } + else if (pCKP->Control.levelcontrol.episode==3 && lvlnum==4) + { + map.objectlayer[94][17] = BALL_NOPASSPOINT; + } + + return 0; +} + +char loadtileattributes(int episode, char *extrapath) +{ +FILE *fp; +int t,a,b; +char fname[MAX_STRING_LENGTH]; +char buf[MAX_STRING_LENGTH]; +int bufsize; + + unsigned char *filebuf; + int i,j; // standard counters + + FILE *fin; + + filebuf = (unsigned char*) malloc(500000*sizeof(unsigned char)); + + // We need a function that autodetects tli files in a directory... + sprintf(buf,"tiles.tli"); + + formatPathString(fname,extrapath); + + strcat(fname,buf); + + g_pLogFile->ftextOut("loadtileattributes() : Trying to read the tiles from \"%s\"
    ", fname); + + if( (fin = fopen(fname,"rb")) == NULL ) + { + // No, try to read it from the exe-file + + sprintf(buf,"keen%d.exe",episode); + + formatPathString(fname,extrapath); + + strcat(fname,buf); + + g_pLogFile->ftextOut("loadtileattributes() : Extracting tile attributes from the exe file \"%s\"
    ", fname); + + if( (fin = fopen(fname,"rb")) != NULL ) + { + int version; + int offset; + + bufsize = unlzexe(fin, filebuf); + + rewind(fin); + + if ( bufsize == 0 ) // Program was not unpacked, so read it normally + { + for(i = 0; i < 512 ; i++) // I don't why this value (512), but it makes read mods correctly. At last Yorpius II + getc(fin); + + while(!feof(fin)) + { + filebuf[bufsize] = getc(fin); + bufsize++; + } + + bufsize--; + } + + + fclose(fin); + + version = getEXEVersion(episode, bufsize); + + g_pLogFile->ftextOut("Commander Keen Episode %d (Version %d.%d) was detected.
    ",episode,version/100,version%100); + + if(version < 0) + { + why_term_ptr = "loadtileattributes(): Unknown EXE-File. It is possible, that the exe-file is a mod. Please use an original exe-file.\nNot all Mods work with CKP"; + } + else if(version == 134) + { + why_term_ptr = "loadtileattributes(): Sorry, but version 1.34 isn't supported! please use version 1.31"; + } + + if( episode == 1 && version == 110 ) + { + offset = 0x131F8; + numtiles = 611; + } + else if( episode == 1 && version == 131 ) + { + offset = 0x130F8; + numtiles = 611; + } + else if( episode == 1 && version == 134 ) + { + offset = 0x00000; + numtiles = 611; + return -1; + } + else if( episode == 2 && version == 100 ) + { + offset = 0x17938; + numtiles = 689; + } + else if( episode == 2 && version == 131 ) + { + offset = 0x17828; + numtiles = 689; + } + else if( episode == 3 && version == 100 ) + { + offset = 0x199F8; + numtiles = 715; + } + else if( episode == 3 && version == 131 ) + { + offset = 0x198C8; + numtiles = 715; + } + else + { + crashflag = 1; + why_term_ptr = "loadtileattributes(): Algorithm for extracting tiles is not supported for this version!"; + return 1; + } + + memcpy(filebuf, filebuf + offset, 6*2*numtiles); + } + else + { + crashflag = 1; + why_term_ptr = "loadtileattributes(): Error reading tiles!"; + return 1; + } + } + else + { + // read from the tli file + int bufsize; + + bufsize = 0; + + while(!feof(fin)) + { + filebuf[bufsize] = getc(fin); + bufsize++; + } + fclose(fin); + } + + // Here we really start reading the tiles + if(TileProperty != NULL) + { + for(i = 0 ; i < 1000 ; i++) + { + if(TileProperty[i] != NULL) + free(TileProperty[i]); + } + free(TileProperty); + } + + TileProperty = (int**) malloc(1000*sizeof(int*)); + + for(i = 0 ; i < 1000 ; i++) + { + TileProperty[i] = NULL; + TileProperty[i] = (int*) malloc(6*sizeof(int)); + } + + for(j=0 ; j < 1000 ; j++ ) + { + for(i=0; i < 6 ; i++) + TileProperty[j][i]=0; + } + + if(TileProperty == NULL) + { + crashflag = 1; + why_term_ptr = "loadtileattributes(): The memory couldn't be allocated for this version of game!"; + return 1; + } + + for(i=0 ; i < 6 ; i++) + { + for(j=0 ; j < numtiles ; j++) + { + TileProperty[j][i] = filebuf[i*2*(numtiles)+2*j]; + TileProperty[j][i] += 256*filebuf[i*2*(numtiles)+2*j+1]; + } + } + + free(filebuf); + + int value; + + for( j=0 ; j < (numtiles) ; j++ ) + { + value = TileProperty[j][0]; + + // stuff for animated tiles + if(value == 1) + { + tiles[j].animOffset = 0; // starting offset from the base frame + } + else if( value == 2 ) + { + tiles[j].animOffset = 0; // starting offset from the base frame + j++; + tiles[j].animOffset = 1; // starting offset from the base frame + } + else + { + tiles[j].animOffset = 0; // starting offset from the base frame + j++; + tiles[j].animOffset = 1; // starting offset from the base frame + j++; + tiles[j].animOffset = 2; // starting offset from the base frame + j++; + tiles[j].animOffset = 3; // starting offset from the base frame + } + } + + sprintf(fname, "ep%dattr.dat", episode); + + + fp = fopen(fname, "rb"); + if (!fp) + { + crashflag = 1; + crashflag2 = episode; + why_term_ptr = "loadtileattributes(): Cannot open tile attribute file! Episode in flag2."; + return 1; + } + + // load in the tile attributes + for(t=0;t numtiles) + tiles[t].chgtile = 0; + } + fclose(fp); + + return 0; +} + +char loadstrings_AddAttr(char *attr, int stringIndex) +{ +char stAttrName[80]; +char stAttrValue[80]; +int attrvalue; +int RAMAllocSize; +char *copyPtr; +unsigned int i; + + // if the attribute does not have an equals sign bail + if (!strstr(attr, "=")) + { + g_pLogFile->ftextOut("loadstrings_AddAttr(): '%s' is not a valid attribute definition.
    ", attr); + return 1; + } + + // split the attribute up into it's name and it's value + copyPtr = stAttrName; + for(i=0;itextOut(RED,"loadstrings_AddAttr(): Unable to allocate space for attribute name ('%s').
    ", stAttrName); + return 1; + } + + // copy the data into the strings structure + memcpy(strings[stringIndex].attrnames[strings[stringIndex].numAttributes], stAttrName, RAMAllocSize); + strings[stringIndex].attrvalues[strings[stringIndex].numAttributes] = attrvalue; + + strings[stringIndex].numAttributes++; + return 0; +} + +// load strings from file *fname ("strings.dat") +char loadstrings(const char *fname) +{ +FILE *fp; +char state; +unsigned char stName[80]; +unsigned char stString[1024]; +unsigned char stAttr[80]; +int i,c; +int nameIndex, stringIndex; +int attrIndex=0; +int waitChar, gotoState; +char highlight; +int RAMSize; +char *RAMPtr; + + #define STSTATE_WAITCHAR 0 + #define STSTATE_READNAME 1 + #define STSTATE_READSTRING 2 + #define STSTATE_READATTR 3 + +g_pLogFile->ftextOut("loadstrings(): Opening string file '%s'.
    ", fname); + fp = fopen(fname, "rb"); + if (!fp) + { + g_pLogFile->ftextOut("loadstrings(): String file unable to open.
    "); + return 1; + } + + // go through all the strings and NULL out the entries...this will + // let us know which ones are in use (and need to be free()d at shutdown) + for(i=0;i0 && stString[stringIndex-1]=='\\'+(highlight*128)) + { // delimiter detected + if (c=='(') + { + stString[stringIndex - 1] = '[' + (highlight*128); + } + else if (c==')') + { + stString[stringIndex - 1] = ']' + (highlight*128); + } + else if (c=='H') + { + highlight = 1; + stringIndex--; + } + else if (c=='h') + { + highlight = 0; + stringIndex--; + } + else if (c=='\\') + { + stString[stringIndex - 1] = '\\' + (highlight*128); + } + } + else + { // normal non-delimited char + stString[stringIndex] = c; + if (highlight && c!=0 && c!=13) + { + stString[stringIndex] += 128; + } + stringIndex++; + } + } + else + { + stString[stringIndex-1] = 0; //null-terminate (cutting off final CR) + + /* save the string to the strings[] structure */ + + // we're going to malloc() an area and copy the name, then the string, + // into it. We'll need room for both the name and the string, plus + // null-terminators for each. + RAMSize = strlen( (char*) stName) + strlen((char*)stString) + 2; + RAMPtr = (char*) malloc(RAMSize); + if (!RAMPtr) + { + g_pLogFile->ftextOut(RED,"loadstrings(): Could not allocate memory for string '%s'
    ", stName); + return 1; + } + + // assign our pointers + strings[numStrings].name = (unsigned char*) &RAMPtr[0]; + strings[numStrings].stringptr = (unsigned char*) &RAMPtr[strlen((char*)stName)+1]; + + // copy the string info to the newly malloc()'d memory area + memcpy(strings[numStrings].name, stName, strlen((char*)stName)+1); + memcpy(strings[numStrings].stringptr, stString, strlen((char*)stString)+1); + + numStrings++; + // read the name of the next string + state = STSTATE_READNAME; + nameIndex = 0; + stringIndex = 0; + } + break; + } + + } while(1); + + g_pLogFile->ftextOut("loadstrings(): loaded %d strings from '%s'.
    ", numStrings, fname); + fclose(fp); + return 0; +} + +int freestrings(void) +{ +int i,j; +int NumStringsFreed; + + NumStringsFreed = 0; + for(i=0;i + +char loadstrings(const char *fname); +unsigned int fgeti(FILE *fp); +unsigned long fgetl(FILE *fp); +void formatPathString(char *output, const char *path); + +#ifdef __cplusplus +} +#endif diff --git a/src/fileio/CParser.cpp b/src/fileio/CParser.cpp new file mode 100644 index 000000000..201bae93b --- /dev/null +++ b/src/fileio/CParser.cpp @@ -0,0 +1,224 @@ +/* + * CParser.cpp + * + * Created on: 22.05.2009 + * Author: gerstrong + */ + +#include "CParser.h" +#include "../CLogFile.h" + +#include +#include +#include + +#define CONFIGFILENAME "genius.cfg" +#define MAX_STRING_LENGTH 256 + + +CParser::CParser() { + m_isOpen = false; +} + +CParser::~CParser() { + + while(!m_filebuffer.empty()) + { + free(m_filebuffer.front()); + m_filebuffer.pop_front(); + } +} + +// replaced by sscanf, since that function is slower and leaks memory +void CParser::parseline(char *p_input,char *p_output, int pos, int size) +{ + char buf; + int i=0; + + while( (pos+i) < size ) + { + buf = p_input[pos+i]; + if(buf == '\n') + break; + else + p_output[i]=buf; + + i++; + } +} + + +// Opens the text which can be parsed. This will read all the stuff in to the memory. +bool CParser::loadParseFile(void) // Open, read the list and close the file +{ + FILE *fp; + + if((fp=fopen(CONFIGFILENAME,"rt"))) + { + char *line; + + while(!feof(fp)) + { + line = (char*) calloc(256,sizeof(char)); + fgets(line,256,fp); + //fscanf(fp,"%s\n",line); + m_filebuffer.push_back(line); + m_isOpen = true; + } + fclose(fp); + return true; + } + else + { + g_pLogFile->ftextOut(GREEN,"Parser : The file has not been found. When CKP is trying to save the file it will create a new one."); + return false; + } + +} + +// Close the text which was parsed. This will also copy all stuff of the memory to the file. +bool CParser::saveParseFile(void) // open, write on the file and close +{ + FILE *fp; + + if((fp=fopen(CONFIGFILENAME,"wt"))) + { + list::iterator i; + + for(i=m_filebuffer.begin() ; i != m_filebuffer.end() ; ++i ) + fprintf(fp,"%s",*i); + + fclose(fp); + return true; + } + else + { + g_pLogFile->ftextOut(RED,"Parser : Error opening the file for write operations. Check your permissions or if the disk is full"); + return false; + } +} + +// read the value of the to be seeked keyword and returns it as an int. +// If no value was detected, it returns -1; +// If something was detected, the file is also rewinded! +int CParser::getIntValue(const char *keyword, const char *category) +{ + // The getter will search for category and than for keyword. After that, read the value and return it! + list::iterator i; + + char *line; + + for(i=m_filebuffer.begin() ; i != m_filebuffer.end() ; ++i ) + { + line = *i; + if(line[0]=='[') // found category + { + if(strncmp(line+1,category,strlen(category)) == 0) // is it the category we are looking for? + { + ++i; + line = *i; + + // category found !! let's see if the keyword exists + while(line[0]!='[') + { + if(strncmp(line,keyword,strlen(keyword)) == 0) + { + int value; + // keyword also found!! set the new value!! case 3 + sscanf(line+strlen(keyword)+2,"%d",&value); + return value; + } + + ++i; + + if(i == m_filebuffer.end()) + break; + + line = *i; + } + } + } + } + return -1; +} + +// This function saves the value of a keyword. If the value already exists in the file +// it will be overwritten. +// If something was written the file is also rewinded! +void CParser::saveIntValue(const char *keyword, const char *category,int value) +{ + // Three cases: + // 1.- category doesn't exist + // 2.- category exists, but keyword not + // 3.- category and keyword exist, only the value must be changed + + list::iterator i; + + + char *line; + + for(i=m_filebuffer.begin() ; i != m_filebuffer.end() ; ++i ) + { + line = *i; + if(line[0]=='[') // found category + { + if(strncmp(line+1,category,strlen(category)) == 0) // is it the category we are looking for? + { + ++i; + line = *i; + + // category found !! let's see if, the keyword exists + while(line[0]!='[') + { + if(strncmp(line,keyword,strlen(keyword)) == 0) + { + // keyword also found!! set the new value!! case 3 + i = m_filebuffer.erase(i); + char *newline; + newline = (char*) calloc(256,sizeof(char)); + sprintf(newline,"%s = %d\n",keyword,value); + m_filebuffer.insert(i,newline); + return; + } + ++i; + + if(i == m_filebuffer.end()) + break; + + line = *i; + + } + + // not found! case 2: category found, but no keyword + char *newline; + newline = (char*) calloc(256,sizeof(char)); + sprintf(newline,"%s = %d\n",keyword,value); + + if(i != m_filebuffer.end()) + { + --i; + m_filebuffer.insert(i,newline); + } + else + { + m_filebuffer.push_back(newline); + } + return; + } + } + } + // First case: Category doesn't exist! Create a new one, and as the keyword also cannot exist, create it too! + char *newline; + newline = (char*) calloc(256,sizeof(char)); + sprintf(newline,"\n"); + m_filebuffer.insert(m_filebuffer.end(),newline); + newline = (char*) calloc(256,sizeof(char)); + sprintf(newline,"[%s]\n",category); + m_filebuffer.insert(m_filebuffer.end(),newline); + newline = (char*) calloc(256,sizeof(char)); + sprintf(newline,"%s = %d\n",keyword,value); + m_filebuffer.insert(m_filebuffer.end(),newline); + return; +} + + diff --git a/src/fileio/CParser.h b/src/fileio/CParser.h new file mode 100644 index 000000000..3d460fcfd --- /dev/null +++ b/src/fileio/CParser.h @@ -0,0 +1,50 @@ +/* + * CParser.h + * + * Created on: 22.05.2009 + * Author: gerstrong + */ + +#ifndef CPARSER_H_ +#define CPARSER_H_ + +#include +#include +using namespace std; + + +class CParser { +public: + CParser(); + virtual ~CParser(); + + + // replaced by sscanf, since that function is slower and leaks memory + void parseline(char *p_input,char *p_output, int pos, int size); + + // Opena the text which can be parsed. This will read all the stuff in to the memory. + bool loadParseFile(void); + + // Close the text which was parsed. This will also copy all stuff of the memory to the file. + bool saveParseFile(void); + + // read the value of the to be seeked keyword and returns it as an int. + // If no value was detected, it returns -1; + // If something was detected, the file is also rewinded! + int getIntValue(const char *keyword, const char *category); + + // This function saves the value of a keyword. If the value already exists in the file + // it will be overwritten. + // If something was written the file is also rewinded! + void saveIntValue(const char *keyword, const char *category, int value); + + bool isOpen(void) {return m_isOpen;} + +private: + bool m_isOpen; + + list m_filebuffer; + +}; + +#endif /* CPARSER_H_ */ diff --git a/src/fileio/lzexe.cpp b/src/fileio/lzexe.cpp new file mode 100644 index 000000000..d8d2530cf --- /dev/null +++ b/src/fileio/lzexe.cpp @@ -0,0 +1,150 @@ +/* + * lzexe.c + * + * Created on: 24.01.2009 + * Author: gerstrong + */ + +#include +#include + +int get_bit(int *p_bit_count, FILE **fin) +{ + static unsigned short bits; + int bit; + + bit = bits & 1; + (*p_bit_count)--; + + if ((*p_bit_count) <= 0) + { + bits = getc(*fin) | getc(*fin) << 8; + + if ((*p_bit_count) == -1) /* special case for first bit word */ + { + bit = bits & 1; + bits >>= 1; + } + + (*p_bit_count) += 16; + } + else + bits >>= 1; + + return bit; +} + +int getEXEVersion(int episode, int bufsize) +{ + switch (bufsize) + { + case 99762: + if(episode != 1) + return -1; + else + return 110; + case 99972: + if(episode != 1) + return -1; + else + return 131; + + case 398: + if(episode != 1) + return -1; + else + return 134; + + case 118114: + if(episode != 2) + return -1; + else + return 100; + + case 118160: + + if(episode != 2) + return -1; + else + return 131; + + case 127086: + + if(episode != 3) + return -1; + else + return 100; + + case 127104: + if(episode != 3) + return -1; + else + return 131; + + default: return -2; + } + +} + +// return how much was unpacked or zero if nothing was unpacked +int unlzexe(FILE *fin, unsigned char *outbuffer) +{ + int bit_count; + short offset; + int pos, repeat; + + pos = 0; + bit_count = 0; + + /* skip header */ + fseek(fin, 32, SEEK_SET); + + while (1) + { + + if (get_bit(&bit_count, &fin)) + { + outbuffer[pos++] = getc(fin); + } + else + { + if (get_bit(&bit_count, &fin)) + { + unsigned char tmp[2]; + fread(tmp, 1, 2, fin); + repeat = (tmp[1] & 0x07); + + offset = ((tmp[1] & ~0x07) << 5) | tmp[0] | 0xE000; + + if (repeat == 0) + { + repeat = getc (fin); + + + if (repeat == 0) + break; + else if (repeat == 1) + continue; + else + repeat++; + } + else + repeat += 2; + } + else + { + repeat = ((get_bit(&bit_count, &fin) << 1) | get_bit(&bit_count, &fin)) + 2; + offset = getc(fin) | 0xFF00; + } + + while (repeat > 0) + { + outbuffer[pos] = outbuffer[pos + offset]; + pos++; + repeat--; + } + } + } + + return pos; +} diff --git a/src/fileio/rle.cpp b/src/fileio/rle.cpp new file mode 100644 index 000000000..f4e938079 --- /dev/null +++ b/src/fileio/rle.cpp @@ -0,0 +1,76 @@ +/* + * rle.c + * + * Created on: 29.01.2009 + * Author: gerstrong + */ + +#include +#include "../funcdefs.h" + + +int unRLEW(FILE *fp, unsigned int *filebuf) +{ + + int t,i, howmany, cursize, finsize; + /* +1.) If implemented, get the first dword in the file, [Final Length] +2.) If [Length of data so far] < [Final Length] then: + 3.) Get a word + 2.) Is this word $FEFE? + -> If yes; + Get the next two words (Word1 and Word2) + Copy Word1 [Word2] times + Move forward three words and got to 2.) + -> If no; + Copy the word + Move forward a word and go to 2.) + */ + + cursize = 0; + + rewind(fp); + + + while(!feof(fp)) // Detect, if the file is really RLEW compressed! + { + t = fgeti(fp); + if(t == 0xFEFE) + { + cursize = 1; + break; + } + } + + + if(cursize == 0) + { + return -1; // This file is not RLEW compressed! + } + rewind(fp); + + finsize = fgeti(fp); + + + while( cursize < finsize ) + { + t = fgeti(fp); + if (t == 0xFEFE) + { + howmany = fgeti(fp); + t = fgeti(fp); + for(i=0;itextOut(PURPLE,"Sorry, but your exe-file is not compatible for reading the story.
    "); + } + else + { + *ptext = (char*) malloc((endflag-startflag)*sizeof(char)); + strncpy((*ptext),(char*)filebuf+startflag,(endflag-startflag)*sizeof(char)); + } + + free(filebuf); + + return (endflag-startflag); + } + else + return -1; + } + else + { + int pos; + int filesize; + + pos = ftell (fp); + fseek (fp, 0, SEEK_END); + filesize = ftell (fp); + fseek (fp, pos, SEEK_SET); + + pos = 0; + + *ptext = (char*) malloc(filesize*sizeof(char)); + + while(!feof(fp)) + { + (*ptext)[pos] = fgetc(fp); + pos++; + } + + fclose(fp); + + return filesize; + } +} + diff --git a/src/finale.cpp b/src/finale.cpp new file mode 100644 index 000000000..bab9e885f --- /dev/null +++ b/src/finale.cpp @@ -0,0 +1,135 @@ +/* FINALE.C + Code for displaying the FINALE.CK? files. + Thanks to Andrew Durdin for FIN2BMP, from which I got + the decompression algorithm. +*/ + +#include "keen.h" +#include "include/fileio.h" +#include "CGraphics.h" + +int finale_x; +int finale_y; +int finale_count; +int finale_planecol; +int finale_plane_length; +int finale_done; + +// used internally by finale_draw() +void finale_plot(int pix) +{ +int mask; + + mask = 128; + do + { + if (pix & mask) + { + if (finale_planecol==1) + { + g_pGraphics->sb_setpixel(finale_x, finale_y, finale_planecol); + } + else + { // merge with previous planes + g_pGraphics->sb_setpixel(finale_x, finale_y, g_pGraphics->sb_getpixel(finale_x, finale_y) | finale_planecol); + } + } + else if (finale_planecol==1) + { + g_pGraphics->sb_setpixel(finale_x, finale_y, 0); + } + + finale_x++; + if (finale_x > 319) + { + finale_x = 0; + finale_y++; + } + + finale_count++; + if (finale_count >= finale_plane_length) + { + finale_x = finale_y = 0; + finale_count = 0; + finale_planecol <<= 1; + if (finale_planecol > 8) finale_done = 1; + } + + if (mask==1) + { + return; + } + else + { + mask >>= 1; + } + + } while(1); + +} + +// draws a finale.ck? file into the upper-left corner of the scrollbuffer +void finale_draw(const char *filename, const char *path) +{ +char fname[256]; +FILE *fp; +int cmdbyte; +int bytecount; +int repeatbyte; +int i; +char buffer[256]; + + + formatPathString(buffer,path); + + + map_unregister_all_animtiles(); + + sprintf(fname, "%s%s", buffer,filename); + fp = fopen(fname, "rb"); + if (!fp) + { + crashflag = 1; + why_term_ptr = "finale_draw(): cannot open finake.ck? file."; + return; + } + + finale_plane_length = fgetl(fp)*2; //length of a plane when decompressed + finale_planecol = 1; + finale_x = finale_y = 0; + finale_count = 0; + finale_done = 0; + + /* decompress/draw the image */ + do + { + cmdbyte = fgetc(fp); + if (cmdbyte<0) + { // EOF + return; + } + + if (cmdbyte & 0x80) + { + //N + 1 bytes of data follows + bytecount = (cmdbyte & 0x7F) + 1; + for(i=0;iControl.levelcontrol.curlevel; + crashflag3 = pCKP->Control.levelcontrol.episode; + why_term_ptr = "No player start position! (flag2=pCKP->Control.levelcontrol.curlevel, flag3=pCKP->Control.levelcontrol.episode)"; + } + + if (!loadinggame) + { + gameloop_initialize(pCKP); + } + else + { + loadinggame = 0; + fade.mode = FADE_GO; + fade.dir = FADE_IN; + fade.curamt = 0; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + } + + // fire all guns immediately first time around + gunfiretimer = (gunfirefreq+1); + + // if this is Mortimer's Castle, fade in and do the conversation + // with Mortimer. + if (pCKP->Control.levelcontrol.episode==3 && pCKP->Control.levelcontrol.curlevel==16) + { + for(i=0;ipollEvents(); + g_pTimer->SpeedThrottle(); + gamedo_RenderScreen(pCKP); + } while(fade.mode!=FADE_COMPLETE /*&& !immediate_keytable[KQUIT]*/); + + eseq3_Mortimer(pCKP); + } + + lastquit = 1; + g_pInput->flushKeys(); // The Windows need that. I don't know why! + + // Now, we are ready to loop the game scenes (map and level) + // Let's create the player objects + do + { + if (primaryplayer==1) otherplayer = 0; else otherplayer = 1; + + #ifdef NETWORK_PLAY +// if (numplayers>1) net_getdata(); + if (is_server) + { + Net_Server_Run(); + } + else if (is_client) + { + Net_Client_Run(); + } + #endif + + gamedo_fades(); + + // periodically make all enemy gun fixtures fire (in ep3) + // (also ice cannons in ep1) we do this in a global variable + // so they're all in sync. when gunfiretimer==0 all gun SE + // objects will fire. + if (gunfiretimer > gunfirefreq) + { + gunfiretimer = 0; + } + else gunfiretimer++; + + // gather input and copy to player[].keytable[] structures + gamedo_getInput(pCKP); + + // run the player behaviour for each player in the game + if (!map.isworldmap) + { + for(i=0;iControl.levelcontrol.gameovermode && pCKP->Control.levelcontrol.level_done==LEVEL_NOT_DONE) + { + ScreenIsScrolling = 0; + if (gamedo_ScrollTriggers(primaryplayer)) ScreenIsScrolling = 1; + } + + + + // do frameskipping, and render/blit the screen if it's time + gamedo_frameskipping(pCKP); + + // when we complete a fade out flag to exit the game loop + if (fade.mode==FADE_COMPLETE) + { + if (fade.dir==FADE_OUT) + { + demomode = DEMO_NODEMO; + pCKP->Control.levelcontrol.level_done = LEVEL_COMPLETE; + pCKP->Control.levelcontrol.command = LVLC_CHANGE_LEVEL; + if (pCKP->Control.levelcontrol.curlevel != WM_MAP_NUM) + { // exiting a level, going back to world map + for(i=0;iControl.levelcontrol.success==1) + { // mark level as completed on world map + pCKP->Control.levelcontrol.levels_completed[pCKP->Control.levelcontrol.curlevel] = 1; + } + pCKP->Control.levelcontrol.chglevelto = WM_MAP_NUM; + } + } + else + { + fade.mode = NO_FADE; + } + } + + // when walking through the exit door don't show keen's sprite past + // the door frame (so it looks like he walks "through" the door) + if (pCKP->Control.levelcontrol.level_done==LEVEL_DONE_WALK) + { + usedinfobox = 0; + gamepdo_walkbehindexitdoor(pCKP->Control.levelcontrol.level_finished_by, pCKP); + } + + // allow enter to return to main menu + // if we're in game over mode + + enter = (g_pInput->getPressedCommand(IC_STATUS)); + if (pCKP->Control.levelcontrol.gameovermode) + { + if (enter) + { + int cities; + CHighScores *HighScoreTable; + + if (pCKP->Control.levelcontrol.levels_completed[4]) cities++; + if (pCKP->Control.levelcontrol.levels_completed[6]) cities++; + if (pCKP->Control.levelcontrol.levels_completed[7]) cities++; + if (pCKP->Control.levelcontrol.levels_completed[13]) cities++; + if (pCKP->Control.levelcontrol.levels_completed[11]) cities++; + if (pCKP->Control.levelcontrol.levels_completed[9]) cities++; + if (pCKP->Control.levelcontrol.levels_completed[15]) cities++; + if (pCKP->Control.levelcontrol.levels_completed[16]) cities++; + + HighScoreTable = new CHighScores(pCKP); + + bool extras[4]; + + // check inventory or saved cities + memset(extras,false,4*sizeof(bool)); + if(pCKP->Control.levelcontrol.episode == 1) + { + if(player[0].inventory.HasJoystick) + extras[0] = true; + if(player[0].inventory.HasBattery) + extras[1] = true; + if(player[0].inventory.HasVacuum) + extras[2] = true; + if(player[0].inventory.HasFuel) + extras[3] = true; + } + + HighScoreTable->writeHighScore((int)player[0].inventory.score,extras,cities); + + HighScoreTable->showHighScore(); + + delete HighScoreTable; + + + if (fade.mode!=FADE_GO && fade.dir!=FADE_OUT) + { + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + fade.mode = FADE_GO; + } + + pCKP->Control.levelcontrol.command = LVLC_GAME_OVER; + + } + + if (fade.mode==FADE_COMPLETE && fade.dir==FADE_OUT) + { + pCKP->Control.levelcontrol.command = LVLC_GAME_OVER; + } + } + + #ifdef NETWORK_PLAY +// if (numplayers>1) net_senddata(); + #endif + + if (g_pInput->getPressedKey(KQUIT)) + { + VerifyQuit(pCKP); + } + + if (QuitState != NO_QUIT) return; + + + // limit frame rate + if (!acceleratemode) + { + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + #ifdef NETWORK_PLAY +// if (numplayers>1) net_sync(); + #endif + } + + if(g_pInput->getExitEvent()) + { + g_pInput->sendKey(KQUIT); + g_pInput->cancelExitEvent(); + } + + } while(!crashflag && pCKP->Control.levelcontrol.command==LVLC_NOCOMMAND); + + // Cleanup the player structure! + +} + +// gives keycard for door doortile to player p +void give_keycard(int doortile, int p) +{ +/*int i;*/ + g_pSound->playSound(SOUND_GET_CARD, PLAY_NOW); + if (doortile==DOOR_YELLOW) player[p].inventory.HasCardYellow = 1; + else if (doortile==DOOR_RED) player[p].inventory.HasCardRed = 1; + else if (doortile==DOOR_GREEN) player[p].inventory.HasCardGreen = 1; + else if (doortile==DOOR_BLUE) player[p].inventory.HasCardBlue = 1; + else + { + crashflag = 1; + crashflag2 = doortile; + why_term_ptr = "give_keycard(): invalid value for doortile parameter."; + } +} + +// take away the specified keycard from player p +void take_keycard(int doortile, int p) +{ +/*int i;*/ + if (doortile==DOOR_YELLOW) player[p].inventory.HasCardYellow = 0; + else if (doortile==DOOR_RED) player[p].inventory.HasCardRed = 0; + else if (doortile==DOOR_GREEN) player[p].inventory.HasCardGreen = 0; + else if (doortile==DOOR_BLUE) player[p].inventory.HasCardBlue = 0; +} + +// unregisters all animated tiles with baseframe tile +void unregister_animtiles(int tile) +{ +int i; + for(i=0;iplaySound(SOUND_DOOR_OPEN, PLAY_NOW); + + if(options[OPT_KEYCARDSTACK].value != 1) + take_keycard(doortile, cp); + + /* erase door from map */ + if (pCKP->Control.levelcontrol.episode==3) + { + chgtotile = map.mapdata[mpx-1][mpy]; + } + else + { + chgtotile = tiles[map.mapdata[mpx][mpy]].chgtile; + } + + if(TileProperty[map.mapdata[mpx][mpy-1]][BEHAVIOR] > 1 && + TileProperty[map.mapdata[mpx][mpy-1]][BEHAVIOR] < 6) // This happens because, sometimes the player opens the door + // from a lower part. + { + map_chgtile(mpx, mpy-1, chgtotile); + tilefix=1; + + } + if(TileProperty[map.mapdata[mpx][mpy]][BEHAVIOR] > 1 && + TileProperty[map.mapdata[mpx][mpy]][BEHAVIOR] < 6) // This happens because, sometimes the player opens the door + // from a lower part. + { + map_chgtile(mpx, mpy, chgtotile); // upper? + + } + if(TileProperty[map.mapdata[mpx][mpy+1]][BEHAVIOR] > 1 && + TileProperty[map.mapdata[mpx][mpy+1]][BEHAVIOR] < 6) // This happens because, sometimes the player opens the door + // from a lower part. + { + map_chgtile(mpx, mpy+1, chgtotile); // When he stands in front of the door! + } + + // replace the door tiles with a door object, which will do the animation + o = spawn_object(mpx<<4< than "extra life at" and award 1-UPs when appropriate +void extralifeat(int cp) +{ + if (player[cp].inventory.score > player[cp].inventory.extralifeat) + { + g_pSound->playSound(SOUND_EXTRA_LIFE, PLAY_NOW); + player[cp].inventory.lives++; + player[cp].inventory.extralifeat += 20000; + } +} + +// have keen pick up the goodie at screen pixel position (px, py) +void keen_get_goodie(int px, int py, int theplayer, stCloneKeenPlus *pCKP) +{ +int mpx,mpy,t; +/*int i;*/ + mpx = px>>4; + mpy = py>>4; + t = map.mapdata[mpx][mpy]; + + if ((TileProperty[t][BEHAVIOR] < 17 && TileProperty[t][BEHAVIOR] > 5) || + (TileProperty[t][BEHAVIOR] > 17 && TileProperty[t][BEHAVIOR] < 22) || + (TileProperty[t][BEHAVIOR] == 27 || TileProperty[t][BEHAVIOR] == 28) ) // All pickupable items + //if (tiles[t].pickupable) + { // pick up the goodie, i.e. erase it from the map + map_chgtile(mpx, mpy, tiles[t].chgtile); + //if (tiles[t].isAnimated) map_deanimate(mpx, mpy); + if (TileProperty[t][ANIMATION] != 1) map_deanimate(mpx, mpy); + } + else if (TileProperty[t][BEHAVIOR] == 1) + //else if (tiles[t].lethal) + { // whoah, this "goodie" isn't so good... + killplayer(theplayer, pCKP); + return; + } + + // do whatever the goodie is supposed to do... + procgoodie(t, mpx, mpy, theplayer, pCKP); +} + +void initgame(stCloneKeenPlus *pCKP) +{ +int x,y; +unsigned int i; + + animtiletimer = curanimtileframe = 0; + //PlatExtending = 0; + + // reset player walk frame widths + for(i=0;iControl.levelcontrol.episode==1) + { + gunfirefreq = ICECANNON_FIRE_FREQ; + } + else + { + gunfirefreq = GUN_FIRE_FREQ; + } + + // reset the ysize attribute of all doors + sprites[DOOR_YELLOW_SPRITE].ysize = 32; + sprites[DOOR_RED_SPRITE].ysize = 32; + sprites[DOOR_GREEN_SPRITE].ysize = 32; + sprites[DOOR_BLUE_SPRITE].ysize = 32; + + pCKP->Control.levelcontrol.level_done_timer = 0; + pCKP->Control.levelcontrol.gameovermode = 0; + + // all objects -> not exist + for(i=1;iControl.levelcontrol.episode==1) + { + objdefsprites[OBJ_YORP] = OBJ_YORP_DEFSPRITE; + objdefsprites[OBJ_GARG] = OBJ_GARG_DEFSPRITE; + objdefsprites[OBJ_BUTLER] = OBJ_BUTLER_DEFSPRITE; + objdefsprites[OBJ_TANK] = OBJ_TANK_DEFSPRITE; + objdefsprites[OBJ_ICECHUNK] = OBJ_ICECHUNK_DEFSPRITE; + objdefsprites[OBJ_ICEBIT] = OBJ_ICEBIT_DEFSPRITE; + objdefsprites[OBJ_ROPE] = OBJ_ROPE_DEFSPRITE; + + objdefsprites[OBJ_RAY] = OBJ_RAY_DEFSPRITE_EP1; + objdefsprites[OBJ_VORT] = OBJ_VORT_DEFSPRITE_EP1; + } + else if (pCKP->Control.levelcontrol.episode==2) + { + objdefsprites[OBJ_WALKER] = OBJ_WALKER_DEFSPRITE; + objdefsprites[OBJ_TANKEP2] = OBJ_TANKEP2_DEFSPRITE; + objdefsprites[OBJ_BEAR] = OBJ_BEAR_DEFSPRITE; + + objdefsprites[OBJ_RAY] = OBJ_RAY_DEFSPRITE_EP2; + objdefsprites[OBJ_VORT] = OBJ_VORT_DEFSPRITE_EP2; + objdefsprites[OBJ_PLATFORM] = OBJ_PLATFORM_DEFSPRITE_EP2; + objdefsprites[OBJ_BABY] = OBJ_BABY_DEFSPRITE_EP2; + } + else if (pCKP->Control.levelcontrol.episode==3) + { + objdefsprites[OBJ_FOOB] = OBJ_FOOB_DEFSPRITE; + objdefsprites[OBJ_NINJA] = OBJ_NINJA_DEFSPRITE; + objdefsprites[OBJ_MOTHER] = OBJ_MOTHER_DEFSPRITE; + objdefsprites[OBJ_MEEP] = OBJ_MEEP_DEFSPRITE; + objdefsprites[OBJ_BALL] = OBJ_BJ_DEFSPRITE; + objdefsprites[OBJ_JACK] = OBJ_BJ_DEFSPRITE; + + objdefsprites[OBJ_RAY] = OBJ_RAY_DEFSPRITE_EP3; + objdefsprites[OBJ_VORT] = OBJ_VORT_DEFSPRITE_EP3; + objdefsprites[OBJ_PLATFORM] = OBJ_PLATFORM_DEFSPRITE_EP3; + objdefsprites[OBJ_BABY] = OBJ_BABY_DEFSPRITE_EP3; + } + + objdefsprites[OBJ_DOOR] = DOOR_YELLOW_SPRITE; + objdefsprites[OBJ_TELEPORTER] = OBJ_TELEPORTER_DEFSPRITE; + + objdefsprites[OBJ_SECTOREFFECTOR] = BlankSprite; + +// initilize game variables + pCKP->Control.levelcontrol.level_done = LEVEL_NOT_DONE; + animtiletimer = curanimtileframe = 0; + DemoObjectHandle = 0; + + for(i=0;iResources.GameSelected == 0) + { + if (loadtileattributes(pCKP->Control.levelcontrol.episode, pCKP->GameData[0].DataDirectory)) return 1; + } + else + { + if (loadtileattributes(pCKP->Control.levelcontrol.episode, pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory)) return 1; + } + + map.firsttime = 1; + + memset(player, 0, sizeof(player)); + + for(i=0;iControl.levelcontrol.levels_completed[i] = 0; + + for(i=0;iControl.levelcontrol.episode==1) + { + player[i].inventory.charges = 0; + } + else if (pCKP->Control.levelcontrol.episode==2) + { + player[i].inventory.charges = 3; + } + else + { + player[i].inventory.charges = 5; + } + if (demomode) player[i].inventory.charges = 100; + + // start with pogo stick in all episodes but 1 + if (pCKP->Control.levelcontrol.episode!=1 || demomode) + { player[i].inventory.HasPogo = 1; } + else + { player[i].inventory.HasPogo = 0; } + } + + initsprites(pCKP, s); + + if (demomode) srand(375); + + primaryplayer = 0; + + return 0; +} + +char spawn_object(int x, int y, int otype) +{ +int i; + // find an unused object slot + for(i=1;i>CSF)+ysize; + if ((temp>>4)<<4 != temp) + { + objects[o].blockedd = 0; + } + else + { // on a tile boundary, test if tile under object is solid + objects[o].blockedd = 0; + x = (objects[o].x>>CSF); + y = (objects[o].y>>CSF)+ysize+1; + for(xa=0;xa 1 && + TileProperty[getmaptileat(x+xa,y)][BEHAVIOR] < 6) ) + { + objects[o].blockedd = 1; + goto setblockedd; + } + } + if(TileProperty[getmaptileat(x+xsize-2, y)][BUP] || (TileProperty[getmaptileat(x+xa,y)][BEHAVIOR] > 1 && + TileProperty[getmaptileat(x+xa,y)][BEHAVIOR] < 6) ) + { + objects[o].blockedd = 1; + } + setblockedd: ; + } + + // set blockedu + objects[o].blockedu = 0; + x = (objects[o].x>>CSF); + y = (objects[o].y>>CSF)-1; + for(xa=0;xa>CSF)-1; + y = (objects[o].y>>CSF)+1; + for(ya=0;ya>CSF)+ysize-1))][BRIGHT]) + //if (tiles[getmaptileat(x, ((objects[o].y>>CSF)+ysize-1))].solidr) + { + objects[o].blockedl = 1; + } + setblockedl: ; + + // set blockedr + objects[o].blockedr = 0; + x = (objects[o].x>>CSF)+xsize; + y = (objects[o].y>>CSF)+1; + for(ya=0;ya>CSF)+ysize-1))][BLEFT]) + //if (tiles[getmaptileat(x, ((objects[o].y>>CSF)+ysize-1))].solidl) + { + objects[o].blockedr = 1; + } + setblockedr: ; + + // hit detection with players + objects[o].touchPlayer = 0; + for(cplayer=0;cplayerOBJ_YINERTIA_RATE) + { + if (objects[o].yinertia < OBJFALLSPEED) objects[o].yinertia++; + objects[o].yinertiatimer = 0; + } else objects[o].yinertiatimer++; + } + objects[o].y += objects[o].yinertia; + } +} + +// returns nonzero if object1 overlaps object2 +char hitdetect(int object1, int object2) +{ +int s1, s2; +unsigned int rect1x1, rect1y1, rect1x2, rect1y2; +unsigned int rect2x1, rect2y1, rect2x2, rect2y2; + + // get the sprites used by the two objects + s1 = objects[object1].sprite; + s2 = objects[object2].sprite; + + // get the bounding rectangle of the first object + rect1x1 = objects[object1].x + sprites[s1].bboxX1; + rect1y1 = objects[object1].y + sprites[s1].bboxY1; + rect1x2 = objects[object1].x + sprites[s1].bboxX2; + rect1y2 = objects[object1].y + sprites[s1].bboxY2; + + // get the bounding rectangle of the second object + rect2x1 = objects[object2].x + sprites[s2].bboxX1; + rect2y1 = objects[object2].y + sprites[s2].bboxY1; + rect2x2 = objects[object2].x + sprites[s2].bboxX2; + rect2y2 = objects[object2].y + sprites[s2].bboxY2; + + // find out if the rectangles overlap + if ((rect1x1 < rect2x1) && (rect1x2 < rect2x1)) return 0; + if ((rect1x1 > rect2x2) && (rect1x2 > rect2x2)) return 0; + if ((rect1y1 < rect2y1) && (rect1y2 < rect2y1)) return 0; + if ((rect1y1 > rect2y2) && (rect1y2 > rect2y2)) return 0; + + return 1; +} + +void killplayer(int theplayer, stCloneKeenPlus *pCKP) +{ + if (player[theplayer].godmode || g_pInput->getHoldedKey(KTAB)) return; + if (player[theplayer].ankhtime) return; + if (pCKP->Control.levelcontrol.level_done) return; + if (!player[theplayer].pdie) + { + player[theplayer].pdie = PDIE_DYING; + player[theplayer].pdieframe = 0; + player[theplayer].pdietimer = 0; + player[theplayer].pdietillfly = DIE_TILL_FLY_TIME; + player[theplayer].pdie_xvect = rand()%(DIE_MAX_XVECT*2); + player[theplayer].pdie_xvect -= DIE_MAX_XVECT; + player[theplayer].inventory.lives--; + player[theplayer].y += (8<stop(); + g_pSound->playSound(SOUND_KEEN_DIE, PLAY_NOW); + } +} + +void freezeplayer(int theplayer) +{ + if (player[theplayer].godmode /*|| immediate_keytable[KTAB]*/) return; + if (player[theplayer].ankhtime) return; + // give the player a little "kick" + player[theplayer].pjumptime = PJUMP_NORMALTIME_1; + player[theplayer].pjumpupdecreaserate = PJUMP_UPDECREASERATE_1; + player[theplayer].pjumpupspeed = 15; + player[theplayer].pjumping = PJUMPUP; + player[theplayer].pjumpupspeed_decreasetimer = 0; + player[theplayer].pjustjumped = 1; + + // and freeze him (stun him on ep2/3) + player[theplayer].pfrozentime = PFROZEN_TIME; + player[theplayer].pfrozenframe = 0; + player[theplayer].pfrozenanimtimer = 0; + player[theplayer].ppogostick = 0; +} + + +void PlayerTouchedExit(int theplayer, stCloneKeenPlus *pCKP) +{ +/*int i;*/ + if (!player[theplayer].pjumping && !player[theplayer].pfalling\ + && !player[theplayer].ppogostick && \ + pCKP->Control.levelcontrol.level_done==LEVEL_NOT_DONE) + { + // don't allow player to walk through a door if he's standing + // on an object such as a platform or an enemy + if (player[theplayer].psupportingobject) + { + return; + } + + // if player has ankh shut it off + if (player[theplayer].ankhtime) + { + player[theplayer].ankhtime = 0; + objects[player[theplayer].ankhshieldobject].exists = 0; + } + + player[theplayer].ppogostick = 0; + + g_pMusicPlayer->stop(); + g_pSound->playSound(SOUND_LEVEL_DONE, PLAY_NOW); + pCKP->Control.levelcontrol.level_done = LEVEL_DONE_WALK; + pCKP->Control.levelcontrol.level_finished_by = theplayer; + } +} + +void endlevel(int success, stCloneKeenPlus *pCKP) +{ + if (fade.mode == NO_FADE) + { + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + fade.mode = FADE_GO; + pCKP->Control.levelcontrol.success = success; + pCKP->Control.levelcontrol.tobonuslevel = 0; + } +} + +void SetGameOver(stCloneKeenPlus *pCKP) +{ +/*int x,y,bmnum;*/ + if (!pCKP->Control.levelcontrol.gameovermode) + { + pCKP->Control.levelcontrol.gameovermode = 1; + g_pSound->playSound(SOUND_GAME_OVER, PLAY_NOW); + } +} + + +// this is so objects can block the player, +// player can stand on them, etc. +// x and y are the CSFed coordinates to check (e.g. playx and playy) +// returns nonzero if there is a solid object +// at that point +char checkobjsolid(unsigned int x, unsigned int y, unsigned int cp) +{ + int o; + + for(o=1;o= objects[o].x+sprites[objects[o].sprite].bboxX1) + if (x <= objects[o].x+sprites[objects[o].sprite].bboxX2) + if (y >= objects[o].y+sprites[objects[o].sprite].bboxY1) + if (y <= objects[o].y+sprites[objects[o].sprite].bboxY2) + return o; + } + } + return 0; +} + +// returns 1 if player cp has the card to door t, which -> door +char CheckDoorBlock(int t, int cp, int which,stCloneKeenPlus *pCKP) +{ + if (which==DOOR_YELLOW) + { + if (!player[cp].inventory.HasCardYellow) + { + player[cp].blockedby = t; + return 1; + } + } + else if (which==DOOR_RED) + { + if (!player[cp].inventory.HasCardRed) + { + player[cp].blockedby = t; + return 1; + } + } + else if (which==DOOR_GREEN) + { + if (!player[cp].inventory.HasCardGreen) + { + player[cp].blockedby = t; + return 1; + } + } + else if (which==DOOR_BLUE) + { + if (!player[cp].inventory.HasCardBlue) + { + player[cp].blockedby = t; + return 1; + } + } + + return 0; +} + +// checks if tile at (x,y) is solid to the player walking left into it. +// returns 1 and sets blockedby if so. +char checkissolidl(int x, int y, int cp, stCloneKeenPlus *pCKP) +{ +int t; + t = getmaptileat(x, y); + + if(TileProperty[t][BLEFT] || x < 0) + //if (tiles[t].solidl) + { + player[cp].blockedby = t; + return 1; + } + if (checkobjsolid(x<=16) + { + y2 = 0; + t++; + } + } +} + +// creates a mask from a sourcetile, places it in desttile +void MakeMask(int sourcetile, int desttile, int transparentcol) +{ +int x,y,c; + for(y=0;y<16;y++) + { + for(x=0;x<16;x++) + { + c = tiledata[sourcetile][y][x]; + if (c != transparentcol) c = 0; else c = 15; + tiledata[desttile][y][x] = c; + } + } +} + +// replaces all instances of color find in sprite s with +// color replace, as long as the y is greater than miny +void ReplaceSpriteColor(int s, int find, int replace, int miny) +{ +int x,y; + + for(y=miny;yControl.levelcontrol.episode==1) + { + +// MakeMask(443, 155, 7); + // tiles[443].masktile = 155; +// tiles[428].masktile = 155; + } +} + +void procgoodie(int t, int mpx, int mpy, int theplayer, stCloneKeenPlus *pCKP) +{ + if ((TileProperty[t][BEHAVIOR] > 5 && TileProperty[t][BEHAVIOR] < 11) || + (TileProperty[t][BEHAVIOR] > 17 && TileProperty[t][BEHAVIOR] < 22) ) + { + if((player[theplayer].x*player[theplayer].y) % 2 == 1) + g_pSound->playStereofromCoord(SOUND_GET_BONUS, PLAY_NOW, 0); + else + g_pSound->playStereofromCoord(SOUND_GET_BONUS, PLAY_NOW, 320); + } + else if (TileProperty[t][BEHAVIOR] > 10 && TileProperty[t][BEHAVIOR] < 16) g_pSound->playSound(SOUND_GET_ITEM, PLAY_NOW); + switch(TileProperty[t][BEHAVIOR]) + { + // keycards + case 18: give_keycard(DOOR_YELLOW, theplayer); break; + case 19: give_keycard(DOOR_RED, theplayer); break; + case 20: give_keycard(DOOR_GREEN, theplayer); break; + case 21: give_keycard(DOOR_BLUE, theplayer); break; + + case DOOR_YELLOW: + if (player[theplayer].inventory.HasCardYellow) + open_door(DOOR_YELLOW, DOOR_YELLOW_SPRITE, mpx, mpy, theplayer, pCKP); + break; + case DOOR_RED: + if (player[theplayer].inventory.HasCardRed) + open_door(DOOR_RED, DOOR_RED_SPRITE, mpx, mpy, theplayer, pCKP); + break; + case DOOR_GREEN: + if (player[theplayer].inventory.HasCardGreen) + open_door(DOOR_GREEN, DOOR_GREEN_SPRITE, mpx, mpy, theplayer, pCKP); + break; + case DOOR_BLUE: + if (player[theplayer].inventory.HasCardBlue) + open_door(DOOR_BLUE, DOOR_BLUE_SPRITE, mpx, mpy, theplayer, pCKP); + break; + + case 7: // What gives you 100 Points + player[theplayer].inventory.score += 100; extralifeat(theplayer); + break; + case 8: // What gives you 200 Points + player[theplayer].inventory.score += 200; extralifeat(theplayer); + break; + case 6: // What gives you 500 Points + player[theplayer].inventory.score += 500; extralifeat(theplayer); + break; + case 9: // What gives you 1000 Points + player[theplayer].inventory.score += 1000; extralifeat(theplayer); + break; + case 10: // What gives you 5000 Points + player[theplayer].inventory.score += 5000; extralifeat(theplayer); + break; + + case 15: // raygun + player[theplayer].inventory.charges += 5; + break; + case 16: // the Holy Pogo Stick + player[theplayer].inventory.HasPogo = 1; + g_pSound->playSound(SOUND_GET_PART, PLAY_NOW); + break; + + case 11: + player[theplayer].inventory.HasJoystick = 1; + g_pSound->playSound(SOUND_GET_PART, PLAY_NOW); + break; + + case 12: + player[theplayer].inventory.HasBattery = 1; + g_pSound->playSound(SOUND_GET_PART, PLAY_NOW); + break; + case 13: + + player[theplayer].inventory.HasVacuum = 1; + g_pSound->playSound(SOUND_GET_PART, PLAY_NOW); + break; + case 14: + player[theplayer].inventory.HasFuel = 1; + g_pSound->playSound(SOUND_GET_PART, PLAY_NOW); + break; + + // in-level teleporter + // (in level13.ck1 that takes you to the bonus level) + case 24: + endlevel(0, pCKP); + pCKP->Control.levelcontrol.tobonuslevel = 1; + break; + + case YORPSTATUEHEAD: + if(pCKP->Control.levelcontrol.episode == 1) + { + youseeinyourmind(mpx, mpy, pCKP); + } + else if(pCKP->Control.levelcontrol.episode == 2) + if(!player[theplayer].blockedr && !player[theplayer].blockedl) + VorticonElder(mpx, mpy, pCKP); + break; + + case 27: + if(pCKP->Control.levelcontrol.episode == 3) + GiveAnkh(theplayer); + break; + case 28: + player[theplayer].inventory.charges++; + g_pSound->playSound(SOUND_GET_ITEM, PLAY_NOW); + break; + + case 17: + if (pCKP->Control.levelcontrol.canexit && (!pCKP->Control.levelcontrol.isfinallevel || player[theplayer].inventory.HasFuel)) + { + pCKP->Control.levelcontrol.exitXpos = (mpx+2)<<4; + PlayerTouchedExit(theplayer, pCKP); + } + break; + + case 23:break; // these are switches. They cannot not be picked up! + case 25:break; // Refer to JumpandPogo to check the activation code + case 26:break; + + // we fell off the bottom of the map + case TILE_FELLOFFMAP_EP1: + if (!player[theplayer].pdie) + { + g_pSound->playSound(SOUND_KEEN_FALL, PLAY_FORCE); + player[theplayer].ankhtime = 0; + player[theplayer].godmode = 0; + player[theplayer].pdie = PDIE_FELLOFFMAP; + } + break; + + default: //crashflag = 1; + //crashflag2 = t; + why_term_ptr = "procgoodie_ep1: Unknown goodie-- value given in flag2."; + break; + } + + +} + +void GiveAnkh(int cp) +{ +int o; + if (!player[cp].ankhtime) + { + o = spawn_object(player[cp].x, player[cp].y, OBJ_SECTOREFFECTOR); + objects[o].ai.se.type = SE_ANKHSHIELD; + player[cp].ankhshieldobject = o; + } + + g_pSound->playSound(SOUND_ANKH, PLAY_NOW); + player[cp].ankhtime = PLAY_ANKH_TIME; + gamepdo_ankh(cp); +} + +void gameloop_initialize(stCloneKeenPlus *pCKP) +{ +unsigned int x,y,i/*,tl*/; +int timeout; + + if (pCKP->Control.levelcontrol.episode == 3) + { + // coat the top of the map ("oh no!" border) with a non-solid tile + // so keen can jump partially off the top of the screen + for(x=1;xControl.levelcontrol.episode==1) + { + // coat the bottom of the map below the border. + // since the border has solidceil=1 this provides + // a platform to catch yorps that fall off the map + y = map.ysize; + for(x=2;x>CSF>>4 < (map.xsize/2) || pCKP->Control.levelcontrol.episode==1) + { + x += (18<>CSF>>4 < (map.xsize/2) || pCKP->Control.levelcontrol.episode==1) + player[i].pdir = player[i].pshowdir = RIGHT; + else + player[i].pdir = player[i].pshowdir = LEFT; + } + } + +// scroll past the first two tiles (the level border), they'll +// now never be visible because you're not allowed to scroll +// left past X=32. + for(i=0;i<2*16;i++) + { + map_scroll_right(); + map_scroll_down(); + } + +// scroll the screen until the primary player is onscreen +// enough to where he doesn't set off the scroll triggers + for(timeout=0;timeout<10000;timeout++) + { + if (!gamedo_ScrollTriggers(primaryplayer)) break; + } + + // initiate fade-in + fade.mode = FADE_GO; + fade.dir = FADE_IN; + fade.rate = FADE_NORM; + fade.curamt = 0; + fade.fadetimer = 0; + + // "keens left" when returning to world map after dying + if (pCKP->Control.levelcontrol.dokeensleft) + { + keensleft(pCKP); + pCKP->Control.levelcontrol.dokeensleft = 0; + } + +} diff --git a/src/gamedo.cpp b/src/gamedo.cpp new file mode 100644 index 000000000..e3c8ebd56 --- /dev/null +++ b/src/gamedo.cpp @@ -0,0 +1,815 @@ +/* GAMEDO.C + Contains all of the gamedo_xxx functions...which are called from the + main game loop. These functions perform some task that is done each + time around the game loop, not directly related to the player. +*/ + +#include "keen.h" + +#include "include/game.h" +#include "include/gamedo.h" +#include "include/gamepdo.h" +#include "include/misc.h" +#include "sdl/CVideoDriver.h" +#include "sdl/sound/CSound.h" +#include "CGraphics.h" +#include "sdl/CInput.h" +#include "vorticon/CPlayer.h" +#include "keenext.h" + +#include "include/enemyai.h" + +extern unsigned long gotPlayX; + +extern unsigned long CurrentTickCount; + +extern unsigned int unknownKey; + +extern CPlayer *Player; + +int animtiletimer, curanimtileframe; + +// gathers data from input controllers: keyboard, joystick, network, +// whatever to populate each player's keytable +unsigned char oldleftkey = 5; +unsigned char oldrightkey = 5; +unsigned char oldupkey = 5; +unsigned char olddownkey = 5; +unsigned char oldctrlkey = 5; +unsigned char oldaltkey = 5; +void gamedo_getInput(stCloneKeenPlus *pCKP) +{ +int i; +int byt; +unsigned int msb, lsb; +int p/*, keysdirty*/; + + if (demomode==DEMO_PLAYBACK) + { + // time to get a new key block? + if (!demo_RLERunLen) + { + /* get next RLE run length */ + lsb = demo_data[demo_data_index++]; + msb = demo_data[demo_data_index++]; + demo_RLERunLen = (msb<<8) | lsb; + byt = demo_data[demo_data_index++]; // get keys down + + player[0].keytable[KLEFT] = 0; + player[0].keytable[KRIGHT] = 0; + player[0].keytable[KCTRL] = 0; + player[0].keytable[KALT] = 0; + + + if (byt & 1) player[0].keytable[KLEFT] = 1; + if (byt & 2) player[0].keytable[KRIGHT] = 1; + if (byt & 4) player[0].keytable[KCTRL] = 1; + if (byt & 8) player[0].keytable[KALT] = 1; + if (byt & 16) + { // demo STOP command + if (fade.mode!=FADE_GO) endlevel(1, pCKP); + } + } + else + { + // we're still in the last RLE run, don't change any keys + demo_RLERunLen--; + } + + // user trying to cancel the demo? + for(i=0;igetPressedKey(i)) + { + if (fade.mode!=FADE_GO) endlevel(0, pCKP); + } + } + if (g_pInput->getPressedCommand(IC_STATUS)) + { + if (fade.mode!=FADE_GO) endlevel(0, pCKP); + } + + return; + } + + if (is_server) return; + + p = primaryplayer; + //player[p].keytable[KQUIT] = immediate_keytable[KQUIT]; + + memcpy(player[p].lastplaycontrol,player[p].playcontrol,PA_MAX_ACTIONS); + + // Entry for the primary player + for(i=0 ; igetHoldedCommand(IC_LEFT)) + player[p].playcontrol[PA_X] -= 100; + if(g_pInput->getHoldedCommand(IC_RIGHT)) + player[p].playcontrol[PA_X] += 100; + + if(g_pInput->getHoldedCommand(IC_UP)) + player[p].playcontrol[PA_Y] -= 100; + if(g_pInput->getHoldedCommand(IC_DOWN)) + player[p].playcontrol[PA_Y] += 100; + + if(g_pInput->getHoldedCommand(IC_JUMP)) + player[p].playcontrol[PA_JUMP] = 1; + if(g_pInput->getHoldedCommand(IC_POGO)) + player[p].playcontrol[PA_POGO] = 1; + if(g_pInput->getHoldedCommand(IC_FIRE)) + player[p].playcontrol[PA_FIRE] = 1; + if(g_pInput->getHoldedCommand(IC_STATUS)) + player[p].playcontrol[PA_STATUS] = 1; + + + #ifdef NETWORK_PLAY +// if (numplayers>1) + if (is_client) + { + if (player[p].keytable[KLEFT] != oldleftkey) keysdirty = 1; + else if (player[p].keytable[KRIGHT] != oldrightkey) keysdirty = 1; + else if (player[p].keytable[KUP] != oldupkey) keysdirty = 1; + else if (player[p].keytable[KDOWN] != olddownkey) keysdirty = 1; + else if (player[p].keytable[KCTRL] != oldctrlkey) keysdirty = 1; + else if (player[p].keytable[KALT] != oldaltkey) keysdirty = 1; + else keysdirty = 0; + if (keysdirty) + { + net_sendkeys(); + oldleftkey = player[p].keytable[KLEFT]; + oldrightkey = player[p].keytable[KRIGHT]; + oldupkey = player[p].keytable[KUP]; + olddownkey = player[p].keytable[KDOWN]; + oldctrlkey = player[p].keytable[KCTRL]; + oldaltkey = player[p].keytable[KALT]; + } + } + #endif + + if (numplayers>1 && localmp) + { + /* player[1].keytable[KQUIT] = 0; + player[1].keytable[KLEFT] = immediate_keytable[KLEFT2]; + player[1].keytable[KRIGHT] = immediate_keytable[KRIGHT2]; + player[1].keytable[KUP] = immediate_keytable[KUP2]; + player[1].keytable[KDOWN] = immediate_keytable[KDOWN2]; + player[1].keytable[KCTRL] = immediate_keytable[KCTRL2]; + player[1].keytable[KALT] = immediate_keytable[KALT2]; + player[1].keytable[KENTER] = 0; + player[1].keytable[KSPACE] = 0; + + player[2].keytable[KQUIT] = 0; + player[2].keytable[KLEFT] = immediate_keytable[KLEFT3]; + player[2].keytable[KRIGHT] = immediate_keytable[KRIGHT3]; + player[2].keytable[KUP] = immediate_keytable[KUP3]; + player[2].keytable[KDOWN] = immediate_keytable[KDOWN3]; + player[2].keytable[KCTRL] = immediate_keytable[KCTRL3]; + player[2].keytable[KALT] = immediate_keytable[KALT3]; + player[2].keytable[KENTER] = 0; + player[2].keytable[KSPACE] = 0;*/ + } + + if (demomode==DEMO_RECORD) + { + /*fputc(player[0].keytable[KLEFT], demofile); + fputc(player[0].keytable[KRIGHT], demofile); + fputc(player[0].keytable[KCTRL], demofile); + fputc(player[0].keytable[KALT], demofile); + fputc(immediate_keytable[KF1], demofile);*/ + } +} + +// handles scrolling, for player cp +// returns nonzero if the scroll was changed +int gamedo_ScrollTriggers(int theplayer) +{ +signed int px, py; +int scrollchanged; + + if (player[theplayer].pdie) return 0; + + //px = (Player[theplayer].getCoordX()>>CSF)-scroll_x; + //py = (Player[theplayer].getCoordY()>>CSF)-scroll_y; + + px = (player[theplayer].x>>CSF)-scroll_x; + py = (player[theplayer].y>>CSF)-scroll_y; + + scrollchanged = 0; + + /* left-right scrolling */ + if(px > SCROLLTRIGGERRIGHT && scroll_x < max_scroll_x) + { + map_scroll_right(); + scrollchanged = 1; + } + else if(px < SCROLLTRIGGERLEFT && scroll_x > 32) + { + map_scroll_left(); + scrollchanged = 1; + } + + /* up-down scrolling */ + if (py > SCROLLTRIGGERDOWN && scroll_y < max_scroll_y) + { + map_scroll_down(); + scrollchanged = 1; + } + else if (py < SCROLLTRIGGERUP && scroll_y > 32) + { + map_scroll_up(); + scrollchanged = 1; + } + + return scrollchanged; +} + +// animates animated tiles +void gamedo_AnimatedTiles(void) +{ +int i; + /* animate animated tiles */ + if (animtiletimer>ANIM_TILE_TIME) + { + /* advance to next frame */ + curanimtileframe = (curanimtileframe+1)&7; + /* re-draw all animated tiles */ + for(i=1;idrawTile(animtiles[i].x, animtiles[i].y, animtiles[i].baseframe+((animtiles[i].offset+curanimtileframe)%TileProperty[animtiles[i].baseframe][ANIMATION])); + } + } + animtiletimer = 0; + } + else animtiletimer++; +} + +// do object and enemy AI +void gamedo_enemyai(stCloneKeenPlus *pCKP) +{ +int i; +// handle objects and do enemy AI + for(i=1;i (map.xsize << CSF << 4) || objects[i].y > (map.ysize << CSF << 4)) + continue; + + objects[i].scrx = (objects[i].x>>CSF)-scroll_x; + objects[i].scry = (objects[i].y>>CSF)-scroll_y; + if (objects[i].scrx < -(sprites[objects[i].sprite].xsize) || objects[i].scrx > 320 \ + || objects[i].scry < -(sprites[objects[i].sprite].ysize) || objects[i].scry > 200) + { + objects[i].onscreen = 0; + objects[i].wasoffscreen = 1; + if (objects[i].type==OBJ_ICEBIT) objects[i].exists = 0; + } + else + { + #ifdef TARGET_WIN32 +// if (numplayers>1) +// if (!objects[i].hasbeenonscreen) +// net_sendobjectonscreen(i); + #endif + + objects[i].onscreen = 1; + objects[i].hasbeenonscreen = 1; + } + + if (objects[i].hasbeenonscreen || objects[i].type==OBJ_RAY || \ + objects[i].type==OBJ_ICECHUNK || objects[i].type==OBJ_PLATFORM ||\ + objects[i].type==OBJ_PLATVERT) + { + common_enemy_ai(i); + switch(objects[i].type) + { + //KEEN1 + case OBJ_YORP: yorp_ai(i, pCKP->Control.levelcontrol); break; + case OBJ_GARG: garg_ai(i, pCKP); break; + case OBJ_VORT: vort_ai(i, pCKP, pCKP->Control.levelcontrol); break; + case OBJ_BUTLER: butler_ai(i); break; + case OBJ_TANK: tank_ai(i); break; + case OBJ_RAY: ray_ai(i, pCKP, pCKP->Control.levelcontrol); break; + case OBJ_DOOR: door_ai(i); break; + case OBJ_ICECHUNK: icechunk_ai(i); break; + case OBJ_ICEBIT: icebit_ai(i); break; + case OBJ_TELEPORTER: teleporter_ai(i, pCKP->Control.levelcontrol); break; + case OBJ_ROPE: rope_ai(i); break; + //KEEN2 + case OBJ_WALKER: walker_ai(i, pCKP->Control.levelcontrol); break; + case OBJ_TANKEP2: tankep2_ai(i, pCKP); break; + case OBJ_PLATFORM: platform_ai(i, pCKP->Control.levelcontrol); break; + case OBJ_BEAR: bear_ai(i, pCKP->Control.levelcontrol, pCKP); break; + case OBJ_SECTOREFFECTOR: se_ai(i, pCKP); break; + case OBJ_BABY: baby_ai(i, pCKP->Control.levelcontrol); break; + case OBJ_EXPLOSION: explosion_ai(i); break; + case OBJ_EARTHCHUNK: earthchunk_ai(i); break; + //KEEN3 + case OBJ_FOOB: foob_ai(i, pCKP); break; + case OBJ_NINJA: ninja_ai(i, pCKP); break; + case OBJ_MEEP: meep_ai(i, pCKP->Control.levelcontrol); break; + case OBJ_SNDWAVE: sndwave_ai(i, pCKP); break; + case OBJ_MOTHER: mother_ai(i, pCKP->Control.levelcontrol); break; + case OBJ_FIREBALL: fireball_ai(i, pCKP); break; + case OBJ_BALL: ballandjack_ai(i, pCKP); break; + case OBJ_JACK: ballandjack_ai(i, pCKP); break; + case OBJ_PLATVERT: platvert_ai(i); break; + case OBJ_NESSIE: nessie_ai(i); break; + + case OBJ_DEMOMSG: break; + default: + crashflag = 1; + crashflag2 = i; + crashflag3 = objects[i].type; + why_term_ptr = "Invalid object flag2 of type flag3"; + break; + } + + objects[i].scrx = (objects[i].x>>CSF)-scroll_x; + objects[i].scry = (objects[i].y>>CSF)-scroll_y; + } + } +} + + +int savew, saveh; + +void gamedo_render_drawobjects(stCloneKeenPlus *pCKP) +{ +unsigned int i; +int x,y,o,tl,xsize,ysize; +int xa,ya; + + // copy player data to their associated objects show they can get drawn + // in the object-drawing loop with the rest of the objects + for( i=0 ;i < numplayers ; i++) + { + o = player[i].useObject; + + if (!player[i].hideplayer) + { + objects[o].sprite = player[i].playframe + playerbaseframes[i]; + } + + else + { + objects[o].sprite = BlankSprite; + } + objects[o].x = player[i].x; + objects[o].y = player[i].y; + objects[o].scrx = (player[i].x>>CSF)-scroll_x; + objects[o].scry = (player[i].y>>CSF)-scroll_y; + + } + + // if we're playing a demo keep the "DEMO" message on the screen + // as an object + if (demomode==DEMO_PLAYBACK) + { + #define DEMO_X_POS 137 + #define DEMO_Y_POS 6 + objects[DemoObjectHandle].exists = 1; + objects[DemoObjectHandle].onscreen = 1; + objects[DemoObjectHandle].type = OBJ_DEMOMSG; + objects[DemoObjectHandle].sprite = DemoSprite; + objects[DemoObjectHandle].x = (DEMO_X_POS+scroll_x)<>CSF)-scroll_x); + objects[i].scry = ((objects[i].y>>CSF)-scroll_y); + g_pGraphics->drawSprite(objects[i].scrx, objects[i].scry, objects[i].sprite, i); + + if (objects[i].honorPriority) + { + // handle priority tiles and tiles with masks + // get the upper-left coordinates to start checking for tiles + x = (((objects[i].x>>CSF)-1)>>4)<<4; + y = (((objects[i].y>>CSF)-1)>>4)<<4; + + // get the xsize/ysize of this sprite--round up to the nearest 16 + xsize = ((sprites[objects[i].sprite].xsize)>>4<<4); + if (xsize != sprites[objects[i].sprite].xsize) xsize+=16; + + ysize = ((sprites[objects[i].sprite].ysize)>>4<<4); + if (ysize != sprites[objects[i].sprite].ysize) ysize+=16; + + // now redraw any priority/masked tiles that we covered up + // with the sprite + for(ya=0;ya<=ysize;ya+=16) + { + for(xa=0;xa<=xsize;xa+=16) + { + tl = getmaptileat(x+xa,y+ya); + if(TileProperty[tl][BEHAVIOR] == 65534) + { + g_pGraphics->drawTilewithmask(x+xa-scroll_x,y+ya-scroll_y,tl,tl+1); + } + else if (TileProperty[tl][BEHAVIOR] == 65535) + { + if ( TileProperty[tl][ANIMATION] > 1 ) + { + tl = (tl-tiles[tl].animOffset)+((tiles[tl].animOffset+curanimtileframe)%TileProperty[tl][ANIMATION]); + } + g_pGraphics->drawPrioritytile(x+xa-scroll_x,y+ya-scroll_y,tl); + } + } + } + } + + } + if(i==0) break; + } + +} + +void gamedo_render_drawdebug(void) +{ +int tl,y; +/*int h;*/ +char debugmsg[80]; + + if (debugmode) + { + if (debugmode==1) + { + savew = 190; + saveh = 80; + g_pGraphics->saveArea(4,4,savew,saveh); + y = 5-8; + sprintf(debugmsg, "p1x/y: %ld/%d", player[0].x, player[0].y); + g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8); + sprintf(debugmsg, "p2x/y: %ld/%d", player[1].x, player[1].y); + g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8); + sprintf(debugmsg, "scroll_x/y = %d/%d", (unsigned int)scroll_x, (unsigned int)scroll_y); + g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8); + sprintf(debugmsg, "scrollbuf_x/y: %d/%d", scrollx_buf, scrolly_buf); + g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8); + sprintf(debugmsg, "iw,pw: %d/%d", player[0].inhibitwalking, player[0].pwalking); + g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8); + sprintf(debugmsg, "pinertia_x: %d", player[0].pinertia_x); + g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8); + sprintf(debugmsg, "psupt: (%d,%d)", player[0].psupportingtile, player[0].psupportingobject); + g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8); + + sprintf(debugmsg, "lvl,tile = %d,%d", getlevelat((player[0].x>>CSF)+4, (player[0].y>>CSF)+9), tl); + g_pGraphics->sb_font_draw( (unsigned char*) debugmsg, 5, y+=8); + +/* + sprintf(debugmsg, "NOH=%d", NessieObjectHandle); + sb_font_draw(debugmsg, 5, y+=8); + sprintf(debugmsg, "x,y=(%d,%d)", objects[NessieObjectHandle].x,objects[NessieObjectHandle].y); + sb_font_draw(debugmsg, 5, y+=8); + sprintf(debugmsg, " >>CSF=(%d,%d)", objects[NessieObjectHandle].x>>CSF,objects[NessieObjectHandle].y>>CSF); + sb_font_draw(debugmsg, 5, y+=8); + sprintf(debugmsg, " >>CSF>>4=(%d,%d)", objects[NessieObjectHandle].x>>CSF>>4,objects[NessieObjectHandle].y>>CSF>>4); + sb_font_draw(debugmsg, 5, y+=8); + + sprintf(debugmsg, "nessiestate = %d", objects[NessieObjectHandle].ai.nessie.state); + sb_font_draw(debugmsg, 5, y+=8); + sprintf(debugmsg, "pausetimer = %d", objects[NessieObjectHandle].ai.nessie.pausetimer); + sb_font_draw(debugmsg, 5, y+=8); + sprintf(debugmsg, "pausex/y = (%d,%d)", objects[NessieObjectHandle].ai.nessie.pausex,objects[NessieObjectHandle].ai.nessie.pausey); + sb_font_draw(debugmsg, 5, y+=8); + sprintf(debugmsg, "destx/y = %d/%d", objects[NessieObjectHandle].ai.nessie.destx,objects[NessieObjectHandle].ai.nessie.desty); + sb_font_draw(debugmsg, 5, y+=8); + sprintf(debugmsg, " >>CSF = %d/%d", objects[NessieObjectHandle].ai.nessie.destx>>CSF,objects[NessieObjectHandle].ai.nessie.desty>>CSF); + sb_font_draw(debugmsg, 5, y+=8); + sprintf(debugmsg, " >>CSF>>4 = %d/%d", objects[NessieObjectHandle].ai.nessie.destx>>CSF>>4,objects[NessieObjectHandle].ai.nessie.desty>>CSF>>4); + sb_font_draw(debugmsg, 5, y+=8); + sprintf(debugmsg, "mort_swim_amt = %d", objects[NessieObjectHandle].ai.nessie.mortimer_swim_amt); + sb_font_draw(debugmsg, 5, y+=8); + + h = objects[NessieObjectHandle].ai.nessie.tiletrailhead; + + sprintf(debugmsg, "tthead=%d", h); + sb_font_draw(debugmsg, 5, y+=8); + + sprintf(debugmsg, "ttX=%d,%d,%d,%d,%d", objects[NessieObjectHandle].ai.nessie.tiletrailX[0],objects[NessieObjectHandle].ai.nessie.tiletrailX[1],objects[NessieObjectHandle].ai.nessie.tiletrailX[2],objects[NessieObjectHandle].ai.nessie.tiletrailX[3],objects[NessieObjectHandle].ai.nessie.tiletrailX[4]); + sb_font_draw(debugmsg, 5, y+=8); + sprintf(debugmsg, "ttY=%d,%d,%d,%d,%d", objects[NessieObjectHandle].ai.nessie.tiletrailY[0],objects[NessieObjectHandle].ai.nessie.tiletrailY[1],objects[NessieObjectHandle].ai.nessie.tiletrailY[2],objects[NessieObjectHandle].ai.nessie.tiletrailY[3],objects[NessieObjectHandle].ai.nessie.tiletrailY[4]); + sb_font_draw(debugmsg, 5, y+=8); +*/ + } + else if (debugmode==2) + { + savew = map.xsize+4; + saveh = map.ysize+4; + g_pGraphics->saveArea(4,4,savew,saveh); + radar(); + } + } +} + +void gamedo_render_erasedebug(void) +{ + if (debugmode) g_pGraphics->restoreArea(4,4,savew,saveh); +} + +void gamedo_render_eraseobjects(void) +{ +int i; + + // erase all objects. + // note that this is done in the reverse order they are drawn. + // this is necessary or you will see corrupted pixels when + // two objects are occupying the same space. + for(i=0;ieraseSprite(objects[i].scrx, objects[i].scry, objects[i].sprite, i); + } + } +} + +extern int NumConsoleMessages; + +// draws sprites, players, and debug messages (if debug mode is on), +// performs frameskipping and blits the display as needed, +// at end of functions erases all drawn objects from the scrollbuf. +void gamedo_RenderScreen(stCloneKeenPlus *pCKP) +{ + int x,y,bmnum; + + g_pGraphics->renderHQBitmap(); + + gamedo_render_drawobjects(pCKP); + //gamedo_render_drawdebug(); + + if(pCKP != NULL) + { + if (pCKP->Control.levelcontrol.gameovermode) + { + // figure out where to center the gameover bitmap and draw it + bmnum = g_pGraphics->getBitmapNumberFromName("GAMEOVER"); + x = (320/2)-(bitmaps[bmnum].xsize/2); + y = (200/2)-(bitmaps[bmnum].ysize/2); + g_pGraphics->drawBitmap(x, y, bmnum); + } + } + + g_pVideoDriver->sb_blit(); // blit scrollbuffer to display + + gamedo_render_erasedebug(); + gamedo_render_eraseobjects(); + + /*if (framebyframe) + { + while(!immediate_keytable[KF8] && !immediate_keytable[KQUIT]) + { + if (immediate_keytable[KF7]) + { + while(immediate_keytable[KF7] && !immediate_keytable[KQUIT]) + { + poll_events(pCKP); + } + framebyframe = 0; + #ifdef BUILD_SDL + NumConsoleMessages = 0; + #endif + return; + } + poll_events(pCKP); + } + while(immediate_keytable[KF8] && !immediate_keytable[KQUIT]) + { + poll_events(pCKP); + } + }*/ + + curfps++; +} + +int ctspace=0, lastctspace=0; +void gamedo_HandleFKeys(stCloneKeenPlus *pCKP) +{ +int i; + + if (g_pInput->getHoldedKey(KC) && + g_pInput->getHoldedKey(KT) && + g_pInput->getHoldedKey(KSPACE)) + { + ctspace = 1; + } + else ctspace = 0; + + if (ctspace && !lastctspace) + { + for(i=0;iAddConsoleMsg("All items cheat"); + } + + lastctspace = ctspace; + + // GOD cheat -- toggle god mode + if (g_pInput->getHoldedKey(KG) && g_pInput->getHoldedKey(KO) && g_pInput->getHoldedKey(KD)) + { + for(i=0;iDeleteConsoleMsgs(); + if (player[0].godmode) + g_pVideoDriver->AddConsoleMsg("God mode ON"); + else + g_pVideoDriver->AddConsoleMsg("God mode OFF"); + + g_pSound->playSound(SOUND_GUN_CLICK, PLAY_FORCE); + + // Show a message like in the original game + char **text; + + text = (char**) malloc(sizeof(char*)); + + text[0]= (char*) malloc(MAX_STRING_LENGTH*sizeof(char)); + + if (player[0].godmode) + strcpy(text[0], "Godmode enabled"); + else + strcpy(text[0], "Godmode disabled"); + + showTextMB(1,text,pCKP); + + free(text[0]); + free(text); + } + + + if (pCKP->Option[OPT_CHEATS].value) + { + if (g_pInput->getHoldedKey(KTAB)) // noclip/revive + { + // resurrect any dead players. the rest of the KTAB magic is + // scattered throughout the various functions. + for(i=0;igetPressedKey(KF8)) + { + framebyframe = 1; + #ifdef BUILD_SDL + g_pVideoDriver->AddConsoleMsg("Frame-by-frame mode F8:advance F7:stop"); + #endif + } + // F9 - exit level immediately + if(g_pInput->getPressedKey(KF9)) + { + endlevel(1, pCKP); + } + // F6 - onscreen debug--toggle through debug/radar/off + if(g_pInput->getPressedKey(KF6)) + { + debugmode++; + if (debugmode>2) debugmode=0; + } + // F7 - accelerate mode/frame by frame frame advance + if(g_pInput->getPressedKey(KF7)) + { + if (!framebyframe) acceleratemode=1-acceleratemode; + } + } + + // F10 - change primary player + if(g_pInput->getPressedKey(KF10)) + { + primaryplayer++; + if (primaryplayer>=numplayers) primaryplayer=0; + } + // F3 - save game + if (g_pInput->getPressedKey(KF3)) + game_save_interface(pCKP); + +} + +void gamedo_fades(void) +{ + if (fade.mode != FADE_GO) return; + + if (fade.fadetimer > fade.rate) + { + if (fade.dir==FADE_IN) + { + if (fade.curamt < PAL_FADE_SHADES) + { + fade.curamt++; // coming in from black + } + else + { + fade.curamt--; // coming in from white-out + } + if (fade.curamt==PAL_FADE_SHADES) + { + fade.mode = FADE_COMPLETE; + } + g_pGraphics->fadePalette(fade.curamt); + } + else if (fade.dir==FADE_OUT) + { + fade.curamt--; + if (fade.curamt==0) fade.mode = FADE_COMPLETE; + g_pGraphics->fadePalette(fade.curamt); + } + fade.fadetimer = 0; + } + else + { + fade.fadetimer++; + } +} + +void gamedo_frameskipping(stCloneKeenPlus *pCKP) +{ + if (framebyframe) + { + gamedo_RenderScreen(pCKP); + return; + } + + if (frameskiptimer >= g_pVideoDriver->getFrameskip()) + { + gamedo_RenderScreen(pCKP); + frameskiptimer = 0; + } else frameskiptimer++; + +} + +// same as above but only does a sb_blit, not the full RenderScreen. +// used for intros etc. +void gamedo_frameskipping_blitonly(stCloneKeenPlus *pCKP) +{ + if (framebyframe) + { + g_pVideoDriver->sb_blit(); + return; + } + + if (frameskiptimer >= g_pVideoDriver->getFrameskip()) + { + g_pVideoDriver->sb_blit(); + frameskiptimer = 0; + } else frameskiptimer++; +} + diff --git a/src/gameorg.h b/src/gameorg.h new file mode 100644 index 000000000..9124861ea --- /dev/null +++ b/src/gameorg.h @@ -0,0 +1,206 @@ +// various states we go through when a level is completed +// to do the walking out the exit door animation +#define LEVEL_NOT_DONE 0 // not completed +#define LEVEL_DONE_WALK 1 // walking through exit door +#define LEVEL_DONE_WAIT 2 // finished walk through door, wait a bit +#define LEVEL_DONE_FADEOUT 3 // fading out +#define LEVEL_COMPLETE 4 // on to the next level! + +// width of the player sprite, used for walking "behind" the exit door frame +#define PLAYERSPRITE_WIDTH 16 + +// at STOPWALKING time after starting the exit door animation, +// keen stops walking and we go to LEVEL_DONE_WAIT. +#define LEVEL_DONE_STOPWALKING_TIME 450 +// at TOTAL_WAIT_TIME, LEVEL_DONE_FADEOUT is initiated. +#define LEVEL_DONE_TOTAL_WAIT_TIME 1000 + +// for ankh shield... +// stage1 is no flicker of the shield, changes colors +// in stage2 the shield flickers fast, changes colors +// in stage3 the shield flickers slow, no color change +#define ANKH_STAGE1_TIME 3000 +#define ANKH_STAGE2_TIME 1500 +#define ANKH_STAGE3_TIME 500 +#define PLAY_ANKH_TIME (ANKH_STAGE1_TIME+ANKH_STAGE2_TIME+ANKH_STAGE3_TIME) +// these correspond stage 1,2 and 3 respectively +#define ANKH_STATE_NOFLICKER 0 +#define ANKH_STATE_FLICKERFAST 1 +#define ANKH_STATE_FLICKERSLOW 2 + +// rate at which the periodically firing guns in ep3 will fire +#define GUN_FIRE_FREQ 800 +// rate ate which the ice cannons in ep1 will fire +#define ICECANNON_FIRE_FREQ 400 + +// direction defines for various things +#define RIGHT 0 +#define LEFT 1 +#define UP 2 +#define DOWN 3 + +#define ANKH_SHIELD_FRAME 61 + +// upon starting to walk, keen will quickly increase to +// PFASTINCMAXSPEED. keen can, at a slower rate, +// reach up to PMAXSPEED (increased every walk anim frame) +#define PFASTINCMAXSPEED 9 +#define PMAXSPEED 13 +#define PFASTINCRATE 16 // accel rate up to PFASTINCMAXSPEED +// rates at which player slows down +#define PFRICTION_RATE_INAIR 8 +#define PFRICTION_RATE_ONGROUND 2 +// rate at which player walking animation is shown +#define PWALKANIMRATE 40 + +// speed at which player walks through the exit door +#define PMAXEXITDOORSPEED 3 + +// the various jump states +#define PNOJUMP 0 // not jumping +#define PPREPAREJUMP 1 // doing the jump animation +#define PJUMPUP 2 // jumping +#define PPREPAREPOGO 3 // "pogo compressed" anim frame +#define PPOGOING 4 // pogoing + +// the different jumping frames. when CTRL is held down the player will +// go from frame PPREPAREJUMPFRAME to PJUMP_PREPARE_LAST_FRAME at a rate +// of PJUMP_PREPARE_ANIM_RATE until either CTRL is released or the player +// reaches the last frame. How far he got will select one of the various +// jump heights, defined below. +#define PPREPAREJUMPFRAME 8 +#define PJUMP_PREPARE_LAST_FRAME 13 +#define PJUMP_PREPARE_ANIM_RATE 15 + +// time to show player in his "pogo compressed" frame before jumping +#define PPOGO_PREPARE_TIME 60 + +#define PFIREFRAME 20 // raygun frame index +#define PFIRE_SHOWFRAME_TIME 100 // minimum time to show raygun frame +#define PFIRE_LIMIT_SHOT_FREQ 30 // maximum speed player can shoot + +// player frame indexes for world map +#define PMAPRIGHTFRAME 32 +#define PMAPDOWNFRAME 36 +#define PMAPLEFTFRAME 40 +#define PMAPUPFRAME 44 + +// player dieing states +#define PDIE_NODIE 0 +#define PDIE_DYING 1 +#define PDIE_DEAD 2 +#define PDIE_FELLOFFMAP 3 + +#define DIE_ANIM_RATE 50 +#define DIE_TILL_FLY_TIME 640 +#define PDIE_RISE_SPEED -20 +#define DIE_MAX_XVECT 10 + +// initial negative inertia to provide player at +// start of a normal jump and a (high) pogo jump +#define PJUMPUP_SPEED 20 +#define PPOGOUP_SPEED 24 + +// These control the various jump heights. +// one of these pairs is selected depending on how +// long the CTRL key was held down while Keen +// was preparing to jump. #1 causes the highest +// jump and they get lower from there. +// NORMAL_TIME is the amount of time keen will +// jump straight up at speed -PJUMPUP_SPEED. +// when expired his jump slows down at a rate +// of DECREASERATE. +#define PJUMP_NORMALTIME_1 5 +#define PJUMP_UPDECREASERATE_1 6 + +#define PJUMP_NORMALTIME_2 5 +#define PJUMP_UPDECREASERATE_2 5 + +#define PJUMP_NORMALTIME_3 3 +#define PJUMP_UPDECREASERATE_3 3 + +#define PJUMP_NORMALTIME_4 2 +#define PJUMP_UPDECREASERATE_4 2 + +#define PJUMP_NORMALTIME_5 40 +#define PJUMP_UPDECREASERATE_5 2 + +#define PJUMP_NORMALTIME_6 0 +#define PJUMP_UPDECREASERATE_6 0 + +// for short pogo jumps, uses -PJUMPUP_SPEED +#define PJUMP_NORMALTIME_POGO_SHORT 6 +#define PJUMP_UPDECREASERATE_POGO_SHORT 6 + +// for high pogo jumps, uses -PPOGOUP_SPEED +//#define PJUMP_NORMALTIME_POGO_LONG 25 +//#define PJUMP_UPDECREASERATE_POGO_LONG 12 +#define PJUMP_NORMALTIME_POGO_LONG 36 +#define PJUMP_UPDECREASERATE_POGO_LONG 6 + +// for the super-pogo option +#define PPOGOUP_SPEED_SUPER 40 +#define PJUMP_NORMALTIME_POGO_LONG_SUPER 10 +#define PJUMP_UPDECREASERATE_POGO_LONG_SUPER 4 + +// pogo frames +#define PFRAME_POGO 24 +#define PFRAME_POGOBOUNCE 25 + +// frame and animation speed for frozen keen (ep1) and stunned keen (ep2&3) +#define PFRAME_FROZEN 28 +#define PFROZENANIMTIME 100 +// how long keen should stay frozen when hit by an ice chunk +#define PFROZEN_TIME 1000 +#define PFROZEN_THAW 100 + +// when falling keen's Y inertia increases at INCREASERATE up to MAXSPEED +#define PFALL_INCREASERATE 5 +#define PFALL_MAXSPEED 20 + +// friction when player is pushed by yorp's, ball's, etc. +#define PLAYPUSH_DECREASERATE 1 + +// uses by the key processing function which changes CTRL, ALT, and CTRL+ALT +// into JUMP, POGO, and FIRE. +#define CTRLALT_DEBOUNCETIME 20 + +#define PDIEFRAME 22 + +// various tile indexes +#define BG_GRAY 143 +#define BG_GRAY_PRIORITY 304 +#define BG_BLACK 155 +#define BG_DARK_EP2 147 +#define TILE_FELLOFFMAP_EP1 582 +#define TILE_FELLOFFMAP_EP3 0 +#define TILE_ICE_LEFTCORNER 403 +#define TILE_ICE_RIGHTCORNER 404 +#define TILE_ICE 405 +#define TILE_ICE_CUBE 394 +#define TILE_GLOWCELL 241 +#define DOOR_YELLOW 173 +#define DOOR_RED 195 +#define DOOR_GREEN 197 +#define DOOR_BLUE 199 +#define DOOR_YELLOW_EP3 234 +#define DOOR_RED_EP3 236 +#define DOOR_GREEN_EP3 238 +#define DOOR_BLUE_EP3 240 +#define DOOR_RED_SPRITE (MAX_SPRITES-5) +#define DOOR_GREEN_SPRITE (MAX_SPRITES-4) +#define DOOR_BLUE_SPRITE (MAX_SPRITES-3) +#define DOOR_YELLOW_SPRITE (MAX_SPRITES-2) +#define YORPSTATUEHEAD 486 +#define YORPSTATUEHEADUSED 485 +#define YORPSTATUEBOTTOM 328 +#define ENEMYRAY 109 +#define ENEMYRAYEP2 123 +#define ENEMYRAYEP3 103 +#define RAY_VERT_EP3 104 + +// is player[].psupportingtile contains this value the player is actually +// supported by an object and you should look in player[].psupportingobj +// for it's index. +#define PSUPPORTEDBYOBJECT 0 + diff --git a/src/gamepdo.cpp b/src/gamepdo.cpp new file mode 100644 index 000000000..5f92ea983 --- /dev/null +++ b/src/gamepdo.cpp @@ -0,0 +1,1784 @@ +/* GAMEPDO.C + Contains all of the gamepdo_xxx functions...which are called from the + main game loop. These functions perform some task that is done each + time around the game loop and are related to the player. +*/ + +char tempbuf[200]; + +#include "keen.h" + +#include "sdl/CInput.h" +#include "sdl/CVideoDriver.h" +#include "sdl/CTimer.h" +#include "sdl/sound/CSound.h" + +#include "include/game.h" +#include "include/gamepdo.h" +#include "include/gamedo.h" +#include "include/gm_pdowm.h" +#include "include/misc.h" +#include "include/menu.h" + +#include "vorticon/CDialog.h" +#include "CGraphics.h" + +// player handler mother-function, calls all needed "gamepdo" +// functions for player cp +void gamepdo_HandlePlayer(int cp, stCloneKeenPlus *pCKP) +{ +char doFall; + + if (player[cp].pdie) + { + gamepdo_dieanim(cp, pCKP); + if (!pCKP->Control.levelcontrol.gameovermode) + { + gamepdo_StatusBox(cp, pCKP); + } + } + else + { + if (!pCKP->Control.levelcontrol.gameovermode) + { + player[cp].inhibitwalking = 0; + player[cp].inhibitfall = 0; + + gamepdo_StatusBox(cp, pCKP); + + gamepdo_ProcessInput(cp, pCKP); + + gamepdo_setdir(cp, pCKP); + + gamepdo_setblockedlru(cp, pCKP); + gamepdo_getgoodies(cp, pCKP); + + if (pCKP->Control.levelcontrol.episode==3) gamepdo_ankh(cp); + + gamepdo_raygun(cp, pCKP); + + gamepdo_keencicle(cp, pCKP); + + + if(!player[cp].pjumping && !player[cp].pfalling) + { + gamepdo_walking(cp, pCKP); + gamepdo_walkinganim(cp, pCKP); + } + + + if (fade.mode==NO_FADE || fade.dir==FADE_IN || demomode) + { + gamepdo_playpushed(cp, pCKP); + gamepdo_InertiaAndFriction_X(cp, pCKP); + } + + gamepdo_JumpAndPogo(cp, pCKP); + //gamepdo_Jump(cp, pCKP); + + // decide if player should fall + doFall = 1; + if (player[cp].inhibitfall) doFall = 0; + //else if (pCKP->Option[OPT_CHEATS].value) doFall = 0; + + if (doFall) + { + gamepdo_falling(cp, pCKP); + } + else + { + if(player[cp].pjumping == PJUMPED) + player[cp].pfalling = 0; + player[cp].psupportingtile = 145; + player[cp].psupportingobject = 0; + } + + } + else + { // we're in game-over mode + + } + } + + gamepdo_SelectFrame(cp, pCKP); +} + +void gamepdo_walkbehindexitdoor(int cp, stCloneKeenPlus *pCKP) +{ +int x, diff, width; + + /* don't draw keen as he walks through the door (past exitXpos) */ + // X pixel position of right side of player + x = (player[cp].x >> CSF) + PLAYERSPRITE_WIDTH; + diff = (x - pCKP->Control.levelcontrol.exitXpos); // dist between keen and door + if (diff >= 0) // past exitXpos? + { + width = (PLAYERSPRITE_WIDTH - diff); // get new width of sprite + if (width < 0) width = 0; // don't set to negative + + // set new width of all player walk frames + sprites[playerbaseframes[cp]+0].xsize = width; + sprites[playerbaseframes[cp]+1].xsize = width; + sprites[playerbaseframes[cp]+2].xsize = width; + sprites[playerbaseframes[cp]+3].xsize = width; + } +} + +void gamepdo_dieanim(int cp, stCloneKeenPlus *pCKP) +{ + if (!player[cp].pdie) return; // should never happen... + if (player[cp].pdie==PDIE_DEAD) return; // if true animation is over + if (player[cp].pdie==PDIE_FELLOFFMAP) + { + // wait for falling sound to complete, then kill the player + if (!g_pSound->isPlaying(SOUND_KEEN_FALL)) + { + player[cp].pdie = 0; + killplayer(cp, pCKP); + } + else return; + } + + // peridocally toggle dying animation frame + if (player[cp].pdietimer > DIE_ANIM_RATE) + { + player[cp].pdieframe = 1 - player[cp].pdieframe; + player[cp].pdietimer = 0; + } + else player[cp].pdietimer++; + + // is it time to start flying off the screen? + if (!player[cp].pdietillfly) + { // time to fly off the screen + if (((player[cp].y>>CSF)+96 > scroll_y) && (player[cp].y>(16< (4< PFROZEN_THAW) + { + if (player[cp].pfrozenanimtimer > PFROZENANIMTIME) + { + if (player[cp].pfrozenframe) player[cp].pfrozenframe=0; else player[cp].pfrozenframe=1; + player[cp].pfrozenanimtimer = 0; + } + else player[cp].pfrozenanimtimer++; + } + else + { // thawing out, show the thaw frame + if (pCKP->Control.levelcontrol.episode==3) + player[cp].pfrozenframe = 2; + else + player[cp].pfrozenframe = 3; + } + + player[cp].pfrozentime--; + player[cp].inhibitwalking = 1; + } + +} + +// Only checks if keen exits the level and if two-button firing should be triggered! +void gamepdo_ProcessInput(unsigned int cp, stCloneKeenPlus *pCKP) +{ + stLevelControl *p_levelcontrol; + + p_levelcontrol = &(pCKP->Control.levelcontrol); + + // are we doing the keen-walking-through-exit door animation? + if (pCKP->Control.levelcontrol.level_done && + pCKP->Control.levelcontrol.level_finished_by==cp) + { + // don't let player control keen + + memset(player[cp].playcontrol,0,PA_MAX_ACTIONS); + + player[cp].inhibitfall = 1; + if (pCKP->Control.levelcontrol.level_done==LEVEL_DONE_WALK) + { + // keep him going right + player[cp].pdir = player[cp].pshowdir = RIGHT; + // make keen walk slowly through the exit door + player[cp].playcontrol[PA_X] = 80; + if (player[cp].pinertia_x > PMAXEXITDOORSPEED) + { + player[cp].pinertia_x = PMAXEXITDOORSPEED; + } + } + else + { + // he's all the way through the door; hold him still + player[cp].pinertia_x = 0; + player[cp].pwalking = 0; + } + + if (p_levelcontrol->level_done_timer > LEVEL_DONE_TOTAL_WAIT_TIME) + { + if (p_levelcontrol->level_done != LEVEL_DONE_FADEOUT) + { + p_levelcontrol->level_done = LEVEL_DONE_FADEOUT; + endlevel(1, pCKP); + } + } + else if (p_levelcontrol->level_done_timer > LEVEL_DONE_STOPWALKING_TIME) + { + p_levelcontrol->level_done = LEVEL_DONE_WAIT; + } + + p_levelcontrol->level_done_timer++; + return; + } + + if(options[OPT_TWOBUTTON].value) + { + if(player[cp].playcontrol[PA_JUMP] && player[cp].playcontrol[PA_POGO]) + { + player[cp].playcontrol[PA_FIRE] = 1; + player[cp].playcontrol[PA_JUMP] = 0; + player[cp].playcontrol[PA_POGO] = 0; + } + } + + if(g_pInput->getPressedKey(KP)) + { + // Open the Pause Dialog + CDialog *PauseDialog; + + PauseDialog = new CDialog; + + PauseDialog->setDimensions(10,10,20,3); + PauseDialog->addOptionText("Game Paused"); + PauseDialog->animateDialogBox(true); + + PauseDialog->setVisible(true); + + do + { + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + gamedo_fades(); + + gamedo_render_drawobjects(pCKP); + gamedo_AnimatedTiles(); + PauseDialog->renderDialog(); + gamedo_frameskipping_blitonly(pCKP); + } while(!g_pInput->getPressedAnyKey()); + + delete PauseDialog; + + map_redraw(); + } + +} + +// if player not sliding and not jumping, allow +// them to change their direction. if jumping, +// we can change direction but it will not be shown +// in the frame. +void gamepdo_setdir(int cp, stCloneKeenPlus *pCKP) +{ +int stuck; + + if (player[cp].pfrozentime) return; + // can't change direction on ice, + // UNLESS we're stuck up against a wall + if (player[cp].psliding) + { + stuck = 0; + if (player[cp].pshowdir == LEFT && player[cp].blockedl) stuck = 1; + if (player[cp].pshowdir == RIGHT && player[cp].blockedr) stuck = 1; + if (stuck) + { + // jumped off an ice block into a wall? + if (player[cp].pjumping || player[cp].pfalling) + { + player[cp].psliding = 0; + } + } + else + { + // since we're not stuck up against a wall, we can't change direction + return; + } + } + + if (!player[cp].pjumping && !player[cp].pfiring) + { + if (player[cp].playcontrol[PA_X] < 0) { player[cp].pdir = player[cp].pshowdir = LEFT; } + if (player[cp].playcontrol[PA_X] > 0) { player[cp].pdir = player[cp].pshowdir = RIGHT; } + } + else + { + if (player[cp].playcontrol[PA_X] < 0) { player[cp].pdir = player[cp].pshowdir = LEFT; } + if (player[cp].playcontrol[PA_X] > 0) { player[cp].pdir = player[cp].pshowdir = RIGHT; } + } +} + +// set blockedl/r/u...is Keen up against a solid object or a the edge of the level? +void gamepdo_setblockedlru(unsigned int cp, stCloneKeenPlus *pCKP) +{ + // This function has a lot of bugs now! + int tx,ty; + unsigned int i; + stOption *p_option; + + +#define PLAYERHEIGHT (player[cp].h) +#define PLAYERWIDTH (player[cp].w) // bug here! Sometimes it detects 16 and sometimes 24. Why?! + + p_option = pCKP->Option; + + player[cp].blockedl = player[cp].blockedr = 0; + player[cp].blockedu = 0; + if (pCKP->Control.levelcontrol.level_done && + pCKP->Control.levelcontrol.level_finished_by==cp) return; + + if ((player[cp].x>>CSF) < 2) player[cp].blockedl = 1; + + if (!p_option[OPT_CHEATS].value || g_pInput->getHoldedKey(KTAB)==0) // holding down TAB will turn off clipping + { + tx = (player[cp].x>>CSF); + ty = (player[cp].y>>CSF); + + if((TileProperty[getmaptileat(tx,ty)][BUP] == 1) && (TileProperty[getmaptileat(tx,ty)][BEHAVIOR] == 1)) + { + killplayer(cp,pCKP); // Whines + } + + // set psliding if we're on ice + if (TileProperty[getmaptileat(tx,ty+PLAYERHEIGHT)][BUP] == 3) + { + player[cp].psliding = 1; + player[cp].pshowdir = player[cp].pdir; + } + else + { + player[cp].psliding = 0; + } + // set psemisliding if we're on an ice block + if (TileProperty[getmaptileat(tx,ty+PLAYERHEIGHT)][BUP] == 2) // 2*pheighth because the ice down off the player must be detected + { + player[cp].psemisliding = 1; + } + else + { + player[cp].psemisliding = 0; + } + + // we use checkissolidl to check for blockedr, and vice versa + // for blockedl. this is because here we are checking for the + // right of the player--which will be the left of a potential tile. + // Also check floor and ceiling tiles + // TODO: Try to optimize this! + + for( i=5 ; i < PLAYERWIDTH ; i++ ) + { + if(TileProperty[getmaptileat((tx+i),ty)][BDOWN] || checkobjsolid((tx+i)<>CSF)+PLAYERWIDTH, (player[cp].y>>CSF)+i,cp, pCKP)) + { + player[cp].blockedr = 1; + player[cp].widejump = false; + break; + } + } + + for( i=2 ; i < PLAYERHEIGHT ; i++ ) + { + if (checkissolidr((player[cp].x>>CSF)+4, (player[cp].y>>CSF)+i,cp, pCKP)) + { + player[cp].blockedl = 1; + player[cp].widejump = false; + break; + } + } + for( i=5 ; i < PLAYERWIDTH+1 ; i++ ) + { + if(checkobjsolid((tx+i)<>CSF)+13)>>4<<4 != ((player[cp].x>>CSF)+11)) + { // not on a tile boundary. + player[cp].blockedr = 0; + } + } + + + if (player[cp].blockedl && TileProperty[player[cp].blockedby][BRIGHT] && !TileProperty[player[cp].blockedby][BLEFT]) + { + if ((((player[cp].x>>CSF)+2)>>4<<4)+12 != ((player[cp].x>>CSF)+2)) + { // not on a tile boundary. + player[cp].blockedl = 0; + } + } + + // Check if the player is going out of the level map + if( player[cp].y <= (2<< 4 << CSF) ) // Upper edge or ceiling + player[cp].blockedu = 1; + else if( player[cp].y >= (map.ysize << 4 << CSF) ) + { + player[cp].blockedd = 1; + player[cp].pdie = 1; + + } + + if( (player[cp].x) >= ((map.xsize-3) << 4 << CSF) ) + player[cp].blockedr = 1; + + else if( (player[cp].x) <= ( 2 << 4 << CSF ) ) + player[cp].blockedl = 1; + } + else player[cp].playpushed_x = 0; +} + +// let's have keen be able to pick up goodies +void gamepdo_getgoodies(int cp, stCloneKeenPlus *pCKP) +{ + if ((TileProperty[getmaptileat((player[cp].x>>CSF)+9, (player[cp].y>>CSF)+1)][BEHAVIOR] > 0) && + ( TileProperty[getmaptileat((player[cp].x>>CSF)+9, (player[cp].y>>CSF)+1)][BEHAVIOR] < 31 ) ) + { keen_get_goodie((player[cp].x>>CSF)+9, (player[cp].y>>CSF)+1, cp, pCKP); return; } + + else if ((TileProperty[getmaptileat((player[cp].x>>CSF)+4, (player[cp].y>>CSF)+8)][BEHAVIOR] > 0) && + ( TileProperty[getmaptileat((player[cp].x>>CSF)+4, (player[cp].y>>CSF)+8)][BEHAVIOR] < 31 ) ) + { keen_get_goodie((player[cp].x>>CSF)+4, (player[cp].y>>CSF)+8, cp, pCKP); return; } + + else if ((TileProperty[getmaptileat((player[cp].x>>CSF)+9, (player[cp].y>>CSF)+16)][BEHAVIOR] > 0) && + ( TileProperty[getmaptileat((player[cp].x>>CSF)+9, (player[cp].y>>CSF)+16)][BEHAVIOR] < 31 ) ) + { keen_get_goodie((player[cp].x>>CSF)+9, (player[cp].y>>CSF)+16, cp, pCKP); return; } + + else if ((TileProperty[getmaptileat((player[cp].x>>CSF)+4, (player[cp].y>>CSF)+23)][BEHAVIOR] > 0) && + ( TileProperty[getmaptileat((player[cp].x>>CSF)+4, (player[cp].y>>CSF)+23)][BEHAVIOR] < 31 ) ) + { keen_get_goodie((player[cp].x>>CSF)+4, (player[cp].y>>CSF)+23, cp, pCKP); return; } +} + +// animation for walking +void gamepdo_walkinganim(int cp, stCloneKeenPlus *pCKP) +{ + // no walk animation while sliding + if (player[cp].inhibitwalking || player[cp].psliding ) return; + + // should we do walk animation? + if (player[cp].pwalking || player[cp].playpushed_x || player[cp].psemisliding) + { + int walkanimrate; // walk animation speed according to player speed + + + if(!player[cp].psemisliding) + { + walkanimrate = 101*PWALKANIMRATE/(player[cp].treshold+1); + if(walkanimrate > 150) + walkanimrate = 150; + } + else + walkanimrate = PWALKANIMRATE; + + // ** do walk animation ** + if (player[cp].pwalkanimtimer > walkanimrate) + { // time to change walking frame + // make walk noise + if (!player[cp].pjumping && !player[cp].pfalling) + { + if (!player[cp].pfrozentime) + { + if (player[cp].pwalkframea&1) + { + g_pSound->playStereofromCoord(SOUND_KEEN_WALK, PLAY_NOW, objects[player[cp].useObject].scrx); + } + else + { + g_pSound->playStereofromCoord(SOUND_KEEN_WALK2, PLAY_NOW, objects[player[cp].useObject].scrx); + } + + if(!map.isworldmap && (player[cp].blockedr || player[cp].blockedl)) + { + g_pSound->playStereofromCoord(SOUND_KEEN_BUMPHEAD, PLAY_NOW, objects[player[cp].useObject].scrx); + // It is not bumping a head, but walking in some direction and being blocked + } + else if(map.isworldmap) + { + // Same on world map! + + short play=0; + + if (player[cp].blockedu && player[cp].pdir == UP) + play=1; + + if (player[cp].blockedd && player[cp].pdir == DOWN) + play=1; + + if (player[cp].blockedl && player[cp].pdir == LEFT) + play=1; + + if (player[cp].blockedr && player[cp].pdir == RIGHT) + play=1; + + if (play) + g_pSound->playStereofromCoord(SOUND_KEEN_BUMPHEAD, PLAY_NOW, objects[player[cp].useObject].scrx); + } + + } + } + // increase walk frame and wrap it to 1st frame if needed + if (player[cp].pwalkframea < 4) + { player[cp].pwalkframea++; } + else + { player[cp].pwalkframea=1; } + + player[cp].pwalkanimtimer = 0; + } + else + { // did not change walk frame + player[cp].pwalkanimtimer++; + } + + // set walk frame: map frame "4" to frame "2", this gives a + // sequence of 1,2,3,2,1,2,3,2,1,2,3,2.... + if (player[cp].pwalkframea==4) + { + player[cp].pwalkframe = 2; + } + else + { + player[cp].pwalkframe = player[cp].pwalkframea; + } + } +} + +// handle playpushed_x: for yorps/walkers/etc pushing keen +void gamepdo_playpushed(int cp, stCloneKeenPlus *pCKP) +{ + if (pCKP->Option[OPT_CHEATS].value && g_pInput->getHoldedKey(KTAB)) return; + + // if we're being pushed... + if (player[cp].playpushed_x) + { + // do friction on push force... + if (player[cp].playpushed_decreasetimer>PLAYPUSH_DECREASERATE) + { + // push playpushed_x towards zero + if (player[cp].playpushed_x < 0) + { + player[cp].playpushed_x++; + } + else + { + player[cp].playpushed_x--; + } + player[cp].playpushed_decreasetimer = 0; + } + else player[cp].playpushed_decreasetimer++; + + // if we run up against a wall all push inertia stops + if (player[cp].playpushed_x > 0 && player[cp].blockedr) player[cp].playpushed_x = 0; + if (player[cp].playpushed_x < 0 && player[cp].blockedl) player[cp].playpushed_x = 0; + } + +} +// handles inertia and friction for the X direction +// (this is where the inertia/playpushed_x is actually applied to playx) +void gamepdo_InertiaAndFriction_X(unsigned int cp, stCloneKeenPlus *pCKP) +{ + + stLevelControl *p_levelcontrol; + int friction_rate; + + p_levelcontrol = &(pCKP->Control.levelcontrol); + + if (player[cp].hideplayer) + { + player[cp].pinertia_x = 0; + return; + } + // don't move when firing + if (player[cp].pfiring && !player[cp].pjumping && !player[cp].pfalling) + { + player[cp].pinertia_x = 0; + } + + // Check walking boost and pogoing. It is similar to inertia + if(player[cp].pjumping || player[cp].pfalling) + { + if (player[cp].playcontrol[PA_X] < 0) + { + if(player[cp].pboost_x > 0 && !player[cp].ppogostick) + { + player[cp].pboost_x = 0; + player[cp].pinertia_x /= 2; + } + else + { + player[cp].pboost_x--; + } + } + if (player[cp].playcontrol[PA_X] > 0) + { + if(player[cp].pboost_x < 0 && !player[cp].ppogostick) + { + player[cp].pboost_x = 0; + player[cp].pinertia_x /= 2; + } + else + { + player[cp].pboost_x++; + } + } + + if(player[cp].pboost_x >= PJUMPINERTIA || + player[cp].pboost_x <= -PJUMPINERTIA) + { + if(player[cp].ppogostick) + { + player[cp].pinertia_x += player[cp].pboost_x/PJUMPINERTIA; + } + else + { + // This is a normal jump without obstacles + if(player[cp].widejump) + { + player[cp].pinertia_x += 2*player[cp].pboost_x/PJUMPINERTIA + player[cp].chargedjump; + player[cp].chargedjump = 0; + } + + // When falling get some inertia + if(player[cp].pfalling) + { + player[cp].pinertia_x += 2*player[cp].pboost_x/PJUMPINERTIA; + } + else + { + player[cp].pinertia_x += 2*player[cp].pboost_x/PJUMPINERTIA; + } + } + player[cp].pboost_x = 0; + } + } + + // Calculate Threshold of your analog device for walking animation speed! + player[cp].treshold = player[cp].playcontrol[PA_X]; + + int pmaxspeed = 0; + + if(!player[cp].pjumping && !player[cp].pfalling && + !player[cp].psemisliding && !player[cp].psliding && !player[cp].ppogostick && !player[cp].pslowingdown) + { + if(player[cp].treshold < player[cp].playcontrol[PA_Y] && player[cp].playcontrol[PA_Y] > 0 ) + player[cp].treshold = player[cp].playcontrol[PA_Y]; + + if(player[cp].treshold > player[cp].playcontrol[PA_Y] && player[cp].playcontrol[PA_Y] < 0 ) + player[cp].treshold = player[cp].playcontrol[PA_Y]; + + if(player[cp].treshold < 0) + player[cp].treshold *= (-1); + } + else + { + player[cp].treshold = 100; + } + + // if we hit a solid object do not move, and keep inertia... + // * at slow speed: if we're falling or jumping and we're facing + // the right direction, we want to keep + // a small amount of inertia pent up so we can + // easily get into tight spaces. + // * at zero: otherwise, or if we're not walking, we want + // to hold the inertia at zero so we don't "shoot" + // off of platforms, etc which looks weird. + if (!p_levelcontrol->level_done || p_levelcontrol->level_finished_by!=cp) + { + if (player[cp].pinertia_x < 0 && player[cp].blockedl) + { + if (!player[cp].pwalking || (!player[cp].pfalling && !player[cp].pjumping) || player[cp].pdir==RIGHT || (player[cp].pfrozentime && p_levelcontrol->episode==1)) + { + player[cp].pinertia_x = player[cp].pboost_x = 0; + player[cp].widejump = false; + } + else if (player[cp].pinertia_x < -PFASTINCMAXSPEED) + { + //player[cp].pinertia_x--; + player[cp].pinertia_x >>= 1; + } + return; + } + else if (player[cp].pinertia_x > 0 && player[cp].blockedr) + { + if (!player[cp].pwalking || (!player[cp].pfalling && !player[cp].pjumping) || player[cp].pdir==LEFT || (player[cp].pfrozentime&&p_levelcontrol->episode==1)) + { + player[cp].pinertia_x = player[cp].pboost_x = 0; + player[cp].widejump = false; + } + else if (player[cp].pinertia_x > PFASTINCMAXSPEED) + { + //player[cp].pinertia_x++; + player[cp].pinertia_x >>= 1; + } + return; + } + } + + pmaxspeed = player[cp].treshold*PMAXSPEED/100; + + if(player[cp].pinertia_x > pmaxspeed) + player[cp].pinertia_x = pmaxspeed; + if(player[cp].pinertia_x < -pmaxspeed) + player[cp].pinertia_x = -pmaxspeed; + + + + // apply pinertia_x and playpushed_x inertia + // (unless we're about to make a pogo jump) + if ( player[cp].pjumping != PPREPAREPOGO) + { + player[cp].x += (player[cp].pinertia_x + player[cp].playpushed_x); + } + + + // if we stopped walking (i.e. left or right not held down) apply friction + // there's no friction if we're semisliding + if (!(player[cp].playcontrol[PA_X] < 0) && !(player[cp].playcontrol[PA_X] > 0) && \ + !player[cp].psemisliding) + { + // determine friction rate--different rates for on ground and in air + if (map.isworldmap) + { + friction_rate = PFRICTION_RATE_WM; + } + else + { + if (!player[cp].pfalling & !player[cp].pjumping) + { + friction_rate = PFRICTION_RATE_ONGROUND; + } + else + { + friction_rate = PFRICTION_RATE_INAIR; + } + } + + + // and apply friction to pinertia_x + // when pogoing apply friction till we get down to PFASTINCMAXSPEED + // then stop the friction + if (!player[cp].ppogostick || (player[cp].pinertia_x > PFASTINCMAXSPEED) || (player[cp].pinertia_x < -PFASTINCMAXSPEED)) + { + if (player[cp].pfriction_timer_x > friction_rate) + { + if (!player[cp].pfrozentime || p_levelcontrol->episode!=1) + { // disable friction while frozen + // here the wall animation must be applied! + if (player[cp].pinertia_x < 0) player[cp].pinertia_x++; + else if (player[cp].pinertia_x > 0) player[cp].pinertia_x--; + } + + player[cp].pfriction_timer_x = 0; + } + else player[cp].pfriction_timer_x++; + } + } + +} +void gamepdo_Jump(int cp, stCloneKeenPlus *pCKP) +{ + // handle the JUMP key, both for normal jumps and (high) pogo jumps + if (!player[cp].pjumping && !player[cp].pfalling && !player[cp].pfiring) + { + player[cp].pboost_x = 0; + // give em the chance to jump + if (player[cp].playcontrol[PA_JUMP] && !player[cp].ppogostick && !player[cp].pfrozentime) + { + player[cp].pjumping = PPREPAREJUMP; + player[cp].pjumpframe = PPREPAREJUMPFRAME; + player[cp].pjumpanimtimer = 0; + player[cp].pwalking = 0; + } + else if (player[cp].ppogostick) + { + player[cp].pjumping = PPREPAREPOGO; + player[cp].pjumpanimtimer = 0; + player[cp].pwalking = 0; + } + } + + // Preparing to jump. Charge the jump here + if(player[cp].pjumping == PPREPAREJUMP) + { + player[cp].pjumping = PJUMPUP; + player[cp].pinertia_y = -25; + + // Code for the charge jump which really collects pinertia_y + } + + // He is jumping up + if(player[cp].pjumping == PJUMPUP) + { + // handle the jump upwards. Works like friction. The inertia_y is lost by a unit at every loop + + // Did he bonk the ceiling + if(!player[cp].blockedu) + { + player[cp].y += player[cp].pinertia_y; + } + else + { + player[cp].pinertia_y = 0; + player[cp].pjumpfloattimer = 0; + player[cp].pjumping = PJUMPED; + } + player[cp].pjumpfloattimer++; + + if(player[cp].pjumpfloattimer >= 5) + { + player[cp].pjumpfloattimer = 0; + if(player[cp].pinertia_y < 0) + { + player[cp].pinertia_y++; + } + else + { + player[cp].pinertia_y = 0; + player[cp].pjumpfloattimer = 0; + player[cp].pjumping = PJUMPED; + } + } + } + + // The player has jumped and should be about to fall + if(player[cp].pjumping == PJUMPED) + { + // Maybe not needed! + player[cp].pjumping = 0; + player[cp].pfalling = 1; + } +} + +void gamepdo_JumpAndPogo(int cp, stCloneKeenPlus *pCKP) +{ +int mx, my, t, l; +int platx, platy; +signed char pxoff, pyoff; +int o; +int try2; + +stLevelControl *p_levelcontrol; + +p_levelcontrol = &(pCKP->Control.levelcontrol); + + // toggle pogo when KPOGO key is pressed + if (player[cp].playcontrol[PA_POGO] && !player[cp].lastplaycontrol[PA_POGO] && !player[cp].pfrozentime) + { + if (p_levelcontrol->episode==2) + { + // if we are at a switch hit the switch instead + mx = (player[cp].x>>CSF)+8; + my = (player[cp].y>>CSF)+9; + try2 = 0; + retry: ; + t = getmaptileat(mx, my); + if (player[cp].ppogostick==0 && (t==TILE_SWITCH_UP || t==TILE_SWITCH_DOWN)) + { // switch to extend platform + + // figure out where the platform is supposed to extend + // (this is coded in the object layer...high byte is the Y offset + // and the low byte is the X offset) + l = getlevelat(mx, my); + // if zero it's the switch on a tantalus ray! + if (l==0) + { + g_pSound->playStereofromCoord(SOUND_SWITCH_TOGGLE, PLAY_NOW, objects[player[cp].useObject].scrx); + + map_chgtile(mx>>4,my>>4,TILE_SWITCH_DOWN); + p_levelcontrol->success = 0; + p_levelcontrol->command = LVLC_TANTALUS_RAY; + return; + } + pxoff = (l & 0x00ff); + pyoff = (l & 0xff00) >> 8; + platx = (mx >> 4) + pxoff; + platy = (my >> 4) + pyoff; + + if (PlatExtending) // don't allow player to hit switch again while + { // plat is moving as this will glitch the plat + return; + } + else PlatExtending = 1; + + g_pSound->playStereofromCoord(SOUND_SWITCH_TOGGLE, PLAY_NOW, objects[player[cp].useObject].scrx); + + if (t==TILE_SWITCH_UP) + { // switch toggled from up to down--extend platform + map_chgtile(mx>>4,my>>4,TILE_SWITCH_DOWN); + o = spawn_object((mx>>4<<4)<>4<<4)<>4,my>>4,TILE_SWITCH_UP); + o = spawn_object((mx>>4<<4)<>4<<4)<dark ^= 1; + g_pGraphics->initPalette(p_levelcontrol->dark); + g_pGraphics->fadePalette(PAL_FADE_SHADES); + g_pSound->playStereofromCoord(SOUND_SWITCH_TOGGLE, PLAY_NOW, objects[player[cp].useObject].scrx); + } + else + { // toggle pogo stick + if (!try2) + { + my = (player[cp].y>>CSF)+1; + try2 = 1; + goto retry; + } + + player[cp].ppogostick = 1 - player[cp].ppogostick; + } + } + else + { // not episode 2...don't bother with all of this + if (player[cp].inventory.HasPogo) + { + player[cp].ppogostick = 1 - player[cp].ppogostick; + } + } + } + + // handle the JUMP key, both for normal jumps and (high) pogo jumps + if (!player[cp].pjumping && !player[cp].pfalling && !player[cp].pfiring) + { + player[cp].pboost_x = 0; + // give em the chance to jump + if (player[cp].playcontrol[PA_JUMP] && !player[cp].ppogostick && !player[cp].pfrozentime) + { + player[cp].pjumping = PPREPAREJUMP; + player[cp].pjumpframe = PPREPAREJUMPFRAME; + player[cp].pjumpanimtimer = 0; + player[cp].pwalking = 0; + } + else if (player[cp].ppogostick) + { + player[cp].pjumping = PPREPAREPOGO; + player[cp].pjumpanimtimer = 0; + player[cp].pwalking = 0; + } + } + + switch(player[cp].pjumping) + { + case PPREPAREPOGO: + if (player[cp].pjumpanimtimer>PPOGO_PREPARE_TIME) + { + // continously bounce while pogo stick is out + g_pSound->playStereofromCoord(SOUND_KEEN_JUMP, PLAY_NOW, objects[player[cp].useObject].scrx); + + // jump high if JUMP key down, else bounce low + if (player[cp].playcontrol[PA_JUMP]) + { + if (!pCKP->Option[OPT_SUPERPOGO].value) + { // normal high pogo jump + player[cp].pjumpupspeed = PPOGOUP_SPEED; + player[cp].pjumptime = PJUMP_NORMALTIME_POGO_LONG; + player[cp].pjumpupdecreaserate = PJUMP_UPDECREASERATE_POGO_LONG; + } + else + { + player[cp].pjumpupspeed = PPOGOUP_SPEED_SUPER; + player[cp].pjumptime = PJUMP_NORMALTIME_POGO_LONG_SUPER; + player[cp].pjumpupdecreaserate = PJUMP_UPDECREASERATE_POGO_LONG_SUPER; + } + } + else + { + if(player[cp].ppogostick != 0) + { + player[cp].pjumpupspeed = PJUMPUP_SPEED; + player[cp].pjumptime = PJUMP_NORMALTIME_POGO_SHORT; + player[cp].pjumpupdecreaserate = PJUMP_UPDECREASERATE_POGO_SHORT; + } + } + player[cp].pjumpframe = PJUMP_PREPARE_LAST_FRAME; + player[cp].pjumping = PPOGOING; + player[cp].pjumpupspeed_decreasetimer = 0; + player[cp].pjustjumped = 1; + + } else player[cp].pjumpanimtimer++; + break; + case PPREPAREJUMP: + player[cp].widejump = true; + + if(g_pInput->getHoldedCommand(IC_LEFT)) + player[cp].chargedjump-=2; + else if(g_pInput->getHoldedCommand(IC_RIGHT)) + player[cp].chargedjump+=2; + + player[cp].pinertia_x = 0; // prevent moving while preparing to jump + if (player[cp].pjumpanimtimer > PJUMP_PREPARE_ANIM_RATE) + { + if (player[cp].pjumpframe == PJUMP_PREPARE_LAST_FRAME || !player[cp].playcontrol[PA_JUMP]) + { // time to start the jump + // select a jump depending on how long keen was preparing + player[cp].pjumpupspeed = PJUMPUP_SPEED; + switch(player[cp].pjumpframe) + { + case PPREPAREJUMPFRAME: + player[cp].pjumptime = PJUMP_NORMALTIME_6; + player[cp].pjumpupdecreaserate = PJUMP_UPDECREASERATE_6; + player[cp].pjumpupspeed = 6; + player[cp].chargedjump = player[cp].chargedjump >> 5; + break; + case PPREPAREJUMPFRAME+1: + player[cp].pjumptime = PJUMP_NORMALTIME_5; + player[cp].pjumpupdecreaserate = PJUMP_UPDECREASERATE_5; + player[cp].pjumpupspeed = 8; + player[cp].chargedjump = player[cp].chargedjump >> 4; + break; + case PPREPAREJUMPFRAME+2: + player[cp].pjumptime = PJUMP_NORMALTIME_4; + player[cp].pjumpupdecreaserate = PJUMP_UPDECREASERATE_4; + player[cp].pjumpupspeed = 10; + player[cp].chargedjump = player[cp].chargedjump >> 3; + break; + case PPREPAREJUMPFRAME+3: + player[cp].pjumptime = PJUMP_NORMALTIME_3; + player[cp].pjumpupdecreaserate = PJUMP_UPDECREASERATE_3; + player[cp].pjumpupspeed = 14; + player[cp].chargedjump = player[cp].chargedjump >> 2; + break; + case PPREPAREJUMPFRAME+4: + player[cp].pjumptime = PJUMP_NORMALTIME_2; + player[cp].pjumpupdecreaserate = PJUMP_UPDECREASERATE_2; + player[cp].pjumpupspeed = 18; + player[cp].chargedjump = player[cp].chargedjump >> 1; + break; + default: + player[cp].pjumptime = PJUMP_NORMALTIME_1; + player[cp].pjumpupdecreaserate = PJUMP_UPDECREASERATE_1; + break; + } + + player[cp].pjumpframe = PJUMP_PREPARE_LAST_FRAME; + + g_pSound->playStereofromCoord(SOUND_KEEN_JUMP, PLAY_NOW, objects[player[cp].useObject].scrx); + player[cp].pjumping = PJUMPUP; + player[cp].pjumpupspeed_decreasetimer = 0; + player[cp].pjustjumped = 1; + player[cp].pjumpfloattimer = 0; + + // make so if we're jumping left or right + // the walk code will start at full speed + player[cp].pwalking = 1; + player[cp].pwalkanimtimer = 0; + player[cp].pwalkframe = 1; + if (TileProperty[player[cp].psupportingtile][BEHAVIOR] == 3) + { // on ice, always jump direction facing + if (player[cp].pshowdir==LEFT) + { player[cp].pdir=LEFT; } + else + { player[cp].pdir=RIGHT; } + } + else + { + player[cp].pjumpdir = UP; + + } + + if (player[0].playcontrol[PA_X] < 0) + { + player[cp].pinertia_x--; + } + if (player[0].playcontrol[PA_X] > 0) + { + player[cp].pinertia_x++; + } + + player[cp].pwalkincreasetimer = 0; + } + else + { + player[cp].pjumpframe++; + } + player[cp].pjumpanimtimer=0; + } else player[cp].pjumpanimtimer++; + break; + case PJUMPUP: + player[cp].pinertia_x += player[cp].chargedjump; + player[cp].chargedjump = 0; + case PPOGOING: + // check for hitting a ceiling + if (player[cp].blockedu) // did we bonk something? + { // immediatly abort the jump + player[cp].pjumping = PNOJUMP; + g_pSound->playStereofromCoord(SOUND_KEEN_BUMPHEAD, PLAY_NOW, objects[player[cp].useObject].scrx); + } + + // do the jump + if (!player[cp].pjumptime) + { + if (player[cp].pjumpupspeed_decreasetimer>player[cp].pjumpupdecreaserate) + { + if (!player[cp].pjumpupspeed) + { + player[cp].pjumping = PNOJUMP; + } else player[cp].pjumpupspeed--; + player[cp].pjumpupspeed_decreasetimer=0; + } else player[cp].pjumpupspeed_decreasetimer++; + } + else player[cp].pjumptime--; + + player[cp].y -= player[cp].pjumpupspeed; + break; + } + +} + +void gamepdo_falling(int cp, stCloneKeenPlus *pCKP) +{ +unsigned int temp; +int objsupport; +short tilsupport; + + player[cp].pfalling = 0; // assume not falling if not jumped to the maximum height + + // do not fall if we're jumping + if (player[cp].pjumping) + { + player[cp].psemisliding = 0; + return; + } + + // ** determine if player should fall (nothing solid is beneath him) ** + + player[cp].psupportingtile = BG_GRAY; + player[cp].psupportingobject = 0; + // test if tile under player is solid; if so set psupportingtile + objsupport = checkobjsolid(player[cp].x+(4<>CSF)+5, (player[cp].y>>CSF)+sprites[0].ysize)][BUP]; + if(TileProperty[getmaptileat((player[cp].x>>CSF)+4, (player[cp].y>>CSF)+sprites[0].ysize)][BEHAVIOR] >= 2&& + TileProperty[getmaptileat((player[cp].x>>CSF)+4, (player[cp].y>>CSF)+sprites[0].ysize)][BEHAVIOR] <= 5) + tilsupport = 1; // This workaround prevents the player from falling through doors. + + if (!tilsupport && !objsupport) + { // lower-left isn't solid + objsupport = checkobjsolid(player[cp].x+(12<>CSF)+10, (player[cp].y>>CSF)+sprites[0].ysize)][BUP]; + //tilsupport = tiles[getmaptileat((player[cp].x>>CSF)+12, (player[cp].y>>CSF)+sprites[0].ysize)].solidfall; + if (!tilsupport && !objsupport) + { // lower-right isn't solid + player[cp].pfalling = 1; // so fall. + player[cp].pjustfell = 1; + } + else + { // lower-left isn't solid but lower-right is + if (objsupport) + { + player[cp].psupportingtile = PSUPPORTEDBYOBJECT; + player[cp].psupportingobject = objsupport; + } + } + } + else + { // lower-left is solid + if (objsupport) + { + player[cp].psupportingtile = PSUPPORTEDBYOBJECT; + player[cp].psupportingobject = objsupport; + } + } + + // if not on a tile boundary, always fall, prevents being able + // to land in the middle of a tile. + if (!player[cp].pfalling && player[cp].psupportingtile!=PSUPPORTEDBYOBJECT) + { + temp = (player[cp].y>>CSF)+sprites[0].ysize; // bottom of player + if ((temp>>4)<<4 != temp) // true if it's not a multiple of 16 + { + player[cp].pfalling = 1; // not on a tile boundary. fall. + player[cp].pjustfell = 1; + player[cp].psupportingtile = BG_GRAY; + player[cp].psupportingobject = 0; + } + } + // if supported by an object make sure we're at the top of + // the object else fall + if (!player[cp].pfalling && player[cp].psupportingtile==PSUPPORTEDBYOBJECT) + { + if ((player[cp].y>>CSF)+sprites[0].ysize > (objects[player[cp].psupportingobject].y>>CSF)+4) + { + if (!tilsupport) + { + player[cp].pfalling = 1; + player[cp].pjustfell = 1; + player[cp].psupportingtile = BG_GRAY; + player[cp].psupportingobject = 0; + } + } + } + + // the first time we land on an object, line us up to be exactly on + // top of the object + if (player[cp].psupportingobject && !player[cp].lastsupportingobject) + { + player[cp].y = objects[player[cp].psupportingobject].y - (sprites[0].ysize<Option[OPT_CHEATS].value && g_pInput->getHoldedKey(KPLUS)) { player[cp].pfalling = 1; player[cp].pjustfell = 1; } + + if (player[cp].pfalling) + { // nothing solid under player, let's make him fall + player[cp].psemisliding = 0; + + // just now started falling? (wasn't falling last time) + if (player[cp].plastfalling == 0) + { + // set initial fall speed and make the AAAAAUUUUHHHHH noise + player[cp].pfallspeed = 1; + player[cp].pfallspeed_increasetimer = 0; + if (!player[cp].pjustjumped) + { + g_pSound->playStereofromCoord(SOUND_KEEN_FALL, PLAY_NOW, objects[player[cp].useObject].scrx); + } + } + + // gradually increase the fall speed up to maximum rate + if (player[cp].pfallspeed_increasetimer>PFALL_INCREASERATE) + { + if (player[cp].pfallspeedstopSound(SOUND_KEEN_FALL); // terminate fall noise + // thud noise + if (!player[cp].ppogostick) + g_pSound->playStereofromCoord(SOUND_KEEN_LAND, PLAY_NOW, objects[player[cp].useObject].scrx); + + // fix "sliding" effect when you fall, go one way, then + // before you land turn around and as you hit the ground + // you're starting to move the other direction + // (set inertia to 0 if it's contrary to player's current dir) + + } + + + } // close "not falling" + + // save fall state so we can detect the high/low-going edges + player[cp].plastfalling = player[cp].pfalling; + + // ensure no sliding if we fall or jump off of ice + if (player[cp].pfalling||player[cp].pjumping) player[cp].psliding=0; +} + +// wouldn't it be cool if keen had a raygun, and he could shoot things? +// oh wait, he does, and here's the code for it. +void gamepdo_raygun(int cp, stCloneKeenPlus *pCKP) +{ +int o; +int canRefire; + + stOption *p_option; + p_option = pCKP->Option; + + if (player[cp].pfireframetimer) player[cp].pfireframetimer--; + + // FIRE button down, and not keencicled? + if (player[cp].playcontrol[PA_FIRE] && !player[cp].pfrozentime) + { + player[cp].inhibitwalking = 1; // prevent moving + player[cp].pfiring = 1; // flag that we're firing + player[cp].ppogostick = 0; // put away pogo stick if out + + if (!player[cp].lastplaycontrol[PA_FIRE] || pCKP->Option[OPT_FULLYAUTOMATIC].value) + { // fire is newly pressed + + // limit how quickly shots can be fired + if (pCKP->Option[OPT_FULLYAUTOMATIC].value) + { + if (player[cp].pfireframetimer < PFIRE_LIMIT_SHOT_FREQ_FA) + { + canRefire = 1; + } + else canRefire = 0; + } + + else + { + if (player[cp].pfireframetimer < PFIRE_LIMIT_SHOT_FREQ) + { + canRefire = 1; + } + else canRefire = 0; + } + + if (canRefire) + { + // show raygun for a minimum time even if FIRE is immediatly released + player[cp].pfireframetimer = PFIRE_SHOWFRAME_TIME; + + // try to fire off a blast + if (player[cp].inventory.charges) + { // we have enough charges + + player[cp].inventory.charges--; + player[cp].pshowdir = player[cp].pdir; + + g_pSound->playStereofromCoord(SOUND_KEEN_FIRE, PLAY_NOW, objects[player[cp].useObject].scrx); + + if (player[cp].pdir==RIGHT) + { // fire a blast to the right + o = spawn_object(player[cp].x+((sprites[0].xsize-4)<playStereofromCoord(SOUND_GUN_CLICK, PLAY_NOW, objects[player[cp].useObject].scrx); + + } // end "do we have charges?" + + } // end "limit how quickly shots can be fired" + + } // end "fire is newly pressed" + } // end "fire button down and not keencicled" + else + { // FIRE button is NOT down + // put away ray gun after it's shown for the minimum period of time + if (!player[cp].pfireframetimer) + { // ray gun shown for minimum time + player[cp].pfiring = 0; + } + else + { // minimum time not expired + player[cp].pfiring = 1; + player[cp].inhibitwalking = 1; + } + } + +} + +// select the appropriate player frame based on what he's doing +void gamepdo_SelectFrame(int cp, stCloneKeenPlus *pCKP) +{ + player[cp].playframe = 0; // basic standing + + // select the frame assuming he's pointing right. ep1 does not select + // a walk frame while fading--this is for the bonus teleporter in L13. + if (player[cp].pdie) player[cp].playframe = PDIEFRAME + player[cp].pdieframe; + else + { + if (player[cp].pfrozentime) player[cp].playframe = PFRAME_FROZEN + player[cp].pfrozenframe; + else if (player[cp].pfiring) player[cp].playframe = PFIREFRAME; + else if (player[cp].ppogostick) player[cp].playframe = PFRAME_POGO + (player[cp].pjumping==PPREPAREPOGO); + else if (player[cp].pjumping) player[cp].playframe += player[cp].pjumpframe; + else if (player[cp].pfalling) player[cp].playframe += 13; + else if (player[cp].pwalking || player[cp].playpushed_x) player[cp].playframe += player[cp].pwalkframe; + } + + // if he's going left switch the frame selected above to the + // appropriate one for the left direction + if (player[cp].pshowdir && !player[cp].pdie && !player[cp].pfrozentime) + { + if (player[cp].pfiring) + { + player[cp].playframe++; + } + else if (player[cp].ppogostick) + { + player[cp].playframe+=2; + } + else if (player[cp].pjumping || player[cp].pfalling) + { + player[cp].playframe+=6; + } + else + { + player[cp].playframe+=4; + } + } +} + +// handles walking. the walking animation is handled by gamepdo_walkinganim() +void gamepdo_walking(int cp, stCloneKeenPlus *pCKP) +{ + int cur_pfastincrate; + if (player[cp].inhibitwalking && !player[cp].psliding) + { + if (!player[cp].pfrozentime||pCKP->Control.levelcontrol.episode!=1) + if (!player[cp].pjumping && !player[cp].pfalling) + player[cp].pinertia_x = 0; + return; + } + + // this prevents a "slipping" effect if you jump, say, right, then + // start walking left just as you hit the ground + if (player[cp].pjustjumped && ((player[cp].pinertia_x > 0 && player[cp].pdir==LEFT) ||\ + (player[cp].pinertia_x < 0 && player[cp].pdir==RIGHT)))\ + { + if(!player[cp].ppogostick) + player[cp].pinertia_x = 0; + } + + // this code makes it so that if you jump/fall onto a semi-sliding + // block you'll start moving a little + if (!player[cp].pjumping && !player[cp].pfalling) + { + // on left/right press clear pjustjumped + if ((player[cp].playcontrol[PA_X] < 0)||(player[cp].playcontrol[PA_X] > 0)) + { + player[cp].pjustjumped = 0; + player[cp].pjustfell = 0; + } + + // if we fall onto a semislide tile with no inertia + // start moving a little + if (player[cp].pjustfell && player[cp].psemisliding) + { + if (player[cp].pdir==RIGHT) + { + if (player[cp].blockedr) + { + player[cp].pjustjumped = 0; + player[cp].pjustfell = 0; + } + else + { + if (!player[cp].pinertia_x) player[cp].pinertia_x = 1; + player[cp].pshowdir = player[cp].pdir; + } + } + else + { + if (player[cp].blockedl) + { + player[cp].pjustjumped = 0; + player[cp].pjustfell = 0; + } + else + { + if (!player[cp].pinertia_x) player[cp].pinertia_x = -1; + player[cp].pshowdir = player[cp].pdir; + } + } + } + } + + // test if we're trying to walk + if ((player[cp].psemisliding&&player[cp].pinertia_x!=0) || (((player[cp].playcontrol[PA_X] < 0) || (player[cp].playcontrol[PA_X] > 0) || (((player[cp].playcontrol[PA_Y] < 0) || (player[cp].playcontrol[PA_Y] > 0))&&map.isworldmap)) && !player[cp].inhibitwalking)) + { + // we just started walking or we changed directions suddenly? + if (player[cp].pwalking == 0 || ((player[cp].lastpdir==RIGHT && player[cp].pdir==LEFT)||(player[cp].lastpdir==LEFT && player[cp].pdir==RIGHT))) + { + player[cp].widejump = false; + player[cp].pwalkanimtimer = 0; + player[cp].pwalkframe = 1; + player[cp].pwalkincreasetimer = 0; + player[cp].pfriction_timer_x = 0; + player[cp].pfriction_timer_y = 0; + + if (!player[cp].pjumping && !player[cp].pfalling) + { + if(!player[cp].ppogostick) // Only if he stays on the ground (No pogoing) + player[cp].pinertia_x /= 2; + player[cp].pinertia_y = 0; + } + + player[cp].lastpdir = player[cp].pdir; + player[cp].pwalking = 1; + } + } + else + { // end "d-pad down and bit sliding" + if(player[cp].pinertia_x != 0) + player[cp].pslowingdown=1; + else + { + player[cp].pslowingdown=0; + player[cp].pwalking = 0; + } + } + + /* when sliding on ice force maximum speed */ + if (player[cp].psliding) + { + if (player[cp].pjumping != PPREPAREJUMP && + player[cp].pjumping != PPREPAREPOGO) + { + // reset walk frame because we have no walk animation while on ice + player[cp].pwalkframe = 0; + // keep player sliding at maximum speed + if (player[cp].pdir==RIGHT) + { + player[cp].pinertia_x = PMAXSPEED; + } + else if (player[cp].pdir==LEFT) + { + player[cp].pinertia_x = -PMAXSPEED; + } + } + return; + } + else if (!player[cp].pwalking) return; // don't run rest of sub if not walking + // if we get here we're walking and not sliding + + /* increase player inertia while walk key held down */ + if (player[cp].ppogostick) + cur_pfastincrate = PFASTINCRATE_POGO; + else + cur_pfastincrate = PFASTINCRATE; + + if((player[cp].pjumpdir != UP) && (player[cp].pjumping != 0)) + { + return; + } + + if (player[cp].playcontrol[PA_X] > 0) + { // RIGHT key down + + // quickly reach PFASTINCMAXSPEED + if (player[cp].pwalkincreasetimer>=cur_pfastincrate && player[cp].pinertia_x=cur_pfastincrate && player[cp].pinertia_x>-PFASTINCMAXSPEED) + { + player[cp].pinertia_x--; + player[cp].pwalkincreasetimer=0; + } + else + { + player[cp].pwalkincreasetimer++; + } + + // prevent sliding on map + if (map.isworldmap ) + { + if(player[cp].pinertia_x > 0) + { + player[cp].pinertia_x = 0; + } + else + { + player[cp].pinertia_x=player[cp].playcontrol[PA_X]*PFASTINCMAXSPEED/100; + } + } + // increase up to max speed every time frame is changed + if (!player[cp].pwalkanimtimer && player[cp].pinertia_x>-PMAXSPEED) + { + player[cp].pinertia_x--; + } + } + + if (player[cp].playcontrol[PA_Y] > 0) + { + // quickly reach PFASTINCMAXSPEED + if (player[cp].pwalkincreasetimer>=PFASTINCRATE && player[cp].pinertia_y=PFASTINCRATE && player[cp].pinertia_y>-PFASTINCMAXSPEED) + { + player[cp].pinertia_y--; + player[cp].pwalkincreasetimer=0; + } + else + { + player[cp].pwalkincreasetimer++; + } + // increase up to max speed every time frame is changed + if (!player[cp].pwalkanimtimer && player[cp].pinertia_y>-PMAXSPEED) + { + player[cp].pinertia_y--; + } + + // prevent sliding on map + if (map.isworldmap ) + { + if(player[cp].pinertia_y > 0) + { + player[cp].pinertia_y = 0; + } + else + { + player[cp].pinertia_y=player[cp].playcontrol[PA_Y]*PFASTINCMAXSPEED/100; + } + } + } + +} + +void gamepdo_ankh(int cp) +{ +int o; + if (!player[cp].ankhtime) return; + + o = player[cp].ankhshieldobject; + objects[o].x = player[cp].x - (8<Control.levelcontrol.episode==3) + { + AllowMountUnmountNessie(cp); + } + + gamepdo_wm_SelectFrame(cp, pCKP); + + // copy player's keytable to lastkeytable + memcpy(&player[cp].lastkeytable, &player[cp].keytable, sizeof(player[cp].lastkeytable)); +} + +// select the appropriate player frame based on what he's doing +void gamepdo_wm_SelectFrame(int cp, stCloneKeenPlus *pCKP) +{ + // select base frame for current direction + if (player[cp].pshowdir==RIGHT) player[cp].playframe = PMAPRIGHTFRAME; + else if (player[cp].pshowdir==LEFT) player[cp].playframe = PMAPLEFTFRAME; + else if (player[cp].pshowdir==UP) player[cp].playframe = PMAPUPFRAME; + else if (player[cp].pshowdir==DOWN) player[cp].playframe = PMAPDOWNFRAME; + + // episode 3 map frames start at 31, ep1&2 at 32 + if (pCKP->Control.levelcontrol.episode==3) player[cp].playframe--; + + // no walking animation if we're fading + if (fade.mode != NO_FADE) return; + + // add in walk frame if walking + if (player[cp].pwalking) player[cp].playframe += player[cp].pwalkframe; +} + +// set blockedl and blockedr...is Keen up against a solid object? +void gamepdo_wm_setblockedlrud(int cp, stCloneKeenPlus *pCKP) +{ + player[cp].blockedl = player[cp].blockedr = 0; + player[cp].blockedu = player[cp].blockedd = 0; + + // cheat: holding down TAB will turn off clipping. or if you are in godmode + if ((pCKP->Option[OPT_CHEATS].value && g_pInput->getHoldedKey(KTAB)) || player[cp].godmode) return; + + // R + if (wm_issolid((player[cp].x>>CSF)+8, (player[cp].y>>CSF)+1)) + { player[cp].blockedr = 1; } + else if (wm_issolid((player[cp].x>>CSF)+8, (player[cp].y>>CSF)+8)) + { player[cp].blockedr = 1; } + else if (wm_issolid((player[cp].x>>CSF)+8, (player[cp].y>>CSF)+13)) + { player[cp].blockedr = 1; } + + // L + if (wm_issolid((player[cp].x>>CSF)+0, (player[cp].y>>CSF)+1)) + { player[cp].blockedl = 1; } + else if (wm_issolid((player[cp].x>>CSF)+0, (player[cp].y>>CSF)+8)) + { player[cp].blockedl = 1; } + else if (wm_issolid((player[cp].x>>CSF)+0, (player[cp].y>>CSF)+13)) + { player[cp].blockedl = 1; } + + // U + if (wm_issolid((player[cp].x>>CSF)+1, (player[cp].y>>CSF)-1)) + { player[cp].blockedu = 1; } + else if (wm_issolid((player[cp].x>>CSF)+4, (player[cp].y>>CSF)-1)) + { player[cp].blockedu = 1; } + else if (wm_issolid((player[cp].x>>CSF)+7, (player[cp].y>>CSF)-1)) + { player[cp].blockedu = 1; } + + // D + if (wm_issolid((player[cp].x>>CSF)+1, (player[cp].y>>CSF)+14)) + { player[cp].blockedd = 1; } + else if (wm_issolid((player[cp].x>>CSF)+4, (player[cp].y>>CSF)+14)) + { player[cp].blockedd = 1; } + else if (wm_issolid((player[cp].x>>CSF)+7, (player[cp].y>>CSF)+14)) + { player[cp].blockedd = 1; } + +} + +// select proper player direction +void gamepdo_wm_setdir(int cp, stCloneKeenPlus *pCKP) +{ +int exception; + player[cp].dpadcount = 0; + if (player[cp].playcontrol[PA_X] < 0) { player[cp].pdir = LEFT; player[cp].dpadcount++; } + if (player[cp].playcontrol[PA_X] > 0) { player[cp].pdir = RIGHT; player[cp].dpadcount++; } + if (player[cp].playcontrol[PA_Y] < 0) { player[cp].pdir = UP; player[cp].dpadcount++; } + if (player[cp].playcontrol[PA_Y] > 0) { player[cp].pdir = DOWN; player[cp].dpadcount++; } + + exception = 0; + if (player[cp].pshowdir==UP && !player[cp].playcontrol[PA_Y] < 0) exception = 1; + if (player[cp].pshowdir==DOWN && !player[cp].playcontrol[PA_Y] > 0) exception = 1; + if (player[cp].pshowdir==LEFT && !player[cp].playcontrol[PA_X] < 0) exception = 1; + if (player[cp].pshowdir==RIGHT && !player[cp].playcontrol[PA_X] > 0) exception = 1; + if ((player[cp].playcontrol[PA_Y] < 0) && (player[cp].playcontrol[PA_Y] > 0)) player[cp].pshowdir = DOWN; + if ((player[cp].playcontrol[PA_X] < 0) && (player[cp].playcontrol[PA_X] > 0)) player[cp].pshowdir = RIGHT; + + if (player[cp].dpadcount==1 || player[cp].dpadlastcount==0 || exception) + { + player[cp].pshowdir = player[cp].pdir; + } + player[cp].dpadlastcount = player[cp].dpadcount; +} + +// handles inertia and friction for the Y direction +// (this is where the inertia is actually applied to playx) +void gamepdo_InertiaAndFriction_Y(int cp, stCloneKeenPlus *pCKP) +{ + if (player[cp].hideplayer) + { + player[cp].pinertia_y = 0; + return; + } + + // if we hit a solid object kill all inertia + if (player[cp].pinertia_y > 0 && player[cp].blockedd) + { + player[cp].pinertia_y = 0; + } + else if (player[cp].pinertia_y < 0 && player[cp].blockedu) + { + player[cp].pinertia_y = 0; + } + + // apply pinertia_y + player[cp].y += player[cp].pinertia_y; + + // if we stopped walking (i.e. LRUD not held down) apply friction + //if (!player[cp].keytable[KDOWN] && !player[cp].keytable[KUP]) + if (!player[cp].playcontrol[PA_Y]) + { + // and apply friction to pinertia_y + if (player[cp].pfriction_timer_y > PFRICTION_RATE_WM) + { + if (player[cp].pinertia_y < 0) player[cp].pinertia_y++; + else if (player[cp].pinertia_y > 0) player[cp].pinertia_y--; + player[cp].pfriction_timer_y = 0; + } + else player[cp].pfriction_timer_y++; + } +} + +void gamepdo_wm_AllowEnterLevel(int cp, stCloneKeenPlus *pCKP) +{ +int lvl; +int x,y,i,o; +int destx, desty; +int telfrom, teldest, telsnap; + +stLevelControl *p_levelcontrol; + +// 3859 <-> 3889 +// 3911 -> 3955 +// 3877 <-> 3922 + +// 4032 -> 3842 +// 3842 -> 3877 +// 4063 -> 4094 +// 4094 -> 4072 +// 4072 -> 3980 +// 3980 -> 4032 nosnap + +// table of teleporters (mostly for ep3). player will teleport from +// a teleporter in a teleport_from entry, to the teleporter +// in the matching teleport_dest entry. Thus 3859 leads to 3889, etc. +// if the snap entry is 1 the screen will snap to center on the new +// position, otherwise it will smoothly scroll over to it +#define NUM_TPORTS 20 +int teleport_from[NUM_TPORTS+1] = {4014,4032,3842,4063,4094,4072,3980,3859,3889,3911,3877,3922,3947,4025,3988,3955,41,38,0}; +int teleport_dest[NUM_TPORTS+1] = {4072,3842,3877,4094,4072,3980,4032,3889,3859,3955,3922,3877,4025,3988,3911,3889,38,41,0}; +int teleport_snap[NUM_TPORTS+1] = {1 ,1 ,1 ,1 ,1 ,1 ,0 ,0 ,0 ,1 ,1 ,1 ,1 ,0 ,1 ,1 ,0 ,0 ,0}; + +p_levelcontrol = &(pCKP->Control.levelcontrol); + + if (fade.mode != NO_FADE) return; + if (player[cp].hideplayer) return; // don't execute function while teleporting + + if ((player[cp].playcontrol[PA_JUMP] || player[cp].playcontrol[PA_POGO]) && !player[cp].wm_lastenterstate) + { // trying to enter a level (or use a teleporter, etc) + + // get level/object marker beneath player + x = (player[cp].x>>CSF)+4; + y = (player[cp].y>>CSF)+4; + lvl = map.objectlayer[x>>4][y>>4]; + if (!lvl) + { + y = (player[cp].y>>CSF)+8; + lvl = map.objectlayer[x>>4][y>>4]; + } + + x = x >> 4 << 4; + y = y >> 4 << 4; + + if (lvl) + { + /* handle special map objects, and standard levels too */ + + // look through the teleporter tables and see if this is + // a teleporter + telfrom = 0; + for(i=0;iepisode==3) + { + objects[o].ai.teleport.baseframe = TELEPORT_BASEFRAME_EP3; + objects[o].ai.teleport.idleframe = TELEPORT_IDLEFRAME_EP3; + } + else + { // the teleporter in ep1 + objects[o].ai.teleport.baseframe = TELEPORT_GRAY_BASEFRAME_EP1; + objects[o].ai.teleport.idleframe = TELEPORT_GRAY_IDLEFRAME_EP1; + } + g_pSound->playStereofromCoord(SOUND_TELEPORT, PLAY_NOW, objects[player[cp].useObject].scrx); + + player[cp].hideplayer = 1; + } + } + else + { + switch(lvl) + { + case NESSIE_PATH: break; + case NESSIE_PAUSE: break; + case NESSIE_MOUNTPOINT: break; + + // ep1 bonus teleporter + case LVLS_TELEPORTER_BONUS: + o = spawn_object(x<episode==1) + { + YourShipNeedsTheseParts(pCKP); + } + else + { + ShipEp3(pCKP); + } + break; + + default: // a regular level + p_levelcontrol->chglevelto = (lvl & 0x7fff); + endlevel(1, pCKP); + g_pMusicPlayer->stop(); + g_pSound->playStereofromCoord(SOUND_ENTER_LEVEL, PLAY_NOW, objects[player[cp].useObject].scrx); + + break; + + } // end switch(level) + } // end isn't a teleporter + } // end if(lvl) + } // end trying to enter a level + + player[cp].wm_lastenterstate = (player[cp].playcontrol[PA_JUMP] || player[cp].playcontrol[PA_POGO]); +} + +char wm_issolid(int xb, int yb) +{ + // for map tiles solidl and solidr are always gonna be the same... + // so we can get away with this. + if ( TileProperty[getmaptileat(xb, yb)][BLEFT] ) return 1; + //if (tiles[getmaptileat(xb, yb)].solidl) return 1; + if (getlevelat(xb, yb) & 0x8000) + { + if(g_pInput->getHoldedKey(KTAB) && g_pInput->getHoldedKey(KLSHIFT)) + { + return 0; + } + else + { + return 1; + } + } + return 0; +} + +// if nessie is at a mount point near the player, mounts him! +void MountNessieIfAvailable(int cp) +{ +char AtSameMountPoint; + + if (!player[cp].mounted) + { + // is nessie paused? + if (objects[NessieObjectHandle].ai.nessie.pausetimer) + { + // is she at the same mount point the player is? + if (player[cp].y>>CSF>>4 < map.ysize>>2 && objects[NessieObjectHandle].y>>CSF>>4 < map.ysize>>2) AtSameMountPoint = 1; // both at mortimer's castle + else if (player[cp].y>>CSF>>4 > map.ysize>>1 && objects[NessieObjectHandle].y>>CSF>>4 > map.ysize>>1) AtSameMountPoint = 1; // both at secret island + else AtSameMountPoint = 0; + + if (AtSameMountPoint) + { + objects[NessieObjectHandle].ai.nessie.mounted[cp] = 1; + player[cp].mounted = 1; + player[cp].hideplayer = 1; + } + } + } +} + +void AllowMountUnmountNessie(int cp) +{ +int objmarker; + if (!player[cp].mounted) + { // not mounted. find out if he's trying to mount + // if the upper quarter of the map (mortimer's castle mount point) + // he's trying to mount if he's on a NESSIE_MOUNTPOINT object marker + // and he's going right and is blockedr and/or is going down and is + // blockedd. in the bottom quarter (secret island mount point) + // it's up and blockedu. + + // make sure he's on a mount point + objmarker = getlevelat((player[cp].x>>CSF)+4, (player[0].y>>CSF)+9); + if (objmarker != NESSIE_MOUNTPOINT) return; + + // is he trying to mount? + if (player[cp].y>>CSF>>4 < map.ysize>>2) + { // at mortimer's castle mount point + /*if ( (player[cp].keytable[KRIGHT] && player[cp].blockedr) || \ + (player[cp].keytable[KDOWN] && player[cp].blockedd)) + { + // YES! if nessie is at that mount point, mount her!! + MountNessieIfAvailable(cp); + }*/ + } + else + { // at secret island mount point + /*if (player[cp].keytable[KUP] && player[cp].blockedu) + { + MountNessieIfAvailable(cp); + }*/ + } + } + else + { // mounted. find out if he's trying to unmount. + if (objects[NessieObjectHandle].ai.nessie.pausetimer) + { // nessie is paused + if (objects[NessieObjectHandle].y>>CSF>>4 < map.ysize>>2) + { // nessie is at mortimer's castle mount point + /*if (player[cp].keytable[KUP]) + { + // unmount nessie + objects[NessieObjectHandle].ai.nessie.mounted[cp] = 0; + player[cp].mounted = 0; + player[cp].hideplayer = 0; + }*/ + } + else if (objects[NessieObjectHandle].y>>CSF>>4 > map.ysize>>1) + { // nessie is at secret island mount point + /*if (player[cp].keytable[KDOWN]) + { + // unmount nessie + objects[NessieObjectHandle].ai.nessie.mounted[cp] = 0; + player[cp].mounted = 0; + player[cp].hideplayer = 0; + player[cp].y += (18< + +CHQBitmap::CHQBitmap(SDL_Rect screenrect) { + m_scrimg = NULL; + m_blackscreen = NULL; + m_active = false; + m_alpha = 0; + memcpy(&m_screenrect,&screenrect,sizeof(SDL_Rect)); +} + +CHQBitmap::~CHQBitmap() { + if(m_scrimg){ SDL_FreeSurface(m_scrimg); m_scrimg = NULL;} + if(m_blackscreen){ SDL_FreeSurface(m_blackscreen); m_blackscreen = NULL;} +} + +bool CHQBitmap::loadImage(const char *pFilename) +{ + m_scrimg = SDL_LoadBMP(pFilename); + + // TODO: Resolution detection and comparison with the tilesize must be performed + + m_active = true; + if(!m_scrimg) + m_active = false; + else + { + m_active = true; + // Create a empty black surface for alpha blending with black + m_blackscreen = SDL_CreateRGBSurface(SDL_SWSURFACE, + 320,240,32,0,0,0,0); + } + return m_active; +} + +void CHQBitmap::updateHQBitmap(SDL_Surface *m_surface, unsigned int x, unsigned int y) +{ + m_imagerect.x = x; + m_imagerect.y = y; + m_imagerect.w = m_surface->w; + m_imagerect.h = m_surface->h; + + SDL_BlitSurface(m_scrimg, &m_imagerect, m_surface, NULL); + + if(m_alpha == 255) + return; + + SDL_BlitSurface(m_blackscreen, NULL, m_surface, NULL); +} +void CHQBitmap::setAlphaBlend(Uint8 alpha) +{ + + if(alpha == 20) + { + m_alpha = 255; + return; + } + + m_alpha = alpha*10; + SDL_SetAlpha(m_blackscreen, SDL_SRCALPHA, 255-m_alpha); +} +void CHQBitmap::offsetAlphaBlend(Uint8 alpha) +{ + m_alpha += alpha; + SDL_SetAlpha(m_blackscreen, SDL_SRCALPHA, alpha); +} diff --git a/src/hqp/CHQBitmap.h b/src/hqp/CHQBitmap.h new file mode 100644 index 000000000..d80597be6 --- /dev/null +++ b/src/hqp/CHQBitmap.h @@ -0,0 +1,34 @@ +/* + * CHQBitmap.h + * + * Created on: 18.04.2009 + * Author: gerstrong + */ + +#ifndef CHQBITMAP_H_ +#define CHQBITMAP_H_ + +#include + +class CHQBitmap { +public: + CHQBitmap(SDL_Rect screenrect); + virtual ~CHQBitmap(); + + void setScrollposition(unsigned int xpos, unsigned int ypos); + void updateHQBitmap(SDL_Surface *m_surface, unsigned int x, unsigned int y); + bool loadImage(const char *pFilename); + void setAlphaBlend(Uint8 alpha); + void offsetAlphaBlend(Uint8 alpha); + +private: + bool m_active; + + SDL_Surface *m_blackscreen; // used to put over the bitmap, it can be darkened + SDL_Surface *m_scrimg; + SDL_Rect m_imagerect; + SDL_Rect m_screenrect; + Uint8 m_alpha; +}; + +#endif /* CHQBITMAP_H_ */ diff --git a/src/hqp/CMusic.cpp b/src/hqp/CMusic.cpp new file mode 100644 index 000000000..e7b0f637a --- /dev/null +++ b/src/hqp/CMusic.cpp @@ -0,0 +1,125 @@ +/* + * CMusic.cpp + * + * Created on: 02.05.2009 + * Author: gerstrong + */ + +#include "CMusic.h" +#include "../hqp/hq_sound.h" +#include "../CLogFile.h" +#include "../include/vorbis/oggsupport.h" + +CMusic::CMusic() { + playmode = PLAY_MODE_STOP; +} + +CMusic::~CMusic() { + // TODO Auto-generated destructor stub +} + +int CMusic::load(SDL_AudioSpec AudioSpec, char *musicfile) +{ + FILE *fp; + + if(AudioSpec.format != 0) + { + +#ifdef BUILD_WITH_OGG + SDL_AudioSpec AudioFileSpec; + SDL_AudioCVT Audio_cvt; + + stHQSound pOggAudio; + + pOggAudio.sound_buffer=NULL; + pOggAudio.sound_len=0; + pOggAudio.sound_pos=0; + + if((fp = fopen(musicfile,"rb")) == NULL) + { + g_pLogFile->textOut(PURPLE,"Music Driver(): \"%s\". File does not exist!
    ", musicfile); + return -1; + } + + if(openOGGSound(fp, &AudioFileSpec, &pOggAudio) != 0) + { + g_pLogFile->textOut(PURPLE,"Music Driver(): OGG file could not be opened: \"%s\". File is damaged or something is wrong with your soundcard!
    ", musicfile); + return 1; + } + + g_pLogFile->ftextOut("Music Driver(): File \"%s\" opened successfully!
    ", musicfile); + + int ret; + ret = SDL_BuildAudioCVT(&Audio_cvt, + AudioFileSpec.format, AudioFileSpec.channels, AudioFileSpec.freq, + AudioSpec.format, AudioSpec.channels, AudioSpec.freq); + + music_pos = 0; + + if(ret == -1){ + g_pLogFile->textOut(PURPLE,"Music Driver(): Couldn't convert the audio for an appropriate format!
    "); + free(pOggAudio.sound_buffer); + pOggAudio.sound_len = 0; + pOggAudio.sound_pos = 0; + return 1; + } + + music_len = pOggAudio.sound_len; + + Audio_cvt.buf = (Uint8*) malloc(music_len * Audio_cvt.len_mult * sizeof(Uint8)); + Audio_cvt.len = music_len; + memcpy(Audio_cvt.buf, pOggAudio.sound_buffer, music_len*sizeof(Uint8)); + + free(pOggAudio.sound_buffer); + + SDL_ConvertAudio(&Audio_cvt); + + music_len = Audio_cvt.len_cvt; + music_buffer = new Uint8 [music_len]; + memcpy(music_buffer, Audio_cvt.buf, music_len); + + // Structure Audio_cvt must be freed! + free(Audio_cvt.buf); + + return 0; + +#endif + } + else + g_pLogFile->textOut(PURPLE,"Music Driver(): I would like to open the music for you. But your Soundcard is disabled!!
    "); + + return 0; +} + +void CMusic::unload(void) +{ + if(music_buffer){ delete[] music_buffer; music_buffer = NULL; } + + music_len = 0; + music_pos = 0; + playmode = PLAY_MODE_STOP; +} + +void CMusic::play(void) +{ + playmode = PLAY_MODE_PLAY; +} + +void CMusic::stop(void) +{ + playmode = PLAY_MODE_STOP; +} + +Uint8 *CMusic::passBuffer(int length) // length only refers to the part(buffer) that has to be played +{ + if(length < music_len-music_pos) + { + music_pos += length; + return music_buffer+music_pos-length; + } + else + { + music_pos = 0; + return music_buffer; + } +} diff --git a/src/hqp/CMusic.h b/src/hqp/CMusic.h new file mode 100644 index 000000000..0b14ef0e9 --- /dev/null +++ b/src/hqp/CMusic.h @@ -0,0 +1,44 @@ +/* + * CMusic.h + * + * Created on: 02.05.2009 + * Author: gerstrong + */ + +#ifndef CMUSIC_H_ +#define CMUSIC_H_ + +enum playstatus{ + PLAY_MODE_STOP, + PLAY_MODE_PAUSE, + PLAY_MODE_PLAY +}; + +#include + +#include "../CSingleton.h" +#define g_pMusicPlayer CMusic::Get() + +class CMusic : public CSingleton +{ +public: + CMusic(); + virtual ~CMusic(); + + int load(SDL_AudioSpec AudioSpec, char *musicfile); + void unload(void); + void play(void); + void stop(void); + Uint8 *passBuffer(int length); // returns the buffer that has to be played in every callback + + int playing(void){return playmode;} + +private: + Uint8 *music_buffer; + long music_len; + int music_pos; + int playmode; + +}; + +#endif /* CMUSIC_H_ */ diff --git a/src/hqp/hq_sound.cpp b/src/hqp/hq_sound.cpp new file mode 100644 index 000000000..789bb311f --- /dev/null +++ b/src/hqp/hq_sound.cpp @@ -0,0 +1,102 @@ +/* + * hq_sound.c + * + * Created on: 05.01.2009 + * Author: gerstrong + */ +#include +#include "../hqp/hq_sound.h" +#include "../keen.h" +#include "../sdl/CVideoDriver.h" +#include "../include/vorbis/oggsupport.h" +#include "../CLogFile.h" + +short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const char *soundfile) +{ + SDL_AudioSpec AudioFileSpec; + SDL_AudioCVT Audio_cvt; + + psound->sound_buffer = NULL; + char buf[80]; + FILE *fp; + + sprintf(buf,"data/hqp/snd/%s.OGG",soundfile); // Start with OGG + if((fp = fopen(buf,"rb")) != NULL) + { + #ifdef BUILD_WITH_OGG + if(openOGGSound(fp, &AudioFileSpec, psound) != 0) + { + g_pLogFile->textOut(PURPLE,"OGG file could not be opened: \"%s\". The file was detected, but appears to be damaged. Trying to load the classical sound
    ", soundfile); + return 1; + } + psound->enabled = true; + + #endif + + #ifndef BUILD_WITH_OGG + g_pLogFile->textOut(PURPLE,"Sorry, OGG-Support is disabled!
    "); + sprintf(buf,"data/hqp/snd/%s.WAV",soundfile); + + // Check, if it is a wav file or go back to classic sounds + if (SDL_LoadWAV (buf, &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL) + { + g_pLogFile->textOut(PURPLE,"Wave file could not be opened: \"%s\". Trying to load the classical sound
    ", buf); + return 1; + } + + #endif + } + else + { + sprintf(buf,"data/hqp/snd/%s.WAV",soundfile); + + // Check, if it is a wav file or go back to classic sounds + if (SDL_LoadWAV (buf, &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL) + { + g_pLogFile->textOut(PURPLE,"Wave file could not be opened: \"%s\". Trying to load the classical sounds
    ", buf); + return 1; + } + } + + psound->sound_pos = 0; + g_pLogFile->textOut(PURPLE,"File \"%s\" opened successfully!
    ", buf); + + int ret; + /* Build AudioCVT (This is needed for the conversion from one format to the one used in the game)*/ + ret = SDL_BuildAudioCVT(&Audio_cvt, + AudioFileSpec.format, AudioFileSpec.channels, AudioFileSpec.freq, + AudioSpec->format, AudioSpec->channels, AudioSpec->freq); + + /* Check that the convert was built */ + if(ret == -1){ + g_pLogFile->textOut(PURPLE,"Couldn't build converter!
    "); + SDL_FreeWAV(psound->sound_buffer); + return 1; + } + + /* Setup for conversion, copy original data to new buffer*/ + Audio_cvt.buf = (Uint8*) malloc(psound->sound_len * Audio_cvt.len_mult); + Audio_cvt.len = psound->sound_len; + memcpy(Audio_cvt.buf, psound->sound_buffer, psound->sound_len); + + /* We can delete to original WAV data now */ + SDL_FreeWAV(psound->sound_buffer); + + /* And now we're ready to convert */ + SDL_ConvertAudio(&Audio_cvt); + + /* copy the converted stuff to the original music buffer*/ + psound->sound_len = Audio_cvt.len_cvt; + psound->sound_buffer = (Uint8*) malloc(psound->sound_len); + memcpy(psound->sound_buffer, Audio_cvt.buf, psound->sound_len); + + // Structure Audio_cvt must be freed! + free(Audio_cvt.buf); + + return 0; +} + +void HQSndDrv_Unload(stHQSound *psound) +{ + if(psound->sound_buffer){ free(psound->sound_buffer); psound->sound_buffer = NULL;} +} diff --git a/src/hqp/hq_sound.h b/src/hqp/hq_sound.h new file mode 100644 index 000000000..a126063a5 --- /dev/null +++ b/src/hqp/hq_sound.h @@ -0,0 +1,19 @@ +/* + * hq_sound.h + * + * Created on: 05.01.2009 + * Author: gerstrong + */ + +#include + +typedef struct stHQSound +{ + Uint8 *sound_buffer; + Uint32 sound_len; + int sound_pos; + bool enabled; +} stHQSound; + +short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const char *soundfile); +void HQSndDrv_Unload(stHQSound *psound); diff --git a/src/include/declarations.h b/src/include/declarations.h new file mode 100644 index 000000000..c7530c8b6 --- /dev/null +++ b/src/include/declarations.h @@ -0,0 +1,125 @@ + +#define MAX_COMMANDS 8 +#define MAX_SOUND_LENGTH 1024 +#define MAX_SOUNDS 50 +#define MAX_STRING_LENGTH 256 + + +#define OPT_FULLYAUTOMATIC 0 +#define OPT_SUPERPOGO 1 +#define OPT_ALLOWPKING 2 +#define OPT_CHEATS 3 +#define OPT_TWOBUTTON 4 +#define OPT_KEYCARDSTACK 5 +#define OPT_ANALOGJOYSTICK 6 + +#define NUM_OPTIONS 7 + +#define OPT_MEAN 7 // This isn't part of the options menu anymore + +#define MAX_NUMBER_OF_FILES 100 + +typedef struct stOption +{ + char *name; + char value; +} stOption; + +typedef struct stDisplay +{ + unsigned int Width; + unsigned int Height; + unsigned short Depth; + short Mode; + short Fullscreen; + short Filtermode; + short Zoom; + unsigned short FrameSkip; +} stDisplay; + +typedef struct stDevice +{ + SDL_Joystick *Joystick; + SDL_Event Event; +} stDevice; + +typedef struct stLevelControl +{ + // level control + int command; // used to give a command to playgame_levelmanager() + int chglevelto; // parameter to LVLC_CHANGE_LEVEL + int tobonuslevel; // if 1 player will warp to bonus level on return to WM (for ep1) + // data about current level + int curlevel; // number of current level + char success; // 1 if level was finished, 0 if he died + char isfinallevel; // 1 if this is the final level + char canexit; // 1 if player is allowed to use the exit door + char gameovermode; // 1 if "Game Over" is displayed + char dokeensleft; // 1 if we need to do the "Keens Left" + char dark; // 1 if level is currently dark (lights are out) + + int episode; // which episode we're playing (1-3) + + // array of which levels have been completed (have "Done" tiles over them + // on the world map) + int levels_completed[MAX_LEVELS+1]; + + // exitXpos: the X pixel position (not < + +int get_bit(int *p_bit_count, FILE **fin); /* only used for the conversion of sounds from episode 2 and 3 by sound_extraction_of_exe_files */ + +int unlzexe(FILE *fin, unsigned char *outbuffer); + +int getEXEVersion(int episode, int bufsize); diff --git a/src/include/fileio/rle.h b/src/include/fileio/rle.h new file mode 100644 index 000000000..4cacc69a7 --- /dev/null +++ b/src/include/fileio/rle.h @@ -0,0 +1,8 @@ +/* + * rle.h + * + * Created on: 29.01.2009 + * Author: gerstrong + */ + +int unRLEW(FILE *fp, unsigned int *filebuf); diff --git a/src/include/fileio/story.h b/src/include/fileio/story.h new file mode 100644 index 000000000..6c051082f --- /dev/null +++ b/src/include/fileio/story.h @@ -0,0 +1,8 @@ +/* + * story.h + * + * Created on: 07.02.2009 + * Author: gerstrong + */ + +int readStoryText(char **ptext, int episode, char *path); diff --git a/src/include/game.h b/src/include/game.h new file mode 100644 index 000000000..8e6f14d70 --- /dev/null +++ b/src/include/game.h @@ -0,0 +1,229 @@ +// various states we go through when a level is completed +// to do the walking out the exit door animation +#define LEVEL_NOT_DONE 0 // not completed +#define LEVEL_DONE_WALK 1 // walking through exit door +#define LEVEL_DONE_WAIT 2 // finished walk through door, wait a bit +#define LEVEL_DONE_FADEOUT 3 // fading out +#define LEVEL_COMPLETE 4 // on to the next level! + +// width of the player sprite, used for walking "behind" the exit door frame +#define PLAYERSPRITE_WIDTH 16 + +// at STOPWALKING time after starting the exit door animation, +// keen stops walking and we go to LEVEL_DONE_WAIT. +#define LEVEL_DONE_STOPWALKING_TIME 450 +// at TOTAL_WAIT_TIME, LEVEL_DONE_FADEOUT is initiated. +#define LEVEL_DONE_TOTAL_WAIT_TIME 1000 + +// for ankh shield... +// stage1 is no flicker of the shield, changes colors +// in stage2 the shield flickers fast, changes colors +// in stage3 the shield flashes slow, no color change +#define ANKH_STAGE1_TIME 3000 +#define ANKH_STAGE2_TIME 1500 +#define ANKH_STAGE3_TIME 500 +#define PLAY_ANKH_TIME (ANKH_STAGE1_TIME+ANKH_STAGE2_TIME+ANKH_STAGE3_TIME) +// these correspond stage 1,2 and 3 respectively +#define ANKH_STATE_NOFLICKER 0 +#define ANKH_STATE_FLICKERFAST 1 +#define ANKH_STATE_FLICKERSLOW 2 + +// rate at which the periodically firing guns in ep3 will fire +#define GUN_FIRE_FREQ 800 +// rate at which the ice cannons in ep1 will fire +#define ICECANNON_FIRE_FREQ 400 + +// direction defines used for various things +#define RIGHT 0 +#define LEFT 1 +#define UP 2 +#define DOWN 3 + +#define ANKH_SHIELD_FRAME 61 + +// upon starting to walk, keen will quickly increase to +// PFASTINCMAXSPEED. keen can, at a slower rate, +// reach up to PMAXSPEED (increased every walk anim frame) +#define PFASTINCMAXSPEED 9 +#define PMAXSPEED 13 +#define PJUMPINERTIA 30 // The higher, the value, the more difficult it is to jump or pogo +#define PFASTINCRATE 16 // accel delay rate up to PFASTINCMAXSPEED +#define PFASTINCRATE_POGO 50 // rate when pogo stick is out +// rates at which player slows down +#define PFRICTION_RATE_INAIR 25 //8 +#define PFRICTION_RATE_ONGROUND 5 //2 +#define PFRICTION_RATE_WM 1 // on world map +// rate at which player walking animation is shown +#define PWALKANIMRATE 40 + +// speed at which player walks through the exit door +#define PMAXEXITDOORSPEED 3 + +// the various jump states +#define PNOJUMP 0 // not jumping +#define PPREPAREJUMP 1 // doing the jump animation +#define PJUMPUP 2 // jumping +#define PJUMPED 3 // Player has jumped +#define PPREPAREPOGO 4 // "pogo compressed" anim frame +#define PPOGOING 5 // pogoing + +// the different jumping frames. when CTRL is held down the player will +// go from frame PPREPAREJUMPFRAME to PJUMP_PREPARE_LAST_FRAME at a rate +// of PJUMP_PREPARE_ANIM_RATE until either CTRL is released or the player +// reaches the last frame. How far he got will select one of the various +// jump heights, defined below. +#define PPREPAREJUMPFRAME 8 +#define PJUMP_PREPARE_LAST_FRAME 13 +#define PJUMP_PREPARE_ANIM_RATE 11 + +// time to show player in his "pogo compressed" frame before jumping +#define PPOGO_PREPARE_TIME 50 + +#define PFIREFRAME 20 // raygun frame index +#define PFIRE_SHOWFRAME_TIME 100 // minimum time to show raygun frame +#define PFIRE_LIMIT_SHOT_FREQ 30 // maximum speed player can shoot +#define PFIRE_LIMIT_SHOT_FREQ_FA 50 // fully automatic version + +// player frame indexes for world map +#define PMAPRIGHTFRAME 32 +#define PMAPDOWNFRAME 36 +#define PMAPLEFTFRAME 40 +#define PMAPUPFRAME 44 + +// player dieing states +#define PDIE_NODIE 0 +#define PDIE_DYING 1 +#define PDIE_DEAD 2 +#define PDIE_FELLOFFMAP 3 + +#define DIE_ANIM_RATE 50 +#define DIE_TILL_FLY_TIME 320 +#define PDIE_RISE_SPEED -20 +#define DIE_MAX_XVECT 10 + +// initial negative inertia to provide player at +// start of a normal jump and a (high) pogo jump +#define PJUMPUP_SPEED 20 +#define PPOGOUP_SPEED 24 + +// These control the various jump heights. +// one of these pairs is selected depending on how +// long the CTRL key was held down while Keen +// was preparing to jump. #1 causes the highest +// jump and they get lower from there. +// NORMAL_TIME is the amount of time keen will +// jump straight up at speed -PJUMPUP_SPEED. +// when expired his jump slows down at a rate +// of DECREASERATE. + +#define PJUMP_NORMALTIME_1 6 +#define PJUMP_UPDECREASERATE_1 6 + +#define PJUMP_NORMALTIME_2 5 +#define PJUMP_UPDECREASERATE_2 5 + +#define PJUMP_NORMALTIME_3 4 +#define PJUMP_UPDECREASERATE_3 4 + +#define PJUMP_NORMALTIME_4 3 +#define PJUMP_UPDECREASERATE_4 2 + +#define PJUMP_NORMALTIME_5 2 +#define PJUMP_UPDECREASERATE_5 1 + +#define PJUMP_NORMALTIME_6 1 +#define PJUMP_UPDECREASERATE_6 0 + + +// for short pogo jumps, uses -PJUMPUP_SPEED +#define PJUMP_NORMALTIME_POGO_SHORT 6 +#define PJUMP_UPDECREASERATE_POGO_SHORT 6 + +// for high pogo jumps, uses -PPOGOUP_SPEED +//#define PJUMP_NORMALTIME_POGO_LONG 25 +//#define PJUMP_UPDECREASERATE_POGO_LONG 12 +#define PJUMP_NORMALTIME_POGO_LONG 36 +#define PJUMP_UPDECREASERATE_POGO_LONG 6 + +// for the super-pogo option +#define PPOGOUP_SPEED_SUPER 40 +#define PJUMP_NORMALTIME_POGO_LONG_SUPER 10 +#define PJUMP_UPDECREASERATE_POGO_LONG_SUPER 4 + +// pogo frames +#define PFRAME_POGO 24 +#define PFRAME_POGOBOUNCE 25 + +// frame and animation speed for frozen keen (ep1) and stunned keen (ep2&3) +#define PFRAME_FROZEN 28 +#define PFROZENANIMTIME 100 +// how long keen should stay frozen when hit by an ice chunk +#define PFROZEN_TIME 1000 +#define PFROZEN_THAW 100 + +// when falling keen's Y inertia increases at INCREASERATE up to MAXSPEED +#define PFALL_INCREASERATE 3 +#define PFALL_MAXSPEED 19 + +// friction when player is pushed by yorp's, ball's, etc. +#define PLAYPUSH_DECREASERATE 1 + +// uses by the key processing function which changes CTRL, ALT, and CTRL+ALT +// into JUMP, POGO, and FIRE. +#define CTRLALT_DEBOUNCETIME 20 + +#define PDIEFRAME 22 + +// various tile indexes +#define BG_GRAY 143 +#define BG_GRAY_PRIORITY 304 +#define BG_BLACK 155 +#define BG_DARK_EP2 147 +#define TILE_FELLOFFMAP_EP1 582 +#define TILE_FELLOFFMAP_EP3 0 +#define TILE_ICE_LEFTCORNER 403 +#define TILE_ICE_RIGHTCORNER 404 +#define TILE_ICE 405 +#define TILE_ICE_CUBE 394 +#define TILE_GLOWCELL 241 +#define DOOR_YELLOW 2 +#define DOOR_RED 3 +#define DOOR_GREEN 4 +#define DOOR_BLUE 5 + +#define DOOR_RED_SPRITE (MAX_SPRITES-5) +#define DOOR_GREEN_SPRITE (MAX_SPRITES-4) +#define DOOR_BLUE_SPRITE (MAX_SPRITES-3) +#define DOOR_YELLOW_SPRITE (MAX_SPRITES-2) +#define YORPSTATUEHEAD 22 +#define YORPSTATUEHEADUSED 485 +#define YORPSTATUEBOTTOM 22 +#define ENEMYRAY 109 +#define ENEMYRAYEP2 123 +#define ENEMYRAYEP3 103 +#define RAY_VERT_EP3 104 + +// if player[].psupportingtile contains this value the player is actually +// supported by an object and you should look in player[].psupportingobj +// for it's index. +#define PSUPPORTEDBYOBJECT 0 + +void gameloop(stCloneKeenPlus *pCKP); +void gameloop_initialize(stCloneKeenPlus *pCKP); +void initsprites(stCloneKeenPlus *pCKP, int s); +void keen_get_goodie(int px, int py, int theplayer, stCloneKeenPlus *pCKP); +void procgoodie(int t, int mpx, int mpy, int theplayer, stCloneKeenPlus *pCKP); + +void initgame(stCloneKeenPlus *pCKP); +int initgamefirsttime(stCloneKeenPlus *pCKP, int s); + +void open_door(int doortile, int doorsprite, int mpx, int mpy, int cp, stCloneKeenPlus *pCKP); +void killplayer(int theplayer, stCloneKeenPlus *pCKP); +void PlayerTouchedExit(int theplayer, stCloneKeenPlus *pCKP); + +void endlevel(int success, stCloneKeenPlus *pCKP); + +void SetGameOver(stCloneKeenPlus *pCKP); +char checkissolidl(int x, int y, int cp, stCloneKeenPlus *pCKP); +char checkissolidr(int x, int y, int cp, stCloneKeenPlus *pCKP); + diff --git a/src/include/gamedo.h b/src/include/gamedo.h new file mode 100644 index 000000000..ecce51869 --- /dev/null +++ b/src/include/gamedo.h @@ -0,0 +1,7 @@ + +void gamedo_RenderScreen(stCloneKeenPlus *pCKP); +void gamedo_frameskipping(stCloneKeenPlus *pCKP); +void gamedo_HandleFKeys(stCloneKeenPlus *pCKP); +void gamedo_frameskipping_blitonly(stCloneKeenPlus *pCKP); +void gamedo_getInput(stCloneKeenPlus *pCKP); +void gamedo_render_drawobjects(stCloneKeenPlus *pCKP); diff --git a/src/include/gamepdo.h b/src/include/gamepdo.h new file mode 100644 index 000000000..50480e898 --- /dev/null +++ b/src/include/gamepdo.h @@ -0,0 +1,27 @@ + +void gamepdo_StatusBox(int cp, stCloneKeenPlus *pCKP); +void gamepdo_HandlePlayer(int cp, stCloneKeenPlus *pCKP); +void gamepdo_getgoodies(int cp, stCloneKeenPlus *pCKP); +void gamepdo_falling(int cp, stCloneKeenPlus *pCKP); +void gamepdo_ProcessInput(unsigned int cp, stCloneKeenPlus *pCKP); + +//void gamepdo_HandlePlayer(int cp); +void gamepdo_walkbehindexitdoor(int cp, stCloneKeenPlus *pCKP); +void gamepdo_dieanim(int cp, stCloneKeenPlus *pCKP); +void gamepdo_keencicle(int cp, stCloneKeenPlus *pCKP); +void gamepdo_setdir(int cp, stCloneKeenPlus *pCKP); +void gamepdo_setblockedlru(unsigned int cp, stCloneKeenPlus *pCKP); +//void gamepdo_getgoodies(int cp); +void gamepdo_walkinganim(int cp, stCloneKeenPlus *pCKP); +void gamepdo_walking(int cp, stCloneKeenPlus *pCKP); +void gamepdo_playpushed(int cp, stCloneKeenPlus *pCKP); +void gamepdo_JumpAndPogo(int cp, stCloneKeenPlus *pCKP); +void gamepdo_Jump(int cp, stCloneKeenPlus *pCKP); +//void gamepdo_falling(int cp, stCommand command[MAX_COMMANDS]); +void gamepdo_raygun(int cp, stCloneKeenPlus *pCKP); +void gamepdo_special(int cp, stCloneKeenPlus *pCKP); +void gamepdo_SelectFrame(int cp, stCloneKeenPlus *pCKP); +void gamepdo_checkcollision(int cp, stCloneKeenPlus *pCKP); +void gamepdo_moveplayer(int cp, stCloneKeenPlus *pCKP); +void gamepdo_ankh(int cp); +//void gamepdo_StatusBox(int cp); diff --git a/src/include/gm_pdowm.h b/src/include/gm_pdowm.h new file mode 100644 index 000000000..ec61660af --- /dev/null +++ b/src/include/gm_pdowm.h @@ -0,0 +1,9 @@ + +void gamepdo_wm_HandlePlayer(int cp, stCloneKeenPlus *pCKP); +void gamepdo_InertiaAndFriction_Y(int cp, stCloneKeenPlus *pCKP); +void gamepdo_InertiaAndFriction_X(unsigned int cp, stCloneKeenPlus *pCKP); +void gamepdo_wm_AllowEnterLevel(int cp, stCloneKeenPlus *pCKP); +void gamepdo_wm_SelectFrame(int cp, stCloneKeenPlus *pCKP); +void gamepdo_wm_setblockedlrud(int cp, stCloneKeenPlus *pCKP); +void gamepdo_wm_setdir(int cp, stCloneKeenPlus *pCKP); + diff --git a/src/include/graphics.h b/src/include/graphics.h new file mode 100644 index 000000000..e6342adc1 --- /dev/null +++ b/src/include/graphics.h @@ -0,0 +1,12 @@ +/* + * graphics.h + * + * Created on: 16.01.2009 + * Author: gerstrong + */ + +char allocmem(); +char Graphics_Start(void); + +void sb_blit(void); +void update_screen(void); diff --git a/src/include/gui/dialog.h b/src/include/gui/dialog.h new file mode 100644 index 000000000..feacde3fc --- /dev/null +++ b/src/include/gui/dialog.h @@ -0,0 +1,57 @@ +/* + * dialog.h + * + * This file contains structures for dialog items that + * are created with a function, which read the structure and allocates automatically the dialog + * + * Created on: 21.01.2009 + * Author: gerstrong + */ + +#define STARTER_SAVE 1 +#define STARTER_ESCAPE 2 +#define STARTER_SOUNDOPT 3 +#define STARTER_DISPLAYOPT 4 +#define STARTER_GAMEOPT 5 + +typedef struct stTextLine +{ + char *Text; + short ID; // items are orded by ID +} stTextLine; + +typedef struct stSeparator +{ + short ID; // items are orded by ID +} stSeparator; + + +typedef struct stOptionSwitch +{ + char *Name; + char **Option; + short selected; + short numSel; + short ID; // items are orded by ID +} stOptionSwitch; + +typedef struct stStarterSwitch +{ + char *Name; + int numFunctionToLaunch; + short ID; // items are sorted by IDs +} stStarterSwitch; + +typedef struct stDlgStruct // imagine every substructure as typical control +{ + stTextLine *TextLine; + stOptionSwitch *OptionSwitch; + stStarterSwitch *StarterSwitch; + stSeparator *Separator; + + short num_TextLines; + short num_OptionSwitches; + short num_StarterSwitch; + short num_Separators; + +} stDlgStruct; diff --git a/src/include/main.h b/src/include/main.h new file mode 100644 index 000000000..dca3d276e --- /dev/null +++ b/src/include/main.h @@ -0,0 +1,21 @@ +/* + * main.h + * + * Created on: 13.01.2009 + * Author: gerstrong + */ + +short loadDriverConfiguration(stCloneKeenPlus *pCKP); +short saveDriverConfiguration(stCloneKeenPlus *pCKP); +void startTheWholeGame(stCloneKeenPlus *pCKP); +short readCommandLine(int argc, char *argv[], stCloneKeenPlus *pCKP); +void preallocateCKP(stCloneKeenPlus *pCKP); +short loadGamesConfig(stOption *Option); +short loadResourcesforGame(stCloneKeenPlus *pCKP); +short runGameCycle(stCloneKeenPlus *pCKP, CGame *Game); +short abortCKP(stCloneKeenPlus *pCKP); +void cleanupResources(stCloneKeenPlus *pCKP); +short closeCKP(stCloneKeenPlus *pCKP); +void createDefaultSettings(stOption *Option); +short loadCKPDrivers(stCloneKeenPlus *pCKP); +void SaveConfig(stOption *Option); diff --git a/src/include/menu.h b/src/include/menu.h new file mode 100644 index 000000000..478725efb --- /dev/null +++ b/src/include/menu.h @@ -0,0 +1,26 @@ + +#define TWIRL_SPEED_SLOW 100 +#define TWIRL_SPEED_FAST 20 + +#define MENUS_Y 32 +#define MAINMENU_X 32 + +#define STORYBOARD_X 672 +#define STORYBOARD_Y 32 + +#define FONT_TWIRL 9 +#define TWIRL_SPEED 30 +#define TWIRL_NUM_FRAMES 5 + +#include "../CGame.h" + +char controlsmenu(stCloneKeenPlus *pCKP); +int mainmenu(stCloneKeenPlus *pCKP,int defaultopt); +char configmenu(stCloneKeenPlus *pCKP); +short loadStartMenu(stCloneKeenPlus *pCKP); +void keensleft(stCloneKeenPlus *pCKP); +int intro(stCloneKeenPlus *pCKP); +void showmapatpos(int level, int xoff, int yoff, int wm, stCloneKeenPlus *pCKP); +short loadResourcesforStartMenu(stCloneKeenPlus *pCKP, CGame *Game); +int getDifficulty(stCloneKeenPlus *pCKP); +void showPage(char *text, stCloneKeenPlus *pCKP, int textsize); diff --git a/src/include/misc.h b/src/include/misc.h new file mode 100644 index 000000000..91351b495 --- /dev/null +++ b/src/include/misc.h @@ -0,0 +1,15 @@ + +void cleanup(stCloneKeenPlus *CKP); +void showinventory(int p, stCloneKeenPlus *pCKP); +void YourShipNeedsTheseParts(stCloneKeenPlus *pCKP); +void ShipEp3(stCloneKeenPlus *pCKP); +int endsequence(stCloneKeenPlus *pCKP); +void youseeinyourmind(int mpx, int mpy, stCloneKeenPlus *pCKP); +void VorticonElder(int mpx, int mpy, stCloneKeenPlus *pCKP); +char save_slot_box(int issave, stCloneKeenPlus *pCKP); +void game_save_interface(stCloneKeenPlus *pCKP); +int VerifyQuit(stCloneKeenPlus *pCKP); +char gameiswon(stCloneKeenPlus *pCKP); +void game_save(char *fname, stCloneKeenPlus *pCKP); +int game_load(char *fname, stCloneKeenPlus *pCKP); +void showTextMB(int lines, char **text, stCloneKeenPlus *pCKP); diff --git a/src/include/playeraction.h b/src/include/playeraction.h new file mode 100644 index 000000000..f8624c4ca --- /dev/null +++ b/src/include/playeraction.h @@ -0,0 +1,21 @@ +/* + * playeraction.h + * + * Created on: 09.02.2009 + * Author: gerstrong + */ + +/* These are the actions, one player can perform according to the controls and some physical defines*/ + +#define PA_X 0 +#define PA_Y 1 +#define PA_JUMP 2 +#define PA_POGO 3 +#define PA_FIRE 4 +#define PA_STATUS 5 + +#define PA_MAX_ACTIONS 6 + +#define MAX_SPEED 7000 +#define MAX_BOOST 200 +#define TIME_DIVIDER 500 // For speed and acceleration diff --git a/src/include/vorbis/oggsupport.h b/src/include/vorbis/oggsupport.h new file mode 100644 index 000000000..c4e5e909b --- /dev/null +++ b/src/include/vorbis/oggsupport.h @@ -0,0 +1,12 @@ +/* + * oggsupport.h + * + * Created on: 06.01.2009 + * Author: gerstrong + */ + +#ifdef BUILD_WITH_OGG + +short openOGGSound(FILE *fp, SDL_AudioSpec *pspec, stHQSound *psound); + +#endif diff --git a/src/keen.h b/src/keen.h new file mode 100644 index 000000000..8601e7f4e --- /dev/null +++ b/src/keen.h @@ -0,0 +1,868 @@ +#include +#include +#include + +#ifdef TARGET_DOS + #include + #include + #include + #include + #include "dos\timer.h" +#endif + +#ifdef TARGET_WIN32 + #include +#endif + +#include "vorticon/sounds.h" +#include "funcdefs.h" +#include "CLatch.h" + +#include "include/playeraction.h" + +#define CSF 5 + +//#define OVSIZE 3000 + +// when crashflag is activated by setting it to QUIT_NONFATAL, +// the application will immediately shut down, however the +// "a Fatal Error Occurred" message box will not pop up and +// the sysbeep will not sound. +#define QUIT_NONFATAL 555 + +#define SAVEGAMEVERSION '4' +#define ATTRFILEVERSION 1 + +#define WM_MAP_NUM 80 + +#define MAX_TILES 700 +#define MAX_SPRITES 300 +#define MAX_FONT 256 +#define MAX_BITMAPS 20 + +#define MAX_OBJECTS 100 +#define MAX_ANIMTILES 200 + +#define PAL_FADE_SHADES 20 +#define PAL_FADE_WHITEOUT 40 +typedef struct stFade +{ + int mode; + int dir; + int curamt; + int fadetimer; + int rate; +} stFade; +#define NO_FADE 0 +#define FADE_GO 1 +#define FADE_COMPLETE 2 + +#define FADE_IN 1 +#define FADE_OUT 2 +#define FADE_NORM 3 +#define FADE_FAST 1 +#define FADE_SLOW 30 + +#define NO_QUIT 0 +#define QUIT_PROGRAM 1 +#define QUIT_TO_TITLE 2 + +#define MAX_LEVELS 100 +#define SCROLLBUF_XSIZE 512 +#define SCROLLBUF_YSIZE 512 +#define SCROLLBUF_MEMSIZE ((SCROLLBUF_XSIZE)*(SCROLLBUF_YSIZE+300)) +#define SCROLLBUF_NUMTILESX (SCROLLBUF_XSIZE / 16) +#define SCROLLBUF_NUMTILESY (SCROLLBUF_YSIZE / 16) + +#define BLITBUF_XSIZE 320 +#define BLITBUF_YSIZE 200 +#define BLITBUF_MEMSIZE ((BLITBUF_XSIZE)*(BLITBUF_YSIZE+30)) + // for each entry in the animtileinuse array that is nonzero, that + // location on the display is an animated tile which is currently registered + // in animtiles[]. Used in map_draw_hstripe and map_draw_vstripe. + // When drawing a new stripe over one that previously contained an animated + // tile, this lets it know it needs to unregister the animated tile that + // used to be there. the nonzero value corresponds to the associated entry + // in animtiles[]. the x,y pixel position is the index in here * 16. + #define ATILEINUSE_SIZEX 33 + #define ATILEINUSE_SIZEY 33 + + #define MAX_PLAYERS 8 + + #define WORLD_MAP 80 + #define FINAL_MAP 16 + + #define LVLC_NOCOMMAND 0 + #define LVLC_CHANGE_LEVEL 1 + #define LVLC_END_SEQUENCE 2 + #define LVLC_GAME_OVER 3 + #define LVLC_TANTALUS_RAY 4 // switch on tantalus ray pressed + #define LVLC_START_LEVEL 5 + + +typedef struct stMap +{ + unsigned int xsize, ysize; // size of the map + unsigned char isworldmap; // if 1, this is the world map + unsigned int mapdata[256][256]; // the map data + // in-game, contains monsters and special object tags like for switches + // on world map contains level numbers and flags for things like teleporters + unsigned int objectlayer[256][256]; + char firsttime; // used when generating multiplayer positions on world map +} stMap; +typedef struct stTile +{ + int masktile; // if nonzero, specifies a mask for this tile + int chgtile; // tile to change to when level completed (for wm) + // or tile to change to when picked up (in-level) + unsigned int animOffset; // starting offset from the base frame +} stTile; + + +// Tile information planes +#define ANIMATION 0 +#define BEHAVIOR 1 +#define BUP 2 +#define BRIGHT 3 +#define BDOWN 4 +#define BLEFT 5 + +typedef struct stBitmap +{ + int xsize; + int ysize; + unsigned char *bmptr; + char name[9]; +} stBitmap; +typedef struct stSprite +{ + char xsize, ysize; + unsigned char imgdata[64][64]; + unsigned char maskdata[64][64]; + // bounding box for hit detection + unsigned int bboxX1, bboxY1; + unsigned int bboxX2, bboxY2; +} stSprite; + +typedef struct stInventory +{ + unsigned long score; + unsigned long extralifeat; + unsigned int charges; // ray gun ammo + signed int lives; + unsigned char HasPogo; + unsigned char HasCardYellow; + unsigned char HasCardRed; + unsigned char HasCardGreen; + unsigned char HasCardBlue; + // ep1 only + unsigned char HasJoystick; + unsigned char HasFuel; + unsigned char HasBattery; + unsigned char HasVacuum; +} stInventory; + +// for strings loaded from "strings.dat" +#define MAX_STRINGS 100 +#define MAX_ATTRIBUTES 16 +typedef struct stString +{ + unsigned char *name; // pointer to malloc'd area containing string name + unsigned char *stringptr; // pointer to malloc'd area containing string + + int numAttributes; + unsigned char *attrnames[MAX_ATTRIBUTES+1]; + unsigned int attrvalues[MAX_ATTRIBUTES+1]; +} stString; + +/* Structs used for different enemies data, these are in a union */ +typedef struct stYorpData +{ + unsigned char state; + + unsigned char looktimes,lookposition; + unsigned char timer, dietimer; + unsigned char walkframe; + unsigned int dist_traveled; + signed int yorpdie_inertia_y; + + unsigned char movedir; +} stYorpData; +typedef struct stGargData +{ + unsigned char state; + + unsigned char looktimes,lookframe; + unsigned char timer, dietimer, keenonsameleveltimer; + unsigned char about_to_charge; + unsigned char walkframe; + unsigned int dist_traveled; + signed int gargdie_inertia_y; + + unsigned char movedir; + unsigned char detectedPlayer, detectedPlayerIndex; +} stGargData; +typedef struct stVortData +{ + unsigned char state; + + unsigned char timer,timer2; + unsigned int animtimer; + unsigned char palflashtimer, palflashamt; + unsigned char frame; + unsigned int dist_traveled; + signed int inertiay; + + char ep1style; // episode 1 style four-shots-to-kill + + unsigned char movedir; + // these hold the animation frames indexes since they're + // different for each episode + int WalkLeftFrame; + int WalkRightFrame; + int LookFrame; + int JumpRightFrame; + int JumpLeftFrame; + int DyingFrame; + int DeadFrame; +} stVortData; +typedef struct stBearData +{ + unsigned char state; + + unsigned char timer,timer2; + unsigned int animtimer; + unsigned char frame; + signed int inertiay; + unsigned char movedir; + unsigned int timesincefire; + unsigned int running; + + int dist_traveled; +} stBearData; +typedef struct stButlerData +{ + unsigned char state; + unsigned char timer,animtimer; + unsigned char frame; + unsigned int dist_traveled; + + unsigned char movedir; +} stButlerData; +typedef struct stTankData +{ + unsigned char state; + + unsigned char timer,animtimer; + unsigned char frame; + unsigned int dist_traveled; + + unsigned char movedir; + + int ponsameleveltime; + unsigned char alreadyfiredcauseonsamelevel; + unsigned char fireafterlook; + + unsigned char detectedPlayer; // 1 if player on same level + unsigned char detectedPlayerIndex; // index of player that was detected + + // for tank2 + unsigned int timetillnextshot; + unsigned int firetimes; + unsigned int timetillcanfire; + unsigned int timetillcanfirecauseonsamelevel; +} stTankData; +typedef struct stRayData +{ + char state; + char direction; + char zapzottimer; + + char dontHitEnable; + unsigned int dontHit; // index of an object type ray will not harm + + // for soundwave + int animframe, animtimer; + int offscreentime; + + // for earth chunks + int baseframe; +} stRayData; +typedef struct stDoorData +{ + char timer; + char distance_traveled; +} stDoorData; +typedef struct stIceChunk +{ + char movedir; + char state; + unsigned int originalX, originalY; + int timer; +} stIceChunk; +typedef struct stTeleportData +{ + char animtimer; + char animframe; + char numframechanges; + + char direction; + int whichplayer; + unsigned int destx; + signed int desty; + + int baseframe; + int idleframe; + + char NoExitingTeleporter; + char snap; + + char fadeamt; + char fadetimer; +} stTeleportData; +typedef struct stRopeData +{ + char state; + int droptimer; + int droptimes; + int stoneX, stoneY; + int vortboss; +} stRopeData; + +typedef struct stWalkerData +{ + unsigned char state; + + unsigned char animtimer, dietimer; + unsigned char walkframe; + signed int walkerdie_inertia_y; + int fallinctimer,fallspeed; + + unsigned char walkdir; + unsigned char kickedplayer[MAX_PLAYERS]; +} stWalkerData; + +typedef struct stPlatformData +{ + unsigned char state; + unsigned char animframe; + unsigned int animtimer; + unsigned int waittimer; + + unsigned char movedir; + unsigned char kickedplayer[MAX_PLAYERS]; +} stPlatformData; + +typedef struct stSEData +{ + unsigned int type; + + unsigned char state; + unsigned int timer; + unsigned int platx, platy; + unsigned int bgtile; + unsigned int dir; + + int counter,destroytiles; + unsigned int frame; + int mx,my; + int blowx,blowy; +} stSEData; + +typedef struct stBabyData +{ + char state; + char dir; + signed int inertia_x, inertia_y; + int jumpdectimer, xdectimer; + int jumpdecrate; + int dietimer; + + char walkframe; + int walktimer; +} stBabyData; + +typedef struct stFoobData +{ + char state; + char dir; + + int animframe, animtimer; + int OnSameLevelTime; + int OffOfSameLevelTime; + int spooktimer; + int SpookedByWho; +} stFoobData; + +typedef struct stNinjaData +{ + char state; + char dir; + + int animframe, animtimer; + unsigned int timetillkick; + + signed int XInertia, YInertia; + unsigned int XFrictionTimer, YFrictionTimer; + unsigned int XFrictionRate, YFrictionRate; + int KickMoveTimer; + int isdying; + int dietimer; +} stNinjaData; + +typedef struct stMotherData +{ + char state; + char dir; + char hittimes; + + int animframe, animtimer; + int timer; +} stMotherData; + +typedef struct stMeepData +{ + char state; + char dir; + + int animframe, animtimer; + int timer; +} stMeepData; + +typedef struct stBallJackData +{ + char dir; + int animframe, animtimer; + int speed; +} stBallJackData; + +#define NESSIETRAILLEN 5 +typedef struct stNessieData +{ + char state; + char leftrightdir, updowndir; + unsigned int baseframe; + + unsigned int tiletrailX[NESSIETRAILLEN+1]; + unsigned int tiletrailY[NESSIETRAILLEN+1]; + int tiletrailhead; + + char animframe, animtimer; + unsigned int destx, desty; + + unsigned int pausetimer; + unsigned int pausex, pausey; + + unsigned int mortimer_swim_amt; + unsigned int mounted[MAX_PLAYERS]; +} stNessieData; + +// and the object structure containing the union of the above structs +typedef struct stObject +{ + unsigned int type; // yorp, vorticon, etc. + unsigned int exists; + unsigned int onscreen; // 1=(scrx,scry) position is visible onscreen + unsigned int hasbeenonscreen; + unsigned int sprite; // which sprite should this object be drawn with + unsigned int x, y; // x,y location in map coords, CSFed + int scrx, scry; // x,y pixel position on screen + + // if type is OBJ_PLAYER, this contains the player number that this object + // is associated with + int AssociatedWithPlayer; + + // if zero, priority tiles will not be honored and object will always + // appear in front of the background + char honorPriority; + + char canbezapped; // if 0 ray will not stop on hitdetect + char zapped; // number of times got hit by keen's raygun + + char inhibitfall; // if 1 common_enemy_ai will not do falling + char cansupportplayer[MAX_PLAYERS]; + + unsigned int blockedl, blockedr, blockedu, blockedd; + signed int xinertia, yinertia; + unsigned char xinertiatimer, yinertiatimer; + + unsigned char touchPlayer; // 1=hit detection with player + unsigned char touchedBy; // which player was hit + // Y position on this object the hit was detected + // this is used for the yorps' bonk-on-the-head thing. + // objects are scanned bottom to top, and first pixel + // touching player is what goes in here. + unsigned char hity; + + unsigned int needinit; // 1=new object--requires initilization + unsigned char wasoffscreen; // set to 1 when object goes offscreen + // data for ai and such, used differently depending on + // what kind of object it is + union ai + { + // ep1 + stYorpData yorp; + stGargData garg; + stVortData vort; + stButlerData butler; + stTankData tank; + stRayData ray; + stDoorData door; + stIceChunk icechunk; + stTeleportData teleport; + stRopeData rope; + // ep2 + stWalkerData walker; + stPlatformData platform; + stBearData bear; + stSEData se; + stBabyData baby; + // ep3 + stFoobData foob; + stNinjaData ninja; + stMeepData meep; + stMotherData mother; + stBallJackData bj; + stNessieData nessie; + } ai; + unsigned char erasedata[64][64]; // backbuffer to erase this object +} stObject; + +// (map) stripe attribute structures, for animated tiles +// slot 0 is not used. data starts at slot 1. see description +// of AnimTileInUse in map structure to see why. +typedef struct stAnimTile +{ + int slotinuse; // if 0, this entry should not be drawn + int x; // x pixel position in scrollbuf[] where tile is + int y; // y pixel position in scrollbuf[] + int baseframe; // base frame, i.e. the first frame of animation + int offset; // offset from base frame +} stAnimTile; + +#define NUM_OBJ_TYPES 40 +// ** objects from KEEN1 +#define OBJ_YORP 1 +#define OBJ_GARG 2 +#define OBJ_VORT 3 +#define OBJ_BUTLER 4 +#define OBJ_TANK 5 +#define OBJ_RAY 6 // keen's raygun blast +#define OBJ_DOOR 7 // an opening door +#define OBJ_ICECHUNK 8 // ice chunk from ice cannon +#define OBJ_ICEBIT 9 // piece of shattered ice chunk +#define OBJ_PLAYER 10 +#define OBJ_TELEPORTER 11 // world map teleporter +#define OBJ_ROPE 12 + +// ** objects from KEEN2 (some of these are in ep3 as well) +#define OBJ_WALKER 13 +#define OBJ_TANKEP2 14 +#define OBJ_PLATFORM 15 +#define OBJ_BEAR 16 +#define OBJ_SECTOREFFECTOR 17 +#define OBJ_BABY 18 +#define OBJ_EXPLOSION 19 +#define OBJ_EARTHCHUNK 20 + +// ** objects from KEEN3 +#define OBJ_FOOB 21 +#define OBJ_NINJA 22 +#define OBJ_MEEP 23 +#define OBJ_SNDWAVE 24 +#define OBJ_MOTHER 25 +#define OBJ_FIREBALL 26 +#define OBJ_BALL 27 +#define OBJ_JACK 28 +#define OBJ_PLATVERT 29 +#define OBJ_NESSIE 30 + +#define OBJ_DEMOMSG 31 + +// default sprites...when an object is spawned it's sprite is set to this +// sprite. the object AI will immediately reset the sprite frame, so it +// wouldn't really matter what these are...except that it does because +// the width and height of the default sprite will determine exactly when +// the object because active the first time it scrolls onto the screen +// from the top or left. if the default sprite is wrong the object may +// suddenly appear on the screen instead of smoothly scrolling on. +#define OBJ_YORP_DEFSPRITE 50 +#define OBJ_GARG_DEFSPRITE 60 +#define OBJ_VORT_DEFSPRITE_EP1 78 +#define OBJ_VORT_DEFSPRITE_EP2 82 +#define OBJ_VORT_DEFSPRITE_EP3 71 +#define OBJ_BUTLER_DEFSPRITE 88 +#define OBJ_TANK_DEFSPRITE 98 +#define OBJ_RAY_DEFSPRITE_EP1 108 +#define OBJ_RAY_DEFSPRITE_EP2 122 +#define OBJ_RAY_DEFSPRITE_EP3 102 +#define OBJ_ICECHUNK_DEFSPRITE 112 +#define OBJ_ICEBIT_DEFSPRITE 113 +#define OBJ_TELEPORTER_DEFSPRITE 180 +#define OBJ_ROPE_DEFSPRITE 184 + +#define OBJ_PLATFORM_DEFSPRITE_EP2 126 +#define OBJ_PLATFORM_DEFSPRITE_EP3 107 +#define OBJ_WALKER_DEFSPRITE 102 +#define OBJ_TANKEP2_DEFSPRITE 112 +#define OBJ_BEAR_DEFSPRITE 88 + +#define OBJ_FOOB_DEFSPRITE 95 +#define OBJ_NINJA_DEFSPRITE 77 +#define OBJ_MOTHER_DEFSPRITE 87 +#define OBJ_BJ_DEFSPRITE 109 +#define OBJ_MEEP_DEFSPRITE 118 + +#define OBJ_BABY_DEFSPRITE_EP2 52 +#define OBJ_BABY_DEFSPRITE_EP3 51 + + +// some directions (mostly for OBJ_ICECHUNK and OBJ_ICEBIT) +#define DUPRIGHT 0 +#define DUPLEFT 1 +#define DUP 2 +#define DDOWN 3 +#define DDOWNRIGHT 4 +#define DDOWNLEFT 5 +#define DLEFT 6 +#define DRIGHT 7 + +// directions for OBJ_EARTHCHUNK +#define EC_UPLEFTLEFT 0 // 22 degrees CC of UP/LEFT +#define EC_UPUPLEFT 1 // 22 degrees C of UP/LEFT +#define EC_UP 2 // straight UP +#define EC_UPUPRIGHT 3 // 22 degrees CC of UP/RIGHT +#define EC_UPRIGHTRIGHT 4 // 22 degrees C of UP/RIGHT +#define EC_DOWNLEFTLEFT 5 // 22 degrees CC of DOWN/LEFT +#define EC_DOWNDOWNLEFT 6 // 22 degrees C of DOWN/LEFT +#define EC_DOWN 7 // straight DOWN +#define EC_DOWNDOWNRIGHT 8 // 22 degrees CC of DOWN/RIGHT +#define EC_DOWNRIGHTRIGHT 9 // 22 degrees C of DOWN/RIGHT + +#define EC_UPLEFT 10 +#define EC_UPRIGHT 11 +#define EC_DOWNLEFT 12 +#define EC_DOWNRIGHT 13 + +// scroll triggers +#define SCROLLTRIGGERRIGHT 194 +#define SCROLLTRIGGERLEFT 110 +#define SCROLLTRIGGERUP 80 +#define SCROLLTRIGGERDOWN 114 + +// this structure contains all the variables used by a player +typedef struct stPlayer +{ + // these coordinates are CSFed + unsigned long x; + unsigned int y; + + unsigned int w; + unsigned int h; + + char isPlaying; + int useObject; + + char godmode; + + // used on world map only + char hideplayer; + char mounted; + + short treshold; // This is used for analog devices like joysticks + signed int pinertia_y; + + unsigned long mapplayx; + signed int mapplayy; + + unsigned char playframe; + + unsigned char pfalling,plastfalling,pfallspeed,pfallspeed_increasetimer; + + unsigned char pwalking,playspeed; + unsigned char pslowingdown; + unsigned char pwalkframe,pwalkframea,pwalkanimtimer; + unsigned char pwalkincreasetimer, pfriction_timer_x, pfriction_timer_y; + signed int pinertia_x,pboost_x,playpushed_x; + int chargedjump; + unsigned char playpushed_decreasetimer; + bool widejump; + + unsigned char blockedl,blockedr,blockedu,blockedd; + unsigned int blockedby; + + unsigned char pjumping, pjumptime, pjumpupspeed_decreasetimer, pjumpdir; + unsigned char pjumpframe, pjumpanimtimer, pjumpupspeed; + unsigned char pjumpnormaltime, pjumpupdecreaserate, pjustjumped; + unsigned char pjustfell; + unsigned char pjumpfloattimer; + + unsigned char pdir,pshowdir,lastpdir; + + char pfiring,pfireframetimer; + char inhibitwalking, inhibitfall; + + int ctrltimer, alttimer; + char keyprocstate; + char wm_lastenterstate; + + char pdie, pdieframe, pdietimer; + int pdietillfly; + signed int pdie_xvect; + int psupportingtile, psupportingobject, lastsupportingobject; + char psliding; + char psemisliding; + char ppogostick; + int pfrozentime,pfrozenframe,pfrozenanimtimer; + + unsigned char keytable[50]; + unsigned char lastkeytable[50]; + + + // New values + char playcontrol[PA_MAX_ACTIONS]; + char lastplaycontrol[PA_MAX_ACTIONS]; + + char x_friction; + char y_friction; + + // End new values + + unsigned char dpadcount, dpadlastcount; + + unsigned int ankhtime, ankhshieldobject; + + stInventory inventory; +} stPlayer; + +typedef struct stShipQueue +{ + int cmd; + int time; + int flag1; +} stShipQueue; + + +#define TILE_LITTLE_DONE 77 +#define TILE_BIG_DONE1 78 +#define TILE_BIG_DONE2 79 +#define TILE_BIG_DONE3 80 +#define TILE_BIG_DONE4 81 + +#define TILE_TELEPORTER_GREY_IDLE 99 +#define TILE_TELEPORTER_RED_INUSE 338 + +// special level codes on worldmap +#define LVLS_TELEPORTER_BONUS 46 // bonus teleporter in ep1 +#define LVLS_SHIP 20 + +#define TELEPORTING_OUT 0 +#define TELEPORTING_IN 1 + +#define TELEPORT_BONUS_DESTX ((((23085>>CSF>>4)+2)<<4<>CSF>>4)+2)<<4< +#include "include/declarations.h" +#include "keenext.h" + +typedef struct stCloneKeenPlus +{ + stCommand Command[MAX_COMMANDS]; + SDL_Joystick *Joystick; + SDL_Event Event; + stResources Resources; + stGameData *GameData; + stDevice Device; + stControl Control; + stOption Option[NUM_OPTIONS]; + unsigned short numGames; + unsigned short shutdown; +}stCloneKeenPlus; + +// keen.c +void playgame_levelmanager(stCloneKeenPlus *pCKP); +char play_demo(int demonum, stCloneKeenPlus *pCKP, int s); diff --git a/src/keenext.h b/src/keenext.h new file mode 100644 index 000000000..2e1002586 --- /dev/null +++ b/src/keenext.h @@ -0,0 +1,98 @@ +extern char PlatExtending; +extern stFade fade; +extern stMap map; +extern unsigned int AnimTileInUse[ATILEINUSE_SIZEX][ATILEINUSE_SIZEY]; +extern stTile tiles[MAX_TILES+1]; +extern char localmp; +extern unsigned char tiledata[MAX_TILES+1][16][16]; +extern stSprite sprites[MAX_SPRITES+1]; +extern stBitmap bitmaps[MAX_BITMAPS+1]; +extern stAnimTile animtiles[MAX_ANIMTILES+1]; +extern char font[MAX_FONT+1][8][8]; +extern stObject objects[MAX_OBJECTS+1]; +extern stPlayer player[MAX_PLAYERS]; +extern stPlayer net_lastplayer[MAX_PLAYERS]; +extern unsigned char *scrollbuf; +extern unsigned char *blitbuf; +extern char keytable[50]; +//extern char immediate_keytable[KEYTABLE_SIZE+1]; +//extern char last_immediate_keytable[KEYTABLE_SIZE+1]; +extern int opx,opy; +extern int font_start; +extern char QuitState; + +extern int IntroCanceled; + +extern stString strings[MAX_STRINGS+1]; +extern int numStrings; + +extern int animtiletimer, curanimtileframe; + +extern int thisplayer; +extern unsigned int primaryplayer; +extern unsigned int numplayers; + +extern char frameskiptimer; + +extern stOption *options; + +extern unsigned long scroll_x; +extern unsigned int scrollx_buf; +extern unsigned char scrollpix; +extern unsigned int mapx; +extern unsigned int mapxstripepos; +extern unsigned int scroll_y; +extern unsigned int scrolly_buf; +extern unsigned char scrollpixy; +extern unsigned int mapy; +extern unsigned int mapystripepos; + +extern const char *why_term_ptr; +extern int crashflag,crashflag2,crashflag3; + +extern unsigned int objdefsprites[NUM_OBJ_TYPES+1]; + +extern unsigned int max_scroll_x, max_scroll_y; +extern int atilescount,aobjectscount; +extern int playerbaseframes[MAX_PLAYERS]; +extern char debugmode,acceleratemode; + + +extern char loadinggame, loadslot; + +extern char *BitmapData; + +extern char ScreenIsScrolling; +extern int blockedby; +extern int gunfiretimer, gunfirefreq; +extern char cheatmode; + +extern int numtiles; +extern int **TileProperty; // This version will replace the old stTile Structure and save memory + +extern short usedinfobox; // If statue was used... + + +extern int NessieObjectHandle; +extern int DemoObjectHandle; +extern int BlankSprite; +extern int DemoSprite; +//extern EgaHead LatchHeader; + +extern stShipQueue shipqueue[32]; +extern int ShipQueuePtr; + +extern int demomode; +extern FILE *demofile; +extern unsigned int demo_RLERunLen; +extern unsigned char demo_data[DEMO_MAX_SIZE+1]; +extern unsigned int demo_data_index; +extern int framebyframe; + +extern char otherplayer; + +extern char is_server; +extern char is_client; +extern int fps, curfps; + +extern char disable_fps_adjustment; diff --git a/src/lz.cpp b/src/lz.cpp new file mode 100644 index 000000000..d7d40725c --- /dev/null +++ b/src/lz.cpp @@ -0,0 +1,205 @@ +/* LZ.C + This file contains the functions which decompress the graphics + data from Keen 1. +*/ +#include "keen.h" +#include "CLogFile.h" + +#define LZ_STARTBITS 9 +#define LZ_MAXBITS 12 +#define LZ_ERRORCODE 256 +#define LZ_EOFCODE 257 +#define LZ_DICTSTARTCODE 258 + +#define LZ_MAXDICTSIZE ((1<>= 1; + bitsread++; + } while(bitsreadstringlen;i++) + { + *lz_outbuffer = lzdict[entry]->string[i]; + lz_outbuffer++; + } +} + +// decompresses LZ data from open file lzfile into buffer outbuffer +// returns nonzero if an error occurs +char lz_decompress(FILE *lzfile, unsigned char *outbuffer) +{ +int i; +int numbits; +unsigned int dictindex, maxdictindex; +unsigned int lzcode,lzcode_save,lastcode; +char addtodict; + + /* allocate memory for the LZ dictionary */ + for(i=0;itextOut("lz_decompress(): unable to allocate memory for dictionary!
    "); + return 1; + } + } + + /* initilize the dictionary */ + + // entries 0-255 start with a single character corresponding + // to their entry number + for(i=0;i<256;i++) + { + lzdict[i]->stringlen = 1; + lzdict[i]->string[0] = i; + } + // 256+ start undefined + for(i=256;istringlen = 0; + } + + // reset readbits + lz_readbits(NULL, 0, 1); + + // set starting # of bits-per-code + numbits = LZ_STARTBITS; + maxdictindex = (1 << numbits) - 1; + + // point the global pointer to the buffer we were passed + lz_outbuffer = outbuffer; + + // setup where to start adding strings to the dictionary + dictindex = LZ_DICTSTARTCODE; + addtodict = 1; // enable adding to dictionary + + // read first code + lastcode = lz_readbits(lzfile, numbits, 0); + lz_outputdict(lastcode); + do + { + // read the next code from the compressed data stream + lzcode = lz_readbits(lzfile, numbits, 0); + lzcode_save = lzcode; + + if (lzcode==LZ_ERRORCODE || lzcode==LZ_EOFCODE) + { + break; + } + + // if the code is present in the dictionary, + // lookup and write the string for that code, then add the + // last string + the first char of the just-looked-up string + // to the dictionary at dictindex + + // if not in dict, add the last string + the first char of the + // last string to the dictionary at dictindex (which will be equal + // to lzcode), then lookup and write string lzcode. + + if (lzdict[lzcode]->stringlen==0) + { // code is not present in dictionary + lzcode = lastcode; + } + + if (addtodict) // room to add more entries to the dictionary? + { + // copies string lastcode to string dictindex, then + // concatenates the first character of string lzcode. + for(i=0;istringlen;i++) + { + lzdict[dictindex]->string[i] = lzdict[lastcode]->string[i]; + } + lzdict[dictindex]->string[i] = lzdict[lzcode]->string[0]; + lzdict[dictindex]->stringlen = (lzdict[lastcode]->stringlen + 1); + + // ensure we haven't overflowed the buffer + if (lzdict[dictindex]->stringlen >= (LZ_MAXSTRINGSIZE-1)) + { + g_pLogFile->ftextOut("lz_decompress(): lzdict[%d]->stringlen is too long...max length is %d
    ", dictindex, LZ_MAXSTRINGSIZE); + return 1; + } + + dictindex++; + if (dictindex >= maxdictindex) + { // no more entries can be specified with current code bit-width + if (numbits < LZ_MAXBITS) + { // increase width of codes + numbits++; + maxdictindex = (1 << numbits) - 1; + } + else + { + // reached maximum bit width, can't increase. + // use the final entry (4095) before we shut off + // adding items to the dictionary. + if (dictindex>=(LZ_MAXDICTSIZE-1)) addtodict = 0; + } + } + } + + // write the string associated with the original code read. + // if the code wasn't present, it now should have been added. + lz_outputdict(lzcode_save); + + lastcode = lzcode_save; + } while(1); + + /* free the memory used by the LZ dictionary */ + for(i=0;iftextOut("
    Your personal settings were loaded successfully...
    "); + return 0; +} + +void SaveConfig(stOption *Option) +{ + int i; + CParser Parser; + + if(Parser.loadParseFile()) + { + for (i = 0; i < NUM_OPTIONS; i++) + Parser.saveIntValue(Option[i].name,"Game",Option[i].value); + + Parser.saveParseFile(); + } + + return; +} + +int main(int argc, char *argv[]) +{ + + stCloneKeenPlus CKP; // This is the future main structure of CloneKeen. It will be one variable which controls all + // the program instead of having global variables around somewhere. + + g_pLogFile->CreateLogfile("CGLog.html"); + + banner(); // Intro on the text-console. + + preallocateCKP(&CKP); + + if(loadDriverConfiguration(&CKP) != 0) // Always return 0 if no ERROR + { + g_pLogFile->textOut(RED,"First time message: CKP didn't find the driver config file. However, it is going to generate one basing on default configurations.
    "); + saveDriverConfiguration(&CKP); + } + // TODO: Implement Driver Configuration as class + + if(readCommandLine(argc, argv, &CKP) != 0) + { + g_pLogFile->textOut(RED,"Sorry, but CKP needs correct command line parameters.
    "); + printf("Sorry, but CKP needs correct command line parameters.\n"); + } + + if(loadCKPDrivers(&CKP) != 0) + { + g_pLogFile->textOut(RED,"The game cannot start, because you do not meet the hardware requirements.
    "); + return 1; + } + + createDefaultSettings(CKP.Option); + if(loadGamesConfig(CKP.Option) != 0) + { + g_pLogFile->textOut(PURPLE,"There are no settings! CKP is going to use the default options. You can change them later in the game.
    "); + SaveConfig(CKP.Option); + } + + CGame* Game; + Game = new CGame(); + + if(loadResourcesforStartMenu(&CKP, Game) != 0) + { + g_pLogFile->textOut(RED,"Error! Resources for start menu cannot be loaded! Maybe you need to copy the data files!
    "); + return 1; + } + + if(!CKP.Control.skipstarting) + { + if(loadStartMenu(&CKP) == 1) + { + cleanupResources(&CKP); + return 0; + } + } + + if(!g_pInput->getExitEvent()) + { + + CKP.Control.levelcontrol.episode = CKP.GameData[CKP.Resources.GameSelected-1].Episode; // Assign the correct Episode + + options = CKP.Option; + Game->loadResources(CKP.Control.levelcontrol.episode, CKP.GameData[CKP.Resources.GameSelected-1].DataDirectory); + + //Game->runCycle(); + + CKP.shutdown = SHUTDOWN_BOOTUP; // Prepare game for starting + + while( CKP.shutdown == SHUTDOWN_RESTART || CKP.shutdown == SHUTDOWN_BOOTUP ) + { + CKP.shutdown = SHUTDOWN_NONE; // Game is runnning + runGameCycle(&CKP, Game); + } + } + + if(Game){ delete Game; Game = NULL; } + + cleanupResources(&CKP); + + printf("Thank you very much for playing this wonderful game!"); + + return 0; +} + +short runGameCycle(stCloneKeenPlus *pCKP, CGame *Game) +{ + int opt = MAINMNU_1PLAYER; + int retval; + int eseq = 0; + int defaultopt = 0; + + initgamefirsttime(pCKP, Game->getLatch()->getLatchHeader()->NumSprites); + initgame(pCKP); + + g_pLogFile->ftextOut("Game starting...
    "); + + if (eseq) + { + endsequence(pCKP); + closeCKP(pCKP); + } + + if(!pCKP->Control.skipstarting) + { + if (intro(pCKP)){ pCKP->shutdown=SHUTDOWN_EXIT; return 0; } + pCKP->Control.skipstarting=0; + } + + do + { + if (QuitState==QUIT_TO_TITLE) QuitState = NO_QUIT; + + if(pCKP->Control.storyboard == 1) // Show the story of the game + { + char *text; + int textsize; + + textsize = readStoryText(&text, + pCKP->GameData[pCKP->Resources.GameSelected-1].Episode, + pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory); // Read text from + // and store it at the text pointer + + if(textsize > 0) + { + showPage(text,pCKP,textsize); + free(text); + } + else if(textsize == 0) + { + g_pLogFile->ftextOut("readStoryText(): Error reading story text. Are you sure that there is any story text?"); + } + else if(textsize == 0) + { + g_pLogFile->ftextOut("readStoryText(): Error reading story text. The version appears to be incompatible"); + } + pCKP->Control.storyboard = 0; + } + + if(pCKP->Control.levelcontrol.command != LVLC_START_LEVEL) + { + g_pLogFile->ftextOut("calling mainmenu()
    "); + + opt = mainmenu(pCKP, defaultopt); // Read option from the main menu + // of the game. + + pCKP->Control.skipstarting=0; + + g_pLogFile->ftextOut("gcl: opt = %d
    ", opt); + } + + defaultopt = 0; + IntroCanceled = 0; + switch(opt) + { + case MAINMNU_1PLAYER: + numplayers = 1; + defaultopt = 0; + current_demo = 1; + initgamefirsttime(pCKP, Game->getLatch()->getLatchHeader()->NumSprites); + loadinggame = 0; + playgame_levelmanager(pCKP); + break; + case MAINMNU_2PLAYER: + defaultopt = 0; + current_demo = 1; + numplayers = 2; + initgamefirsttime(pCKP, Game->getLatch()->getLatchHeader()->NumSprites); + loadinggame = 0; + playgame_levelmanager(pCKP); + break; + case MAINMNU_LOADGAME: + if (loadslot) + { + loadinggame = 1; + defaultopt = 0; + current_demo = 1; + numplayers = 1; // here was 2. Why was that? I don't understand + initgamefirsttime(pCKP, Game->getLatch()->getLatchHeader()->NumSprites); + playgame_levelmanager(pCKP); + } + break; + + case MAINMNU_STORY: + pCKP->Control.storyboard=1; + break; + + case MAINMNU_HIGHSCORES: + CHighScores *pHighscores; + pHighscores = new CHighScores(pCKP); + if(pHighscores->showHighScore()) + { + g_pLogFile->ftextOut("Error processing Highscore!!
    "); + } + delete pHighscores; + break; + + case MAINMNU_NEW_GAME: + if(loadStartMenu(pCKP) == 1) + { + pCKP->shutdown = SHUTDOWN_EXIT; + break; + } + //loadResourcesforGame(pCKP); + Game->loadResources(pCKP->Control.levelcontrol.episode, pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory); + + + pCKP->shutdown = SHUTDOWN_RESTART; + break; + + case MAINMNU_TIMEOUT: + case MAINMNU_DEMO: + retval = play_demo(current_demo, pCKP, Game->getLatch()->getLatchHeader()->NumSprites); + + if (retval==DEMO_RESULT_FILE_BAD) + { + // we tried to play a demo that did not exist--assume we + // reached the last demo and go back to the intro + intro(pCKP); + current_demo = 0; + } + else if (retval==DEMO_RESULT_CANCELED) + { // user hit a key to cancel demo + IntroCanceled = 1; // pop up menu + } + + if (IntroCanceled) + { // user canceled out of demo (or intro if at end of demos) + // if user selected "demo" have it selected when he comes back + if (opt==MAINMNU_DEMO) + { + defaultopt = MAINMNU_DEMO; + } + } + + current_demo++; + break; + case RESTART_GAME: + g_pLogFile->ftextOut("********************
    "); + g_pLogFile->ftextOut(" Restarting game...
    "); + g_pLogFile->ftextOut("********************
    \n"); + cleanup(pCKP); + pCKP->shutdown = SHUTDOWN_RESTART; + return 0; + break; + case BACK2MAINMENU: + + default: break; + } + g_pLogFile->ftextOut("bottom of game control loop opt=%d crashflag=%d
    ", opt, crashflag); + if(pCKP->shutdown == SHUTDOWN_EXIT) break; + } while(opt != MAINMNU_QUIT && opt != MAINMNU_NEW_GAME && !crashflag); + + return 0; +} + +void cleanupResources(stCloneKeenPlus *pCKP) +{ + cleanup(pCKP); + return; +} + +void createDefaultSettings(stOption *Option) +{ + setoption(Option,OPT_FULLYAUTOMATIC, "autogun", 0); + setoption(Option,OPT_SUPERPOGO, "superpogo", 0); + setoption(Option,OPT_ALLOWPKING, "pking", 1); + setoption(Option,OPT_CHEATS, "allcheats", 0); + setoption(Option,OPT_TWOBUTTON, "two-button-firing", 0); + setoption(Option,OPT_KEYCARDSTACK, "keycard-stacking", 0); + setoption(Option,OPT_ANALOGJOYSTICK, "analog-joystick", 1); +} + +short loadCKPDrivers(stCloneKeenPlus *pCKP) +{ + g_pGraphics->allocScrollBufmem(); + + // initialize/activate all drivers + g_pLogFile->ftextOut("Starting graphics driver...
    "); + if (!g_pVideoDriver->start()) + { + return abortCKP(pCKP); + } + + g_pLogFile->ftextOut("Starting sound driver...
    "); + + g_pSound->init(); + + g_pLogFile->ftextOut("Starting input driver...
    "); + JoyDrv_Start(&(pCKP->Device.Joystick)); + g_pInput->loadControlconfig(); + + return 0; +} + +short saveDriverConfiguration(stCloneKeenPlus *pCKP) +{ + short retval = 0; + + CParser Parser; + + Parser.saveIntValue("bpp","Video",g_pVideoDriver->getDepth()); + Parser.saveIntValue("frameskip","Video",g_pVideoDriver->getFrameskip()); + + if(g_pVideoDriver->getFullscreen()) + Parser.saveIntValue("fullscreen","Video",1); + else + Parser.saveIntValue("fullscreen","Video",0); + + if(g_pVideoDriver->isOpenGL()) + Parser.saveIntValue("OpenGL","Video",1); + else + Parser.saveIntValue("OpenGL","Video",0); + + + Parser.saveIntValue("width","Video",g_pVideoDriver->getWidth()); + Parser.saveIntValue("height","Video",g_pVideoDriver->getHeight()); + Parser.saveIntValue("scale","Video",g_pVideoDriver->getZoomValue()); + Parser.saveIntValue("OGLfilter","Video",g_pVideoDriver->getOGLFilter()); + Parser.saveIntValue("filter","Video",g_pVideoDriver->getFiltermode()); + + Parser.saveIntValue("channels","Audio",(g_pSound->getAudioSpec()).channels); + Parser.saveIntValue("format","Audio",(g_pSound->getAudioSpec()).format); + Parser.saveIntValue("rate","Audio",(g_pSound->getAudioSpec()).freq); + Parser.saveIntValue("mixerch","Audio",(g_pSound->getMixingchannels())); + + Parser.saveParseFile(); + + return retval; +} + +short loadDriverConfiguration(stCloneKeenPlus *pCKP) +{ + short retval = 0; + CParser Parser; + + if(!Parser.loadParseFile()) + { + retval = 1; + } + else + { + int width, height, depth; + + depth = Parser.getIntValue("bpp","Video"); + width = Parser.getIntValue("width","Video"); + height = Parser.getIntValue("height","Video"); + + if(depth*width*height < 0) + g_pLogFile->ftextOut(RED,"Error reading the configuration file. It appears to be damaged!"); + + g_pVideoDriver->setMode(width, height, depth); + + g_pVideoDriver->setFrameskip(Parser.getIntValue("frameskip","Video")); + + if((Parser.getIntValue("fullscreen","Video")) == 1) + g_pVideoDriver->isFullscreen(true); + + g_pVideoDriver->setOGLFilter(Parser.getIntValue("OGLfilter","Video")); + g_pVideoDriver->setZoom(Parser.getIntValue("scale","Video")); + + g_pVideoDriver->setFilter(Parser.getIntValue("filter","Video")); + + if(Parser.getIntValue("OpenGL","Video") == 1) + g_pVideoDriver->enableOpenGL(true); + else + g_pVideoDriver->enableOpenGL(false); + + if(Parser.getIntValue("channels","Audio") == 2) + g_pSound->setSoundmode(Parser.getIntValue("rate","Audio"), true); + else + g_pSound->setSoundmode(Parser.getIntValue("rate","Audio"), false); + } + + return retval; +} + +short abortCKP(stCloneKeenPlus *pCKP) +{ + g_pLogFile->ftextOut("Fatal error, cleaning up.
    "); + cleanup(pCKP); + g_pLogFile->ftextOut("A fatal error has occurred; game is shutting down.
    "); + return 1; +} + +short closeCKP(stCloneKeenPlus *pCKP) +{ + int count; + int i; + banner(); + SaveConfig(pCKP->Option); + g_pLogFile->ftextOut("
    Thanks for playing!

    "); + cleanup(pCKP); + if (crashflag) + { + if (crashflag != QUIT_NONFATAL) g_pLogFile->ftextOut("\a"); + g_pLogFile->ftextOut("abnormal program termination, error code %d/%d/%d
    explanation: %s
    ", crashflag,crashflag2,crashflag3, why_term_ptr); + + g_pLogFile->ftextOut("numplayers: %d
    ", numplayers); + for(count=0,i=0;iftextOut("# of player instances with isPlaying set: %d
    ", count); + } + return 0; +} + +void playgame_levelmanager(stCloneKeenPlus *pCKP) +{ + int i, o, wm, firsttime = 1; + char levelname[80]; + char SaveGameFileName[40]; + int newlevel; + + stLevelControl *p_levelcontrol; + stOption *p_option; + + p_option = pCKP->Option; + p_levelcontrol = &(pCKP->Control.levelcontrol); + + if( p_levelcontrol->command != LVLC_START_LEVEL ) + { + p_levelcontrol->command = LVLC_CHANGE_LEVEL; + p_levelcontrol->chglevelto = WM_MAP_NUM; + } + p_levelcontrol->tobonuslevel = 0; + p_levelcontrol->success = 0; + map.firsttime = 1; + + usedinfobox = 0; + + do + { + initgame(pCKP); + + newlevel = p_levelcontrol->chglevelto; + if (p_levelcontrol->episode==1 && p_option[OPT_MEAN].value) + { + // in high-difficulity mode switch levels 5 & 9 so + // you can't get the pogo stick until you make it + // to the dark side of mars. + if (newlevel==5) + newlevel = 9; + else if (newlevel==9) + newlevel = 5; + } + sprintf(levelname, "level%02d.ck%d", newlevel, p_levelcontrol->episode); + + if (p_levelcontrol->chglevelto==WORLD_MAP) + { + wm = 1; + } + else + { + wm = 0; + } + p_levelcontrol->canexit = 1; // assume can exit before loading map + if (loadmap(levelname, pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory, p_levelcontrol->chglevelto, wm, pCKP)) + { + crashflag = 1; + crashflag2 = p_levelcontrol->chglevelto; + why_term_ptr = "Unable to load the map (# shown in crashflag2)."; + } + + p_levelcontrol->curlevel = p_levelcontrol->chglevelto; + if (p_levelcontrol->curlevel == FINAL_MAP) + { + p_levelcontrol->isfinallevel = 1; + p_levelcontrol->canexit = 0; + } + else + { + p_levelcontrol->isfinallevel = 0; + } + + if (firsttime) + { + int op; + for(i=0;icommand = LVLC_NOCOMMAND; + + p_levelcontrol->dark = 0; + if (loadinggame) + { + sprintf(SaveGameFileName, "ep%csave%c.dat", p_levelcontrol->episode+'0', loadslot+'0'); + wm = savegameiswm(SaveGameFileName); + if (game_load(SaveGameFileName, pCKP)) + { + crashflag = 1; + crashflag2 = loadslot; + why_term_ptr = "Error loading game (slot # in flag2)! The save file may be corrupt or created by a different version of CloneKeen."; + return; + } + } + g_pGraphics->initPalette(p_levelcontrol->dark); + + // Now load HQ Stuff, because the game could have been loaded too. + g_pGraphics->loadHQGraphics(p_levelcontrol->episode,p_levelcontrol->chglevelto,pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory); + + + if (wm) + { // entering map from normal level, or first time around + if (!p_levelcontrol->tobonuslevel) + { + if (!loadinggame) + { + for(i=0;i>CSF>>4)<>CSF>>4)+1)<playStereofromCoord(SOUND_TELEPORT, PLAY_NOW, objects[player[i].useObject].scrx); + } + } + } + + if (!p_levelcontrol->success || firsttime) + { + if (!p_levelcontrol->tobonuslevel) p_levelcontrol->dokeensleft = 1; + // when you die you lose all keycards + for(i=0;idokeensleft = 0; + + gameloop(pCKP); + + for(i=0;idokeensleft = 0; + gameloop(pCKP); + + // after completion of a normal level check if the game is won + if (gameiswon(pCKP)) + { + p_levelcontrol->command = LVLC_END_SEQUENCE; + } + } + + if(QuitState==QUIT_PROGRAM) + { + pCKP->shutdown = SHUTDOWN_EXIT; + break; + } + g_pGraphics->unloadHQGraphics(); + + } while(p_levelcontrol->command==LVLC_CHANGE_LEVEL && !crashflag); + + g_pGraphics->unloadHQGraphics(); + + if (p_levelcontrol->command==LVLC_END_SEQUENCE) + { + endsequence(pCKP); + g_pLogFile->ftextOut("eseq complete
    "); + } + else if (p_levelcontrol->command==LVLC_TANTALUS_RAY) + { + eseq2_vibrate(pCKP); + eseq2_TantalusRay(pCKP); + IntroCanceled = 1; // popup main menu immediately + } +} + +// plays the demo file specified in fname +// returns: +// DEMO_RESULT_FILE_BAD demo does not exist or file corrupt +// DEMO_RESULT_COMPLETED demo played all the way through +// DEMO_RESULT_CANCELED user canceled the demo +char play_demo(int demonum, stCloneKeenPlus *pCKP, int s) +{ +int i; +int byt; +int lvl; +char filename[40]; +char SaveOptions[NUM_OPTIONS]; + stLevelControl *p_levelcontrol; + stOption *p_option; + + p_levelcontrol = &(pCKP->Control.levelcontrol); + p_option = pCKP->Option; + + // open the demo file + sprintf(filename, "ep%ddemo%d.dat", p_levelcontrol->episode, demonum); + demofile = fopen(filename, "rb"); + if (!demofile) + { + return DEMO_RESULT_FILE_BAD; + } + + // read in the header + if (fgetc(demofile) != 'D') goto demoHeaderCorrupt; + if (fgetc(demofile) != 'M') goto demoHeaderCorrupt; + if (fgetc(demofile) != 'O') goto demoHeaderCorrupt; + if (fgetc(demofile) != p_levelcontrol->episode) goto demoHeaderCorrupt; + lvl = fgetc(demofile); + + // load the compressed demo into the demo_data[] array + for(i=0;icurlevel = lvl; + p_levelcontrol->command = LVLC_NOCOMMAND; + + initgamefirsttime(pCKP, s); + initgame(pCKP); + + // now load the map and play the level + sprintf(filename, "level%02d.ck%d", p_levelcontrol->curlevel, p_levelcontrol->episode); + if (loadmap(filename, pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory, + p_levelcontrol->curlevel, 0, pCKP)) return DEMO_RESULT_FILE_BAD; + + for(i=0;isuccess) + { + return DEMO_RESULT_COMPLETED; + } + else + { + return DEMO_RESULT_CANCELED; + } + +// this label is jumped to when there's an error reading the header. +// it closes the demo file and aborts. +demoHeaderCorrupt: ; + fclose(demofile); + demofile = NULL; + return DEMO_RESULT_FILE_BAD; +} + +short readCommandLine(int argc, char *argv[], stCloneKeenPlus *pCKP) +{ + int i; + char tempbuf[MAX_STRING_LENGTH]; + + + unsigned short *p_gamesel; + // process command line options + g_pLogFile->ftextOut("Processing command-line options.
    "); + numplayers = 1; + p_gamesel = &(pCKP->Resources.GameSelected); + + if (argc>1) + { + for(i=1;iOption[OPT_ALLOWPKING].value = 0; + } + else if (strncmp(tempbuf, "-game",strlen("-game"))==0) // select the game + { + int g; + + sscanf(tempbuf+strlen("-game"),"%d",&g); + + *p_gamesel = g; + } + else if (strcmp(tempbuf, "-dtm")==0) // direct to map + { + pCKP->Control.dtm = 1; + } + else if (strcmp(tempbuf, "-mean")==0) // increase difficulty + { + pCKP->Option[OPT_MEAN].value = 1; + } + else if (strcmp(tempbuf, "-cheat")==0) // enable cheat codes + { + pCKP->Option[OPT_CHEATS].value = 1; + } + else if (strcmp(tempbuf, "-rec")==0) // record a demo + { + demomode = DEMO_RECORD; + } + else if (strcmp(tempbuf, "-eseq")==0) // play end sequence + { + pCKP->Control.eseq = 1; + } + + else if (strcmp(tempbuf, "-story")==0) // play end sequence + { + pCKP->Control.storyboard = 1; + pCKP->Control.skipstarting = 1; + } + else if (strcmp(tempbuf, "-fs")==0) // full-screen + { + g_pVideoDriver->isFullscreen(true); + } + else if (strcmp(tempbuf, "-dbl")==0) // 2x + { + g_pVideoDriver->setZoom(2); + } + else if (strcmp(tempbuf, "-acc")==0) // Hardware Acceleration + { + //pCKP->Device.Display.Mode = VIDEO_MODE_SOFTWARE; + } + else if (strcmp(tempbuf, "-ogl")==0) // Early OpenGL Support + { + //pCKP->Device.Display.Mode = VIDEO_MODE_OPENGL; + } + else if (strcmp(tempbuf, "-stereo")==0) // Enable Stereo Sound + { + g_pSound->setSoundmode(0,true); + } + else if (strcmp(tempbuf, "-showfps")==0) // show fps + { + g_pVideoDriver->showFPS(true); + } + else if (strcmp(tempbuf, "-host")==0) // start network server + { + is_server = 1; + localmp = 0; + } + else if (strcmp(tempbuf, "-join")==0) // connect to a server + { + is_client = 1; + localmp = 0; + } + else if (strncmp(tempbuf, "-level",strlen("-level"))==0) // select the game + { + int g; + sscanf(tempbuf+strlen("-level"),"%d",&g); + + pCKP->Control.levelcontrol.command = LVLC_START_LEVEL; + pCKP->Control.levelcontrol.chglevelto = g; + pCKP->Control.skipstarting = 1; + } + else if (i!=1 || atoi(argv[i])==0) + { + g_pLogFile->ftextOut("Wait a minute...what the hell does '%s' mean? I'm going to ignore this!
    ",tempbuf); + usage(); + return 1; + } + } + } + return 0; +} +void preallocateCKP(stCloneKeenPlus *pCKP) +{ + // This function prepares the CKP Structure so that the it is allocated in the memory. + pCKP->numGames = 0; + pCKP->Resources.GameSelected = 0; + + TileProperty = NULL; + + pCKP->GameData = NULL; + pCKP->GameData = new stGameData[1]; + + memset(pCKP->GameData, 0, sizeof(stGameData)); + + framebyframe = 0; + + demomode = DEMO_NODEMO; + current_demo = 1; + + memset(&pCKP->Control, 0, sizeof(stControl)); + + pCKP->Joystick = NULL; + + acceleratemode = 0; + is_client = 0; + is_server = 0; + localmp = 1; + g_pVideoDriver->showFPS(false); + + player[0].x = player[0].y = 0; +} + + diff --git a/src/map.cpp b/src/map.cpp new file mode 100644 index 000000000..40eff713f --- /dev/null +++ b/src/map.cpp @@ -0,0 +1,394 @@ +/* MAP.C + Functions that deal with the level map. Most notably in here + you'll find the 4-way scrolling engine. +*/ + +#include "keen.h" +#include "CGraphics.h" + +unsigned long scroll_x = 0; // total amount of X scroll +unsigned int scrollx_buf = 0; // amount the scroll buffer is scrolled(x) +unsigned char scrollpix = 0; // (0-7) for tracking when to draw a stripe +unsigned int mapx = 0; // map X location shown at scrollbuffer row 0 +unsigned int mapxstripepos = 0; // X pixel position of next stripe row + +unsigned int scrolly_buf = 0; // amount the scroll buffer is scrolled(y) +unsigned char scrollpixy = 0; // (0-7) for tracking when to draw a stripe +unsigned int mapy = 0; // map Y location shown at scrollbuffer column 0 +unsigned int mapystripepos = 0; // Y pixel position of next stripe column + +// note that the scroll buffer is 512x512, this is where all the 511 and 512 +// numbers come from. + +// scrolls the map one pixel right +void map_scroll_right(void) +{ + scroll_x++; + if(scrollx_buf>=511) scrollx_buf=0; else scrollx_buf++; + + scrollpix++; + if (scrollpix>15) + { // need to draw a new stripe + map_draw_vstripe(mapxstripepos, mapx + 32); + mapx++; + mapxstripepos += 16; + if (mapxstripepos >= 512) mapxstripepos = 0; + scrollpix = 0; + } +} + +// scrolls the map one pixel left +void map_scroll_left(void) +{ + scroll_x--; + if(scrollx_buf==0) scrollx_buf=511; else scrollx_buf--; + + if (scrollpix==0) + { // need to draw a new stripe + mapx--; + if (mapxstripepos == 0) + { + mapxstripepos = (512 - 16); + } + else + { + mapxstripepos -= 16; + } + map_draw_vstripe(mapxstripepos, mapx); + + scrollpix = 15; + } else scrollpix--; +} + +void map_scroll_down(void) +{ + scroll_y++; + if(scrolly_buf>=511) scrolly_buf=0; else scrolly_buf++; + + scrollpixy++; + if (scrollpixy>15) + { // need to draw a new stripe + map_draw_hstripe(mapystripepos, mapy + 32); + mapy++; + mapystripepos += 16; + if (mapystripepos >= 512) mapystripepos = 0; + scrollpixy = 0; + } +} + +void map_scroll_up(void) +{ + scroll_y--; + if(scrolly_buf==0) scrolly_buf=511; else scrolly_buf--; + + if (scrollpixy==0) + { // need to draw a new stripe + mapy--; + if (mapystripepos == 0) + { + mapystripepos = (512 - 16); + } + else + { + mapystripepos -= 16; + } + map_draw_hstripe(mapystripepos, mapy); + + scrollpixy = 15; + } else scrollpixy--; +} + + +// draws a vertical stripe from map position mapx to scrollbuffer position x +void map_draw_vstripe(unsigned int x, unsigned int mpx) +{ +int i,y,c; +/*int xt=x>>4;*/ + for(y=0;ydrawTile(x, ((y<<4)+mapystripepos)&511, c); + + if (AnimTileInUse[x>>4][(((y<<4)+mapystripepos)&511)>>4]) + { // we just drew over an animated tile which we must unregister + animtiles[AnimTileInUse[x>>4][(((y<<4)+mapystripepos)&511)>>4]].slotinuse = 0; + AnimTileInUse[x>>4][(((y<<4)+mapystripepos)&511)>>4] = 0; + } + //if (tiles[c].isAnimated) + if ( TileProperty[c][ANIMATION] > 1 ) + { // we just drew an animated tile which we will now register + for(i=1;i>4][((((y<<4)+mapystripepos)&511))>>4] = i; + goto stop; // and drop out of the loop + } + } + stop: ; + } + } +} +// draw a horizontal stripe, for vertical scrolling +void map_draw_hstripe(unsigned int y, unsigned int mpy) +{ +int i,x,c; +/*int xt;*/ + for(x=0;xdrawTile(((x<<4)+mapxstripepos)&511, y, c); + + if (AnimTileInUse[(((x<<4)+mapxstripepos)&511)>>4][y>>4]) + { // we just drew over an animated tile which we must unregister + animtiles[AnimTileInUse[(((x<<4)+mapxstripepos)&511)>>4][y>>4]].slotinuse = 0; + AnimTileInUse[(((x<<4)+mapxstripepos)&511)>>4][y>>4] = 0; + } + //if (tiles[c].isAnimated) + if ( TileProperty[c][ANIMATION] > 1 ) + { // we just drew an animated tile which we will now register + + for(i=1;i>4][y>>4] = i; + goto stop; // and drop out of the loop + } + } + stop: ; + } + } +} + +// returns the map tile at map position (x,y) +unsigned int getmaptileat(unsigned int x, unsigned int y) +{ +int xa = x>>4; +int ya = y>>4; + + if (xa<=255 && ya<=255) + { + return map.mapdata[xa][ya]; + } + else + { + if(xa > 255) + { + xa = 255; + //player[cp].xa = 255; + } + if(ya > 254) + { + ya = 255; + //player[cp].ya = 255; + } + + return map.mapdata[xa][ya]; + //crashflag = 1; + //crashflag2 = x; + //crashflag3 = y; + //why_term_ptr = "getmaptileat(): OOB reading from mapdata."; + //return 0; + } +} +unsigned int getlevelat(unsigned int x, unsigned int y) +{ + + return map.objectlayer[x>>4][y>>4]; +} + +// called at start of level to draw the upper-left corner of the map +// onto the scrollbuffer...from then on the map will only be drawn +// in stripes as it scrolls around. +void drawmap(void) +{ +int y; + for(y=0;y=mapx && y>=mapy && xdrawTile(((mapxstripepos+((x-mapx)<<4))&511), ((mapystripepos+((y-mapy)<<4))&511), newtile); + } +} + +// searches for animated tiles at the map position (X,Y) and +// unregisters them from animtiles +void map_deanimate(int x, int y) +{ +int px,py; +int i; + // figure out pixel position of map tile (x,y) + px = ((mapxstripepos+((x-mapx)<<4))&511); + py = ((mapystripepos+((y-mapy)<<4))&511); + + // find it! + for(i=1;i>4][py>>4] = 0; + return; + } + } +} + +// tells if the object is animating at a given position +int map_isanimated(int x, int y) +{ +int px,py; +int i; + // figure out pixel position of map tile (x,y) + px = ((mapxstripepos+((x-mapx)<<4))&511); + py = ((mapystripepos+((y-mapy)<<4))&511); + + // find it! + for(i=1;i 1 ) + { + /*crashflag = 1; + crashflag2 = x; + crashflag3 = y; + why_term_ptr = "map_animate(): you told me to animate x/y=crashflag1/2 but that tile isn't supposed to be animated!";*/ + return; + } + // don't reanimate a tile that's already registered--then we'd + // have multiple entries for it in animtiles[] (that's not good). + if (AnimTileInUse[px>>4][py>>4]) + { + return; + } + + // find an unused slot in animtiles + for(i=1;i>4][py>>4] = i; + return; + } + } + + crashflag = 1; + crashflag2 = x; + crashflag3 = y; + why_term_ptr = "Unable to animate tile at x/y=crashflag1/2"; +} + +// searches the map's object layer for object OBJ. +// if it is found returns nonzero and places the +// coordinates of the first occurance of the object +// in (xout,yout) +char map_findobject(unsigned int obj, int *xout, int *yout) +{ +unsigned int x,y; + + for(y=2;y +#include +#include +using namespace std; + +#define SELMOVE_SPD 3 + +short openDlgStruct(stDlgStruct *pDlgStruct, stCloneKeenPlus *pCKP); + +void showmapatpos(int level, int xoff, int yoff, int wm, stCloneKeenPlus *pCKP) +{ +int i; +char levelname[MAX_STRING_LENGTH]; +g_pLogFile->ftextOut("showmapatpos(%d, %d, %d, %d);
    ",level,xoff,yoff,wm); + pCKP->Control.levelcontrol.dark = 0; + g_pGraphics->initPalette(pCKP->Control.levelcontrol.dark); + + initgame(pCKP); // reset scroll + memset(levelname,0,MAX_STRING_LENGTH*sizeof(char)); + sprintf(levelname, "level%02d.ck%d", level, pCKP->Control.levelcontrol.episode); + + + short numsel; + if(pCKP->Resources.GameSelected == 0 ) // First time startup. No game has been chosen + numsel = 0; + else + numsel = pCKP->Resources.GameSelected-1; + + loadmap(levelname, pCKP->GameData[numsel].DataDirectory, level, wm, pCKP); + + drawmap(); + for(i=0;isb_blit(); +} + +short loadResourcesforStartMenu(stCloneKeenPlus *pCKP, CGame *Game) +{ + string line; + + ifstream gamescfg("data/games.cfg"); + + if (gamescfg.is_open()) + { + while ( !gamescfg.eof() && pCKP->numGames < 20 ) + { + getline (gamescfg,line); + + if(strncmp(line.data(),"[",strlen("[")) == 0) + { + stGameData *NewGameData; + + pCKP->numGames++; + NewGameData = new stGameData[pCKP->numGames]; + memset(NewGameData,0,pCKP->numGames*sizeof(stGameData)); + memcpy(NewGameData,pCKP->GameData,(pCKP->numGames-1)*sizeof(stGameData)); + + delete[] pCKP->GameData; + + pCKP->GameData = NewGameData; + } + if(strncmp(line.data(),"Name=",strlen("Name=")) == 0) + { + line.copy(pCKP->GameData[pCKP->numGames-1].Name,line.length()-strlen("Name="),strlen("Name=")); + } + if(strncmp(line.data(),"Episode=",strlen("Episode=")) == 0) + { + sscanf(line.data(),"Episode=%hd", &(pCKP->GameData[pCKP->numGames-1].Episode)); + } + if(strncmp(line.data(),"Path=",strlen("Path=")) == 0) + { + unsigned short l = strlen("Path="); + line.copy(pCKP->GameData[pCKP->numGames-1].DataDirectory,line.length()-l,l); + } + } + gamescfg.close(); + } + else + { + g_pLogFile->ftextOut(RED,"loadResourcesforStartMenu(): \"data/games.cfg\" could not be read! Assure, that the directory can be accessed."); + return -1; + } + + if( pCKP->numGames >= 20 ) + g_pLogFile->ftextOut(PURPLE,"parseTheGames(): Warning! Number of games limit in \"data/games.cfg\" reached."); + + if(pCKP->numGames == 0) + { + g_pLogFile->ftextOut(PURPLE,"parseTheGames(): In the file \"data/games.cfg\" no games were found."); + return -1; + } + + unsigned short c=0; + for(c=0 ; c < pCKP->numGames ; c++) + { + checkConsistencyofGameData(&(pCKP->GameData[c])); + } + + // /* Load the graphics of the first game for displaying the menu */ /* Graphics of the first Episode are taken*/ + if(!pCKP->Control.skipstarting) + pCKP->Control.levelcontrol.episode = 1; + else + pCKP->Control.levelcontrol.episode = pCKP->GameData[pCKP->Resources.GameSelected-1].Episode; + + //if (latch_loadgraphics(pCKP->Control.levelcontrol.episode, pCKP->GameData[0].DataDirectory)) return abortCKP(pCKP); + if (Game->getLatch()->loadGraphics(pCKP->Control.levelcontrol.episode, pCKP->GameData[0].DataDirectory)) return abortCKP(pCKP); + + player[0].x = player[0].y = 0; + if(initgamefirsttime(pCKP, 0) != 0) + { + return 1; + } + initgame(pCKP); + + return 0; +} + + +#define MAINMENU_GOTO_DEMO_TIME 4000 + +extern char fade_black; +short loadStartMenu(stCloneKeenPlus *pCKP) +{ + CDialog *GamesMenu; + int i; + + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + fade.dir = FADE_IN; + fade.curamt = 0; + fade.fadetimer = 0; + showmapatpos(90, (104 << 2)+256+256+80, 32-4, 0, pCKP); + + // Prepare the Games Menu + GamesMenu = new CDialog(); + + GamesMenu->setDimensions(2,2,36,5); + + // Show me the games you detected! + for( i=0 ; i < pCKP->numGames ; i++ ) + { + GamesMenu->addOptionText(pCKP->GameData[i].Name); + } + + GamesMenu->animateDialogBox(true); + + do + { + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + + // do fades + gamedo_fades(); + if(fade.mode == FADE_COMPLETE) + GamesMenu->setVisible(true); + + gamedo_AnimatedTiles(); + + // Check the Input + if(g_pInput->getPressedCommand(IC_DOWN)) + GamesMenu->setNextSelection(); + + if(g_pInput->getPressedCommand(IC_UP)) + GamesMenu->setPrevSelection(); + + if(g_pInput->getPressedCommand(IC_STATUS)) + { + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + fade.mode = FADE_GO; + pCKP->Resources.GameSelected = GamesMenu->getSelection()+1; + pCKP->Control.levelcontrol.episode = pCKP->GameData[pCKP->Resources.GameSelected-1].Episode; + break; + } + + // Render the Games-Menu + GamesMenu->renderDialog(); + + // blit the scrollbuffer to the display + gamedo_frameskipping_blitonly(pCKP); + } while(!g_pInput->getExitEvent()); + + delete GamesMenu; + + return 0; +} + +int mainmenu(stCloneKeenPlus *pCKP,int defaultopt) +{ + + CDialog *MainMenu; + int bmnum; + int x; + int selection; + + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + fade.dir = FADE_IN; + fade.curamt = 0; + fade.fadetimer = 0; + showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP); + + // Prepare the Games Menu + MainMenu = new CDialog(); + + MainMenu->setDimensions(11,9,18,11); + + // Load the Title Bitmap + bmnum = g_pGraphics->getBitmapNumberFromName("TITLE"); + + MainMenu->addOptionText("1-Player Game"); + MainMenu->addOptionText("2-Player Game"); + MainMenu->addOptionText("Load Game"); + MainMenu->addOptionText("Story"); + MainMenu->addOptionText("High Scores"); + MainMenu->addOptionText("Options"); + MainMenu->addOptionText("Demo"); + MainMenu->addOptionText("Change Game"); + MainMenu->addOptionText("Quit"); + + x = (320/2)-(bitmaps[bmnum].xsize/2); + + g_pGraphics->drawBitmap(x, 0, bmnum); + + MainMenu->animateDialogBox(true); + + do + { + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + + // do fades + gamedo_fades(); + if(fade.mode == FADE_COMPLETE) + MainMenu->setVisible(true); + + gamedo_AnimatedTiles(); + + // Check the Input + if(g_pInput->getPressedCommand(IC_DOWN)) + MainMenu->setNextSelection(); + + if(g_pInput->getPressedCommand(IC_UP)) + MainMenu->setPrevSelection(); + + if(g_pInput->getPressedCommand(IC_STATUS)) + { + selection = MainMenu->getSelection(); + break; + } + + + // Render the Games-Menu + MainMenu->renderDialog(); + + // blit the scrollbuffer to the display + gamedo_frameskipping_blitonly(pCKP); + + if(g_pInput->getExitEvent()) + return MAINMNU_QUIT; + + } while(1); + + if (selection==MAINMNU_LOADGAME) + { + int diff; + diff = getDifficulty(pCKP); + if(diff>2) + { + return BACK2MAINMENU; + } + + options[OPT_MEAN].value = diff; + + loadslot = save_slot_box(0, pCKP); + if (loadslot) + { + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + fade.mode = FADE_GO; + } + bmnum = g_pGraphics->getBitmapNumberFromName("TITLE"); + x = (320/2)-(bitmaps[bmnum].xsize/2); + g_pGraphics->drawBitmap(x, 0, bmnum); + } + else if (selection==MAINMNU_OPTIONS) + { + if (configmenu(pCKP)) + { // need to restart game + return RESTART_GAME; + } + } + else + { + if(selection==MAINMNU_1PLAYER || selection==MAINMNU_2PLAYER) + { + int diff; + diff = getDifficulty(pCKP); + if(diff>2) + { + delete MainMenu; + return BACK2MAINMENU; + } + + options[OPT_MEAN].value = diff; + } + + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + fade.mode = FADE_GO; + } + + delete MainMenu; + + return selection; +} + +void initialiazeDlgStruct(stDlgStruct *pDlgStruct) +{ + pDlgStruct->OptionSwitch = (stOptionSwitch*) malloc(pDlgStruct->num_OptionSwitches*sizeof(stOptionSwitch)); + pDlgStruct->Separator = (stSeparator*) malloc(pDlgStruct->num_Separators*sizeof(stSeparator)); + pDlgStruct->StarterSwitch = (stStarterSwitch*) malloc(pDlgStruct->num_StarterSwitch*sizeof(stStarterSwitch)); + pDlgStruct->TextLine = (stTextLine*) malloc(pDlgStruct->num_TextLines*sizeof(stTextLine)); +} + +int getDifficulty(stCloneKeenPlus *pCKP) +{ + CDialog *DifficultyMenu; + int bmnum; + int selection; + int x; + + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + fade.dir = FADE_IN; + fade.curamt = 0; + fade.fadetimer = 0; + + showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP); + + // Load the Title Bitmap + bmnum = g_pGraphics->getBitmapNumberFromName("TITLE"); + + x = (320/2)-(bitmaps[bmnum].xsize/2); + + g_pGraphics->drawBitmap(x, 0, bmnum); + + // Prepare the Games Menu + DifficultyMenu = new CDialog(); + + DifficultyMenu->setDimensions(15,4,14,6); + + DifficultyMenu->addOptionText("Normal"); + DifficultyMenu->addOptionText("Hard"); + DifficultyMenu->addSeparator(); + DifficultyMenu->addOptionText("Cancel"); + + DifficultyMenu->animateDialogBox(true); + + do + { + // do fades + gamedo_fades(); + if(fade.mode == FADE_COMPLETE) + DifficultyMenu->setVisible(true); + + gamedo_AnimatedTiles(); + + // Check the Input + if(g_pInput->getPressedCommand(IC_DOWN)) + DifficultyMenu->setNextSelection(); + + if(g_pInput->getPressedCommand(IC_UP)) + DifficultyMenu->setPrevSelection(); + + if(g_pInput->getPressedCommand(IC_STATUS)) + { + selection = DifficultyMenu->getSelection(); + break; + } + // Render the Games-Menu + DifficultyMenu->renderDialog(); + + // blit the scrollbuffer to the display + gamedo_frameskipping_blitonly(pCKP); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + + } while(1); + + delete DifficultyMenu; + + return selection; +} + +int AudioDlg(stCloneKeenPlus *pCKP) +{ + CDialog *AudioMenu; + int bmnum; + int selection; + int x; + int ok=0; + + int rate=0; + short mode=0; + + showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP); + + // Load the Title Bitmap + bmnum = g_pGraphics->getBitmapNumberFromName("TITLE"); + x = (320/2)-(bitmaps[bmnum].xsize/2); + g_pGraphics->drawBitmap(x, 0, bmnum); + + // Prepare the Games Menu + AudioMenu = new CDialog(); + AudioMenu->setDimensions(4,4,32,7); + + char buf[256]; + rate = g_pSound->getAudioSpec().freq; + sprintf(buf,"Rate: %d kHz",rate); + AudioMenu->addOptionText(buf); + mode = g_pSound->getAudioSpec().channels - 1; + if(mode == 1) + AudioMenu->addOptionText("Mode: Stereo"); + else + AudioMenu->addOptionText("Mode: Mono"); + AudioMenu->addSeparator(); + AudioMenu->addOptionText("Save and go back"); + AudioMenu->addOptionText("Cancel"); + + AudioMenu->animateDialogBox(true); + + do + { + // do fades + gamedo_fades(); + if(fade.mode == FADE_COMPLETE) + AudioMenu->setVisible(true); + gamedo_AnimatedTiles(); + + // Check the Input + if(g_pInput->getPressedCommand(IC_DOWN)) + AudioMenu->setNextSelection(); + + if(g_pInput->getPressedCommand(IC_UP)) + AudioMenu->setPrevSelection(); + + if(g_pInput->getPressedCommand(IC_STATUS)) + { + selection = AudioMenu->getSelection(); + + if(selection == 0) + { + switch(rate) + { + case 44100: rate = 48000; break; + case 22050: rate = 44100; break; + case 11000: rate = 22050; break; + default: rate = 11000; break; + } + + sprintf(buf,"Rate: %d kHz",rate); + AudioMenu->setOptionText(0,buf); + } + + if(selection == 1) + { + mode = !mode; + if(!mode) + AudioMenu->setOptionText(1,"Mode: Mono"); + else + AudioMenu->setOptionText(1,"Mode: Stereo"); + } + + if(selection == 3) + { + g_pSound->destroy(); + g_pSound->setSoundmode(rate, mode ? true : false); + saveDriverConfiguration(pCKP); + g_pSound->init(); + ok = g_pSound->loadSoundData(pCKP->Control.levelcontrol.episode, + pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory); + + break; + } + if(selection == 4) + break; + + } + // Render the Games-Menu + AudioMenu->renderDialog(); + + // blit the scrollbuffer to the display + gamedo_frameskipping_blitonly(pCKP); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + + } while(1); + + delete AudioMenu; + return ok; +} + +void OptionsDlg(stCloneKeenPlus *pCKP) +{ + CDialog *OptionsMenu; + int bmnum; + int selection; + int x,i; + + char buf[256]; + + showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP); + + // Load the Title Bitmap + bmnum = g_pGraphics->getBitmapNumberFromName("TITLE"); + x = (320/2)-(bitmaps[bmnum].xsize/2); + g_pGraphics->drawBitmap(x, 0, bmnum); + + // Prepare the Games Menu + OptionsMenu = new CDialog(); + OptionsMenu->setDimensions(4,4,32,11); + + for( i = 0 ; i < NUM_OPTIONS ; i++ ) + { + sprintf(buf,"%s: ",options[i].name); + if(options[i].value) + strcat(buf,"Enabled"); + else + strcat(buf,"Disabled"); + + OptionsMenu->addOptionText(buf); + } + + OptionsMenu->addSeparator(); + OptionsMenu->addOptionText("Return"); + + OptionsMenu->animateDialogBox(true); + + do + { + // do fades + gamedo_fades(); + if(fade.mode == FADE_COMPLETE) + OptionsMenu->setVisible(true); + gamedo_AnimatedTiles(); + + // Check the Input + if(g_pInput->getPressedCommand(IC_DOWN)) + OptionsMenu->setNextSelection(); + if(g_pInput->getPressedCommand(IC_UP)) + OptionsMenu->setPrevSelection(); + + if(g_pInput->getPressedCommand(IC_STATUS)) + { + selection = OptionsMenu->getSelection(); + + if(selection < NUM_OPTIONS) + { + sprintf(buf,"%s: ",options[selection].name); + + if(options[selection].value) + { + options[selection].value = 0; + strcat(buf,"Disabled"); + } + else + { + options[selection].value = 1; + strcat(buf,"Enabled"); + } + + OptionsMenu->setOptionText(selection,buf); + } + else + { + SaveConfig(pCKP->Option); + break; + } + } + // Render the Games-Menu + OptionsMenu->renderDialog(); + + // blit the scrollbuffer to the display + gamedo_frameskipping_blitonly(pCKP); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + + } while(1); + + delete OptionsMenu; +} + +short GraphicsDlg(stCloneKeenPlus *pCKP) +{ + CDialog *DisplayMenu; + int bmnum; + int selection; + int x; + unsigned int width; + unsigned int height; + unsigned short depth; + unsigned short zoom = 1; + unsigned short filter = 0; + unsigned short frameskip = 0; + bool opengl = false; + unsigned char gl_filter = 0; + bool fsmode; + char buf[256]; + short retval = 0; + + showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP); + + // Load the Title Bitmap + bmnum = g_pGraphics->getBitmapNumberFromName("TITLE"); + x = (320/2)-(bitmaps[bmnum].xsize/2); + g_pGraphics->drawBitmap(x, 0, bmnum); + + // Prepare the Games Menu + DisplayMenu = new CDialog(); + DisplayMenu->setDimensions(4,4,32,11); + + width = g_pVideoDriver->getWidth(); + height = g_pVideoDriver->getHeight(); + depth = g_pVideoDriver->getDepth(); + sprintf(buf,"Resolution: %dx%dx%d",width,height,depth); + + zoom = g_pVideoDriver->getZoomValue(); + filter = g_pVideoDriver->getFiltermode(); + frameskip = g_pVideoDriver->getFrameskip(); + + DisplayMenu->addOptionText(buf); + if(g_pVideoDriver->getFullscreen()) + { + DisplayMenu->addOptionText("Fullscreen mode"); + fsmode = true; + } + else + { + DisplayMenu->addOptionText("Windowed mode"); + fsmode = false; + } + + opengl = g_pVideoDriver->isOpenGL(); + if(!opengl) + { + zoom = g_pVideoDriver->getZoomValue(); + + if(zoom == 1) + sprintf(buf,"No scale"); + else + sprintf(buf,"Scale: %d", zoom); + DisplayMenu->addOptionText(buf); + } + else + { + gl_filter = g_pVideoDriver->getOGLFilter(); + + if(gl_filter == 1) + sprintf(buf,"OGL Filter: Linear"); + else + sprintf(buf,"OGL Filter: Nearest"); + DisplayMenu->addOptionText(buf); + } + + filter = g_pVideoDriver->getFiltermode(); + if(filter == 0) + DisplayMenu->addOptionText("No Filter"); + else if(filter == 1) + DisplayMenu->addOptionText("Scale2x Filter"); + else if(filter == 2) + DisplayMenu->addOptionText("Scale3x Filter"); + else if(filter == 3) + DisplayMenu->addOptionText("Scale4x Filter"); + else + DisplayMenu->addOptionText("Unknown Filter"); + + sprintf(buf,"Frameskip: %d", frameskip); + DisplayMenu->addOptionText(buf); + + if(opengl) + DisplayMenu->addOptionText("OpenGL Acceleration"); + else + DisplayMenu->addOptionText("Software Rendering"); + + DisplayMenu->addSeparator(); + DisplayMenu->addOptionText("Save and return"); + DisplayMenu->addOptionText("Cancel"); + + DisplayMenu->animateDialogBox(true); + + do + { + // do fades + gamedo_fades(); + if(fade.mode == FADE_COMPLETE) + DisplayMenu->setVisible(true); + gamedo_AnimatedTiles(); + + // Check the Input + if(g_pInput->getPressedCommand(IC_DOWN)) + DisplayMenu->setNextSelection(); + if(g_pInput->getPressedCommand(IC_UP)) + DisplayMenu->setPrevSelection(); + + if(g_pInput->getPressedCommand(IC_STATUS)) + { + selection = DisplayMenu->getSelection(); + + if(selection == 0) + { + // Now the part of the resolution list + if(width == 1024) + { + width = 320; + height = 240; + } + else if(width == 320) + { + width = 640; + height = 480; + } + else if(width == 640) + { + width = 800; + height = 600; + } + else if(width == 800) + { + width = 1024; + height = 768; + } + + // TODO: Replace this by the available modes list! + + sprintf(buf,"Resolution: %dx%dx%d",width,height,depth); + DisplayMenu->setOptionText(selection,buf); + } + else if(selection == 1) + { + if(!fsmode) + DisplayMenu->setOptionText(1,"Fullscreen mode"); + else + DisplayMenu->setOptionText(1,"Windowed mode"); + fsmode = !fsmode; + } + else if(selection == 2) + { + if(opengl) + { + gl_filter = (gl_filter==1) ? 0 : 1; + + if(gl_filter == 1) + sprintf(buf,"OGL Filter: Linear"); + else + sprintf(buf,"OGL Filter: Nearest"); + + DisplayMenu->setOptionText(2,buf); + } + else + { + if(zoom >= 3) + zoom = 1; + else + zoom++; + + if(zoom == 1) + sprintf(buf,"No scale"); + else + sprintf(buf,"Scale: %d", zoom); + } + + DisplayMenu->setOptionText(2,buf); + } + + else if(selection == 3) + { + if(filter >= 3) + filter = 0; + else + filter++; + + if(filter == 0) + DisplayMenu->setOptionText(3,"No Filter"); + else if(filter == 1) + DisplayMenu->setOptionText(3,"Scale2x Filter"); + else if(filter == 2) + DisplayMenu->setOptionText(3,"Scale3x Filter"); + else if(filter == 3) + DisplayMenu->setOptionText(3,"Scale4x Filter (OpenGL)"); + } + else if(selection == 4) + { + frameskip++; + + if(frameskip > 20) + frameskip = 0; + + sprintf(buf,"Frameskip: %d",frameskip); + DisplayMenu->setOptionText(4,buf); + } + else if(selection == 5) + { + opengl = opengl ? false : true; // switch the mode!! + + if(opengl) + DisplayMenu->setOptionText(5,"OpenGL Acceleration"); + else + DisplayMenu->setOptionText(5,"Software Rendering"); + } + else if(selection == 7) + { + g_pVideoDriver->stop(); + + if(fsmode) + g_pVideoDriver->isFullscreen(true); + else + g_pVideoDriver->isFullscreen(false); + + g_pVideoDriver->enableOpenGL(opengl); + g_pVideoDriver->setOGLFilter(gl_filter); + g_pVideoDriver->setMode(width,height,depth); + g_pVideoDriver->setZoom(zoom); + g_pVideoDriver->setFilter(filter); + g_pVideoDriver->setFrameskip(frameskip); + saveDriverConfiguration(pCKP); + g_pGraphics->allocScrollBufmem(); + + // initialize/activate all drivers + g_pLogFile->ftextOut("Starting graphics driver...
    "); + if (g_pVideoDriver->start()) + retval = 1; + + showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP); + + fade.mode = FADE_GO; + fade.dir = FADE_IN; + fade.curamt = 0; + fade.rate = FADE_NORM; + fade.fadetimer = 0; + gamedo_fades(); + break; + } + else + break; + } + // Render the Games-Menu + DisplayMenu->renderDialog(); + + // blit the scrollbuffer to the display + gamedo_frameskipping_blitonly(pCKP); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + + } while(1); + + delete DisplayMenu; + + return retval; +} + + +// This function shows the Story of Commander Keen! +void showPage(char *text, stCloneKeenPlus *pCKP, int textsize) +{ + unsigned int i, j, k; + int exit=0; + int textpos; + //char lastupstate, lastdnstate; + int enter; + unsigned int dlgX,dlgY,dlgW,dlgH; + //unsigned char lastkeytable[KEYTABLE_SIZE+1]; + unsigned int scroll, maxscroll; + char buffer[200][40]; + + showmapatpos(90, STORYBOARD_X, STORYBOARD_Y, 0, pCKP); + + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + fade.dir = FADE_IN; + fade.curamt = 0; + fade.fadetimer = 0; + + scroll=0; + maxscroll=0; + + j=0; + k=0; + + AllPlayersInvisible(); + + dlgX = 0; + dlgY = 0; + dlgW = 39; + dlgH = 15; + + textpos=0; + memset(buffer,0,200*40*sizeof(char)); + // Prepare the buffer + + char sbuf[256]; + unsigned int totnumline=0; + + for(i=0;i<200;i++) + { + for(j=0;j dlgW-2)) + { + if(text[textpos] == ' ') + { + textpos++; + break; + } + } + + if(text[textpos]=='\n' ) + { + textpos++; + break; + } + + if(text[textpos]==31 ) // I don't know, what they do, + //but original version seems to ignore them! + { + text[textpos]=' '; + } + + + buffer[i][j]=text[textpos]; + textpos++; + if(textpos >= textsize) + break; + } + if(textpos >= textsize) + { + totnumline+=3; + break; + } + + totnumline++; + } + buffer[i][j] = ' '; // Last character is empty! + + char coverline[39]; + memset(coverline,2,38*sizeof(char)); // for the upper and lower edges + coverline[38]=0; + + do + { + gamedo_fades(); + + gamedo_AnimatedTiles(); + + sb_dialogbox(dlgX, dlgY, dlgW, dlgH); + + k=0; + + // Draw the text + for(i=0;i>3)][0]=='~') // Special Background Colour + { + char temp[39]; + memset(temp,' ',38*sizeof(char)); + temp[38]=0; + g_pGraphics->sb_color_font_draw((unsigned char*) temp, (dlgX+1)<<3, (((dlgY+i+1)<<3) -(scroll%8)),COLOUR_DARKRED,COLOUR_GREY); + g_pGraphics->sb_color_font_draw((unsigned char*) buffer[i+(scroll>>3)]+1, (dlgX+1)<<3, (((dlgY+i+1)<<3) -(scroll%8)),COLOUR_DARKRED,COLOUR_GREY); + } + else + { + g_pGraphics->sb_font_draw((unsigned char*) buffer[i+(scroll>>3)], (dlgX+1)<<3, (((dlgY+i+1)<<3) -(scroll%8))); + } + } + g_pGraphics->sb_font_draw((unsigned char*) coverline, (dlgX+1)<<3, dlgY); // Upper and lower edge Update + g_pGraphics->sb_font_draw((unsigned char*) coverline, (dlgX+1)<<3, (dlgY+dlgH-1)<<3); + + // If user presses up or down + if (g_pInput->getHoldedCommand(IC_DOWN)) + { + if(scroll < (totnumline-dlgH)<<3) + scroll++; + SDL_Delay(2); + } + else if (g_pInput->getHoldedCommand(IC_UP)) + { + if(scroll > 0) + scroll--; + SDL_Delay(2); + } + + enter = (g_pInput->getPressedCommand(IC_STATUS));//||g_pInput->getPressedCommand(KCTRL)||g_pInput->getPressedCommand(KALT)); + if (enter) + { + exit=1; + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + fade.mode = FADE_GO; + } + + gamedo_frameskipping(pCKP); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + + + if(exit==1 && fade.mode==FADE_COMPLETE) + break; + + if (g_pInput->getPressedCommand(KQUIT)) break; + } while(!crashflag); + return; +} + +char configmenu(stCloneKeenPlus *pCKP) +{ + CDialog *OptionsMenu; + int bmnum; + int selection; + int x; + + showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP); + + // Load the Title Bitmap + bmnum = g_pGraphics->getBitmapNumberFromName("TITLE"); + + x = (320/2)-(bitmaps[bmnum].xsize/2); + + g_pGraphics->drawBitmap(x, 0, bmnum); + + // Prepare the Games Menu + OptionsMenu = new CDialog(); + + OptionsMenu->setDimensions(15,4,14,8); + + OptionsMenu->addOptionText("Graphics"); + OptionsMenu->addOptionText("Audio"); + OptionsMenu->addOptionText("Game"); + OptionsMenu->addOptionText("Controls"); + OptionsMenu->addSeparator(); + OptionsMenu->addOptionText("Back"); + + OptionsMenu->animateDialogBox(true); + + do + { + // do fades + gamedo_fades(); + if(fade.mode == FADE_COMPLETE) + OptionsMenu->setVisible(true); + + gamedo_AnimatedTiles(); + + // Check the Input + if(g_pInput->getPressedCommand(IC_DOWN)) + OptionsMenu->setNextSelection(); + + if(g_pInput->getPressedCommand(IC_UP)) + OptionsMenu->setPrevSelection(); + + if(g_pInput->getPressedCommand(IC_STATUS)) + { + selection = OptionsMenu->getSelection(); + break; + } + // Render the Games-Menu + OptionsMenu->renderDialog(); + + // blit the scrollbuffer to the display + gamedo_frameskipping_blitonly(pCKP); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + + } while(1); + + switch(selection) + { + case 0: + GraphicsDlg(pCKP); + break; + + case 1: + AudioDlg(pCKP); + break; + + case 2: + OptionsDlg(pCKP); + break; + + case 3: + controlsmenu(pCKP); + break; + + default: + break; + } + + delete OptionsMenu; + + return 0; +} + +char controlsmenu(stCloneKeenPlus *pCKP) +{ + CDialog *ControlsMenu; + int bmnum; + int selection; + int x; + char buf[256]; + char buf2[256]; + + showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP); + + // Load the Title Bitmap + bmnum = g_pGraphics->getBitmapNumberFromName("TITLE"); + + x = (320/2)-(bitmaps[bmnum].xsize/2); + + g_pGraphics->drawBitmap(x, 0, bmnum); + + // Prepare the Games Menu + ControlsMenu = new CDialog(); + + ControlsMenu->setDimensions(1,1,38,24); + + g_pInput->getEventName(IC_LEFT,buf2); + sprintf(buf,"Left: %s",buf2); + ControlsMenu->addOptionText(buf); + g_pInput->getEventName(IC_UP,buf2); + sprintf(buf,"Up: %s",buf2); + ControlsMenu->addOptionText(buf); + g_pInput->getEventName(IC_RIGHT,buf2); + sprintf(buf,"Right: %s",buf2); + ControlsMenu->addOptionText(buf); + g_pInput->getEventName(IC_DOWN,buf2); + sprintf(buf,"Down: %s",buf2); + ControlsMenu->addOptionText(buf); + g_pInput->getEventName(IC_JUMP,buf2); + sprintf(buf,"Jump: %s",buf2); + ControlsMenu->addOptionText(buf); + g_pInput->getEventName(IC_POGO,buf2); + sprintf(buf,"Pogo: %s",buf2); + ControlsMenu->addOptionText(buf); + g_pInput->getEventName(IC_FIRE,buf2); + sprintf(buf,"Fire: %s",buf2); + ControlsMenu->addOptionText(buf); + g_pInput->getEventName(IC_STATUS,buf2); + sprintf(buf,"Status: %s",buf2); + ControlsMenu->addOptionText(buf); + ControlsMenu->addSeparator(); + ControlsMenu->addOptionText("Return"); + + ControlsMenu->animateDialogBox(true); + + do + { + // do fades + gamedo_fades(); + if(fade.mode == FADE_COMPLETE) + ControlsMenu->setVisible(true); + gamedo_AnimatedTiles(); + + // Check the Input + if(g_pInput->getPressedCommand(IC_DOWN)) + ControlsMenu->setNextSelection(); + if(g_pInput->getPressedCommand(IC_UP)) + ControlsMenu->setPrevSelection(); + + if(g_pInput->getPressedCommand(IC_STATUS)) + { + selection = ControlsMenu->getSelection(); + + if(selection < MAX_COMMANDS) + { + int item=0; + if(selection < 4) + item = selection + 4; + else + item = selection - 4; + + switch(selection) + { + case 0: sprintf(buf,"Left: "); break; + case 1: sprintf(buf,"Up: "); break; + case 2: sprintf(buf,"Right: "); break; + case 3: sprintf(buf,"Down: "); break; + case 4: sprintf(buf,"Jump: "); break; + case 5: sprintf(buf,"Pogo: "); break; + case 6: sprintf(buf,"Fire: "); break; + case 7: sprintf(buf,"Status: "); break; + } + + strcpy(buf2,buf); + strcat(buf2,"*Waiting for Input*"); + ControlsMenu->setOptionText(selection,buf2); + + while(!g_pInput->readNewEvent(item)) + { + ControlsMenu->renderDialog(); + gamedo_frameskipping_blitonly(pCKP); + } + + g_pInput->getEventName(item,buf2); + strcat(buf,buf2); + ControlsMenu->setOptionText(selection,buf); + } + else + { + g_pInput->saveControlconfig(); + break; + } + } + // Render the Menu + ControlsMenu->renderDialog(); + + // blit the scrollbuffer to the display + gamedo_frameskipping_blitonly(pCKP); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + + } while(1); + + delete ControlsMenu; + return 0; +} + +int intro(stCloneKeenPlus *pCKP) +{ +int x,y; +unsigned int i; +int yb; + +int curPage, changedPage; +int textVisible; +char stStringName[40]; +char *stStringData; +char stTextLine1[80]; +char stTextLine2[80]; +char stTextLine3[80]; +char SlowPrintBuffer[80]; +int x1,x2,x3,x4,x5; +int y1,y2,y3,y4,y5; +char *copyPtr, copyIndex; + +int ontime, offtime, textTimer; +int y1adj, y2adj, y3adj; +int lastpage; +int SlowPrint, SlowPrintTimer, SlowPrintIndex; +int SlowPrintSpeed; +char keypressed; +char lastkeypressed; +char *SlowPrintPtr; + +const char *ScrollText1 = "Presenting"; +const char *ScrollTextErase = " "; +const char *ScrollText2 = "CloneKeenPlus"; +const char *ScrollText4 = "by Caitlin Shaw"; +const char *ScrollText5 = "and Gerstrong"; +char ScrollText3[20]; +char ScrollTextTimer; +int STimer; +char SState; +char ShowPressF10; +#define PRESSF10_X (160 - (PRESSF10_WIDTH/2)) +#define PRESSF10_Y 3 +//#define PRESSF10_X (315 - PRESSF10_WIDTH) +//#define PRESSF10_Y (195 - PRESSF10_HEIGHT) + + if (!g_pVideoDriver->getFullscreen()) + ShowPressF10 = 0; // 0 = mask hide all + else + ShowPressF10 = 15; // 15 = mask show all + + // display the starry background and initiate a fade-in + showmapatpos(90, 104<<4, 32, 0, pCKP); + fade.mode = FADE_GO; + fade.rate = FADE_NORM; + fade.dir = FADE_IN; + fade.curamt = 0; + fade.fadetimer = 0; + + player[0].hideplayer = 1; + + #define SCROLL_STOP_Y 75 + #define F10_STOP_Y 210 + + /* move "Presenting" up the screen */ + g_pGraphics->setFadeBlack(1); + sprintf(ScrollText3, "Episode %d", pCKP->Control.levelcontrol.episode); + x1 = (320/2) - ((strlen(ScrollText1)*8)/2); + y1 = 235; + x2 = (320/2) - ((strlen(ScrollText2)*8)/2); + y2 = SCROLL_STOP_Y+16; + x3 = (320/2) - ((strlen(ScrollText3)*8)/2); + y3 = y2+24; + x4 = (320/2) - ((strlen(ScrollText4)*8)/2); + y4 = y3+16; + x5 = (320/2) - ((strlen(ScrollText5)*8)/2); + y5 = y4+16; + SState = 0; + STimer = 0; + ScrollTextTimer = 0; + + lastkeypressed = 1; + do + { + // do fades + gamedo_fades(); + gamedo_AnimatedTiles(); + + if (fade.dir != FADE_OUT) + { + // if user pressed a key cancel the intro + keypressed = 0; + for(i=0;igetPressedKey(i)) + { + keypressed = i; + break; + } + } + if (keypressed && !lastkeypressed) + { + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + fade.mode = FADE_GO; + IntroCanceled = 1; + } + if (keypressed) lastkeypressed = 1; else lastkeypressed = 0; + + } // end if(fade.dir!=FADE_OUT) + + g_pGraphics->sb_font_draw_inverse( (unsigned char*) ScrollText1, x1, y1); + + if (SState >= 1) + { + g_pGraphics->sb_font_draw_inverse( (unsigned char*) ScrollText2, x2, y2); + if (SState==1) + { + if (STimer > 200) + { + SState = 2; + STimer = 0; + } + else STimer++; + } + } + + if (SState >= 2) + { + g_pGraphics->sb_font_draw_inverse( (unsigned char*) ScrollText3, x3, y3); + if (SState==2) + { + if (STimer > 200) + { + SState = 3; + STimer = 0; + } + else STimer++; + } + } + + if (SState >= 3) + { + g_pGraphics->sb_font_draw_inverse( (unsigned char*) ScrollText4, x4, y4); + if (SState==3) + { + if (STimer > 200) + { + SState = 4; + STimer = 0; + } + else STimer++; + } + } + + if (SState >= 4) + { + g_pGraphics->sb_font_draw_inverse( (unsigned char*) ScrollText5, x5, y5); + if (STimer > 1000) + { + g_pGraphics->setFadeBlack(0); + break; + } + else STimer++; + } + + // if Press F10 message is still visible, display it + if (ShowPressF10) + { + if (y1 <= F10_STOP_Y) ShowPressF10 = 0; + if (g_pVideoDriver->getFullscreen()) ShowPressF10 = 0; + + i = 0; + for(y=0;ygetScrollbuffer()[yb+((PRESSF10_X+x+scrollx_buf)&511)] = (pressf10_image[i++] & ShowPressF10); + } + } + } + + // blit the scrollbuffer to the display + gamedo_frameskipping_blitonly(pCKP); + + if (SState==0) + { + g_pGraphics->sb_font_draw_inverse( (unsigned char*) ScrollTextErase, x1, y1); + + if (y1 > SCROLL_STOP_Y) + { + if (ScrollTextTimer > 10) + { + y1--; + ScrollTextTimer = 0; + } + else ScrollTextTimer++; + } + else + { + if (STimer > 200) + { + SState = 1; + STimer = 0; + } + else STimer++; + } + } + + // when fade is complete we're done! + if (fade.dir==FADE_OUT && fade.mode==FADE_COMPLETE) + { + g_pGraphics->setFadeBlack(0); + return 0; + } + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + /*if (immediate_keytable[KQUIT] || crashflag) + { + fade_black = 0; + return 1; + }*/ + } while(!g_pInput->getExitEvent()); + + // TODO: This invokes Segfault. Please check, where! + if(g_pInput->getExitEvent()) + return 1; + + g_pGraphics->sb_font_draw_inverse( (unsigned char*) ScrollTextErase, x1, y1); + g_pGraphics->sb_font_draw_inverse( (unsigned char*) ScrollTextErase, x2, y2); + g_pGraphics->sb_font_draw_inverse( (unsigned char*) ScrollTextErase, x3, y3); + g_pGraphics->sb_font_draw_inverse( (unsigned char*) ScrollTextErase, x4, y4); + g_pGraphics->sb_font_draw_inverse( (unsigned char*) ScrollTextErase, x5, y5); + + /* the appearing/disapearing text */ + curPage = 1; + changedPage = 1; + do + { + // do fades + gamedo_fades(); + gamedo_AnimatedTiles(); + + // need to load a new page from the strings file? + if (changedPage) + { + // load the data for the new page + sprintf(stStringName, "Tribute_Page_%d", curPage); + stStringData = getstring(stStringName); + ontime = GetStringAttribute(stStringName, "ONTIME"); + offtime = GetStringAttribute(stStringName, "OFFTIME"); + y1adj = GetStringAttribute(stStringName, "Y1ADJ"); + y2adj = GetStringAttribute(stStringName, "Y2ADJ"); + y3adj = GetStringAttribute(stStringName, "Y3ADJ"); + lastpage = GetStringAttribute(stStringName, "LASTPAGE"); + SlowPrint = GetStringAttribute(stStringName, "SLOWPRINT"); + + // if no SLOWPRINT attribute disable slowprinting + if (SlowPrint==-1) + { + SlowPrint = 0; + } + else + { + SlowPrintSpeed = GetStringAttribute(stStringName, "SLOWPRINTSPD"); + } + + // for y adjustments that weren't specified use 0 + if (y1adj==-1) y1adj = 0; + if (y2adj==-1) y2adj = 0; + if (y3adj==-1) y3adj = 0; + + stTextLine1[0] = stTextLine2[0] = stTextLine3[0] = 0; + + // we have the text as three CR-terminated lines, now split it + // up into the 3 buffers + copyIndex = 0; + copyPtr = stTextLine1; + for(i=0;iControl.levelcontrol.episode + '0'; + } + else + { + SlowPrintBuffer[i] = SlowPrintPtr[i]; + } + } + + // clear out the text line + for(i=0;i SlowPrintSpeed) + { // time to print the next character of the line we're slowprinting + if (SlowPrintBuffer[SlowPrintIndex]) + { + SlowPrintPtr[SlowPrintIndex] = SlowPrintBuffer[SlowPrintIndex]; + SlowPrintIndex++; + } + else + { // reached the NULL (slowprint complete) + SlowPrint = 0; + } + + SlowPrintTimer = 0; + } + else SlowPrintTimer++; + } + + if (fade.dir != FADE_OUT) + { + if (!textTimer) + { // time to either invisibilize the text, or go to the next page + if (textVisible) + { + // erase the text + for(i=0;igetPressedKey(i)) + { + keypressed = 1; + break; + } + } + if (keypressed && !lastkeypressed) + { + fade.dir = FADE_OUT; + fade.curamt = PAL_FADE_SHADES; + fade.fadetimer = 0; + fade.rate = FADE_NORM; + fade.mode = FADE_GO; + IntroCanceled = 1; + } + lastkeypressed = keypressed; + + + } // end if(fade.dir!=FADE_OUT) + + // draw/erase all three lines of text + g_pGraphics->sb_font_draw_inverse( (unsigned char*) stTextLine1, x1, y1); + g_pGraphics->sb_font_draw_inverse( (unsigned char*) stTextLine2, x2, y2); + g_pGraphics->sb_font_draw_inverse( (unsigned char*) stTextLine3, x3, y3); + + // blit the scrollbuffer to the display + gamedo_frameskipping_blitonly(pCKP); + + // when fade is complete we're done! + if (fade.dir==FADE_OUT && fade.mode==FADE_COMPLETE) + { + return 0; + } + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(!g_pInput->getPressedCommand(KQUIT) && !crashflag); + return 1; +} + +void keensleft(stCloneKeenPlus *pCKP) +{ +int enter, lastenterstate; +unsigned int p; +int x,y,i; +int boxY, boxH; +int boxtimer; +int ep3; + +stLevelControl *p_levelcontrol; + + p_levelcontrol = &(pCKP->Control.levelcontrol); + + // on episode 3 we have to subtract one from the map tiles + // because the tiles start at 31, not 32 like on the other eps + ep3 = 0; + if (p_levelcontrol->episode==3) ep3 = 1; + + #define KEENSLEFT_TIME 400 + + for(i=0;idrawFont( (unsigned char*) getstring("LIVES_LEFT_BACKGROUND"),(KEENSLEFT_X+1)*8,(boxY+1)*8,0); + g_pGraphics->drawFont( (unsigned char*) getstring("LIVES_LEFT"),((KEENSLEFT_X+7)*8)+4,(boxY+1)*8,0); + y = ((boxY+2)*8)+4; + if (numplayers>1) y--; + for(p=0;pdrawSprite_direct(x, y, PMAPDOWNFRAME+playerbaseframes[p]-ep3); + x+=16; + } + y+=18; + } + g_pVideoDriver->update_screen(); + + g_pSound->playSound(SOUND_KEENSLEFT, PLAY_NOW); + + boxtimer = 0; + do + { + + gamedo_fades(); + + if (boxtimer > KEENSLEFT_TIME) + { + break; + } else boxtimer++; + + enter = g_pInput->getPressedCommand(IC_STATUS)||g_pInput->getPressedCommand(IC_FIRE)|| + g_pInput->getPressedCommand(IC_JUMP)||g_pInput->getPressedCommand(IC_POGO); + if (enter) + { + break; + } + if (g_pInput->getPressedCommand(KQUIT)) + { + return; + } + + lastenterstate = enter; + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(!crashflag); + +} diff --git a/src/misc.cpp b/src/misc.cpp new file mode 100644 index 000000000..5dee33eb8 --- /dev/null +++ b/src/misc.cpp @@ -0,0 +1,1293 @@ +/* MISC.C + All KINDS of assorted crap :) Has most of the in-game dialog boxes + such as the status box etc. + + Also like I said there's all kinds of assorted crap in here. + That's why it's called "misc.c" (get it? :)) +*/ + +#include "keen.h" +#ifdef BUILD_SDL +#include +#include "sdl/joydrv.h" +#include "sdl/CInput.h" +#include "sdl/CTimer.h" +#include "sdl/CVideoDriver.h" +#include "sdl/sound/CSound.h" +#endif + +#include "include/misc.h" +#include "include/game.h" +#include "include/eseq_ep1.h" +#include "include/eseq_ep2.h" +#include "include/eseq_ep3.h" +#include "include/gamedo.h" +#include "CLogFile.h" +#include "CGraphics.h" + +void banner(void) +{ +char buf[80]; + + sprintf(buf, "%s *Unknown* build check banner()", REVISION); + #ifdef TARGET_WIN32 + sprintf(buf, "%s Windows build", REVISION); + #endif + #ifdef TARGET_LNX + sprintf(buf, "%s Linux build", REVISION); + #endif + printf("%s", buf); + printf(" (%d bit)", static_cast (sizeof(int*)*8)); + + printf("\nby Caitlin Shaw, 2003-2005\nand Gerstrong 2008-2009\n"); + printf("\n"); + printf("BY A FAN, FOR FANS. ALL \"COMMANDER KEEN\" GRAPHICS,\n"); + printf("SOUND, AND LEVEL FILES ARE THE PROPERTY OF ID SOFTWARE.\n"); + printf("\n"); +} + +void cleanup(stCloneKeenPlus *CKP) +{ + if(CKP->GameData){ delete[] CKP->GameData; CKP->GameData = NULL; } + + g_pLogFile->ftextOut(BLACK,true," Freed %d strings.
    ", freestrings()); + + JoyDrv_Stop(&(CKP->Joystick)); + g_pLogFile->textOut(BLACK,true," Joystick driver shut down.
    "); + g_pSound->stopAllSounds(); + g_pSound->destroy(); + g_pLogFile->textOut(BLACK,true," Sound driver shut down.
    "); + + #ifdef NETWORK_PLAY + if (is_server) + { + NetDrv_Server_Stop(); + g_pLogFile->ftextOut(" * Network (server) shut down.
    "); + } + if (is_client) + { + NetDrv_Client_Stop(); + g_pLogFile->ftextOut(" * Network (client) shut down.
    "); + } + #endif + + if (demofile) + { + fclose(demofile); + g_pLogFile->ftextOut(BLACK,true," Demo file closed.
    "); + } + + g_pGraphics->stopGraphics(); + g_pLogFile->ftextOut(BLACK,true," Graphics driver shut down.
    "); + + g_pGraphics->freemem(); + + g_pLogFile->ftextOut("
    "); +} + +// draw an empty dialog box, for youseeinyourmind(), etc. +void dialogbox(int x1, int y1, int w, int h) +{ +int x,y,i,j; + + g_pGraphics->drawCharacter(x1*8, y1*8, 1); + g_pGraphics->drawCharacter((x1+w)*8, y1*8, 3); + for(x=(x1*8)+8,i=0;idrawCharacter(x, y1*8, 2); + x+=8; + } + y=(y1+1)*8; + for(j=0;jdrawCharacter(x, y, 4); + else if (i==w) g_pGraphics->drawCharacter(x, y, 5); + else g_pGraphics->drawCharacter(x, y, ' '); + x+=8; + } + y+=8; + } + for(x=(x1*8),i=0;i<=w;i++) + { + if (i==0) g_pGraphics->drawCharacter(x, y, 6); + else if (i==w) g_pGraphics->drawCharacter(x, y, 8); + else g_pGraphics->drawCharacter(x, y, 7); + x+=8; + } +} +// draw an empty dialog box, for youseeinyourmind(), etc. +void sb_dialogbox(int x1, int y1, int w, int h) +{ + int x,y,i,j; + + g_pGraphics->sb_drawCharacter(x1*8, y1*8, 1); + g_pGraphics->sb_drawCharacter((x1+w)*8, y1*8, 3); + for(x=(x1*8)+8,i=0;isb_drawCharacter(x, y1*8, 2); + x+=8; + } + y=(y1+1)*8; + for(j=0;jsb_drawCharacter(x, y, 4); + else if (i==w) g_pGraphics->sb_drawCharacter(x, y, 5); + else g_pGraphics->sb_drawCharacter(x, y, ' '); + x+=8; + } + y+=8; + } + for(x=(x1*8),i=0;i<=w;i++) + { + if (i==0) g_pGraphics->sb_drawCharacter(x, y, 6); + else if (i==w) g_pGraphics->sb_drawCharacter(x, y, 8); + else g_pGraphics->sb_drawCharacter(x, y, 7); + x+=8; + } +} + +#define YORPSTATUEHEADUSED 485 +void youseeinyourmind(int mpx, int mpy, stCloneKeenPlus *pCKP) +{ +int twirlframe, twirltimer; +char strname[80]; +int dlgX,dlgY,dlgW,dlgH,twirlX,twirlY; + +bool isgarg; + +int i; + + isgarg = false; + if(map.mapdata[mpx][mpy] >= 435 && map.mapdata[mpx][mpy] <= 438) + isgarg = true; + + for(i=0; i < 4 ; i++) + { + player[0].playcontrol[PA_JUMP+i] = 0; + } + + if (!isgarg) + { + if(!map_isanimated(mpx, mpy)) + return; + } + else + { // it's a garg statue + if(!map_isanimated(mpx, mpy)) + return; + } + + #define TWIRL_SPEED 50 + + + //sound_pause(); + + // get the name of the string we need to display + sprintf(strname, "EP1_YSIYM_LVL%d", pCKP->Control.levelcontrol.curlevel); + + dlgX = GetStringAttribute(strname, "LEFT"); + dlgY = GetStringAttribute(strname, "TOP"); + dlgW = GetStringAttribute(strname, "WIDTH"); + dlgH = GetStringAttribute(strname, "HEIGHT"); + twirlX = GetStringAttribute(strname, "TWIRLX"); + twirlY = GetStringAttribute(strname, "TWIRLY"); + + dialogbox(dlgX,dlgY,dlgW,dlgH); + g_pGraphics->drawFont((unsigned char*) getstring(strname), (dlgX+1)<<3, (dlgY+1)<<3,0); + + twirlframe = 0; + twirltimer = TWIRL_SPEED+1; + // wait for enter + do + { + + + + if (twirltimer>TWIRL_SPEED) + { + g_pGraphics->drawCharacter((dlgX+twirlX)<<3, (dlgY+twirlY)<<3, 9+twirlframe); + g_pVideoDriver->update_screen(); + twirlframe++; + if (twirlframe>5) twirlframe=0; + twirltimer=0; + } else twirltimer++; + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + g_pVideoDriver->update_screen(); + } while(!g_pInput->getPressedKey(KENTER) /*&& !immediate_keytable[KQUIT] && !getanyevent(pCKP)*/); + + // make the statue head stop glowing + if (!isgarg) + { + map_chgtile(mpx, mpy, YORPSTATUEHEADUSED); + map_deanimate(mpx, mpy); + } + else + { // it's a garg statue + + map_chgtile(mpx, mpy, 434); + map_deanimate(mpx, mpy); + } + + //sound_resume(); + +} + +void VorticonElder(int mpx, int mpy, stCloneKeenPlus *pCKP) +{ +int twirlframe, twirltimer; +int dlgX,dlgY,dlgW,dlgH,twirlX,twirlY; +const char *strName; + +int i; +for(i=0; i < 4 ; i++) +{ + player[0].playcontrol[PA_JUMP+i] = 0; +} + + #define TWIRL_SPEED 50 + + if(usedinfobox == 1) + return; + + g_pSound->pauseSound(); + + switch(pCKP->Control.levelcontrol.curlevel) + { + case 8: + strName = "EP2_VE_NOJUMPINDARK"; + break; + case 10: + strName = "EP2_VE_EVILBELTS"; + break; + + default: + crashflag = 1; + why_term_ptr = "VE box: Illegal level #."; + break; + } + + dlgX = GetStringAttribute(strName, "LEFT"); + dlgY = GetStringAttribute(strName, "TOP"); + dlgW = GetStringAttribute(strName, "WIDTH"); + dlgH = GetStringAttribute(strName, "HEIGHT"); + twirlX = GetStringAttribute(strName, "TWIRLX"); + twirlY = GetStringAttribute(strName, "TWIRLY"); + + dialogbox(dlgX, dlgY, dlgW, dlgH); + g_pGraphics->drawFont( (unsigned char*) getstring(strName), (dlgX+1)<<3, (dlgY+1)<<3,0); + + twirlframe = 0; + twirltimer = TWIRL_SPEED+1; + // wait for enter + do + { + if (twirltimer>TWIRL_SPEED) + { + g_pGraphics->drawCharacter((dlgX+twirlX)<<3, (dlgY+twirlY)<<3, 9+twirlframe); + g_pVideoDriver->update_screen(); + twirlframe++; + if (twirlframe>5) twirlframe=0; + twirltimer=0; + } else twirltimer++; + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + g_pVideoDriver->update_screen(); + } while(!g_pInput->getPressedKey(KENTER) /*&& !immediate_keytable[KQUIT] && !getanyevent(pCKP)*/); + + // make the switch stop glowing + map_chgtile(mpx, mpy+1, 432); + + //tiles[432].isAnimated = 0; + map_deanimate(mpx, mpy+1); + + g_pSound->resumeSounds(); + + usedinfobox = 1; +} + + +void inventory_draw_ep1(int p) +{ +int x,t,i,j; +char tempbuf[40]; +int dlgX,dlgY,dlgW,dlgH; + + dlgX = GetStringAttribute("EP1_StatusBox", "LEFT"); + dlgY = GetStringAttribute("EP1_StatusBox", "TOP"); + dlgW = GetStringAttribute("EP1_StatusBox", "WIDTH"); + dlgH = GetStringAttribute("EP1_StatusBox", "HEIGHT"); + + dialogbox(dlgX,dlgY,dlgW,dlgH); + g_pGraphics->drawFont( (unsigned char*) getstring("EP1_StatusBox"), (dlgX+1)<<3, (dlgY+1)<<3, 0); + +// fill in what we have + // 321: joystick/battery/vacuum/fuel not gotten + // 414: raygun, 415, pogo + // 424: yellow/red/green/blue cards + // 448: ship parts, gotten + // raygun icon + g_pGraphics->drawTile_direct((dlgX+4)<<3, ((dlgY+8)<<3)+3, 414); + // pogo + if (player[p].inventory.HasPogo) g_pGraphics->drawTile_direct(((dlgX+12)<<3)+4, ((dlgY+9)<<3)+3, 415); + // cards + if (player[p].inventory.HasCardYellow) g_pGraphics->drawTile_direct((dlgX+21)<<3, ((dlgY+8)<<3)+3, 424); + if (player[p].inventory.HasCardRed) g_pGraphics->drawTile_direct((dlgX+25)<<3, ((dlgY+8)<<3)+3, 425); + if (player[p].inventory.HasCardGreen) g_pGraphics->drawTile_direct((dlgX+21)<<3, ((dlgY+10)<<3)+4, 426); + if (player[p].inventory.HasCardBlue) g_pGraphics->drawTile_direct((dlgX+25)<<3, ((dlgY+10)<<3)+4, 427); + // ship parts + if (player[p].inventory.HasJoystick) t=448; else t=321; + g_pGraphics->drawTile_direct((dlgX+18)<<3, ((dlgY+4)<<3)+3, t); + if (player[p].inventory.HasBattery) t=449; else t=322; + g_pGraphics->drawTile_direct((dlgX+21)<<3, ((dlgY+4)<<3)+3, t); + if (player[p].inventory.HasVacuum) t=450; else t=323; + g_pGraphics->drawTile_direct((dlgX+24)<<3, ((dlgY+4)<<3)+3, t); + if (player[p].inventory.HasFuel) t=451; else t=324; + g_pGraphics->drawTile_direct((dlgX+27)<<3, ((dlgY+4)<<3)+3, t); + // ray gun charges + i = player[p].inventory.charges; + if (i>999) i=999; + sprintf(tempbuf, "%d", i); + g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+4)<<3, (dlgY+12)<<3, 0); + + // score + i = player[p].inventory.score; + sprintf(tempbuf, "%d", i); + g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+12-strlen(tempbuf))<<3, (dlgY+2)<<3, 0); + // extra life at + i = player[p].inventory.extralifeat; + sprintf(tempbuf, "%d", i); + g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+28-strlen(tempbuf))<<3, (dlgY+2)<<3, 0); + // lives + i = player[p].inventory.lives; + x = ((dlgX+1)<<3)+4; + if (i>7) i=7; + for(j=0;jdrawSprite_direct(x, (dlgY+4)<<3, playerbaseframes[p]); + x += sprites[0].xsize; + } +} + +void inventory_draw_ep2(int p, stCloneKeenPlus *pCKP) +{ +int x,/*y,t,*/i,j; +char tempbuf[40]; +int dlgX,dlgY,dlgW,dlgH; + + stLevelControl *p_levelcontrol; + + p_levelcontrol = &(pCKP->Control.levelcontrol); + + dlgX = GetStringAttribute("EP2_StatusBox", "LEFT"); + dlgY = GetStringAttribute("EP2_StatusBox", "TOP"); + dlgW = GetStringAttribute("EP2_StatusBox", "WIDTH"); + dlgH = GetStringAttribute("EP2_StatusBox", "HEIGHT"); + + dialogbox(dlgX,dlgY,dlgW,dlgH); + g_pGraphics->drawFont( (unsigned char*) getstring("EP2_StatusBox"), (dlgX+1)<<3, (dlgY+1)<<3, 0); + + // cards + if (player[p].inventory.HasCardYellow) g_pGraphics->drawTile_direct(((dlgX+21)<<3)-4, ((dlgY+8)<<3)+3, 424); + if (player[p].inventory.HasCardRed) g_pGraphics->drawTile_direct(((dlgX+25)<<3)-4, ((dlgY+8)<<3)+3, 425); + if (player[p].inventory.HasCardGreen) g_pGraphics->drawTile_direct(((dlgX+21)<<3)-4, ((dlgY+10)<<3)+4, 426); + if (player[p].inventory.HasCardBlue) g_pGraphics->drawTile_direct(((dlgX+25)<<3)-4, ((dlgY+10)<<3)+4, 427); + // cities saved + if (p_levelcontrol->levels_completed[4]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL4_TargetName"), (dlgX+1)<<3, (dlgY+8)<<3, 0); + if (p_levelcontrol->levels_completed[6]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL6_TargetName"), (dlgX+8)<<3, (dlgY+8)<<3, 0); + if (p_levelcontrol->levels_completed[7]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL7_TargetName"), (dlgX+1)<<3, (dlgY+9)<<3, 0); + if (p_levelcontrol->levels_completed[13]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL13_TargetName"), (dlgX+8)<<3, (dlgY+9)<<3, 0); + if (p_levelcontrol->levels_completed[11]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL11_TargetName"), (dlgX+1)<<3, (dlgY+10)<<3, 0); + if (p_levelcontrol->levels_completed[9]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL9_TargetName"), (dlgX+8)<<3, (dlgY+10)<<3, 0); + if (p_levelcontrol->levels_completed[15]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL15_TargetName"), (dlgX+1)<<3, (dlgY+11)<<3, 0); + if (p_levelcontrol->levels_completed[16]) g_pGraphics->drawFont( (unsigned char*) getstring("EP2_LVL16_TargetName"), (dlgX+8)<<3, (dlgY+11)<<3, 0); + + // raygun icon + g_pGraphics->drawTile_direct((dlgX+20)<<3, ((dlgY+5)<<3)-5, 414); + + // ray gun charges text + i = player[p].inventory.charges; + if (i>999) i=999; + sprintf(tempbuf, "%d", i); + g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+27-strlen( (char*) tempbuf))<<3, ((dlgY+5)<<3)-1, 0); + + // score + i = player[p].inventory.score; + sprintf(tempbuf, "%d", i); + g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+12-strlen( (char*) tempbuf))<<3, (dlgY+2)<<3, 0); + // extra life at + i = player[p].inventory.extralifeat; + sprintf(tempbuf, "%d", i); + g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+28-strlen( (char*) tempbuf))<<3, (dlgY+2)<<3, 0); + // lives + i = player[p].inventory.lives; + x = ((dlgX + 1)<<3)+4; + if (i>7) i=7; + for(j=0;jdrawSprite_direct(x, (dlgY+4)<<3, playerbaseframes[p]); + x += sprites[0].xsize; + } + +} + +void inventory_draw_ep3(int p) +{ +//int x,y,t,i,j; +int i,j,x; +int ankhtimepercent; +char tempbuf[40]; +int dlgX,dlgY,dlgW,dlgH; + + dlgX = GetStringAttribute("EP3_StatusBox", "LEFT"); + dlgY = GetStringAttribute("EP3_StatusBox", "TOP"); + dlgW = GetStringAttribute("EP3_StatusBox", "WIDTH"); + dlgH = GetStringAttribute("EP3_StatusBox", "HEIGHT"); + + dialogbox(dlgX,dlgY,dlgW,dlgH); + g_pGraphics->drawFont( (unsigned char*) getstring("EP3_StatusBox"), (dlgX+1)<<3, (dlgY+1)<<3, 0); + + // calculate % ankh time left + ankhtimepercent = (int)((float)player[p].ankhtime / (PLAY_ANKH_TIME/100)); + // ankh time + g_pGraphics->drawTile_direct((dlgX+4)<<3, ((dlgY+8)<<3)+3, 214); + sprintf(tempbuf, "%d", ankhtimepercent); + g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+8)<<3, ((dlgY+8)<<3)+7, 0); + + // raygun icon + g_pGraphics->drawTile_direct((dlgX+23)<<3, ((dlgY+5)<<3)-5, 216); + + // ray gun charges text + i = player[p].inventory.charges; + if (i>999) i=999; + sprintf(tempbuf, "%d", i); + g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+26)<<3, ((dlgY+5)<<3)-1, 0); + + // cards + if (player[p].inventory.HasCardYellow) g_pGraphics->drawTile_direct(((dlgX+14)<<3)+4, ((dlgY+8)<<3)+4, 217); + if (player[p].inventory.HasCardRed) g_pGraphics->drawTile_direct(((dlgX+18)<<3)+4, ((dlgY+8)<<3)+4, 218); + if (player[p].inventory.HasCardGreen) g_pGraphics->drawTile_direct(((dlgX+22)<<3)+4, ((dlgY+8)<<3)+4, 219); + if (player[p].inventory.HasCardBlue) g_pGraphics->drawTile_direct(((dlgX+26)<<3)+4, ((dlgY+8)<<3)+4, 220); + + // score + i = player[p].inventory.score; + sprintf(tempbuf, "%d", i); + g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+12-strlen(tempbuf))<<3, (dlgY+2)<<3, 0); + // extra life at + i = player[p].inventory.extralifeat; + sprintf(tempbuf, "%d", i); + g_pGraphics->drawFont( (unsigned char*) tempbuf, (dlgX+28-strlen(tempbuf))<<3, (dlgY+2)<<3, 0); + // lives + i = player[p].inventory.lives; + x = ((dlgX+1)<<3)+4; + if (i>9) i=9; + for(j=0;jdrawSprite_direct(x, (dlgY+4)<<3, playerbaseframes[p]); + x += sprites[0].xsize; + } +} + +void showinventory(int p, stCloneKeenPlus *pCKP) +{ +//int x,y,t,i,j; +//char tempbuf[40]; + unsigned short i; + + stLevelControl *p_levelcontrol; + p_levelcontrol = &(pCKP->Control.levelcontrol); + + // draw the episode-specific stuff + if (p_levelcontrol->episode==1) + { + inventory_draw_ep1(p); + } + else if (p_levelcontrol->episode==2) + { + inventory_draw_ep2(p, pCKP); + } + else if (p_levelcontrol->episode==3) + { + inventory_draw_ep3(p); + } + + + g_pVideoDriver->update_screen(); + + // wait for any button pressed or any action triggered + bool close=false; + + while(!close) + { + g_pInput->pollEvents(); + + for(i=0 ; igetPressedCommand(i)) + close=true; + } + + for(i=0 ; igetPressedKey(i)) + close=true; + } + } +} + +/*void sshot(char *visiblefile, char *scrollfile) +{ +FILE *fp; +int x,y; + + fp = fopen(visiblefile, "wb"); + if (!fp) return;< + + for(y=0;y<200;y++) + for(x=0;x<320;x++) + fputc(getpixel(x,y), fp); + + fclose(fp); + + fp = fopen(scrollfile, "wb"); + if (!fp) return; + + for(y=0;y<512;y++) + for(x=0;x<512;x++) + fputc(sb_getpixel(x,y), fp); + + fclose(fp); +}*/ + +void YourShipNeedsTheseParts(stCloneKeenPlus *pCKP) +{ +int cp; +int dlgX,dlgY,dlgW,dlgH; + + dlgX = GetStringAttribute("EP1_SHIP", "LEFT"); + dlgY = GetStringAttribute("EP1_SHIP", "TOP"); + dlgW = GetStringAttribute("EP1_SHIP", "WIDTH"); + dlgH = GetStringAttribute("EP1_SHIP", "HEIGHT"); + + cp = 0; // Fixme + + dialogbox(dlgX,dlgY,dlgW,dlgH); + + g_pGraphics->drawFont( (unsigned char*) getstring("EP1_SHIP"), (dlgX+1)<<3, (dlgY+1)<<3,0); + + // draw needed parts + if (!player[cp].inventory.HasJoystick) + g_pGraphics->drawTile_direct((dlgX+9)<<3, (dlgY+3)<<3, 448); + + if (!player[cp].inventory.HasBattery) + g_pGraphics->drawTile_direct((dlgX+12)<<3, (dlgY+3)<<3, 449); + + if (!player[cp].inventory.HasVacuum) + g_pGraphics->drawTile_direct((dlgX+15)<<3, (dlgY+3)<<3, 450); + + if (!player[cp].inventory.HasFuel) + g_pGraphics->drawTile_direct((dlgX+18)<<3, (dlgY+3)<<3, 451); + + g_pVideoDriver->update_screen(); + + // wait for any key! + g_pInput->flushKeys(); + while(!g_pInput->getPressedAnyKey()) + { + g_pInput->pollEvents(); + + if(g_pInput->getPressedAnyCommand()) + break; + } +} + +void ShipEp3(stCloneKeenPlus *pCKP) +{ +char strname[80]; +int twirlframe, twirltimer; +int dlgX,dlgY,dlgW,dlgH,twirlX,twirlY; + + g_pSound->pauseSound(); + + // display one of four random strings + sprintf(strname, "EP3_SHIP%d", (rand()%4)+1); + + dlgX = GetStringAttribute(strname, "LEFT"); + dlgY = GetStringAttribute(strname, "TOP"); + dlgW = GetStringAttribute(strname, "WIDTH"); + dlgH = GetStringAttribute(strname, "HEIGHT"); + twirlX = GetStringAttribute(strname, "TWIRLX"); + twirlY = GetStringAttribute(strname, "TWIRLY"); + + dialogbox(dlgX,dlgY,dlgW,dlgH); + g_pGraphics->drawFont( (unsigned char*) getstring(strname), (dlgX+1)<<3, (dlgY+1)<<3,0); + + g_pVideoDriver->update_screen(); + + // wait for ctrl/space/enter released then pressed again then released + twirlframe = 0; + twirltimer = TWIRL_SPEED+1; + g_pInput->flushKeys(); + // wait for any key + do + { + if (twirltimer>TWIRL_SPEED) + { + g_pGraphics->drawCharacter((dlgX+twirlX)<<3, (dlgY+twirlY)<<3, twirlframe+9); + g_pVideoDriver->update_screen(); + twirlframe++; + if (twirlframe>5) twirlframe=0; + twirltimer=0; + } else twirltimer++; + if(g_pInput->getPressedAnyCommand()) break; + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(!g_pInput->getPressedAnyKey()); + + g_pSound->resumeSounds(); +} + +void game_save(char *fname, stCloneKeenPlus *pCKP) +{ + unsigned int i; + FILE *fp; + + fp = fopen(fname, "wb"); + + // save the header/version check + fputc('S', fp); + fputc(SAVEGAMEVERSION, fp); + + // save all necessary structures to the file + if (map.isworldmap) fputc('W', fp); else fputc('L', fp); + + sgrle_compress(fp, (unsigned char *)&numplayers, sizeof(numplayers)); + sgrle_compress(fp, (unsigned char *)&(pCKP->Control.levelcontrol), sizeof(pCKP->Control.levelcontrol)); + sgrle_compress(fp, (unsigned char *)&scroll_x, sizeof(scroll_x)); + sgrle_compress(fp, (unsigned char *)&scroll_y, sizeof(scroll_y)); + sgrle_compress(fp, (unsigned char *)&max_scroll_x, sizeof(max_scroll_x)); + sgrle_compress(fp, (unsigned char *)&max_scroll_y, sizeof(max_scroll_y)); + sgrle_compress(fp, (unsigned char *)&map, sizeof(map)); + for(i=0;iControl.levelcontrol); + + fp = fopen(fname, "rb"); + if (!fp) return 1; + + // do the header and version check + if (fgetc(fp) != 'S') { fclose(fp); return 1; } + if (fgetc(fp) != SAVEGAMEVERSION) { fclose(fp); return 1; } + fgetc(fp); // iswm flag--not needed here + + // load all structures from the file + sgrle_reset(); + sgrle_decompress(fp, (unsigned char *)&numplayers, sizeof(numplayers)); + sgrle_decompress(fp, (unsigned char *) p_levelcontrol , sizeof(*p_levelcontrol)); + sgrle_decompress(fp, (unsigned char *)&scrx, sizeof(scrx)); + sgrle_decompress(fp, (unsigned char *)&scry, sizeof(scry)); + sgrle_decompress(fp, (unsigned char *)&max_scroll_x, sizeof(max_scroll_x)); + sgrle_decompress(fp, (unsigned char *)&max_scroll_y, sizeof(max_scroll_y)); + sgrle_decompress(fp, (unsigned char *)&map, sizeof(map)); + + initgame(pCKP); // reset scroll + drawmap(); + for(i=0;iControl.levelcontrol); + +top: ; + if (issave) + { + dlgX = GetStringAttribute("WhichSlotSave", "LEFT"); + dlgY = GetStringAttribute("WhichSlotSave", "TOP"); + dlgW = GetStringAttribute("WhichSlotSave", "WIDTH"); + dlgH = GetStringAttribute("WhichSlotSave", "HEIGHT"); + } + else + { + dlgX = GetStringAttribute("WhichSlotLoad", "LEFT"); + dlgY = GetStringAttribute("WhichSlotLoad", "TOP"); + dlgW = GetStringAttribute("WhichSlotLoad", "WIDTH"); + dlgH = GetStringAttribute("WhichSlotLoad", "HEIGHT"); + map_redraw(); + bmnum = g_pGraphics->getBitmapNumberFromName("TITLE"); + x = (320/2)-(bitmaps[bmnum].xsize/2); + g_pGraphics->drawBitmap(x, 0, bmnum); + } + + saveslot = 0; + do + { + + gamedo_render_drawobjects(pCKP); + + sb_dialogbox(dlgX,dlgY,dlgW,dlgH); + if (issave) + { + g_pGraphics->sb_font_draw( (unsigned char*) getstring("WhichSlotSave"),(dlgX+1)<<3,(dlgY+1)<<3); + } + else + { + g_pGraphics->sb_font_draw( (unsigned char*) getstring("WhichSlotLoad"),(dlgX+1)<<3,(dlgY+1)<<3); + gamedo_AnimatedTiles(); + } + + for (int i=0 ; i<9 ; i++) + { + if (g_pInput->getPressedKey(KNUM1+i)) saveslot = 1+i; + } + + g_pVideoDriver->sb_blit(); + gamedo_render_eraseobjects(); + + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(!g_pInput->getPressedKey(KQUIT) && !saveslot); + + /* check if the selected save file exists */ + sprintf(fname, "ep%csave%c.dat", p_levelcontrol->episode+'0', saveslot+'0'); + slotexists = 0; + fp = fopen(fname, "rb"); + if (fp) + { + fclose(fp); + slotexists = 1; + } + + if ((issave && !slotexists) || (!issave && slotexists)) + { + map_redraw(); + return saveslot; + } + + if (issave) + { + dlgX = GetStringAttribute("SaveSlotOverwrite", "LEFT"); + dlgY = GetStringAttribute("SaveSlotOverwrite", "TOP"); + dlgW = GetStringAttribute("SaveSlotOverwrite", "WIDTH"); + dlgH = GetStringAttribute("SaveSlotOverwrite", "HEIGHT"); + } + else + { + dlgX = GetStringAttribute("LoadNoSuchSlot", "LEFT"); + dlgY = GetStringAttribute("LoadNoSuchSlot", "TOP"); + dlgW = GetStringAttribute("LoadNoSuchSlot", "WIDTH"); + dlgH = GetStringAttribute("LoadNoSuchSlot", "HEIGHT"); + } + + // either we're trying to save over an existing game, or we're + // loading a game that doesn't exist. + do + { + + gamedo_render_drawobjects(pCKP); + + sb_dialogbox(dlgX,dlgY,dlgW,dlgH); + if (issave) + { + g_pGraphics->sb_font_draw( (unsigned char*) getstring("SaveSlotOverwrite"),(dlgX+1)<<3,(dlgY+1)<<3); + if (g_pInput->getPressedKey(KN)) + { + map_redraw(); + goto top; + } + else if (g_pInput->getPressedKey(KY)) + { + map_redraw(); + return saveslot; + } + } + else + { + g_pGraphics->sb_font_draw( (unsigned char*) getstring("LoadNoSuchSlot"),(dlgX+1)<<3,(dlgY+1)<<3); + + if (g_pInput->getPressedAnyKey()) + { + map_redraw(); + goto top; + } + + gamedo_AnimatedTiles(); + } + + g_pVideoDriver->sb_blit(); + gamedo_render_eraseobjects(); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(!g_pInput->getPressedKey(KQUIT)); + + map_redraw(); + return 0; +} + +void game_save_interface(stCloneKeenPlus *pCKP) +{ +int waittimer; +char fname[40]; +char saveslot; +int dlgX,dlgY,dlgW,dlgH; + + dlgX = GetStringAttribute("GameSaveSuccess", "LEFT"); + dlgY = GetStringAttribute("GameSaveSuccess", "TOP"); + dlgW = GetStringAttribute("GameSaveSuccess", "WIDTH"); + dlgH = GetStringAttribute("GameSaveSuccess", "HEIGHT"); + + saveslot = save_slot_box(1, pCKP); + if (!saveslot) return; // canceled + + /* save the game */ + sprintf(fname, "ep%csave%c.dat", pCKP->Control.levelcontrol.episode+'0', saveslot+'0'); + game_save(fname,pCKP); + + /* display the "your game has been saved" box */ + waittimer = 0; + do + { + waittimer++; + if (waittimer > 5000) break; + + gamedo_render_drawobjects(pCKP); + + sb_dialogbox(dlgX,dlgY,dlgW,dlgH); + g_pGraphics->sb_font_draw( (unsigned char*) getstring("GameSaveSuccess"),(dlgX+1)<<3,(dlgY+1)<<3); + + g_pVideoDriver->sb_blit(); + gamedo_render_eraseobjects(); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(!g_pInput->getPressedAnyKey()); + + map_redraw(); +} + +int VerifyQuit(stCloneKeenPlus *pCKP) +{ +int dlgX,dlgY,dlgW,dlgH; +char *text; + + if (fade.mode==FADE_GO) return NO_QUIT; + + text = getstring("VerifyQuit"); + dlgX = GetStringAttribute("VerifyQuit", "LEFT"); + dlgY = GetStringAttribute("VerifyQuit", "TOP"); + dlgW = GetStringAttribute("VerifyQuit", "WIDTH"); + dlgH = GetStringAttribute("VerifyQuit", "HEIGHT"); + + // either we're trying to save over an existing game, or we're + // loading a game that doesn't exist. + do + { + gamedo_render_drawobjects(pCKP); + gamedo_AnimatedTiles(); + + sb_dialogbox(dlgX, dlgY, dlgW, dlgH); + g_pGraphics->sb_font_draw( (unsigned char*) text, (dlgX+1)<<3, (dlgY+1)<<3); + if (g_pInput->getPressedKey(KQ)) + { + map_redraw(); + QuitState = QUIT_PROGRAM; + return 0; + } + else if (g_pInput->getPressedKey(KT)) + { + map_redraw(); + QuitState = QUIT_TO_TITLE; + return QuitState; + } + else if (g_pInput->getPressedKey(KQUIT)) + { + map_redraw(); + QuitState = NO_QUIT; + return QuitState; + } + + g_pVideoDriver->sb_blit(); + gamedo_render_eraseobjects(); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + } while(1); +} + +int endsequence(stCloneKeenPlus *pCKP) +{ + + if (pCKP->Control.levelcontrol.episode==1) + { + if (eseq1_ReturnsToShip(pCKP)) return 0; + if (eseq1_ShipFlys(pCKP)) return 0; + eseq1_BackAtHome(pCKP); + } + else if (pCKP->Control.levelcontrol.episode==2) + { + if (eseq2_HeadsForEarth(pCKP)) return 0; + if (eseq2_LimpsHome(pCKP)) return 0; + if (eseq2_SnowedOutside(pCKP)) return 0; + } + else if (pCKP->Control.levelcontrol.episode==3) + { + if (eseq3_AwardBigV(pCKP)) return 0; + } + + return 0; +} + +void AllPlayersInvisible(void) +{ +int i; + + for(i=0;iControl.levelcontrol); + + if (p_levelcontrol->episode==1) + { + /* episode 1: game is won when all parts are collected */ + + // count the number of parts the players have acquired + partcount = 0; + for(i=0;i= 4) + { + return 1; + } + else return 0; + } + else if (p_levelcontrol->episode==2) + { + /* episode 2: game is won when all cities are saved */ + if (!p_levelcontrol->levels_completed[4]) return 0; + if (!p_levelcontrol->levels_completed[6]) return 0; + if (!p_levelcontrol->levels_completed[7]) return 0; + if (!p_levelcontrol->levels_completed[13]) return 0; + if (!p_levelcontrol->levels_completed[11]) return 0; + if (!p_levelcontrol->levels_completed[9]) return 0; + if (!p_levelcontrol->levels_completed[15]) return 0; + if (!p_levelcontrol->levels_completed[16]) return 0; + return 1; + } + else if (p_levelcontrol->episode==3) + { + /* episode 3: game is won when mortimer is defeated */ + if (p_levelcontrol->levels_completed[16]) + { + return 1; + } + else + { + return 0; + } + } + +return 0; +} + +void usage(void) +{ + printf("Usage: keen [lvlnum] [-*player] [-nopk] [-ep*] [-dtm] [-nocheat] [-rec] -[eseq]
    \n"); + printf("lvlnum specify a level number (such as 2) to go directly to that level
    "); + printf("-*player select number of players (1-4); defaults to 1
    "); + printf("-nopk do not allow players to kill each other in multiplayer games
    "); + printf("-game* select game of data base; if not given, start menu is opened
    "); + printf("-dtm go directly to the world map, bypassing intro and title screen
    "); + printf("-mean increase game difficulty
    "); + printf("-cheat enable function key cheat/debug codes
    "); + printf("-rec record player actions to demo.dat for making a demo
    "); + printf("-eseq for the impatient--cut directly to the ending sequence
    "); +#ifdef BUILD_SDL + printf("-fs use fullscreen mode
    "); + printf("-dbl zoom image 2x
    "); + printf("-ogl hardware acceleration
    "); + printf("-showfps show FPS in upper-right of screen
    "); +#endif +#ifdef TARGET_WIN32 + printf("
    -host & -join for the experimental network play mode. These DON'T work yet.\n"); +#endif + + printf("
    "); + printf("Examples:
    "); + printf(" keen 3 -ep2 play ep 2, level 3 in 1-player mode
    "); + printf(" keen -ep3 -dtm -2player play ep3, skip title&intro, 2-player mode
    "); + printf(" keen -ep3 play a normal game of ep3
    "); +} + +void radar(void) +{ +unsigned int x,y,o; +unsigned int x1,y1,x2,y2; +unsigned int yoff; + // draw the map + for(y=0;ygetScrollbuffer()[yoff+((4+x+scrollx_buf)&511)] = map.mapdata[x][y]&15; + } + } + + // draw objects + for(o=0;o> CSF >> 4; + y = objects[o].y >> CSF >> 4; + + yoff = ((y+4+scrolly_buf)&511)<<9; + g_pGraphics->getScrollbuffer()[yoff+((4+x+scrollx_buf)&511)] = objects[o].type&15; + } + } + + // draw the area that is visible in the scrollbuffer + x1 = mapx; y1 = mapy; + x2 = x1+32; y2 = y1+32; + for(y=y1;ygetScrollbuffer()[yoff+((4+x1+scrollx_buf)&511)] = 10; + if (x2getScrollbuffer()[yoff+((4+x2+scrollx_buf)&511)] = 10; + } + } + for(x=x1;x<=x2;x++) + { + if (y1 < map.ysize && x < map.xsize) + { + yoff = ((y1+4+scrolly_buf)&511)<<9; + g_pGraphics->getScrollbuffer()[yoff+((4+x+scrollx_buf)&511)] = 10; + } + if (y2 < map.ysize && x < map.xsize) + { + yoff = ((y2+4+scrolly_buf)&511)<<9; + g_pGraphics->getScrollbuffer()[yoff+((4+x+scrollx_buf)&511)] = 10; + } + } + + // draw the area that is visible on the screen + // 320x200 = 20x12.5 tiles + x1 = scroll_x>>4; y1 = scroll_y>>4; + x2 = x1+20; y2 = y1+12; + for(y=y1;ygetScrollbuffer()[yoff+((4+x1+scrollx_buf)&511)] = 12; + if (x2getScrollbuffer()[yoff+((4+x2+scrollx_buf)&511)] = 12; + } + } + for(x=x1;x<=x2;x++) + { + if (x < map.xsize) + { + if (y1 < map.ysize) + { + yoff = ((y1+4+scrolly_buf)&511)<<9; + g_pGraphics->getScrollbuffer()[yoff+((4+x+scrollx_buf)&511)] = 12; + } + if (y2 < map.ysize) + { + yoff = ((y2+4+scrolly_buf)&511)<<9; + g_pGraphics->getScrollbuffer()[yoff+((4+x+scrollx_buf)&511)] = 12; + } + } + } +} + +void SetAllCanSupportPlayer(int o, int state) +{ + unsigned int i; + for(i=0;idrawFont((unsigned char*) text[i], (dlgX+1)<<3, (dlgY+1+i)<<3,0); + } + + twirlframe = 0; + twirltimer = TWIRL_SPEED+1; + + while(g_pInput->getPressedKey(KENTER)) + { + //poll_events(pCKP); + + /*if (immediate_keytable[KQUIT]) + { + return; + }*/ + } + + // wait for enter + do + { + if (twirltimer>TWIRL_SPEED) + { + g_pGraphics->drawCharacter((dlgX+twirlX)<<3, (dlgY+twirlY)<<3, 9+twirlframe); + g_pVideoDriver->update_screen(); + twirlframe++; + if (twirlframe>5) twirlframe=0; + twirltimer=0; + } else twirltimer++; + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + g_pVideoDriver->update_screen(); + } while(!g_pInput->getPressedKey(KENTER)/* && !immediate_keytable[KQUIT]*/); +} diff --git a/src/pressf10.h b/src/pressf10.h new file mode 100644 index 000000000..347c18756 --- /dev/null +++ b/src/pressf10.h @@ -0,0 +1,11 @@ +#define PRESSF10_WIDTH 94 +#define PRESSF10_HEIGHT 5 + +unsigned char pressf10_image[PRESSF10_WIDTH * PRESSF10_HEIGHT] = { \ + 10,10,10,0,10,10,10,0,10,10,10,0,10,10,10,0,10,10,10,0,0,0,0,10,10,10,0,10,0,0,10,0,0,0,0,0,10,10,10,0,10,10,10,0,10,10,10,0,0,0,0,10,10,10,0,10,0,10,0,10,0,0,0,10,0,0,0,10,10,10,0,10,10,10,0,10,10,10,0,10,10,10,0,10,10,10,0,10,0,0,10,0,0,10, \ + 10,0,10,0,10,0,10,0,10,0,0,0,10,0,0,0,10,0,0,0,0,0,0,10,0,0,0,10,0,10,0,10,0,0,0,0,10,0,0,0,10,0,10,0,10,0,10,0,0,0,0,10,0,0,0,10,0,10,0,10,0,0,0,10,0,0,0,10,0,0,0,10,0,0,0,10,0,10,0,10,0,0,0,10,0,0,0,10,10,0,10,0,0,10, \ + 10,10,10,0,10,10,10,0,10,10,0,0,10,10,10,0,10,10,10,0,0,0,0,10,10,0,0,10,0,10,0,10,0,0,0,0,10,10,0,0,10,0,10,0,10,10,10,0,0,0,0,10,10,0,0,10,0,10,0,10,0,0,0,10,0,0,0,10,10,10,0,10,0,0,0,10,10,10,0,10,10,0,0,10,10,0,0,10,10,0,10,0,0,10, \ + 10,0,0,0,10,10,0,0,10,0,0,0,0,0,10,0,0,0,10,0,0,0,0,10,0,0,0,10,0,10,0,10,0,0,0,0,10,0,0,0,10,0,10,0,10,10,0,0,0,0,0,10,0,0,0,10,0,10,0,10,0,0,0,10,0,0,0,0,0,10,0,10,0,0,0,10,10,0,0,10,0,0,0,10,0,0,0,10,0,10,10,0,0,0, \ + 10,0,0,0,10,0,10,0,10,10,10,0,10,10,10,0,10,10,10,0,0,0,0,10,0,0,0,10,0,0,10,0,0,0,0,0,10,0,0,0,10,10,10,0,10,0,10,0,0,0,0,10,0,0,0,10,10,10,0,10,10,10,0,10,10,10,0,10,10,10,0,10,10,10,0,10,0,10,0,10,10,10,0,10,10,10,0,10,0,0,10,0,0,10 \ +}; + diff --git a/src/scale2x/getopt.cpp b/src/scale2x/getopt.cpp new file mode 100644 index 000000000..3bebf80d3 --- /dev/null +++ b/src/scale2x/getopt.cpp @@ -0,0 +1,113 @@ +/* + * This file is part of the Advance project. + * + * Copyright (C) 2002 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#if HAVE_CONFIG_H +#include +#endif + +#if !HAVE_GETOPT + +/* This source is extracted from the DJGPP LIBC library */ + +#define unconst(var, type) ((type)(var)) + +/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ +#include +#include + +int opterr = 1, optind = 1, optopt = 0; +char *optarg = 0; + +#define BADCH (int)'?' +#define EMSG "" + +int getopt(int nargc, char *const nargv[], const char *ostr) +{ + static const char *place = EMSG; /* option letter processing */ + char *oli; /* option letter list index */ + char *p; + + if (!*place) + { + if (optind >= nargc || *(place = nargv[optind]) != '-') + { + place = EMSG; + return(EOF); + } + if (place[1] && *++place == '-') + { + ++optind; + place = EMSG; + return(EOF); + } + } + + if ((optopt = (int)*place++) == (int)':' + || !(oli = strchr(ostr, optopt))) + { + /* + * if the user didn't specify '-' as an option, + * assume it means EOF. + */ + if (optopt == (int)'-') + return EOF; + if (!*place) + ++optind; + if (opterr) + { + if (!(p = strrchr(*nargv, '/'))) + p = *nargv; + else + ++p; + fprintf(stderr, "%s: illegal option -- %c\n", p, optopt); + } + return BADCH; + } + if (*++oli != ':') + { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else + { /* need an argument */ + if (*place) /* no white space */ + optarg = unconst(place, char *); + else if (nargc <= ++optind) + { /* no arg */ + place = EMSG; + if (!(p = strrchr(*nargv, '/'))) + p = *nargv; + else + ++p; + if (opterr) + fprintf(stderr, "%s: option requires an argument -- %c\n", p, optopt); + return BADCH; + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return optopt; /* dump back option letter */ +} + +#endif + diff --git a/src/scale2x/pixel.cpp b/src/scale2x/pixel.cpp new file mode 100644 index 000000000..30bd76938 --- /dev/null +++ b/src/scale2x/pixel.cpp @@ -0,0 +1,68 @@ +/* + * This file is part of the Scale2x project. + * + * Copyright (C) 2003 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "pixel.h" + +pixel_t pixel_get( int x, int y, const unsigned char* pix, unsigned slice, unsigned pixel, int dx, int dy, int opt_tes) +{ + const unsigned char* p; + unsigned i; + pixel_t v; + + if (opt_tes) { + if (x < 0) + x += dx; + if (x >= dx) + x -= dx; + if (y < 0) + y += dy; + if (y >= dy) + y -= dy; + } else { + if (x < 0) + x = 0; + if (x >= dx) + x = dx - 1; + if (y < 0) + y = 0; + if (y >= dy) + y = dy - 1; + } + + p = pix + (y * slice) + (x * pixel); + + v = 0; + for(i=0;i> (i*8); + } +} diff --git a/src/scale2x/pixel.h b/src/scale2x/pixel.h new file mode 100644 index 000000000..aacbd2449 --- /dev/null +++ b/src/scale2x/pixel.h @@ -0,0 +1,30 @@ +/* + * This file is part of the Scale2x project. + * + * Copyright (C) 2003 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __PIXEL_H +#define __PIXEL_H + +typedef unsigned long long pixel_t; + +pixel_t pixel_get( int x, int y, const unsigned char* pix, unsigned slice, unsigned pixel, int dx, int dy, int opt_tes); +void pixel_put(int x, int y, unsigned char* pix, unsigned slice, unsigned pixel, unsigned dx, unsigned dy, pixel_t v); + +#endif + diff --git a/src/scale2x/portable.h b/src/scale2x/portable.h new file mode 100644 index 000000000..e33911ad3 --- /dev/null +++ b/src/scale2x/portable.h @@ -0,0 +1,46 @@ +/* + * This file is part of the Scale2x project. + * + * Copyright (C) 2001, 2002, 2003 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __PORTABLE_H +#define __PORTABLE_H + +#if HAVE_CONFIG_H +#include +#endif + +/* ------------------------------------------------------------------------ */ +/* getopt */ + +#if HAVE_GETOPT_H +#include +#endif + +#if HAVE_UNISTD_H +#include +#endif + +#if !HAVE_GETOPT +int getopt(int argc, char * const *argv, const char *options); +extern char *optarg; +extern int optind, opterr, optopt; +#endif + +#endif + diff --git a/src/scale2x/scale2x.cpp b/src/scale2x/scale2x.cpp new file mode 100644 index 000000000..756664bed --- /dev/null +++ b/src/scale2x/scale2x.cpp @@ -0,0 +1,1464 @@ +/* + * This file is part of the Scale2x project. + * + * Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * This file contains a C and MMX implementation of the Scale2x effect. + * + * You can find an high level description of the effect at : + * + * http://scale2x.sourceforge.net/ + * + * Alternatively at the previous license terms, you are allowed to use this + * code in your program with these conditions: + * - the program is not used in commercial activities. + * - the whole source code of the program is released with the binary. + * - derivative works of the program are allowed. + */ + +#if HAVE_CONFIG_H +#include +#endif + +#include "scale2x.h" + +#include + +/***************************************************************************/ +/* Scale2x C implementation */ + +/** + * Define the macro USE_SCALE_RANDOMWRITE to enable + * an optimized version which writes memory in random order. + * This version is a little faster if you write in system memory. + * But it's a lot slower if you write in video memory. + * So, enable it only if you are sure to never write directly in video memory. + */ +#define USE_SCALE_RANDOMWRITE + +static inline void scale2x_8_def_whole(scale2x_uint8* restrict dst0, scale2x_uint8* restrict dst1, const scale2x_uint8* restrict src0, const scale2x_uint8* restrict src1, const scale2x_uint8* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst0[0] = src1[0] == src0[0] ? src0[0] : src1[0]; + dst0[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + dst1[0] = src1[0] == src2[0] ? src2[0] : src1[0]; + dst1[1] = src1[1] == src2[0] ? src2[0] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst0 += 2; + dst1 += 2; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst0[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst0[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + dst1[0] = src1[-1] == src2[0] ? src2[0] : src1[0]; + dst1[1] = src1[1] == src2[0] ? src2[0] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst0 += 2; + dst1 += 2; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst0[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst0[1] = src1[0] == src0[0] ? src0[0] : src1[0]; + dst1[0] = src1[-1] == src2[0] ? src2[0] : src1[0]; + dst1[1] = src1[0] == src2[0] ? src2[0] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + } +} + +static inline void scale2x_8_def_border(scale2x_uint8* restrict dst, const scale2x_uint8* restrict src0, const scale2x_uint8* restrict src1, const scale2x_uint8* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst[0] = src1[0] == src0[0] ? src0[0] : src1[0]; + dst[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst += 2; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 2; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst[1] = src1[0] == src0[0] ? src0[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } +} + +static inline void scale2x_8_def_center(scale2x_uint8* restrict dst, const scale2x_uint8* restrict src0, const scale2x_uint8* restrict src1, const scale2x_uint8* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst[0] = src1[0]; + dst[1] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst += 2; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst[1] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 2; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst[1] = src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } +} + +static inline void scale2x_16_def_whole(scale2x_uint16* restrict dst0, scale2x_uint16* restrict dst1, const scale2x_uint16* restrict src0, const scale2x_uint16* restrict src1, const scale2x_uint16* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst0[0] = src1[0] == src0[0] ? src0[0] : src1[0]; + dst0[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + dst1[0] = src1[0] == src2[0] ? src2[0] : src1[0]; + dst1[1] = src1[1] == src2[0] ? src2[0] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst0 += 2; + dst1 += 2; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst0[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst0[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + dst1[0] = src1[-1] == src2[0] ? src2[0] : src1[0]; + dst1[1] = src1[1] == src2[0] ? src2[0] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst0 += 2; + dst1 += 2; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst0[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst0[1] = src1[0] == src0[0] ? src0[0] : src1[0]; + dst1[0] = src1[-1] == src2[0] ? src2[0] : src1[0]; + dst1[1] = src1[0] == src2[0] ? src2[0] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + } +} + +static inline void scale2x_16_def_border(scale2x_uint16* restrict dst, const scale2x_uint16* restrict src0, const scale2x_uint16* restrict src1, const scale2x_uint16* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst[0] = src1[0] == src0[0] ? src0[0] : src1[0]; + dst[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst += 2; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 2; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst[1] = src1[0] == src0[0] ? src0[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } +} + +static inline void scale2x_16_def_center(scale2x_uint16* restrict dst, const scale2x_uint16* restrict src0, const scale2x_uint16* restrict src1, const scale2x_uint16* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst[0] = src1[0]; + dst[1] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst += 2; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst[1] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 2; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst[1] = src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } +} + +static inline void scale2x_32_def_whole(scale2x_uint32* restrict dst0, scale2x_uint32* restrict dst1, const scale2x_uint32* restrict src0, const scale2x_uint32* restrict src1, const scale2x_uint32* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst0[0] = src1[0] == src0[0] ? src0[0] : src1[0]; + dst0[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + dst1[0] = src1[0] == src2[0] ? src2[0] : src1[0]; + dst1[1] = src1[1] == src2[0] ? src2[0] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst0 += 2; + dst1 += 2; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst0[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst0[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + dst1[0] = src1[-1] == src2[0] ? src2[0] : src1[0]; + dst1[1] = src1[1] == src2[0] ? src2[0] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst0 += 2; + dst1 += 2; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst0[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst0[1] = src1[0] == src0[0] ? src0[0] : src1[0]; + dst1[0] = src1[-1] == src2[0] ? src2[0] : src1[0]; + dst1[1] = src1[0] == src2[0] ? src2[0] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + } +} + +static inline void scale2x_32_def_border(scale2x_uint32* restrict dst, const scale2x_uint32* restrict src0, const scale2x_uint32* restrict src1, const scale2x_uint32* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst[0] = src1[0] == src0[0] ? src0[0] : src1[0]; + dst[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst += 2; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst[1] = src1[1] == src0[0] ? src0[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 2; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst[0] = src1[-1] == src0[0] ? src0[0] : src1[0]; + dst[1] = src1[0] == src0[0] ? src0[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } +} + +static inline void scale2x_32_def_center(scale2x_uint32* restrict dst, const scale2x_uint32* restrict src0, const scale2x_uint32* restrict src1, const scale2x_uint32* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst[0] = src1[0]; + dst[1] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst += 2; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst[1] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 2; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst[1] = src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + } +} + +/** + * Scale by a factor of 2 a row of pixels of 8 bits. + * The function is implemented in C. + * The pixels over the left and right borders are assumed of the same color of + * the pixels on the border. + * Note that the implementation is optimized to write data sequentially to + * maximize the bandwidth on video memory. + * \param src0 Pointer at the first pixel of the previous row. + * \param src1 Pointer at the first pixel of the current row. + * \param src2 Pointer at the first pixel of the next row. + * \param count Length in pixels of the src0, src1 and src2 rows. + * It must be at least 2. + * \param dst0 First destination row, double length in pixels. + * \param dst1 Second destination row, double length in pixels. + */ +void scale2x_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count) +{ +#ifdef USE_SCALE_RANDOMWRITE + scale2x_8_def_whole(dst0, dst1, src0, src1, src2, count); +#else + scale2x_8_def_border(dst0, src0, src1, src2, count); + scale2x_8_def_border(dst1, src2, src1, src0, count); +#endif +} + +/** + * Scale by a factor of 2 a row of pixels of 16 bits. + * This function operates like scale2x_8_def() but for 16 bits pixels. + * \param src0 Pointer at the first pixel of the previous row. + * \param src1 Pointer at the first pixel of the current row. + * \param src2 Pointer at the first pixel of the next row. + * \param count Length in pixels of the src0, src1 and src2 rows. + * It must be at least 2. + * \param dst0 First destination row, double length in pixels. + * \param dst1 Second destination row, double length in pixels. + */ +void scale2x_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count) +{ +#ifdef USE_SCALE_RANDOMWRITE + scale2x_16_def_whole(dst0, dst1, src0, src1, src2, count); +#else + scale2x_16_def_border(dst0, src0, src1, src2, count); + scale2x_16_def_border(dst1, src2, src1, src0, count); +#endif +} + +/** + * Scale by a factor of 2 a row of pixels of 32 bits. + * This function operates like scale2x_8_def() but for 32 bits pixels. + * \param src0 Pointer at the first pixel of the previous row. + * \param src1 Pointer at the first pixel of the current row. + * \param src2 Pointer at the first pixel of the next row. + * \param count Length in pixels of the src0, src1 and src2 rows. + * It must be at least 2. + * \param dst0 First destination row, double length in pixels. + * \param dst1 Second destination row, double length in pixels. + */ +void scale2x_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count) +{ +#ifdef USE_SCALE_RANDOMWRITE + scale2x_32_def_whole(dst0, dst1, src0, src1, src2, count); +#else + scale2x_32_def_border(dst0, src0, src1, src2, count); + scale2x_32_def_border(dst1, src2, src1, src0, count); +#endif +} + +/** + * Scale by a factor of 2x3 a row of pixels of 8 bits. + * \note Like scale2x_8_def(); + */ +void scale2x3_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count) +{ +#ifdef USE_SCALE_RANDOMWRITE + scale2x_8_def_whole(dst0, dst2, src0, src1, src2, count); + scale2x_8_def_center(dst1, src0, src1, src2, count); +#else + scale2x_8_def_border(dst0, src0, src1, src2, count); + scale2x_8_def_center(dst1, src0, src1, src2, count); + scale2x_8_def_border(dst2, src2, src1, src0, count); +#endif +} + +/** + * Scale by a factor of 2x3 a row of pixels of 16 bits. + * \note Like scale2x_16_def(); + */ +void scale2x3_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count) +{ +#ifdef USE_SCALE_RANDOMWRITE + scale2x_16_def_whole(dst0, dst2, src0, src1, src2, count); + scale2x_16_def_center(dst1, src0, src1, src2, count); +#else + scale2x_16_def_border(dst0, src0, src1, src2, count); + scale2x_16_def_center(dst1, src0, src1, src2, count); + scale2x_16_def_border(dst2, src2, src1, src0, count); +#endif +} + +/** + * Scale by a factor of 2x3 a row of pixels of 32 bits. + * \note Like scale2x_32_def(); + */ +void scale2x3_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count) +{ +#ifdef USE_SCALE_RANDOMWRITE + scale2x_32_def_whole(dst0, dst2, src0, src1, src2, count); + scale2x_32_def_center(dst1, src0, src1, src2, count); +#else + scale2x_32_def_border(dst0, src0, src1, src2, count); + scale2x_32_def_center(dst1, src0, src1, src2, count); + scale2x_32_def_border(dst2, src2, src1, src0, count); +#endif +} + +/** + * Scale by a factor of 2x4 a row of pixels of 8 bits. + * \note Like scale2x_8_def(); + */ +void scale2x4_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, scale2x_uint8* dst3, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count) +{ +#ifdef USE_SCALE_RANDOMWRITE + scale2x_8_def_whole(dst0, dst3, src0, src1, src2, count); + scale2x_8_def_center(dst1, src0, src1, src2, count); + scale2x_8_def_center(dst2, src0, src1, src2, count); +#else + scale2x_8_def_border(dst0, src0, src1, src2, count); + scale2x_8_def_center(dst1, src0, src1, src2, count); + scale2x_8_def_center(dst2, src0, src1, src2, count); + scale2x_8_def_border(dst3, src2, src1, src0, count); +#endif +} + +/** + * Scale by a factor of 2x4 a row of pixels of 16 bits. + * \note Like scale2x_16_def(); + */ +void scale2x4_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, scale2x_uint16* dst3, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count) +{ +#ifdef USE_SCALE_RANDOMWRITE + scale2x_16_def_whole(dst0, dst3, src0, src1, src2, count); + scale2x_16_def_center(dst1, src0, src1, src2, count); + scale2x_16_def_center(dst2, src0, src1, src2, count); +#else + scale2x_16_def_border(dst0, src0, src1, src2, count); + scale2x_16_def_center(dst1, src0, src1, src2, count); + scale2x_16_def_center(dst2, src0, src1, src2, count); + scale2x_16_def_border(dst3, src2, src1, src0, count); +#endif +} + +/** + * Scale by a factor of 2x4 a row of pixels of 32 bits. + * \note Like scale2x_32_def(); + */ +void scale2x4_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, scale2x_uint32* dst3, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count) +{ +#ifdef USE_SCALE_RANDOMWRITE + scale2x_32_def_whole(dst0, dst3, src0, src1, src2, count); + scale2x_32_def_center(dst1, src0, src1, src2, count); + scale2x_32_def_center(dst2, src0, src1, src2, count); +#else + scale2x_32_def_border(dst0, src0, src1, src2, count); + scale2x_32_def_center(dst1, src0, src1, src2, count); + scale2x_32_def_center(dst2, src0, src1, src2, count); + scale2x_32_def_border(dst3, src2, src1, src0, count); +#endif +} + +/***************************************************************************/ +/* Scale2x MMX implementation */ + +#if defined(__GNUC__) && defined(__i386__) + +/* + * Apply the Scale2x effect at a single row. + * This function must be called only by the other scale2x functions. + * + * Considering the pixel map : + * + * ABC (src0) + * DEF (src1) + * GHI (src2) + * + * this functions compute 2 new pixels in substitution of the source pixel E + * like this map : + * + * ab (dst) + * + * with these variables : + * + * ¤t -> E + * ¤t_left -> D + * ¤t_right -> F + * ¤t_upper -> B + * ¤t_lower -> H + * + * %0 -> current_upper + * %1 -> current + * %2 -> current_lower + * %3 -> dst + * %4 -> counter + * + * %mm0 -> *current_left + * %mm1 -> *current_next + * %mm2 -> tmp0 + * %mm3 -> tmp1 + * %mm4 -> tmp2 + * %mm5 -> tmp3 + * %mm6 -> *current_upper + * %mm7 -> *current + */ +static inline void scale2x_8_mmx_border(scale2x_uint8* dst, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count) +{ + assert(count >= 16); + assert(count % 8 == 0); + + /* always do the first and last run */ + count -= 2*8; + + __asm__ __volatile__( +/* first run */ + /* set the current, current_pre, current_next registers */ + "movq 0(%1), %%mm0\n" + "movq 0(%1), %%mm7\n" + "movq 8(%1), %%mm1\n" + "psllq $56, %%mm0\n" + "psllq $56, %%mm1\n" + "psrlq $56, %%mm0\n" + "movq %%mm7, %%mm2\n" + "movq %%mm7, %%mm3\n" + "psllq $8, %%mm2\n" + "psrlq $8, %%mm3\n" + "por %%mm2, %%mm0\n" + "por %%mm3, %%mm1\n" + + /* current_upper */ + "movq (%0), %%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "movq %%mm0, %%mm3\n" + "movq %%mm1, %%mm5\n" + "pcmpeqb %%mm6, %%mm2\n" + "pcmpeqb %%mm6, %%mm4\n" + "pcmpeqb (%2), %%mm3\n" + "pcmpeqb (%2), %%mm5\n" + "pandn %%mm2, %%mm3\n" + "pandn %%mm4, %%mm5\n" + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "pcmpeqb %%mm1, %%mm2\n" + "pcmpeqb %%mm0, %%mm4\n" + "pandn %%mm3, %%mm2\n" + "pandn %%mm5, %%mm4\n" + "movq %%mm2, %%mm3\n" + "movq %%mm4, %%mm5\n" + "pand %%mm6, %%mm2\n" + "pand %%mm6, %%mm4\n" + "pandn %%mm7, %%mm3\n" + "pandn %%mm7, %%mm5\n" + "por %%mm3, %%mm2\n" + "por %%mm5, %%mm4\n" + + /* set *dst */ + "movq %%mm2, %%mm3\n" + "punpcklbw %%mm4, %%mm2\n" + "punpckhbw %%mm4, %%mm3\n" + "movq %%mm2, (%3)\n" + "movq %%mm3, 8(%3)\n" + + /* next */ + "addl $8, %0\n" + "addl $8, %1\n" + "addl $8, %2\n" + "addl $16, %3\n" + +/* central runs */ + "shrl $3, %4\n" + "jz 1f\n" + + "0:\n" + + /* set the current, current_pre, current_next registers */ + "movq -8(%1), %%mm0\n" + "movq (%1), %%mm7\n" + "movq 8(%1), %%mm1\n" + "psrlq $56, %%mm0\n" + "psllq $56, %%mm1\n" + "movq %%mm7, %%mm2\n" + "movq %%mm7, %%mm3\n" + "psllq $8, %%mm2\n" + "psrlq $8, %%mm3\n" + "por %%mm2, %%mm0\n" + "por %%mm3, %%mm1\n" + + /* current_upper */ + "movq (%0), %%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "movq %%mm0, %%mm3\n" + "movq %%mm1, %%mm5\n" + "pcmpeqb %%mm6, %%mm2\n" + "pcmpeqb %%mm6, %%mm4\n" + "pcmpeqb (%2), %%mm3\n" + "pcmpeqb (%2), %%mm5\n" + "pandn %%mm2, %%mm3\n" + "pandn %%mm4, %%mm5\n" + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "pcmpeqb %%mm1, %%mm2\n" + "pcmpeqb %%mm0, %%mm4\n" + "pandn %%mm3, %%mm2\n" + "pandn %%mm5, %%mm4\n" + "movq %%mm2, %%mm3\n" + "movq %%mm4, %%mm5\n" + "pand %%mm6, %%mm2\n" + "pand %%mm6, %%mm4\n" + "pandn %%mm7, %%mm3\n" + "pandn %%mm7, %%mm5\n" + "por %%mm3, %%mm2\n" + "por %%mm5, %%mm4\n" + + /* set *dst */ + "movq %%mm2, %%mm3\n" + "punpcklbw %%mm4, %%mm2\n" + "punpckhbw %%mm4, %%mm3\n" + "movq %%mm2, (%3)\n" + "movq %%mm3, 8(%3)\n" + + /* next */ + "addl $8, %0\n" + "addl $8, %1\n" + "addl $8, %2\n" + "addl $16, %3\n" + + "decl %4\n" + "jnz 0b\n" + "1:\n" + +/* final run */ + /* set the current, current_pre, current_next registers */ + "movq (%1), %%mm1\n" + "movq (%1), %%mm7\n" + "movq -8(%1), %%mm0\n" + "psrlq $56, %%mm1\n" + "psrlq $56, %%mm0\n" + "psllq $56, %%mm1\n" + "movq %%mm7, %%mm2\n" + "movq %%mm7, %%mm3\n" + "psllq $8, %%mm2\n" + "psrlq $8, %%mm3\n" + "por %%mm2, %%mm0\n" + "por %%mm3, %%mm1\n" + + /* current_upper */ + "movq (%0), %%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "movq %%mm0, %%mm3\n" + "movq %%mm1, %%mm5\n" + "pcmpeqb %%mm6, %%mm2\n" + "pcmpeqb %%mm6, %%mm4\n" + "pcmpeqb (%2), %%mm3\n" + "pcmpeqb (%2), %%mm5\n" + "pandn %%mm2, %%mm3\n" + "pandn %%mm4, %%mm5\n" + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "pcmpeqb %%mm1, %%mm2\n" + "pcmpeqb %%mm0, %%mm4\n" + "pandn %%mm3, %%mm2\n" + "pandn %%mm5, %%mm4\n" + "movq %%mm2, %%mm3\n" + "movq %%mm4, %%mm5\n" + "pand %%mm6, %%mm2\n" + "pand %%mm6, %%mm4\n" + "pandn %%mm7, %%mm3\n" + "pandn %%mm7, %%mm5\n" + "por %%mm3, %%mm2\n" + "por %%mm5, %%mm4\n" + + /* set *dst */ + "movq %%mm2, %%mm3\n" + "punpcklbw %%mm4, %%mm2\n" + "punpckhbw %%mm4, %%mm3\n" + "movq %%mm2, (%3)\n" + "movq %%mm3, 8(%3)\n" + + : "+r" (src0), "+r" (src1), "+r" (src2), "+r" (dst), "+r" (count) + : + : "cc" + ); +} + +static inline void scale2x_16_mmx_border(scale2x_uint16* dst, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count) +{ + assert(count >= 8); + assert(count % 4 == 0); + + /* always do the first and last run */ + count -= 2*4; + + __asm__ __volatile__( +/* first run */ + /* set the current, current_pre, current_next registers */ + "movq 0(%1), %%mm0\n" + "movq 0(%1), %%mm7\n" + "movq 8(%1), %%mm1\n" + "psllq $48, %%mm0\n" + "psllq $48, %%mm1\n" + "psrlq $48, %%mm0\n" + "movq %%mm7, %%mm2\n" + "movq %%mm7, %%mm3\n" + "psllq $16, %%mm2\n" + "psrlq $16, %%mm3\n" + "por %%mm2, %%mm0\n" + "por %%mm3, %%mm1\n" + + /* current_upper */ + "movq (%0), %%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "movq %%mm0, %%mm3\n" + "movq %%mm1, %%mm5\n" + "pcmpeqw %%mm6, %%mm2\n" + "pcmpeqw %%mm6, %%mm4\n" + "pcmpeqw (%2), %%mm3\n" + "pcmpeqw (%2), %%mm5\n" + "pandn %%mm2, %%mm3\n" + "pandn %%mm4, %%mm5\n" + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "pcmpeqw %%mm1, %%mm2\n" + "pcmpeqw %%mm0, %%mm4\n" + "pandn %%mm3, %%mm2\n" + "pandn %%mm5, %%mm4\n" + "movq %%mm2, %%mm3\n" + "movq %%mm4, %%mm5\n" + "pand %%mm6, %%mm2\n" + "pand %%mm6, %%mm4\n" + "pandn %%mm7, %%mm3\n" + "pandn %%mm7, %%mm5\n" + "por %%mm3, %%mm2\n" + "por %%mm5, %%mm4\n" + + /* set *dst */ + "movq %%mm2, %%mm3\n" + "punpcklwd %%mm4, %%mm2\n" + "punpckhwd %%mm4, %%mm3\n" + "movq %%mm2, (%3)\n" + "movq %%mm3, 8(%3)\n" + + /* next */ + "addl $8, %0\n" + "addl $8, %1\n" + "addl $8, %2\n" + "addl $16, %3\n" + +/* central runs */ + "shrl $2, %4\n" + "jz 1f\n" + + "0:\n" + + /* set the current, current_pre, current_next registers */ + "movq -8(%1), %%mm0\n" + "movq (%1), %%mm7\n" + "movq 8(%1), %%mm1\n" + "psrlq $48, %%mm0\n" + "psllq $48, %%mm1\n" + "movq %%mm7, %%mm2\n" + "movq %%mm7, %%mm3\n" + "psllq $16, %%mm2\n" + "psrlq $16, %%mm3\n" + "por %%mm2, %%mm0\n" + "por %%mm3, %%mm1\n" + + /* current_upper */ + "movq (%0), %%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "movq %%mm0, %%mm3\n" + "movq %%mm1, %%mm5\n" + "pcmpeqw %%mm6, %%mm2\n" + "pcmpeqw %%mm6, %%mm4\n" + "pcmpeqw (%2), %%mm3\n" + "pcmpeqw (%2), %%mm5\n" + "pandn %%mm2, %%mm3\n" + "pandn %%mm4, %%mm5\n" + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "pcmpeqw %%mm1, %%mm2\n" + "pcmpeqw %%mm0, %%mm4\n" + "pandn %%mm3, %%mm2\n" + "pandn %%mm5, %%mm4\n" + "movq %%mm2, %%mm3\n" + "movq %%mm4, %%mm5\n" + "pand %%mm6, %%mm2\n" + "pand %%mm6, %%mm4\n" + "pandn %%mm7, %%mm3\n" + "pandn %%mm7, %%mm5\n" + "por %%mm3, %%mm2\n" + "por %%mm5, %%mm4\n" + + /* set *dst */ + "movq %%mm2, %%mm3\n" + "punpcklwd %%mm4, %%mm2\n" + "punpckhwd %%mm4, %%mm3\n" + "movq %%mm2, (%3)\n" + "movq %%mm3, 8(%3)\n" + + /* next */ + "addl $8, %0\n" + "addl $8, %1\n" + "addl $8, %2\n" + "addl $16, %3\n" + + "decl %4\n" + "jnz 0b\n" + "1:\n" + +/* final run */ + /* set the current, current_pre, current_next registers */ + "movq (%1), %%mm1\n" + "movq (%1), %%mm7\n" + "movq -8(%1), %%mm0\n" + "psrlq $48, %%mm1\n" + "psrlq $48, %%mm0\n" + "psllq $48, %%mm1\n" + "movq %%mm7, %%mm2\n" + "movq %%mm7, %%mm3\n" + "psllq $16, %%mm2\n" + "psrlq $16, %%mm3\n" + "por %%mm2, %%mm0\n" + "por %%mm3, %%mm1\n" + + /* current_upper */ + "movq (%0), %%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "movq %%mm0, %%mm3\n" + "movq %%mm1, %%mm5\n" + "pcmpeqw %%mm6, %%mm2\n" + "pcmpeqw %%mm6, %%mm4\n" + "pcmpeqw (%2), %%mm3\n" + "pcmpeqw (%2), %%mm5\n" + "pandn %%mm2, %%mm3\n" + "pandn %%mm4, %%mm5\n" + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "pcmpeqw %%mm1, %%mm2\n" + "pcmpeqw %%mm0, %%mm4\n" + "pandn %%mm3, %%mm2\n" + "pandn %%mm5, %%mm4\n" + "movq %%mm2, %%mm3\n" + "movq %%mm4, %%mm5\n" + "pand %%mm6, %%mm2\n" + "pand %%mm6, %%mm4\n" + "pandn %%mm7, %%mm3\n" + "pandn %%mm7, %%mm5\n" + "por %%mm3, %%mm2\n" + "por %%mm5, %%mm4\n" + + /* set *dst */ + "movq %%mm2, %%mm3\n" + "punpcklwd %%mm4, %%mm2\n" + "punpckhwd %%mm4, %%mm3\n" + "movq %%mm2, (%3)\n" + "movq %%mm3, 8(%3)\n" + + : "+r" (src0), "+r" (src1), "+r" (src2), "+r" (dst), "+r" (count) + : + : "cc" + ); +} + +static inline void scale2x_32_mmx_border(scale2x_uint32* dst, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count) +{ + assert(count >= 4); + assert(count % 2 == 0); + + /* always do the first and last run */ + count -= 2*2; + + __asm__ __volatile__( +/* first run */ + /* set the current, current_pre, current_next registers */ + "movq 0(%1), %%mm0\n" + "movq 0(%1), %%mm7\n" + "movq 8(%1), %%mm1\n" + "psllq $32, %%mm0\n" + "psllq $32, %%mm1\n" + "psrlq $32, %%mm0\n" + "movq %%mm7, %%mm2\n" + "movq %%mm7, %%mm3\n" + "psllq $32, %%mm2\n" + "psrlq $32, %%mm3\n" + "por %%mm2, %%mm0\n" + "por %%mm3, %%mm1\n" + + /* current_upper */ + "movq (%0), %%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "movq %%mm0, %%mm3\n" + "movq %%mm1, %%mm5\n" + "pcmpeqd %%mm6, %%mm2\n" + "pcmpeqd %%mm6, %%mm4\n" + "pcmpeqd (%2), %%mm3\n" + "pcmpeqd (%2), %%mm5\n" + "pandn %%mm2, %%mm3\n" + "pandn %%mm4, %%mm5\n" + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "pcmpeqd %%mm1, %%mm2\n" + "pcmpeqd %%mm0, %%mm4\n" + "pandn %%mm3, %%mm2\n" + "pandn %%mm5, %%mm4\n" + "movq %%mm2, %%mm3\n" + "movq %%mm4, %%mm5\n" + "pand %%mm6, %%mm2\n" + "pand %%mm6, %%mm4\n" + "pandn %%mm7, %%mm3\n" + "pandn %%mm7, %%mm5\n" + "por %%mm3, %%mm2\n" + "por %%mm5, %%mm4\n" + + /* set *dst */ + "movq %%mm2, %%mm3\n" + "punpckldq %%mm4, %%mm2\n" + "punpckhdq %%mm4, %%mm3\n" + "movq %%mm2, (%3)\n" + "movq %%mm3, 8(%3)\n" + + /* next */ + "addl $8, %0\n" + "addl $8, %1\n" + "addl $8, %2\n" + "addl $16, %3\n" + +/* central runs */ + "shrl $1, %4\n" + "jz 1f\n" + + "0:\n" + + /* set the current, current_pre, current_next registers */ + "movq -8(%1), %%mm0\n" + "movq (%1), %%mm7\n" + "movq 8(%1), %%mm1\n" + "psrlq $32, %%mm0\n" + "psllq $32, %%mm1\n" + "movq %%mm7, %%mm2\n" + "movq %%mm7, %%mm3\n" + "psllq $32, %%mm2\n" + "psrlq $32, %%mm3\n" + "por %%mm2, %%mm0\n" + "por %%mm3, %%mm1\n" + + /* current_upper */ + "movq (%0), %%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "movq %%mm0, %%mm3\n" + "movq %%mm1, %%mm5\n" + "pcmpeqd %%mm6, %%mm2\n" + "pcmpeqd %%mm6, %%mm4\n" + "pcmpeqd (%2), %%mm3\n" + "pcmpeqd (%2), %%mm5\n" + "pandn %%mm2, %%mm3\n" + "pandn %%mm4, %%mm5\n" + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "pcmpeqd %%mm1, %%mm2\n" + "pcmpeqd %%mm0, %%mm4\n" + "pandn %%mm3, %%mm2\n" + "pandn %%mm5, %%mm4\n" + "movq %%mm2, %%mm3\n" + "movq %%mm4, %%mm5\n" + "pand %%mm6, %%mm2\n" + "pand %%mm6, %%mm4\n" + "pandn %%mm7, %%mm3\n" + "pandn %%mm7, %%mm5\n" + "por %%mm3, %%mm2\n" + "por %%mm5, %%mm4\n" + + /* set *dst */ + "movq %%mm2, %%mm3\n" + "punpckldq %%mm4, %%mm2\n" + "punpckhdq %%mm4, %%mm3\n" + "movq %%mm2, (%3)\n" + "movq %%mm3, 8(%3)\n" + + /* next */ + "addl $8, %0\n" + "addl $8, %1\n" + "addl $8, %2\n" + "addl $16, %3\n" + + "decl %4\n" + "jnz 0b\n" + "1:\n" + +/* final run */ + /* set the current, current_pre, current_next registers */ + "movq (%1), %%mm1\n" + "movq (%1), %%mm7\n" + "movq -8(%1), %%mm0\n" + "psrlq $32, %%mm1\n" + "psrlq $32, %%mm0\n" + "psllq $32, %%mm1\n" + "movq %%mm7, %%mm2\n" + "movq %%mm7, %%mm3\n" + "psllq $32, %%mm2\n" + "psrlq $32, %%mm3\n" + "por %%mm2, %%mm0\n" + "por %%mm3, %%mm1\n" + + /* current_upper */ + "movq (%0), %%mm6\n" + + /* compute the upper-left pixel for dst on %%mm2 */ + /* compute the upper-right pixel for dst on %%mm4 */ + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "movq %%mm0, %%mm3\n" + "movq %%mm1, %%mm5\n" + "pcmpeqd %%mm6, %%mm2\n" + "pcmpeqd %%mm6, %%mm4\n" + "pcmpeqd (%2), %%mm3\n" + "pcmpeqd (%2), %%mm5\n" + "pandn %%mm2, %%mm3\n" + "pandn %%mm4, %%mm5\n" + "movq %%mm0, %%mm2\n" + "movq %%mm1, %%mm4\n" + "pcmpeqd %%mm1, %%mm2\n" + "pcmpeqd %%mm0, %%mm4\n" + "pandn %%mm3, %%mm2\n" + "pandn %%mm5, %%mm4\n" + "movq %%mm2, %%mm3\n" + "movq %%mm4, %%mm5\n" + "pand %%mm6, %%mm2\n" + "pand %%mm6, %%mm4\n" + "pandn %%mm7, %%mm3\n" + "pandn %%mm7, %%mm5\n" + "por %%mm3, %%mm2\n" + "por %%mm5, %%mm4\n" + + /* set *dst */ + "movq %%mm2, %%mm3\n" + "punpckldq %%mm4, %%mm2\n" + "punpckhdq %%mm4, %%mm3\n" + "movq %%mm2, (%3)\n" + "movq %%mm3, 8(%3)\n" + + : "+r" (src0), "+r" (src1), "+r" (src2), "+r" (dst), "+r" (count) + : + : "cc" + ); +} + +/** + * Scale by a factor of 2 a row of pixels of 8 bits. + * This is a very fast MMX implementation. + * The implementation uses a combination of cmp/and/not operations to + * completly remove the need of conditional jumps. This trick give the + * major speed improvement. + * Also, using the 8 bytes MMX registers more than one pixel are computed + * at the same time. + * Before calling this function you must ensure that the currenct CPU supports + * the MMX instruction set. After calling it you must be sure to call the EMMS + * instruction before any floating-point operation. + * The pixels over the left and right borders are assumed of the same color of + * the pixels on the border. + * Note that the implementation is optimized to write data sequentially to + * maximize the bandwidth on video memory. + * \param src0 Pointer at the first pixel of the previous row. + * \param src1 Pointer at the first pixel of the current row. + * \param src2 Pointer at the first pixel of the next row. + * \param count Length in pixels of the src0, src1 and src2 rows. It must + * be at least 16 and a multiple of 8. + * \param dst0 First destination row, double length in pixels. + * \param dst1 Second destination row, double length in pixels. + */ +void scale2x_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count) +{ + if (count % 8 != 0 || count < 16) { + scale2x_8_def(dst0, dst1, src0, src1, src2, count); + } else { + scale2x_8_mmx_border(dst0, src0, src1, src2, count); + scale2x_8_mmx_border(dst1, src2, src1, src0, count); + } +} + +/** + * Scale by a factor of 2 a row of pixels of 16 bits. + * This function operates like scale2x_8_mmx() but for 16 bits pixels. + * \param src0 Pointer at the first pixel of the previous row. + * \param src1 Pointer at the first pixel of the current row. + * \param src2 Pointer at the first pixel of the next row. + * \param count Length in pixels of the src0, src1 and src2 rows. It must + * be at least 8 and a multiple of 4. + * \param dst0 First destination row, double length in pixels. + * \param dst1 Second destination row, double length in pixels. + */ +void scale2x_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count) +{ + if (count % 4 != 0 || count < 8) { + scale2x_16_def(dst0, dst1, src0, src1, src2, count); + } else { + scale2x_16_mmx_border(dst0, src0, src1, src2, count); + scale2x_16_mmx_border(dst1, src2, src1, src0, count); + } +} + +/** + * Scale by a factor of 2 a row of pixels of 32 bits. + * This function operates like scale2x_8_mmx() but for 32 bits pixels. + * \param src0 Pointer at the first pixel of the previous row. + * \param src1 Pointer at the first pixel of the current row. + * \param src2 Pointer at the first pixel of the next row. + * \param count Length in pixels of the src0, src1 and src2 rows. It must + * be at least 4 and a multiple of 2. + * \param dst0 First destination row, double length in pixels. + * \param dst1 Second destination row, double length in pixels. + */ +void scale2x_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count) +{ + if (count % 2 != 0 || count < 4) { + scale2x_32_def(dst0, dst1, src0, src1, src2, count); + } else { + scale2x_32_mmx_border(dst0, src0, src1, src2, count); + scale2x_32_mmx_border(dst1, src2, src1, src0, count); + } +} + +/** + * Scale by a factor of 2x3 a row of pixels of 8 bits. + * This function operates like scale2x_8_mmx() but with an expansion + * factor of 2x3 instead of 2x2. + */ +void scale2x3_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count) +{ + if (count % 8 != 0 || count < 16) { + scale2x3_8_def(dst0, dst1, dst2, src0, src1, src2, count); + } else { + scale2x_8_mmx_border(dst0, src0, src1, src2, count); + scale2x_8_def_center(dst1, src0, src1, src2, count); + scale2x_8_mmx_border(dst2, src2, src1, src0, count); + } +} + +/** + * Scale by a factor of 2x3 a row of pixels of 16 bits. + * This function operates like scale2x_16_mmx() but with an expansion + * factor of 2x3 instead of 2x2. + */ +void scale2x3_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count) +{ + if (count % 4 != 0 || count < 8) { + scale2x3_16_def(dst0, dst1, dst2, src0, src1, src2, count); + } else { + scale2x_16_mmx_border(dst0, src0, src1, src2, count); + scale2x_16_def_center(dst1, src0, src1, src2, count); + scale2x_16_mmx_border(dst2, src2, src1, src0, count); + } +} + +/** + * Scale by a factor of 2x3 a row of pixels of 32 bits. + * This function operates like scale2x_32_mmx() but with an expansion + * factor of 2x3 instead of 2x2. + */ +void scale2x3_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count) +{ + if (count % 2 != 0 || count < 4) { + scale2x3_32_def(dst0, dst1, dst2, src0, src1, src2, count); + } else { + scale2x_32_mmx_border(dst0, src0, src1, src2, count); + scale2x_32_def_center(dst1, src0, src1, src2, count); + scale2x_32_mmx_border(dst2, src2, src1, src0, count); + } +} + +/** + * Scale by a factor of 2x4 a row of pixels of 8 bits. + * This function operates like scale2x_8_mmx() but with an expansion + * factor of 2x4 instead of 2x2. + */ +void scale2x4_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, scale2x_uint8* dst3, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count) +{ + if (count % 8 != 0 || count < 16) { + scale2x4_8_def(dst0, dst1, dst2, dst3, src0, src1, src2, count); + } else { + scale2x_8_mmx_border(dst0, src0, src1, src2, count); + scale2x_8_def_center(dst1, src0, src1, src2, count); + scale2x_8_def_center(dst2, src0, src1, src2, count); + scale2x_8_mmx_border(dst3, src2, src1, src0, count); + } +} + +/** + * Scale by a factor of 2x4 a row of pixels of 16 bits. + * This function operates like scale2x_16_mmx() but with an expansion + * factor of 2x4 instead of 2x2. + */ +void scale2x4_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, scale2x_uint16* dst3, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count) +{ + if (count % 4 != 0 || count < 8) { + scale2x4_16_def(dst0, dst1, dst2, dst3, src0, src1, src2, count); + } else { + scale2x_16_mmx_border(dst0, src0, src1, src2, count); + scale2x_16_def_center(dst1, src0, src1, src2, count); + scale2x_16_def_center(dst2, src0, src1, src2, count); + scale2x_16_mmx_border(dst3, src2, src1, src0, count); + } +} + +/** + * Scale by a factor of 2x4 a row of pixels of 32 bits. + * This function operates like scale2x_32_mmx() but with an expansion + * factor of 2x4 instead of 2x2. + */ +void scale2x4_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, scale2x_uint32* dst3, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count) +{ + if (count % 2 != 0 || count < 4) { + scale2x4_32_def(dst0, dst1, dst2, dst3, src0, src1, src2, count); + } else { + scale2x_32_mmx_border(dst0, src0, src1, src2, count); + scale2x_32_def_center(dst1, src0, src1, src2, count); + scale2x_32_def_center(dst2, src0, src1, src2, count); + scale2x_32_mmx_border(dst3, src2, src1, src0, count); + } +} + +#endif + + + diff --git a/src/scale2x/scale2x.h b/src/scale2x/scale2x.h new file mode 100644 index 000000000..83b29df14 --- /dev/null +++ b/src/scale2x/scale2x.h @@ -0,0 +1,70 @@ +/* + * This file is part of the Scale2x project. + * + * Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SCALE2X_H +#define __SCALE2X_H + +#define restrict + +typedef unsigned char scale2x_uint8; +typedef unsigned short scale2x_uint16; +typedef unsigned scale2x_uint32; + +void scale2x_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count); +void scale2x_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count); +void scale2x_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count); + +void scale2x3_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count); +void scale2x3_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count); +void scale2x3_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count); + +void scale2x4_8_def(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, scale2x_uint8* dst3, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count); +void scale2x4_16_def(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, scale2x_uint16* dst3, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count); +void scale2x4_32_def(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, scale2x_uint32* dst3, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count); + +#if defined(__GNUC__) && defined(__i386__) + +void scale2x_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count); +void scale2x_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count); +void scale2x_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count); + +void scale2x3_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count); +void scale2x3_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count); +void scale2x3_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count); + +void scale2x4_8_mmx(scale2x_uint8* dst0, scale2x_uint8* dst1, scale2x_uint8* dst2, scale2x_uint8* dst3, const scale2x_uint8* src0, const scale2x_uint8* src1, const scale2x_uint8* src2, unsigned count); +void scale2x4_16_mmx(scale2x_uint16* dst0, scale2x_uint16* dst1, scale2x_uint16* dst2, scale2x_uint16* dst3, const scale2x_uint16* src0, const scale2x_uint16* src1, const scale2x_uint16* src2, unsigned count); +void scale2x4_32_mmx(scale2x_uint32* dst0, scale2x_uint32* dst1, scale2x_uint32* dst2, scale2x_uint32* dst3, const scale2x_uint32* src0, const scale2x_uint32* src1, const scale2x_uint32* src2, unsigned count); + +/** + * End the use of the MMX instructions. + * This function must be called before using any floating-point operations. + */ +static inline void scale2x_mmx_emms(void) +{ + __asm__ __volatile__ ( + "emms" + ); +} + +#endif + +#endif + diff --git a/src/scale2x/scale3x.cpp b/src/scale2x/scale3x.cpp new file mode 100644 index 000000000..15f0ba16c --- /dev/null +++ b/src/scale2x/scale3x.cpp @@ -0,0 +1,704 @@ +/* + * This file is part of the Scale2x project. + * + * Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * This file contains a C and MMX implementation of the Scale2x effect. + * + * You can find an high level description of the effect at : + * + * http://scale2x.sourceforge.net/ + * + * Alternatively at the previous license terms, you are allowed to use this + * code in your program with these conditions: + * - the program is not used in commercial activities. + * - the whole source code of the program is released with the binary. + * - derivative works of the program are allowed. + */ + +#if HAVE_CONFIG_H +#include +#endif + +#include "scale3x.h" + +#include + +/***************************************************************************/ +/* Scale3x C implementation */ + +/** + * Define the macro USE_SCALE_RANDOMWRITE to enable + * an optimized version which writes memory in random order. + * This version is a little faster if you write in system memory. + * But it's a lot slower if you write in video memory. + * So, enable it only if you are sure to never write directly in video memory. + */ +#define USE_SCALE_RANDOMWRITE + +static inline void scale3x_8_def_whole(scale3x_uint8* restrict dst0, scale3x_uint8* restrict dst1, scale3x_uint8* restrict dst2, const scale3x_uint8* restrict src0, const scale3x_uint8* restrict src1, const scale3x_uint8* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst0[0] = src1[0]; + dst0[1] = (src1[0] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[0]) ? src0[0] : src1[0]; + dst0[2] = src1[1] == src0[0] ? src1[1] : src1[0]; + dst1[0] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0]; + dst1[1] = src1[0]; + dst1[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + dst2[0] = src1[0]; + dst2[1] = (src1[0] == src2[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src2[0]) ? src2[0] : src1[0]; + dst2[2] = src1[1] == src2[0] ? src1[1] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst0[2] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + dst1[2] = src1[0]; + dst2[0] = src1[0]; + dst2[1] = src1[0]; + dst2[2] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst0 += 3; + dst1 += 3; + dst2 += 3; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst0[0] = src1[-1] == src0[0] ? src1[-1] : src1[0]; + dst0[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0]; + dst0[2] = src1[1] == src0[0] ? src1[1] : src1[0]; + dst1[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst1[1] = src1[0]; + dst1[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + dst2[0] = src1[-1] == src2[0] ? src1[-1] : src1[0]; + dst2[1] = (src1[-1] == src2[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src2[-1]) ? src2[0] : src1[0]; + dst2[2] = src1[1] == src2[0] ? src1[1] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst0[2] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + dst1[2] = src1[0]; + dst2[0] = src1[0]; + dst2[1] = src1[0]; + dst2[2] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst0 += 3; + dst1 += 3; + dst2 += 3; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst0[0] = src1[-1] == src0[0] ? src1[-1] : src1[0]; + dst0[1] = (src1[-1] == src0[0] && src1[0] != src0[0]) || (src1[0] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0]; + dst0[2] = src1[0]; + dst1[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst1[1] = src1[0]; + dst1[2] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0]; + dst2[0] = src1[-1] == src2[0] ? src1[-1] : src1[0]; + dst2[1] = (src1[-1] == src2[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src2[-1]) ? src2[0] : src1[0]; + dst2[2] = src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst0[2] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + dst1[2] = src1[0]; + dst2[0] = src1[0]; + dst2[1] = src1[0]; + dst2[2] = src1[0]; + } +} + +static inline void scale3x_8_def_border(scale3x_uint8* restrict dst, const scale3x_uint8* restrict src0, const scale3x_uint8* restrict src1, const scale3x_uint8* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst[0] = src1[0]; + dst[1] = (src1[0] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[0]) ? src0[0] : src1[0]; + dst[2] = src1[1] == src0[0] ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst += 3; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0]; + dst[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0]; + dst[2] = src1[1] == src0[0] ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 3; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0]; + dst[1] = (src1[-1] == src0[0] && src1[0] != src0[0]) || (src1[0] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0]; + dst[2] = src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } +} + +static inline void scale3x_8_def_center(scale3x_uint8* restrict dst, const scale3x_uint8* restrict src0, const scale3x_uint8* restrict src1, const scale3x_uint8* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst[0] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0]; + dst[1] = src1[0]; + dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst += 3; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst[1] = src1[0]; + dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 3; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst[1] = src1[0]; + dst[2] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } +} + +static inline void scale3x_16_def_whole(scale3x_uint16* restrict dst0, scale3x_uint16* restrict dst1, scale3x_uint16* restrict dst2, const scale3x_uint16* restrict src0, const scale3x_uint16* restrict src1, const scale3x_uint16* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst0[0] = src1[0]; + dst0[1] = (src1[0] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[0]) ? src0[0] : src1[0]; + dst0[2] = src1[1] == src0[0] ? src1[1] : src1[0]; + dst1[0] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0]; + dst1[1] = src1[0]; + dst1[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + dst2[0] = src1[0]; + dst2[1] = (src1[0] == src2[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src2[0]) ? src2[0] : src1[0]; + dst2[2] = src1[1] == src2[0] ? src1[1] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst0[2] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + dst1[2] = src1[0]; + dst2[0] = src1[0]; + dst2[1] = src1[0]; + dst2[2] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst0 += 3; + dst1 += 3; + dst2 += 3; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst0[0] = src1[-1] == src0[0] ? src1[-1] : src1[0]; + dst0[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0]; + dst0[2] = src1[1] == src0[0] ? src1[1] : src1[0]; + dst1[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst1[1] = src1[0]; + dst1[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + dst2[0] = src1[-1] == src2[0] ? src1[-1] : src1[0]; + dst2[1] = (src1[-1] == src2[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src2[-1]) ? src2[0] : src1[0]; + dst2[2] = src1[1] == src2[0] ? src1[1] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst0[2] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + dst1[2] = src1[0]; + dst2[0] = src1[0]; + dst2[1] = src1[0]; + dst2[2] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst0 += 3; + dst1 += 3; + dst2 += 3; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst0[0] = src1[-1] == src0[0] ? src1[-1] : src1[0]; + dst0[1] = (src1[-1] == src0[0] && src1[0] != src0[0]) || (src1[0] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0]; + dst0[2] = src1[0]; + dst1[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst1[1] = src1[0]; + dst1[2] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0]; + dst2[0] = src1[-1] == src2[0] ? src1[-1] : src1[0]; + dst2[1] = (src1[-1] == src2[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src2[-1]) ? src2[0] : src1[0]; + dst2[2] = src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst0[2] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + dst1[2] = src1[0]; + dst2[0] = src1[0]; + dst2[1] = src1[0]; + dst2[2] = src1[0]; + } +} + +static inline void scale3x_16_def_border(scale3x_uint16* restrict dst, const scale3x_uint16* restrict src0, const scale3x_uint16* restrict src1, const scale3x_uint16* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst[0] = src1[0]; + dst[1] = (src1[0] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[0]) ? src0[0] : src1[0]; + dst[2] = src1[1] == src0[0] ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst += 3; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0]; + dst[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0]; + dst[2] = src1[1] == src0[0] ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 3; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0]; + dst[1] = (src1[-1] == src0[0] && src1[0] != src0[0]) || (src1[0] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0]; + dst[2] = src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } +} + +static inline void scale3x_16_def_center(scale3x_uint16* restrict dst, const scale3x_uint16* restrict src0, const scale3x_uint16* restrict src1, const scale3x_uint16* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst[0] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0]; + dst[1] = src1[0]; + dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst += 3; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst[1] = src1[0]; + dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 3; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst[1] = src1[0]; + dst[2] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } +} + +static inline void scale3x_32_def_whole(scale3x_uint32* restrict dst0, scale3x_uint32* restrict dst1, scale3x_uint32* restrict dst2, const scale3x_uint32* restrict src0, const scale3x_uint32* restrict src1, const scale3x_uint32* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst0[0] = src1[0]; + dst0[1] = (src1[0] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[0]) ? src0[0] : src1[0]; + dst0[2] = src1[1] == src0[0] ? src1[1] : src1[0]; + dst1[0] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0]; + dst1[1] = src1[0]; + dst1[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + dst2[0] = src1[0]; + dst2[1] = (src1[0] == src2[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src2[0]) ? src2[0] : src1[0]; + dst2[2] = src1[1] == src2[0] ? src1[1] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst0[2] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + dst1[2] = src1[0]; + dst2[0] = src1[0]; + dst2[1] = src1[0]; + dst2[2] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst0 += 3; + dst1 += 3; + dst2 += 3; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst0[0] = src1[-1] == src0[0] ? src1[-1] : src1[0]; + dst0[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0]; + dst0[2] = src1[1] == src0[0] ? src1[1] : src1[0]; + dst1[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst1[1] = src1[0]; + dst1[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + dst2[0] = src1[-1] == src2[0] ? src1[-1] : src1[0]; + dst2[1] = (src1[-1] == src2[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src2[-1]) ? src2[0] : src1[0]; + dst2[2] = src1[1] == src2[0] ? src1[1] : src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst0[2] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + dst1[2] = src1[0]; + dst2[0] = src1[0]; + dst2[1] = src1[0]; + dst2[2] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst0 += 3; + dst1 += 3; + dst2 += 3; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst0[0] = src1[-1] == src0[0] ? src1[-1] : src1[0]; + dst0[1] = (src1[-1] == src0[0] && src1[0] != src0[0]) || (src1[0] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0]; + dst0[2] = src1[0]; + dst1[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst1[1] = src1[0]; + dst1[2] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0]; + dst2[0] = src1[-1] == src2[0] ? src1[-1] : src1[0]; + dst2[1] = (src1[-1] == src2[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src2[-1]) ? src2[0] : src1[0]; + dst2[2] = src1[0]; + } else { + dst0[0] = src1[0]; + dst0[1] = src1[0]; + dst0[2] = src1[0]; + dst1[0] = src1[0]; + dst1[1] = src1[0]; + dst1[2] = src1[0]; + dst2[0] = src1[0]; + dst2[1] = src1[0]; + dst2[2] = src1[0]; + } +} + +static inline void scale3x_32_def_border(scale3x_uint32* restrict dst, const scale3x_uint32* restrict src0, const scale3x_uint32* restrict src1, const scale3x_uint32* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst[0] = src1[0]; + dst[1] = (src1[0] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[0]) ? src0[0] : src1[0]; + dst[2] = src1[1] == src0[0] ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst += 3; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0]; + dst[1] = (src1[-1] == src0[0] && src1[0] != src0[1]) || (src1[1] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0]; + dst[2] = src1[1] == src0[0] ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 3; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst[0] = src1[-1] == src0[0] ? src1[-1] : src1[0]; + dst[1] = (src1[-1] == src0[0] && src1[0] != src0[0]) || (src1[0] == src0[0] && src1[0] != src0[-1]) ? src0[0] : src1[0]; + dst[2] = src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } +} + +static inline void scale3x_32_def_center(scale3x_uint32* restrict dst, const scale3x_uint32* restrict src0, const scale3x_uint32* restrict src1, const scale3x_uint32* restrict src2, unsigned count) +{ + assert(count >= 2); + + /* first pixel */ + if (src0[0] != src2[0] && src1[0] != src1[1]) { + dst[0] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0]; + dst[1] = src1[0]; + dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } + ++src0; + ++src1; + ++src2; + dst += 3; + + /* central pixels */ + count -= 2; + while (count) { + if (src0[0] != src2[0] && src1[-1] != src1[1]) { + dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst[1] = src1[0]; + dst[2] = (src1[1] == src0[0] && src1[0] != src2[1]) || (src1[1] == src2[0] && src1[0] != src0[1]) ? src1[1] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } + + ++src0; + ++src1; + ++src2; + dst += 3; + --count; + } + + /* last pixel */ + if (src0[0] != src2[0] && src1[-1] != src1[0]) { + dst[0] = (src1[-1] == src0[0] && src1[0] != src2[-1]) || (src1[-1] == src2[0] && src1[0] != src0[-1]) ? src1[-1] : src1[0]; + dst[1] = src1[0]; + dst[2] = (src1[0] == src0[0] && src1[0] != src2[0]) || (src1[0] == src2[0] && src1[0] != src0[0]) ? src1[0] : src1[0]; + } else { + dst[0] = src1[0]; + dst[1] = src1[0]; + dst[2] = src1[0]; + } +} + +/** + * Scale by a factor of 3 a row of pixels of 8 bits. + * The function is implemented in C. + * The pixels over the left and right borders are assumed of the same color of + * the pixels on the border. + * \param src0 Pointer at the first pixel of the previous row. + * \param src1 Pointer at the first pixel of the current row. + * \param src2 Pointer at the first pixel of the next row. + * \param count Length in pixels of the src0, src1 and src2 rows. + * It must be at least 2. + * \param dst0 First destination row, triple length in pixels. + * \param dst1 Second destination row, triple length in pixels. + * \param dst2 Third destination row, triple length in pixels. + */ +void scale3x_8_def(scale3x_uint8* dst0, scale3x_uint8* dst1, scale3x_uint8* dst2, const scale3x_uint8* src0, const scale3x_uint8* src1, const scale3x_uint8* src2, unsigned count) +{ +#ifdef USE_SCALE_RANDOMWRITE + scale3x_8_def_whole(dst0, dst1, dst2, src0, src1, src2, count); +#else + scale3x_8_def_border(dst0, src0, src1, src2, count); + scale3x_8_def_center(dst1, src0, src1, src2, count); + scale3x_8_def_border(dst2, src2, src1, src0, count); +#endif +} + +/** + * Scale by a factor of 3 a row of pixels of 16 bits. + * This function operates like scale3x_8_def() but for 16 bits pixels. + * \param src0 Pointer at the first pixel of the previous row. + * \param src1 Pointer at the first pixel of the current row. + * \param src2 Pointer at the first pixel of the next row. + * \param count Length in pixels of the src0, src1 and src2 rows. + * It must be at least 2. + * \param dst0 First destination row, triple length in pixels. + * \param dst1 Second destination row, triple length in pixels. + * \param dst2 Third destination row, triple length in pixels. + */ +void scale3x_16_def(scale3x_uint16* dst0, scale3x_uint16* dst1, scale3x_uint16* dst2, const scale3x_uint16* src0, const scale3x_uint16* src1, const scale3x_uint16* src2, unsigned count) +{ +#ifdef USE_SCALE_RANDOMWRITE + scale3x_16_def_whole(dst0, dst1, dst2, src0, src1, src2, count); +#else + scale3x_16_def_border(dst0, src0, src1, src2, count); + scale3x_16_def_center(dst1, src0, src1, src2, count); + scale3x_16_def_border(dst2, src2, src1, src0, count); +#endif +} + +/** + * Scale by a factor of 3 a row of pixels of 32 bits. + * This function operates like scale3x_8_def() but for 32 bits pixels. + * \param src0 Pointer at the first pixel of the previous row. + * \param src1 Pointer at the first pixel of the current row. + * \param src2 Pointer at the first pixel of the next row. + * \param count Length in pixels of the src0, src1 and src2 rows. + * It must be at least 2. + * \param dst0 First destination row, triple length in pixels. + * \param dst1 Second destination row, triple length in pixels. + * \param dst2 Third destination row, triple length in pixels. + */ +void scale3x_32_def(scale3x_uint32* dst0, scale3x_uint32* dst1, scale3x_uint32* dst2, const scale3x_uint32* src0, const scale3x_uint32* src1, const scale3x_uint32* src2, unsigned count) +{ +#ifdef USE_SCALE_RANDOMWRITE + scale3x_32_def_whole(dst0, dst1, dst2, src0, src1, src2, count); +#else + scale3x_32_def_border(dst0, src0, src1, src2, count); + scale3x_32_def_center(dst1, src0, src1, src2, count); + scale3x_32_def_border(dst2, src2, src1, src0, count); +#endif +} + diff --git a/src/scale2x/scale3x.h b/src/scale2x/scale3x.h new file mode 100644 index 000000000..4af94e680 --- /dev/null +++ b/src/scale2x/scale3x.h @@ -0,0 +1,35 @@ +/* + * This file is part of the Scale2x project. + * + * Copyright (C) 2001, 2002, 2003, 2004 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SCALE3X_H +#define __SCALE3X_H + +#define restrict + +typedef unsigned char scale3x_uint8; +typedef unsigned short scale3x_uint16; +typedef unsigned scale3x_uint32; + +void scale3x_8_def(scale3x_uint8* dst0, scale3x_uint8* dst1, scale3x_uint8* dst2, const scale3x_uint8* src0, const scale3x_uint8* src1, const scale3x_uint8* src2, unsigned count); +void scale3x_16_def(scale3x_uint16* dst0, scale3x_uint16* dst1, scale3x_uint16* dst2, const scale3x_uint16* src0, const scale3x_uint16* src1, const scale3x_uint16* src2, unsigned count); +void scale3x_32_def(scale3x_uint32* dst0, scale3x_uint32* dst1, scale3x_uint32* dst2, const scale3x_uint32* src0, const scale3x_uint32* src1, const scale3x_uint32* src2, unsigned count); + +#endif + diff --git a/src/scale2x/scalebit.cpp b/src/scale2x/scalebit.cpp new file mode 100644 index 000000000..b26aa66bc --- /dev/null +++ b/src/scale2x/scalebit.cpp @@ -0,0 +1,511 @@ +/* + * This file is part of the Scale2x project. + * + * Copyright (C) 2003, 2004 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * This file contains an example implementation of the Scale effect + * applyed to a generic bitmap. + * + * You can find an high level description of the effect at : + * + * http://scale2x.sourceforge.net/ + * + * Alternatively at the previous license terms, you are allowed to use this + * code in your program with these conditions: + * - the program is not used in commercial activities. + * - the whole source code of the program is released with the binary. + * - derivative works of the program are allowed. + */ + +#if HAVE_CONFIG_H +#include +#endif + +#include "scale2x.h" +#include "scale3x.h" + +#if HAVE_ALLOCA_H +#include +#endif + +#include +#include + +#define SSDST(bits, num) (scale2x_uint##bits *)dst##num +#define SSSRC(bits, num) (const scale2x_uint##bits *)src##num + +/** + * Apply the Scale2x effect on a group of rows. Used internally. + */ +static inline void stage_scale2x(void* dst0, void* dst1, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) +{ + switch (pixel) { +#if defined(__GNUC__) && defined(__i386__) + case 1 : scale2x_8_mmx(SSDST(8,0), SSDST(8,1), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; + case 2 : scale2x_16_mmx(SSDST(16,0), SSDST(16,1), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; + case 4 : scale2x_32_mmx(SSDST(32,0), SSDST(32,1), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; +#else + case 1 : scale2x_8_def(SSDST(8,0), SSDST(8,1), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; + case 2 : scale2x_16_def(SSDST(16,0), SSDST(16,1), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; + case 4 : scale2x_32_def(SSDST(32,0), SSDST(32,1), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; +#endif + } +} + +/** + * Apply the Scale2x3 effect on a group of rows. Used internally. + */ +static inline void stage_scale2x3(void* dst0, void* dst1, void* dst2, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) +{ + switch (pixel) { +#if defined(__GNUC__) && defined(__i386__) + case 1 : scale2x3_8_mmx(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; + case 2 : scale2x3_16_mmx(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; + case 4 : scale2x3_32_mmx(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; +#else + case 1 : scale2x3_8_def(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; + case 2 : scale2x3_16_def(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; + case 4 : scale2x3_32_def(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; +#endif + } +} + +/** + * Apply the Scale2x4 effect on a group of rows. Used internally. + */ +static inline void stage_scale2x4(void* dst0, void* dst1, void* dst2, void* dst3, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) +{ + switch (pixel) { +#if defined(__GNUC__) && defined(__i386__) + case 1 : scale2x4_8_mmx(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSDST(8,3), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; + case 2 : scale2x4_16_mmx(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSDST(16,3), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; + case 4 : scale2x4_32_mmx(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSDST(32,3), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; +#else + case 1 : scale2x4_8_def(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSDST(8,3), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; + case 2 : scale2x4_16_def(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSDST(16,3), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; + case 4 : scale2x4_32_def(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSDST(32,3), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; +#endif + } +} + +/** + * Apply the Scale3x effect on a group of rows. Used internally. + */ +static inline void stage_scale3x(void* dst0, void* dst1, void* dst2, const void* src0, const void* src1, const void* src2, unsigned pixel, unsigned pixel_per_row) +{ + switch (pixel) { + case 1 : scale3x_8_def(SSDST(8,0), SSDST(8,1), SSDST(8,2), SSSRC(8,0), SSSRC(8,1), SSSRC(8,2), pixel_per_row); break; + case 2 : scale3x_16_def(SSDST(16,0), SSDST(16,1), SSDST(16,2), SSSRC(16,0), SSSRC(16,1), SSSRC(16,2), pixel_per_row); break; + case 4 : scale3x_32_def(SSDST(32,0), SSDST(32,1), SSDST(32,2), SSSRC(32,0), SSSRC(32,1), SSSRC(32,2), pixel_per_row); break; + } +} + +/** + * Apply the Scale4x effect on a group of rows. Used internally. + */ +static inline void stage_scale4x(void* dst0, void* dst1, void* dst2, void* dst3, const void* src0, const void* src1, const void* src2, const void* src3, unsigned pixel, unsigned pixel_per_row) +{ + stage_scale2x(dst0, dst1, src0, src1, src2, pixel, 2 * pixel_per_row); + stage_scale2x(dst2, dst3, src1, src2, src3, pixel, 2 * pixel_per_row); +} + +#define SCDST(i) (dst+(i)*dst_slice) +#define SCSRC(i) (src+(i)*src_slice) +#define SCMID(i) (mid[(i)]) + +/** + * Apply the Scale2x effect on a bitmap. + * The destination bitmap is filled with the scaled version of the source bitmap. + * The source bitmap isn't modified. + * The destination bitmap must be manually allocated before calling the function, + * note that the resulting size is exactly 2x2 times the size of the source bitmap. + * \param void_dst Pointer at the first pixel of the destination bitmap. + * \param dst_slice Size in bytes of a destination bitmap row. + * \param void_src Pointer at the first pixel of the source bitmap. + * \param src_slice Size in bytes of a source bitmap row. + * \param pixel Bytes per pixel of the source and destination bitmap. + * \param width Horizontal size in pixels of the source bitmap. + * \param height Vertical size in pixels of the source bitmap. + */ +static void scale2x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) +{ + unsigned char* dst = (unsigned char*)void_dst; + const unsigned char* src = (const unsigned char*)void_src; + unsigned count; + + assert(height >= 2); + + count = height; + + stage_scale2x(SCDST(0), SCDST(1), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width); + + dst = SCDST(2); + + count -= 2; + while (count) { + stage_scale2x(SCDST(0), SCDST(1), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width); + + dst = SCDST(2); + src = SCSRC(1); + + --count; + } + + stage_scale2x(SCDST(0), SCDST(1), SCSRC(0), SCSRC(1), SCSRC(1), pixel, width); + +#if defined(__GNUC__) && defined(__i386__) + scale2x_mmx_emms(); +#endif +} + +/** + * Apply the Scale2x3 effect on a bitmap. + * The destination bitmap is filled with the scaled version of the source bitmap. + * The source bitmap isn't modified. + * The destination bitmap must be manually allocated before calling the function, + * note that the resulting size is exactly 2x3 times the size of the source bitmap. + * \param void_dst Pointer at the first pixel of the destination bitmap. + * \param dst_slice Size in bytes of a destination bitmap row. + * \param void_src Pointer at the first pixel of the source bitmap. + * \param src_slice Size in bytes of a source bitmap row. + * \param pixel Bytes per pixel of the source and destination bitmap. + * \param width Horizontal size in pixels of the source bitmap. + * \param height Vertical size in pixels of the source bitmap. + */ +static void scale2x3(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) +{ + unsigned char* dst = (unsigned char*)void_dst; + const unsigned char* src = (const unsigned char*)void_src; + unsigned count; + + assert(height >= 2); + + count = height; + + stage_scale2x3(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width); + + dst = SCDST(3); + + count -= 2; + while (count) { + stage_scale2x3(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width); + + dst = SCDST(3); + src = SCSRC(1); + + --count; + } + + stage_scale2x3(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(1), SCSRC(1), pixel, width); + +#if defined(__GNUC__) && defined(__i386__) + scale2x_mmx_emms(); +#endif +} + +/** + * Apply the Scale2x4 effect on a bitmap. + * The destination bitmap is filled with the scaled version of the source bitmap. + * The source bitmap isn't modified. + * The destination bitmap must be manually allocated before calling the function, + * note that the resulting size is exactly 2x4 times the size of the source bitmap. + * \param void_dst Pointer at the first pixel of the destination bitmap. + * \param dst_slice Size in bytes of a destination bitmap row. + * \param void_src Pointer at the first pixel of the source bitmap. + * \param src_slice Size in bytes of a source bitmap row. + * \param pixel Bytes per pixel of the source and destination bitmap. + * \param width Horizontal size in pixels of the source bitmap. + * \param height Vertical size in pixels of the source bitmap. + */ +static void scale2x4(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) +{ + unsigned char* dst = (unsigned char*)void_dst; + const unsigned char* src = (const unsigned char*)void_src; + unsigned count; + + assert(height >= 2); + + count = height; + + stage_scale2x4(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width); + + dst = SCDST(4); + + count -= 2; + while (count) { + stage_scale2x4(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width); + + dst = SCDST(4); + src = SCSRC(1); + + --count; + } + + stage_scale2x4(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCSRC(0), SCSRC(1), SCSRC(1), pixel, width); + +#if defined(__GNUC__) && defined(__i386__) + scale2x_mmx_emms(); +#endif +} + +/** + * Apply the Scale3x effect on a bitmap. + * The destination bitmap is filled with the scaled version of the source bitmap. + * The source bitmap isn't modified. + * The destination bitmap must be manually allocated before calling the function, + * note that the resulting size is exactly 3x3 times the size of the source bitmap. + * \param void_dst Pointer at the first pixel of the destination bitmap. + * \param dst_slice Size in bytes of a destination bitmap row. + * \param void_src Pointer at the first pixel of the source bitmap. + * \param src_slice Size in bytes of a source bitmap row. + * \param pixel Bytes per pixel of the source and destination bitmap. + * \param width Horizontal size in pixels of the source bitmap. + * \param height Vertical size in pixels of the source bitmap. + */ +static void scale3x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) +{ + unsigned char* dst = (unsigned char*)void_dst; + const unsigned char* src = (const unsigned char*)void_src; + unsigned count; + + assert(height >= 2); + + count = height; + + stage_scale3x(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width); + + dst = SCDST(3); + + count -= 2; + while (count) { + stage_scale3x(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width); + + dst = SCDST(3); + src = SCSRC(1); + + --count; + } + + stage_scale3x(SCDST(0), SCDST(1), SCDST(2), SCSRC(0), SCSRC(1), SCSRC(1), pixel, width); +} + +/** + * Apply the Scale4x effect on a bitmap. + * The destination bitmap is filled with the scaled version of the source bitmap. + * The source bitmap isn't modified. + * The destination bitmap must be manually allocated before calling the function, + * note that the resulting size is exactly 4x4 times the size of the source bitmap. + * \note This function requires also a small buffer bitmap used internally to store + * intermediate results. This bitmap must have at least an horizontal size in bytes of 2*width*pixel, + * and a vertical size of 6 rows. The memory of this buffer must not be allocated + * in video memory because it's also read and not only written. Generally + * a heap (malloc) or a stack (alloca) buffer is the best choice. + * \param void_dst Pointer at the first pixel of the destination bitmap. + * \param dst_slice Size in bytes of a destination bitmap row. + * \param void_mid Pointer at the first pixel of the buffer bitmap. + * \param mid_slice Size in bytes of a buffer bitmap row. + * \param void_src Pointer at the first pixel of the source bitmap. + * \param src_slice Size in bytes of a source bitmap row. + * \param pixel Bytes per pixel of the source and destination bitmap. + * \param width Horizontal size in pixels of the source bitmap. + * \param height Vertical size in pixels of the source bitmap. + */ +static void scale4x_buf(void* void_dst, unsigned dst_slice, void* void_mid, unsigned mid_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) +{ + unsigned char* dst = (unsigned char*)void_dst; + const unsigned char* src = (const unsigned char*)void_src; + unsigned count; + unsigned char* mid[6]; + + assert(height >= 4); + + count = height; + + /* set the 6 buffer pointers */ + mid[0] = (unsigned char*)void_mid; + mid[1] = mid[0] + mid_slice; + mid[2] = mid[1] + mid_slice; + mid[3] = mid[2] + mid_slice; + mid[4] = mid[3] + mid_slice; + mid[5] = mid[4] + mid_slice; + + stage_scale2x(SCMID(-2+6), SCMID(-1+6), SCSRC(0), SCSRC(0), SCSRC(1), pixel, width); + stage_scale2x(SCMID(0), SCMID(1), SCSRC(0), SCSRC(1), SCSRC(2), pixel, width); + stage_scale2x(SCMID(2), SCMID(3), SCSRC(1), SCSRC(2), SCSRC(3), pixel, width); + stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(-2+6), SCMID(-2+6), SCMID(-1+6), SCMID(0), pixel, width); + + dst = SCDST(4); + + stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(-1+6), SCMID(0), SCMID(1), SCMID(2), pixel, width); + + dst = SCDST(4); + + count -= 4; + while (count) { + unsigned char* tmp; + + stage_scale2x(SCMID(4), SCMID(5), SCSRC(2), SCSRC(3), SCSRC(4), pixel, width); + stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(1), SCMID(2), SCMID(3), SCMID(4), pixel, width); + + dst = SCDST(4); + src = SCSRC(1); + + tmp = SCMID(0); /* shift by 2 position */ + SCMID(0) = SCMID(2); + SCMID(2) = SCMID(4); + SCMID(4) = tmp; + tmp = SCMID(1); + SCMID(1) = SCMID(3); + SCMID(3) = SCMID(5); + SCMID(5) = tmp; + + --count; + } + + stage_scale2x(SCMID(4), SCMID(5), SCSRC(2), SCSRC(3), SCSRC(3), pixel, width); + stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(1), SCMID(2), SCMID(3), SCMID(4), pixel, width); + + dst = SCDST(4); + + stage_scale4x(SCDST(0), SCDST(1), SCDST(2), SCDST(3), SCMID(3), SCMID(4), SCMID(5), SCMID(5), pixel, width); + +#if defined(__GNUC__) && defined(__i386__) + scale2x_mmx_emms(); +#endif +} + +/** + * Apply the Scale4x effect on a bitmap. + * The destination bitmap is filled with the scaled version of the source bitmap. + * The source bitmap isn't modified. + * The destination bitmap must be manually allocated before calling the function, + * note that the resulting size is exactly 4x4 times the size of the source bitmap. + * \note This function operates like ::scale4x_buf() but the intermediate buffer is + * automatically allocated in the stack. + * \param void_dst Pointer at the first pixel of the destination bitmap. + * \param dst_slice Size in bytes of a destination bitmap row. + * \param void_src Pointer at the first pixel of the source bitmap. + * \param src_slice Size in bytes of a source bitmap row. + * \param pixel Bytes per pixel of the source and destination bitmap. + * \param width Horizontal size in pixels of the source bitmap. + * \param height Vertical size in pixels of the source bitmap. + */ +static void scale4x(void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) +{ + unsigned mid_slice; + void* mid; + + mid_slice = 2 * pixel * width; /* required space for 1 row buffer */ + + mid_slice = (mid_slice + 0x7) & ~0x7; /* align to 8 bytes */ + +#if HAVE_ALLOCA + mid = alloca(6 * mid_slice); /* allocate space for 6 row buffers */ + + assert(mid != 0); /* alloca should never fails */ +#else + mid = malloc(6 * mid_slice); /* allocate space for 6 row buffers */ + + if (!mid) + return; +#endif + + scale4x_buf(void_dst, dst_slice, mid, mid_slice, void_src, src_slice, pixel, width, height); + +#if !HAVE_ALLOCA + free(mid); +#endif +} + +/** + * Check if the scale implementation is applicable at the given arguments. + * \param scale Scale factor. 2, 203 (fox 2x3), 204 (for 2x4), 3 or 4. + * \param pixel Bytes per pixel of the source and destination bitmap. + * \param width Horizontal size in pixels of the source bitmap. + * \param height Vertical size in pixels of the source bitmap. + * \return + * - -1 on precondition violated. + * - 0 on success. + */ +int scale_precondition(unsigned scale, unsigned pixel, unsigned width, unsigned height) +{ + if (pixel != 1 && pixel != 2 && pixel != 4) + return -1; + + switch (scale) { + case 202 : + case 203 : + case 204 : + case 2 : + case 303 : + case 3 : + if (height < 2) + return -1; + break; + case 404 : + case 4 : + if (height < 4) + return -1; + break; + default: + return -1; + } + + if (width < 2) + return -1; + + return 0; +} + +/** + * Apply the Scale effect on a bitmap. + * This function is simply a common interface for ::scale2x(), ::scale3x() and ::scale4x(). + * \param scale Scale factor. 2, 203 (fox 2x3), 204 (for 2x4), 3 or 4. + * \param void_dst Pointer at the first pixel of the destination bitmap. + * \param dst_slice Size in bytes of a destination bitmap row. + * \param void_src Pointer at the first pixel of the source bitmap. + * \param src_slice Size in bytes of a source bitmap row. + * \param pixel Bytes per pixel of the source and destination bitmap. + * \param width Horizontal size in pixels of the source bitmap. + * \param height Vertical size in pixels of the source bitmap. + */ +void scale(unsigned scale, void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height) +{ + switch (scale) { + case 202 : + case 2 : + scale2x(void_dst, dst_slice, void_src, src_slice, pixel, width, height); + break; + case 203 : + scale2x3(void_dst, dst_slice, void_src, src_slice, pixel, width, height); + break; + case 204 : + scale2x4(void_dst, dst_slice, void_src, src_slice, pixel, width, height); + break; + case 303 : + case 3 : + scale3x(void_dst, dst_slice, void_src, src_slice, pixel, width, height); + break; + case 404 : + case 4 : + scale4x(void_dst, dst_slice, void_src, src_slice, pixel, width, height); + break; + } +} + diff --git a/src/scale2x/scalebit.h b/src/scale2x/scalebit.h new file mode 100644 index 000000000..dd46883f9 --- /dev/null +++ b/src/scale2x/scalebit.h @@ -0,0 +1,43 @@ +/* + * This file is part of the Scale2x project. + * + * Copyright (C) 2003 Andrea Mazzoleni + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * This file contains an example implementation of the Scale effect + * applyed to a generic bitmap. + * + * You can find an high level description of the effect at : + * + * http://scale2x.sourceforge.net/ + * + * Alternatively at the previous license terms, you are allowed to use this + * code in your program with these conditions: + * - the program is not used in commercial activities. + * - the whole source code of the program is released with the binary. + * - derivative works of the program are allowed. + */ + +#ifndef __SCALEBIT_H +#define __SCALEBIT_H + +int scale_precondition(unsigned scale, unsigned pixel, unsigned width, unsigned height); +void scale(unsigned scale, void* void_dst, unsigned dst_slice, const void* void_src, unsigned src_slice, unsigned pixel, unsigned width, unsigned height); + +#endif + diff --git a/src/sdl/CInput.cpp b/src/sdl/CInput.cpp new file mode 100644 index 000000000..9bcb7c610 --- /dev/null +++ b/src/sdl/CInput.cpp @@ -0,0 +1,378 @@ +/* + * CInput.cpp + * + * Created on: 20.03.2009 + * Author: gerstrong + */ + +#include +#include + +#include "CInput.h" +#include "../CLogFile.h" + + +CInput::CInput() { + + Uint8 i; + + m_exit = false; + + memset(immediate_keytable,false,KEYTABLE_SIZE); + memset(last_immediate_keytable,false,KEYTABLE_SIZE); + + for(i=0 ; itextOut("SDL: Got quit event!"); + m_exit = true; + break; + case SDL_KEYDOWN: + processKeys(1); + break; + case SDL_KEYUP: + processKeys(0); + break; + case SDL_JOYAXISMOTION: + processJoystickAxis(); + break; + case SDL_JOYBUTTONDOWN: + processJoystickButton(1); + break; + case SDL_JOYBUTTONUP: + processJoystickButton(0); + break; + } + + } +} + +void CInput::processJoystickAxis(void) +{ + unsigned int i; + for(i=0 ; i 3200 && InputCommand[i].joyvalue > 0) || + (Event.jaxis.value < -3200 && InputCommand[i].joyvalue < 0)) + InputCommand[i].active = true; + else + InputCommand[i].active = false; + } + } + } +} +void CInput::processJoystickButton(int value) +{ + unsigned int i; + for(i=0 ; i +{ +public: + CInput(); + virtual ~CInput(); + + void pollEvents(); + + bool getHoldedKey(int key); + bool getPressedKey(int key); + bool getPressedAnyKey(void); + void sendKey(int key); + + bool getHoldedCommand(int command); + bool getPressedCommand(int command); + bool getPressedAnyCommand(void); + bool getExitEvent(void); + void cancelExitEvent(void); + + void getEventName(int position, char *buf); + bool readNewEvent(int position); + + short loadControlconfig(void); + short saveControlconfig(void); + + void flushKeys(void); + +private: + SDL_Event Event; + stInputCommand InputCommand[NUMBER_OF_COMMANDS]; + bool m_exit; + + bool immediate_keytable[KEYTABLE_SIZE]; + bool last_immediate_keytable[KEYTABLE_SIZE]; + + void processKeys(int value); + void processJoystickAxis(void); + void processJoystickButton(int value); +}; + + + +#endif /* CINPUT_H_ */ diff --git a/src/sdl/COpenGL.cpp b/src/sdl/COpenGL.cpp new file mode 100644 index 000000000..e74cca51c --- /dev/null +++ b/src/sdl/COpenGL.cpp @@ -0,0 +1,166 @@ +/* + * COpenGL.cpp + * + * Created on: 04.06.2009 + * Author: gerstrong + */ + +#include "COpenGL.h" +#include "../CLogFile.h" + +#define GAME_STD_WIDTH 320 +#define GAME_STD_HEIGHT 200 + +COpenGL::COpenGL() { + m_blitsurface = NULL; + m_Depth = 4; // 32-bit colour depth +} + +COpenGL::~COpenGL() { + if(m_opengl_buffer){ delete[] m_opengl_buffer; m_opengl_buffer = NULL; } +} + +bool COpenGL::initGL(unsigned Width, unsigned Height, unsigned char Depth, + GLint oglfilter, unsigned char scalex) +{ + m_Depth = Depth; + m_ScaleX = scalex; + //m_texparam = GL_TEXTURE_RECTANGLE_ARB; + m_texparam = GL_TEXTURE_2D; + + // Set the proper resolution for OpenGL. Very important, when user changes the resolution + glViewport(0,0,Width, Height); + //glViewport(0,0,1024, 1024); + + // Set clear colour + glClearColor(0,0,0,0); + + // Set projection + glMatrixMode( GL_PROJECTION ); + glLoadIdentity(); + glOrtho( 0 , 1, 1, 0 , -1 , 1 ); + + // Now Initialize modelview matrix + glMatrixMode( GL_MODELVIEW ); + glLoadIdentity(); + + // Enable Texture loading for the blit screen + /* uint textureID; + + glEnable (GL_TEXTURE_2D); + glGenTextures(1, &textureID); + glBindTexture(GL_TEXTURE_RECTANGLE_ARB, textureID); + //glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST); +*/ + + /*Using the standard OpenGL API for specifying a 2D texture + image: glTexImage2D, glSubTexImage2D, glCopyTexImage2D, + and glCopySubTexImage2D. The target for these commands is + GL_TEXTURE_RECTANGLE_ARB though. + + This is similar to how the texture cube map functionality uses the 2D + texture image specification API though with its own texture target. + + The texture target GL_TEXTURE_RECTANGLE_ARB should also + be used for glGetTexImage, glGetTexLevelParameteriv, and + glGetTexLevelParameterfv.*/ + + + glEnable (m_texparam); + glBindTexture(m_texparam, 1); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + + glTexParameteri(m_texparam, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri (m_texparam, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + + glTexParameteri (m_texparam, GL_TEXTURE_MAG_FILTER, oglfilter); + glTexParameteri (m_texparam, GL_TEXTURE_MIN_FILTER, oglfilter); + + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + + + if(scalex > 1) + m_opengl_buffer = new char[GAME_STD_HEIGHT*GAME_STD_WIDTH*scalex*Depth]; + else + m_opengl_buffer = NULL; + + // If there were any errors + int error; + error = glGetError(); + if( error != GL_NO_ERROR) + { + g_pLogFile->ftextOut("OpenGL Init(): %d
    ",error); + return false; + } + else + { + g_pLogFile->ftextOut("OpenGL Init(): Interface succesfully opened!
    "); + } + + // TODO: Find out where crashes, when OpenGL init failed! + + return true; +} + +void COpenGL::setSurface(SDL_Surface *blitsurface) +{ m_blitsurface = blitsurface; } + +void COpenGL::render(void) +{ + //Clear the screen + glClear(GL_COLOR_BUFFER_BIT); // Clear The Screen + + SDL_LockSurface(m_blitsurface); + + if(m_ScaleX == 2) //Scale 2x + { + scale(2, m_opengl_buffer, (GAME_STD_WIDTH<<1)*(m_Depth>>3), m_blitsurface->pixels, + GAME_STD_WIDTH*(m_Depth>>3), (m_Depth>>3), GAME_STD_WIDTH, GAME_STD_HEIGHT); + + glTexImage2D(m_texparam, 0, GL_RGBA, GAME_STD_WIDTH<<1, GAME_STD_HEIGHT<<1, 0, GL_BGRA, GL_UNSIGNED_BYTE, m_opengl_buffer); + //glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, GAME_STD_WIDTH<<1, GAME_STD_HEIGHT<<1, 0, GL_BGRA, GL_UNSIGNED_BYTE, m_opengl_buffer); + //glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA8, GAME_STD_WIDTH<<1, GAME_STD_HEIGHT<<1, 0, GL_BGRA, GL_UNSIGNED_BYTE, m_opengl_buffer); + } + else if(m_ScaleX == 3) //Scale 3x + { + scale(3, m_opengl_buffer, (GAME_STD_WIDTH*3)*(m_Depth>>3), m_blitsurface->pixels, + GAME_STD_WIDTH*(m_Depth>>3), (m_Depth>>3), GAME_STD_WIDTH, GAME_STD_HEIGHT); + + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, GAME_STD_WIDTH*3, GAME_STD_HEIGHT*3, 0, GL_BGRA, GL_UNSIGNED_BYTE, m_opengl_buffer); + } + else if(m_ScaleX == 4) //Scale 4x + { + scale(4, m_opengl_buffer, (GAME_STD_WIDTH<<2)*(m_Depth>>3), m_blitsurface->pixels, + GAME_STD_WIDTH*(m_Depth>>3), (m_Depth>>3), GAME_STD_WIDTH, GAME_STD_HEIGHT); + + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, GAME_STD_WIDTH<<2, GAME_STD_HEIGHT<<2, 0, GL_BGRA, GL_UNSIGNED_BYTE, m_opengl_buffer); + } + else + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, GAME_STD_WIDTH, GAME_STD_HEIGHT, 0, GL_BGRA, GL_UNSIGNED_BYTE, m_blitsurface->pixels); + + + glBindTexture (GL_TEXTURE_2D, 1); + + glBegin (GL_QUADS); + glTexCoord2f (0.0, 0.0); + glVertex3f (0.0, 0.0, 0.0); + glTexCoord2f (1.0, 0.0); + glVertex3f (1.0, 0.0, 0.0); + glTexCoord2f (1.0, 1.0); + glVertex3f (1.0, 1.0, 0.0); + glTexCoord2f (0.0, 1.0); + glVertex3f (0.0, 1.0, 0.0); + glEnd(); + + SDL_UnlockSurface(m_blitsurface); + + // Reset (Position?) + glLoadIdentity(); + + SDL_GL_SwapBuffers(); +} diff --git a/src/sdl/COpenGL.h b/src/sdl/COpenGL.h new file mode 100644 index 000000000..75a55f881 --- /dev/null +++ b/src/sdl/COpenGL.h @@ -0,0 +1,38 @@ +/* + * COpenGL.h + * + * Created on: 04.06.2009 + * Author: gerstrong + * + * This class is used for passing all the OpenGL function through the + * library in order to render on accelerated video hardware + * + */ + +#ifndef COPENGL_H_ +#define COPENGL_H_ + +#include +#include +#include "../scale2x/scalebit.h" + +class COpenGL { +public: + COpenGL(); + virtual ~COpenGL(); + + void render(void); + bool initGL(unsigned Width, unsigned Height, unsigned char Depth, + GLint oglfilter, unsigned char scalex); + + void setSurface(SDL_Surface *blitsurface); + +private: + SDL_Surface *m_blitsurface; + char* m_opengl_buffer; // Used for internal ScaleX filtering + unsigned char m_Depth; + unsigned char m_ScaleX; + unsigned int m_texparam; +}; + +#endif /* COPENGL_H_ */ diff --git a/src/sdl/CTimer.cpp b/src/sdl/CTimer.cpp new file mode 100644 index 000000000..26fac9fdc --- /dev/null +++ b/src/sdl/CTimer.cpp @@ -0,0 +1,84 @@ +/* + * CTimer.cpp + * + * Created on: 26.03.2009 + * Author: gerstrong + */ + + +#include "../keen.h" +#include "../keenext.h" +#include + +#include "CTimer.h" + +typedef char int8; +typedef short int16; +typedef long int32; + +typedef unsigned char uint8; +typedef unsigned short uint16; +typedef unsigned long uint32; + +#ifdef __GNUC__ + typedef unsigned long long uint64; + typedef long long int64; + #define INLINE inline + #define GINLINE inline +#endif + +Uint32 FPSCallback(Uint32 interval, void* param); + +static uint64 tfreq; +static uint64 desiredfps; + +SDL_TimerID ckp_timer_id; + +Uint32 FPSCallback(Uint32 interval, void* param) +{ + fps = (curfps << 1); + curfps = 0; + return interval; +} + +CTimer::CTimer() { + RefreshThrottleFPS(); + if(SDL_Init(SDL_INIT_TIMER) == 0) + ckp_timer_id = SDL_AddTimer(1000, FPSCallback, NULL); +} + +CTimer::~CTimer() { + SDL_RemoveTimer(ckp_timer_id); +} + +void CTimer::SpeedThrottle(void) +{ + static uint64 ttime,ltime=0; + + waiter: + + ttime=SDL_GetTicks(); + ttime*=10000; + + if( (ttime-ltime) < (tfreq/desiredfps) ) + { + int64 delay; + delay=(tfreq/desiredfps)-(ttime-ltime); + if(delay>0) + SDL_Delay(delay/10000); + goto waiter; + } + if( (ttime-ltime) >= (tfreq*4/desiredfps)) + ltime=ttime; + else + ltime+=tfreq/desiredfps; +} +void CTimer::RefreshThrottleFPS(void) +{ +// desiredfps=FCEUI_GetDesiredFPS()>>8; +// desiredfps = 23000000; + desiredfps = 21800000; + tfreq=10000000; + tfreq<<=16; /* Adjustment for fps returned from FCEUI_GetDesiredFPS(). */ +} + diff --git a/src/sdl/CTimer.h b/src/sdl/CTimer.h new file mode 100644 index 000000000..9d6f30356 --- /dev/null +++ b/src/sdl/CTimer.h @@ -0,0 +1,29 @@ +/* + * CTimer.h + * + * Created on: 26.03.2009 + * Author: gerstrong + */ + + +#ifndef CTIMER_H_ +#define CTIMER_H_ + +#include "../CSingleton.h" +#define g_pTimer CTimer::Get() + +void initTimer(void); + +class CTimer : public CSingleton +{ +public: + CTimer(); + virtual ~CTimer(); + + void SpeedThrottle(void); + void RefreshThrottleFPS(void); + +private: +}; + +#endif /* CTIMER_H_ */ diff --git a/src/sdl/CVideoDriver.cpp b/src/sdl/CVideoDriver.cpp new file mode 100644 index 000000000..762cbb033 --- /dev/null +++ b/src/sdl/CVideoDriver.cpp @@ -0,0 +1,683 @@ + +/* + * CVideoDriver.cpp + * + * Created on: 17.03.2009 + * Author: gerstrong + */ +#include "CVideoDriver.h" +#include "CInput.h" + +#include "../keen.h" +#include "video/colourconvert.h" +#include "video/colourtable.h" +#include "../scale2x/scalebit.h" +#include "../CLogFile.h" +#include "../CGraphics.h" + +#define CKLOGFILENAME "genius.log" + +#define MAX_CONSOLE_MESSAGES 3 +#define CONSOLE_MESSAGE_X 3 +#define CONSOLE_MESSAGE_Y 3 +#define CONSOLE_MESSAGE_SPACING 9 +#define CONSOLE_EXPIRE_RATE 250 + +#define GAME_STD_WIDTH 320 +#define GAME_STD_HEIGHT 200 + +// pointer to the line in VRAM to start blitting to when stretchblitting. +// this may not be the first line on the display as it is adjusted to +// center the image on the screen when in fullscreen. +unsigned char *VRAMPtr; +char blitsurface_alloc = 0; + +SDL_Rect dstrect; + +typedef struct stConsoleMessage +{ + char msg[80]; +} stConsoleMessage; +stConsoleMessage cmsg[MAX_CONSOLE_MESSAGES]; +int NumConsoleMessages = 0; +int ConsoleExpireTimer = 0; + + +CVideoDriver::CVideoDriver() { + // Default values + + showfps=true; + Width=640; + Height=480; + Depth=0; + Mode=0; + Fullscreen=false; + Filtermode=1; + Zoom=2; + FrameSkip=2; + m_opengl = false; + m_opengl_filter = GL_NEAREST; + mp_OpenGL = NULL; + + screenrect.x=0; + screenrect.y=0; + screenrect.h=0; + screenrect.w=0; + + ScrollSurface=NULL; // 512x512 scroll buffer + FGLayerSurface=NULL; // Scroll buffer for Messages + BGLayerSurface=NULL; + BlitSurface=NULL; +} + +CVideoDriver::~CVideoDriver() { + stop(); +} + +void CVideoDriver::stop(void) +{ + if(screen) { SDL_FreeSurface(screen); g_pLogFile->textOut("freed screen
    "); } + if(ScrollSurface && (ScrollSurface->map != NULL)) { SDL_FreeSurface(ScrollSurface); g_pLogFile->textOut("freed scrollsurface
    "); } + if(blitsurface_alloc) { blitsurface_alloc = 0; SDL_FreeSurface(BlitSurface); g_pLogFile->textOut("freed blitsurface
    "); } + if(mp_OpenGL) { delete mp_OpenGL; mp_OpenGL = NULL; } +} + + +bool CVideoDriver::start(void) +{ + if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO) < 0) + { + g_pLogFile->textOut(RED,"Could not initialize SDL: %s
    ", SDL_GetError()); + return false; + } + if (is_server) + { + SDL_WM_SetCaption("CloneKeenPlus [host]", NULL); + } + else if (is_client) + { + SDL_WM_SetCaption("CloneKeenPlus [multiplayer]", NULL); + } + else + { + SDL_WM_SetCaption("CloneKeenPlus", NULL); + } + + // When the program is through executing, call SDL_Quit + atexit(SDL_Quit); + + if(!applyMode()) + return false; + + return createSurfaces(); +} +bool CVideoDriver::applyMode(void) +{ + // Check if some zoom/filter modes are illogical + if( (Zoom == 3 && Filtermode == 1) && !m_opengl ) + Zoom = 2; + + // Grab a surface on the screen + Mode = SDL_HWPALETTE; + + // Enable OpenGL + if(m_opengl) + { + SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); + Mode |= SDL_OPENGL; + } + + // Now we decide if it will be fullscreen or windowed mode. + if(Fullscreen) + Mode |= SDL_FULLSCREEN; + + // Before the resolution is set, check, if the zoom factor is too high! + while(((Width/GAME_STD_WIDTH) < Zoom || (Height/GAME_STD_HEIGHT) < Zoom) && (Zoom > 1)) + Zoom--; + + // Try to center the screen! + screenrect.w = blitrect.w = GAME_STD_WIDTH*Zoom; + screenrect.h = blitrect.h = GAME_STD_HEIGHT*Zoom; + screenrect.x = (Width-screenrect.w)>>1; + if(Width == 320) + screenrect.y = 0; + else + screenrect.y = (Height-screenrect.h)>>1; + blitrect.x = 0; + blitrect.y = 0; + + // And Display can be setup. + screen = SDL_SetVideoMode(Width,Height,Depth,Mode); + + Depth = screen->format->BitsPerPixel; + + if( !screen ) + { + g_pLogFile->textOut(RED,"VidDrv_Start(): Couldn't create a SDL surface: %s
    ", SDL_GetError()); + return false; + } + + if(!Fullscreen) + SDL_ShowCursor(SDL_ENABLE); + else + SDL_ShowCursor(SDL_DISABLE); + + return true; +} + +void CVideoDriver::setMode(unsigned int srcW, unsigned int srcH, + unsigned short srcD) +{ + Width = srcW; + Height = srcH; + Depth = srcD; +} +void CVideoDriver::setFrameskip(unsigned short value) +{ + FrameSkip = value; +} +void CVideoDriver::setFilter(short value) +{ + Filtermode = value; +} +void CVideoDriver::setZoom(short value) +{ + Zoom = value; +} + +bool CVideoDriver::createSurfaces(void) +{ + // This function creates the surfaces which are needed for the game. + unsigned stretch_blit_yoff; + + stretch_blit_yoff = 0; + + ScrollSurface = SDL_CreateRGBSurfaceFrom(g_pGraphics->getScrollbuffer(), 512, 512, 8, 512, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask); + SDL_SetColorKey(ScrollSurface, SDL_SRCCOLORKEY, COLOUR_MASK); + if (!ScrollSurface) + { + g_pLogFile->textOut(RED,"VideoDriver: Couldn't create ScrollSurface!
    "); + return false; + } + + BGLayerSurface = SDL_CreateRGBSurface(Mode,320, 200, Depth, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask); + if (!BGLayerSurface) + { + g_pLogFile->textOut(RED,"VideoDriver: Couldn't create BGLayerSurface!
    "); + return false; + } + + + FGLayerSurface = SDL_CreateRGBSurface(Mode,320, 200, Depth, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask); + if (!FGLayerSurface) + { + g_pLogFile->textOut(RED,"VideoDriver: Couldn't create FGLayerSurface!
    "); + return false; + } + SDL_SetColorKey( FGLayerSurface, SDL_SRCCOLORKEY, + SDL_MapRGB(FGLayerSurface->format, 0, 0, 0) ); + + //Set surface alpha + SDL_SetAlpha( FGLayerSurface, SDL_SRCALPHA, 225 ); + + if(Width == 320) + { + g_pLogFile->textOut("Blitsurface = Screen
    "); + BlitSurface = screen; + blitsurface_alloc = 0; + VRAMPtr = (unsigned char*)screen->pixels + ((Width * stretch_blit_yoff * Depth)>>3)+screenrect.y*screen->pitch + (screenrect.x*Depth>>3); + } + else + { + g_pLogFile->textOut("Blitsurface = creatergbsurfacefrom
    "); + BlitSurface = SDL_CreateRGBSurface(Mode,GAME_STD_WIDTH, GAME_STD_HEIGHT, Depth, screen->format->Rmask, screen->format->Gmask, screen->format->Bmask, screen->format->Amask); + if (!BlitSurface) + { + g_pLogFile->textOut(RED,"VidDrv_Start(): Couldn't create BlitSurface!
    "); + return false; + } + blitsurface_alloc = 1; + VRAMPtr = (unsigned char*)screen->pixels + ((Width * stretch_blit_yoff * Depth)>>3)+screenrect.y*screen->pitch + (screenrect.x*Depth>>3); + } + + dstrect.x = 0; dstrect.y = 0; + dstrect.w = GAME_STD_WIDTH; + dstrect.h = GAME_STD_HEIGHT; + + + + // TODO: If OpenGL used, do we still need this? + + if(m_opengl) // If OpenGL could be set, initialize the matrices + { + mp_OpenGL = new COpenGL(); + if(!(mp_OpenGL->initGL(Width, Height, Depth, m_opengl_filter, Filtermode+1))) + { + delete mp_OpenGL; + mp_OpenGL = NULL; + m_opengl = false; + } + else + mp_OpenGL->setSurface(BlitSurface); + } + + return true; +} + +// alter the color palette. the palette is not actually altered +// on-screen until pal_apply() is called. +void CVideoDriver::pal_set(short colour, char red, char green, char blue) +{ + MyPalette[colour].r = red; + MyPalette[colour].g = green; + MyPalette[colour].b = blue; +} + +// applies all changes to the palette made with pal_set +void CVideoDriver::pal_apply(void) +{ + SDL_SetColors(screen, (SDL_Color *) &MyPalette, 0, 256); + SDL_SetColors(ScrollSurface, (SDL_Color *) &MyPalette, 0, 256); + if (blitsurface_alloc) + { + SDL_SetColors(BlitSurface, (SDL_Color *) &MyPalette, 0, 256); + } +} + +void CVideoDriver::sb_blit(void) +{ +SDL_Rect srcrect; +char wraphoz, wrapvrt; +int save_dstx, save_dstw, save_srcx, save_srcw; +char tempbuf[80]; + + blitBGLayer(); + + dstrect.x = 0; dstrect.y = 0; + dstrect.w = 320; dstrect.h = 200; + + srcrect.x = scrollx_buf; + srcrect.y = scrolly_buf; + if (scrollx_buf > (512-320)) + { // need to wrap right side + srcrect.w = (512-scrollx_buf); + wraphoz = 1; + } + else + { // single blit for whole horizontal copy + srcrect.w = 320; + wraphoz = 0; + } + + if (scrolly_buf > (512-200)) + { // need to wrap on bottom + srcrect.h = (512-scrolly_buf); + wrapvrt = 1; + } + else + { // single blit for whole bottom copy + srcrect.h = 200; + wrapvrt = 0; + } + + SDL_BlitSurface(ScrollSurface, &srcrect, BlitSurface, &dstrect); + + if (wraphoz && wrapvrt) + { + // first do same thing we do for wraphoz + save_dstx = dstrect.x; + save_dstw = dstrect.w; + save_srcx = srcrect.x; + save_srcw = srcrect.w; + dstrect.x = srcrect.w; + dstrect.w = 320 - dstrect.x; + srcrect.x = 0; + srcrect.w = (320 - srcrect.w); + SDL_BlitSurface(ScrollSurface, &srcrect, BlitSurface, &dstrect); + // now repeat for the bottom + // (lower-right square) + dstrect.y = srcrect.h; + dstrect.h = 200 - dstrect.y; + srcrect.y = 0; + srcrect.h = (200 - srcrect.h); + SDL_BlitSurface(ScrollSurface, &srcrect, BlitSurface, &dstrect); + // (lower-left square) + dstrect.x = save_dstx; + dstrect.w = save_dstw; + srcrect.x = save_srcx; + srcrect.w = save_srcw; + SDL_BlitSurface(ScrollSurface, &srcrect, BlitSurface, &dstrect); + } + else if (wraphoz) + { + dstrect.x = srcrect.w; + dstrect.w = 320 - dstrect.x; + srcrect.x = 0; + srcrect.w = (320 - srcrect.w); + SDL_BlitSurface(ScrollSurface, &srcrect, BlitSurface, &dstrect); + } + else if (wrapvrt) + { + dstrect.y = srcrect.h; + dstrect.h = 200 - dstrect.y; + srcrect.y = 0; + srcrect.h = (200 - srcrect.h); + SDL_BlitSurface(ScrollSurface, &srcrect, BlitSurface, &dstrect); + } + + drawConsoleMessages(); + if (showfps) + { + +#ifdef DEBUG + sprintf(tempbuf, "FPS: %03d; x = %ld ; y = %d", fps, player[0].x >>CSF, player[0].y >>CSF); + +#else + sprintf(tempbuf, "FPS: %03d", fps); +#endif + g_pGraphics->drawFont( (unsigned char *) tempbuf, 320-3-(strlen( (char *) tempbuf)<<3), 3, 1); + } + + update_screen(); +} +void CVideoDriver::blitBGLayer(void) +{ + SDL_BlitSurface(BGLayerSurface, NULL, BlitSurface, NULL); +} + +void CVideoDriver::update_screen(void) +{ + if(m_opengl) + { + SDL_BlitSurface(FGLayerSurface, NULL, BlitSurface, NULL); + + mp_OpenGL->render(); + + SDL_LockSurface(FGLayerSurface); + // Flush the layers + memset(FGLayerSurface->pixels,SDL_MapRGB(FGLayerSurface->format, 0, 0, 0), + GAME_STD_WIDTH*GAME_STD_HEIGHT*FGLayerSurface->format->BytesPerPixel); + SDL_UnlockSurface(FGLayerSurface); + } + else // No OpenGL but Software Rendering + { + SDL_BlitSurface(FGLayerSurface, NULL, BlitSurface, NULL); + + // if we're doing zoom then we have copied the scroll buffer into + // another offscreen buffer, and must now stretchblit it to the screen + if (Zoom == 1 && Width != 320 ) + { + SDL_LockSurface(BlitSurface); + SDL_LockSurface(screen); + + if(Filtermode == 0) + { + noscale((char*)VRAMPtr, (char*)BlitSurface->pixels, (Depth>>3)); + } + else + { + g_pLogFile->textOut(PURPLE,"Sorry, but this filter doesn't work at that zoom mode
    "); + g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter
    "); + Filtermode = 0; + } + SDL_UnlockSurface(screen); + SDL_UnlockSurface(BlitSurface); + } + if (Zoom == 2) + { + SDL_LockSurface(BlitSurface); + SDL_LockSurface(screen); + + if(Filtermode == 0) + { + scale2xnofilter((char*)VRAMPtr, (char*)BlitSurface->pixels, (Depth>>3)); + } + else if(Filtermode == 1) + { + scale(2, VRAMPtr, Width*(Depth>>3), BlitSurface->pixels, + GAME_STD_WIDTH*(Depth>>3), (Depth>>3), GAME_STD_WIDTH, GAME_STD_HEIGHT); + } + else + { + g_pLogFile->textOut(PURPLE,"Sorry, but this filter doesn't work at that zoom mode
    "); + g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter
    "); + Filtermode = 0; + } + + SDL_UnlockSurface(screen); + SDL_UnlockSurface(BlitSurface); + } + else if (Zoom == 3) + { + SDL_LockSurface(BlitSurface); + SDL_LockSurface(screen); + + if(Filtermode == 0) + { + scale3xnofilter((char*)VRAMPtr, (char*)BlitSurface->pixels, (Depth>>3)); + } + else if(Filtermode == 1) + { + scale(2, VRAMPtr, Width*(Depth>>3), BlitSurface->pixels, + GAME_STD_WIDTH*(Depth>>3), (Depth>>3), GAME_STD_WIDTH, GAME_STD_HEIGHT); + } + else if(Filtermode == 2) + { + scale(3, VRAMPtr, Width*(Depth>>3), BlitSurface->pixels, + GAME_STD_WIDTH*(Depth>>3), (Depth>>3), GAME_STD_WIDTH, GAME_STD_HEIGHT); + } + else + { + g_pLogFile->textOut(PURPLE,"Sorry, but this filter doesn't work at that zoom mode
    "); + g_pLogFile->textOut(PURPLE,"Try to use a higher zoom factor. Switching to no-filter
    "); + Filtermode = 0; + } + SDL_UnlockSurface(screen); + SDL_UnlockSurface(BlitSurface); + + } + SDL_UpdateRect(screen, screenrect.x, screenrect.y, screenrect.w, screenrect.h); + + SDL_LockSurface(FGLayerSurface); + // Flush the layers + memset(FGLayerSurface->pixels,SDL_MapRGB(FGLayerSurface->format, 0, 0, 0), + GAME_STD_WIDTH*GAME_STD_HEIGHT*FGLayerSurface->format->BytesPerPixel); + SDL_UnlockSurface(FGLayerSurface); + } +} + +void CVideoDriver::noscale(char *dest, char *src, short bbp) +{ + // just passes a blitsurface to the screen + int i; + for(i=0 ; i < 200 ; i++) + memcpy(dest+(i*Width)*bbp,src+(i*GAME_STD_WIDTH)*bbp,320*bbp); +} + +void CVideoDriver::scale2xnofilter(char *dest, char *src, short bbp) +{ + // workaround for copying correctly stuff to the screen, so the screen is scaled normally + // to 2x (without filter). This applies to 16 and 32-bit colour depth. + // use bit shifting method for faster blit! + bbp >>= 1; + + int i,j; + for(i=0 ; i < 200 ; i++) + { + for(j = 0; j < 320 ; j++) + { + memcpy(dest+((j<<1)<>= 1; + + int i,j; + for(i=0 ; i < 200 ; i++) + { + for(j = 0; j < 320 ; j++) + { + // j*3 = (j<<1) + j + memcpy(dest+(((j<<1)+j)< Width || y > Height ) + return; + + + if(BlitSurface->format->BitsPerPixel == 16) + { + Uint16 *ubuff16; + ubuff16 = (Uint16*) FGLayerSurface->pixels; + ubuff16 += (y * 320) + x; + *ubuff16 = convert4to16BPPcolor(c, BlitSurface); + } + else if(BlitSurface->format->BitsPerPixel == 32) + { + Uint32 *ubuff32; + ubuff32 = (Uint32*) FGLayerSurface->pixels; + ubuff32 += (y * 320) + x; + *ubuff32 = convert4to32BPPcolor(c, BlitSurface); + } + else + { + Uint8 *ubuff8; + ubuff8 = (Uint8*) FGLayerSurface->pixels; + ubuff8 += (y * 320) + x; + *ubuff8 = (Uint8) c; + } +} +unsigned char CVideoDriver::getpixel(int x, int y) +{ + return 0; +} + +// "Console" here refers to the capability to pop up in-game messages +// in the upper-left corner during game play ala Doom. +void CVideoDriver::drawConsoleMessages(void) +{ +int i; +int y; + + if (!NumConsoleMessages) return; + if (!ConsoleExpireTimer) + { + NumConsoleMessages--; + if (!NumConsoleMessages) return; + ConsoleExpireTimer = CONSOLE_EXPIRE_RATE; + } + else ConsoleExpireTimer--; + + y = CONSOLE_MESSAGE_Y; + for(i=0;idrawFont( (unsigned char *) cmsg[i].msg, CONSOLE_MESSAGE_X, y, 1); + y += CONSOLE_MESSAGE_SPACING; + } +} + +// removes all console messages +void CVideoDriver::DeleteConsoleMsgs(void) +{ + NumConsoleMessages = 0; +} + +// adds a console msg to the top of the screen and scrolls any +// other existing messages downwards +void CVideoDriver::AddConsoleMsg(const char *the_msg) +{ +int i; + for(i=MAX_CONSOLE_MESSAGES-2;i>=0;i--) + { + strcpy(cmsg[i+1].msg, cmsg[i].msg); + } + strcpy(cmsg[0].msg, the_msg); + + if (NumConsoleMessages < MAX_CONSOLE_MESSAGES) NumConsoleMessages++; + ConsoleExpireTimer = CONSOLE_EXPIRE_RATE; +} + +short CVideoDriver::getZoomValue(void){ return Zoom; } + +void CVideoDriver::showFPS(bool value){ showfps = value; } + +void CVideoDriver::isFullscreen(bool value) +{ + //SDL_Rect** Modes; + //int i; + + //if(value == false) + //{ + Fullscreen = value; + return; + //} + + /*Modes = SDL_ListModes(NULL, SDL_FULLSCREEN); + + // Check if there are any modes available + if (Modes == (SDL_Rect**)0) { + g_pLogFile->textOut(PURPLE,"No modes for Fullscreen available!
    "); + } + + // Print valid modes + for (i=0; Modes[i]; ++i) + { + if(Modes[i]->w == Width) + { + if(Modes[i]->h == Height) + { + Fullscreen = value; + return; + } + } + } + g_pLogFile->textOut(PURPLE,"This mode doesn't exist for Fullscreen!
    "); + + Fullscreen = value;*/ +} + +unsigned short CVideoDriver::getFrameskip(void) +{ + return FrameSkip; +} +bool CVideoDriver::getShowFPS(void) +{ + return showfps; +} +short CVideoDriver::getFiltermode(void) +{ + if(Filtermode < 0) + Filtermode = 0; + return Filtermode; +} +bool CVideoDriver::getFullscreen(void) +{ return Fullscreen; } +unsigned int CVideoDriver::getWidth(void) +{ return Width; } +unsigned int CVideoDriver::getHeight(void) +{ return Height; } +unsigned short CVideoDriver::getDepth(void) +{ return Depth; } +SDL_Surface *CVideoDriver::getScrollSurface(void) +{ return ScrollSurface; } +SDL_Surface *CVideoDriver::getBGLayerSurface(void) +{ return BGLayerSurface; } + + diff --git a/src/sdl/CVideoDriver.h b/src/sdl/CVideoDriver.h new file mode 100644 index 000000000..29e2ebe9d --- /dev/null +++ b/src/sdl/CVideoDriver.h @@ -0,0 +1,101 @@ +/* + * CVideoDriver.h + * + * Created on: 17.03.2009 + * Author: gerstrong + */ + +#ifndef CVIDEODRIVER_H_ +#define CVIDEODRIVER_H_ + +#include "../CSingleton.h" +#define g_pVideoDriver CVideoDriver::Get() + +#include "COpenGL.h" + +#include + +class CVideoDriver : public CSingleton +{ +public: + CVideoDriver(); + virtual ~CVideoDriver(); + + bool applyMode(void); + bool createSurfaces(void); + void stop(void); + bool start(void); + void setMode(unsigned int srcW, unsigned int srcH, + unsigned short srcD); + void isFullscreen(bool value); + //void reset(void); + void drawConsoleMessages(void); + + void pal_set(short colour, char red, char green, char blue); + void pal_apply(void); + + void sb_blit(void); + void blitBGLayer(void); + void update_screen(void); + void noscale(char *dest, char *src, short bbp); + void scale2xnofilter(char *dest, char *src, short bbp); + void scale3xnofilter(char *dest, char *src, short bbp); + + void setpixel(unsigned int x, unsigned int y, unsigned char c); + unsigned char getpixel(int x, int y); + + void DeleteConsoleMsgs(void); + void AddConsoleMsg(const char *the_msg); + + short getZoomValue(void); + unsigned short getFrameskip(void); + bool getShowFPS(void); + short getFiltermode(void); + bool getFullscreen(void); + unsigned int getWidth(void); + unsigned int getHeight(void); + unsigned short getDepth(void); + bool isOpenGL(void) { return m_opengl; } + unsigned char getOGLFilter(void) { return (m_opengl_filter==GL_LINEAR); } + SDL_Surface *getScrollSurface(void); + SDL_Surface *getBGLayerSurface(void); + + void setFrameskip(unsigned short value); + void setFilter(short value); + void setZoom(short value); + void enableOpenGL(bool value) { m_opengl = value; } + void setOGLFilter(unsigned char value) { m_opengl_filter = (value==1) ? GL_LINEAR : GL_NEAREST ; } + + void showFPS(bool value); + +private: + COpenGL *mp_OpenGL; + + unsigned int Width; + unsigned int Height; + unsigned short Depth; + unsigned int Mode; + bool Fullscreen; + short Filtermode; + unsigned short Zoom; + unsigned short FrameSkip; + bool showfps; + bool m_opengl; + int m_opengl_filter; + + SDL_Rect screenrect; + SDL_Rect blitrect; + + SDL_Color MyPalette[256]; + + SDL_Surface *screen; // the actual video memory/window + SDL_Surface *BGLayerSurface; // Special surface which support more colors than the scrollsurface + //for (Ex. HQ-Images) + SDL_Surface *ScrollSurface; // 512x512 scroll buffer + SDL_Surface *FGLayerSurface; // Scroll buffer for Messages + // pointer to the surface that sb_blit is to assemble the scroll buffer into. + // if zoom=1 this is the same as "screen", else it's allocated as it's own + // buffer of 320x200. + SDL_Surface *BlitSurface; +}; +#endif /* CVIDEODRIVER_H_ */ diff --git a/src/sdl/joydrv.cpp b/src/sdl/joydrv.cpp new file mode 100644 index 000000000..ce771e4f2 --- /dev/null +++ b/src/sdl/joydrv.cpp @@ -0,0 +1,57 @@ +/* JOYDRV.C + +*/ + +#include "../keen.h" +#include "../keenext.h" +#include "CVideoDriver.h" +#include "../CLogFile.h" + +#include +#include "joydrv.h" + +char JoyDrv_Start(SDL_Joystick **joystick) +{ + + g_pLogFile->textOut("JoyDrv_Start() : "); + + if (SDL_Init( SDL_INIT_JOYSTICK ) < 0) + { + g_pLogFile->ftextOut("JoyDrv_Start() : Couldn't initialize SDL: %s
    ", SDL_GetError()); + return 1; + } + else + { + int i=0; + int joynum; + joynum = SDL_NumJoysticks(); + if(joynum) + { + if(joynum == 1) + g_pLogFile->ftextOut("1 joystick was found.
    \n", joynum ); + else + g_pLogFile->ftextOut("%i joysticks were found.
    \n", joynum ); + g_pLogFile->textOut("The names of the joysticks are:
    "); + + for( i=0; i < SDL_NumJoysticks(); i++ ) + { + g_pLogFile->ftextOut(" %s
    ", SDL_JoystickName(i)); + } + } + else + { + g_pLogFile->ftextOut("No joysticks were found.
    \n"); + } + } + + SDL_JoystickEventState(SDL_ENABLE); + *joystick = SDL_JoystickOpen(0); + + return 0; +} + +void JoyDrv_Stop(SDL_Joystick **joystick) +{ + if(*joystick) + SDL_JoystickClose(*joystick); +} diff --git a/src/sdl/joydrv.h b/src/sdl/joydrv.h new file mode 100644 index 000000000..17221c0c8 --- /dev/null +++ b/src/sdl/joydrv.h @@ -0,0 +1,4 @@ + + +char JoyDrv_Start(SDL_Joystick **joystick); +void JoyDrv_Stop(SDL_Joystick **joystick); diff --git a/src/sdl/sound/CSound.cpp b/src/sdl/sound/CSound.cpp new file mode 100644 index 000000000..e0a9a264e --- /dev/null +++ b/src/sdl/sound/CSound.cpp @@ -0,0 +1,582 @@ +/* + * CSound.cpp + * + * Created on: 23.05.2009 + * Author: gerstrong + */ + +#include "../../keen.h" +#include "../../include/fileio/lzexe.h" +#include "CSound.h" +#include "../../include/fileio.h" +#include "../../CLogFile.h" +#include "../../hqp/CMusic.h" +#include "../../vorticon/sounds.h" + +#define SAFE_DELETE_ARRAY(x) if(x) delete[] x; x=NULL + +#define BLITBUF_XSIZE 320 // Used only for balance in stereo mode + +// define a callback function we can work with +void CCallback(void *unused, Uint8 *stream, int len) +{ + // let it call a method on my (singleton) sound object + g_pSound->callback(unused, stream, len); +} + + +CSound::CSound() { + m_active = false; + m_volume = 0; + m_mixing_channels = 0; + m_soundchannel = NULL; + m_soundslot = NULL; + m_MixedForm = NULL; + AudioSpec.channels = 2; // Stereo Sound + AudioSpec.format = AUDIO_U8; // 8-bit sound + AudioSpec.freq = 48000; // high quality +} + +CSound::~CSound() { + destroy(); + if (m_soundslot) { delete[] m_soundslot; m_soundslot = NULL; } + if (m_soundchannel) { delete[] m_soundchannel; m_soundchannel = NULL; } +} + +bool CSound::init(void) +{ + char name[MAX_STRING_LENGTH]; + + // now start up the SDL sound system + AudioSpec.silence = 0; + AudioSpec.samples = 1024; + AudioSpec.callback = CCallback; + AudioSpec.userdata = NULL; + + /* Initialize fillerup() variables */ + if( SDL_OpenAudio(&AudioSpec, NULL) < 0 ) + { + g_pLogFile->ftextOut("SoundDrv_Start(): The Sound settings don't work! Going into Failsafemode!
    "); + + AudioSpec.channels = 1; + AudioSpec.freq = 11000; + + if( SDL_OpenAudio(&AudioSpec, NULL) < 0 ) + { + g_pLogFile->ftextOut("SoundDrv_Start(): Couldn't open audio: %s
    ", SDL_GetError()); + g_pLogFile->ftextOut("Sound will be disabled.
    "); + AudioSpec.channels = 0; + AudioSpec.format = 0; + AudioSpec.freq = 0; + m_active = false; + return false; + } + } + + m_MixedForm = new Uint8[AudioSpec.size]; + + g_pLogFile->ftextOut("SDL_AudioSpec:
    "); + g_pLogFile->ftextOut(" freq: %d
    ", AudioSpec.freq); + g_pLogFile->ftextOut(" channels: %d
    ", AudioSpec.channels); + g_pLogFile->ftextOut(" audio buffer size: %d
    ", AudioSpec.size); + g_pLogFile->ftextOut("Using audio driver: %s
    ", SDL_AudioDriverName(name, 32)); + + m_mixing_channels = 7; + + switch(m_mixing_channels) + { + case 15: m_mixing_channels_base = 4; break; + case 7: m_mixing_channels_base = 3; break; + case 3: m_mixing_channels_base = 2; + default: break; + } + + m_volume = 2; // Max Value!; + + if(m_soundchannel) delete[] m_soundchannel; m_soundchannel = NULL; + m_soundchannel = new CSoundChannel[m_mixing_channels]; + + for(unsigned short i=0 ; i < m_mixing_channels ; i++) + m_soundchannel[i].setFrequencyCorrection(AudioSpec.freq); + + SDL_PauseAudio(0); + + g_pLogFile->ftextOut("Sound System: SDL sound system initialized.
    "); + m_active = true; + + return true; +} + +void CSound::destroy(void) +{ + stopAllSounds(); + + if (m_active) + { + SDL_PauseAudio(1); + SDL_CloseAudio(); + m_active = false; + m_mixing_channels = 0; + } + SAFE_DELETE_ARRAY(m_MixedForm); + SAFE_DELETE_ARRAY(m_soundchannel); + SAFE_DELETE_ARRAY(m_soundslot); + + g_pLogFile->ftextOut("SoundDrv_Stop(): shut down.
    "); +} + + +// stops all currently playing sounds +void CSound::stopAllSounds(void) +{ + for(unsigned int chnl=0;chnlplaying() == PLAY_MODE_PLAY) + { + SDL_MixAudio(stream, g_pMusicPlayer->passBuffer(len), len, SDL_MIX_MAXVOLUME); + } + + for( i=0 ; i < m_mixing_channels ; i++ ) + { + m_soundchannel[i].readWaveform(m_MixedForm, len, AudioSpec.channels, AudioSpec.freq); + SDL_MixAudio(stream, m_MixedForm, len, SDL_MIX_MAXVOLUME); + } +} + +// if priorities allow, plays the sound "snd". +// nonzero return value indicates a higher priority sound is playing. +void CSound::playSound(int snd, char mode) +{ + playStereosound(snd, mode, 0); +} + +void CSound::playStereofromCoord(int snd, char mode, unsigned int xcoordinate) +{ + if(AudioSpec.channels == 2) + { + int bal; + + bal = ((short)(xcoordinate) - (BLITBUF_XSIZE>>1)); // Faster calculation of balance transformation + + if(bal < -127) + bal = -127; + else if(bal > 127) + bal = 127; + + playStereosound(snd, mode, bal); + } + else + playSound(snd, mode); +} + +void CSound::playStereosound(int snd, char mode, short balance) +{ + if(!(m_mixing_channels && m_active)) return; + + short chnl = 0; + int i; + + if (mode==PLAY_NORESTART) + { + if (isPlaying(snd)) + return; + } + + // if a forced sound is playing then let it play + if (forcedisPlaying()) return; + + // stop all other sounds if this sound has maximum priority + if (m_soundslot[snd].getPriority()==255 || mode==PLAY_FORCE) + { + stopAllSounds(); + } + + if (snd==SOUND_KEEN_FALL) + { // only play KEEN_FALL if no other sounds are playing + for(chnl=0;chnl m_soundslot[snd].getPriority()) + { + return; + } + } + } + chnl = 0; + goto playsound; + } + + // first try to find an empty channel + for(chnl=0;chnlftextOut("sound_load_all(): loading all sounds...
    "); + + char buffer[256]; + + formatPathString(buffer,path); + + sprintf(soundfile, "%ssounds.ck%d", buffer,Episode); + + FILE *p_file; + + if( ( p_file = fopen(soundfile,"rb") ) == NULL ) + { + formatPathString(buffer,path); + + sprintf(buf,"keen%d.exe",Episode); + g_pLogFile->ftextOut("sound_load_all(): \"%s\" was not found in the data directory. Looking for \"%s\" in \"%s\" and trying to extract this file
    ", soundfile, buf, buffer); + extractOfExeFile(buffer, Episode); + } + else + fclose(p_file); + + ok = m_soundslot[SOUND_KEEN_WALK].loadSound(soundfile, "KEENWALKSND", SOUND_KEEN_WALK); + ok |= m_soundslot[SOUND_KEEN_WALK2].loadSound(soundfile, "KEENWLK2SND", SOUND_KEEN_WALK2); + ok |= m_soundslot[SOUND_KEEN_JUMP].loadSound(soundfile, "KEENJUMPSND", SOUND_KEEN_JUMP); + ok |= m_soundslot[SOUND_KEEN_POGO].loadSound(soundfile, "KEENPOGOSND", SOUND_KEEN_POGO); + ok |= m_soundslot[SOUND_KEEN_LAND].loadSound(soundfile, "KEENLANDSND", SOUND_KEEN_LAND); + ok |= m_soundslot[SOUND_KEEN_BLOK].loadSound(soundfile, "KEENBLOKSND", SOUND_KEEN_BLOK); + ok |= m_soundslot[SOUND_KEEN_DIE].loadSound(soundfile, "KEENDIESND", SOUND_KEEN_DIE); + ok |= m_soundslot[SOUND_KEEN_FALL].loadSound(soundfile, "PLUMMETSND", SOUND_KEEN_FALL); + ok |= m_soundslot[SOUND_KEEN_BUMPHEAD].loadSound(soundfile, "BUMPHEADSND", SOUND_KEEN_BUMPHEAD); + ok |= m_soundslot[SOUND_ENTER_LEVEL].loadSound(soundfile, "WLDENTERSND", SOUND_ENTER_LEVEL); + ok |= m_soundslot[SOUND_KEENSLEFT].loadSound(soundfile, "keensleft", SOUND_KEENSLEFT); + + ok |= m_soundslot[SOUND_KEEN_FIRE].loadSound(soundfile, "KEENFIRESND", SOUND_KEEN_FIRE); + ok |= m_soundslot[SOUND_GUN_CLICK].loadSound(soundfile, "GUNCLICK", SOUND_GUN_CLICK); + ok |= m_soundslot[SOUND_SHOT_HIT].loadSound(soundfile, "SHOTHIT", SOUND_SHOT_HIT); + + ok |= m_soundslot[SOUND_GET_ITEM].loadSound(soundfile, "GOTITEMSND", SOUND_GET_ITEM); + ok |= m_soundslot[SOUND_GET_BONUS].loadSound(soundfile, "GOTBONUSSND", SOUND_GET_BONUS); + ok |= m_soundslot[SOUND_GET_PART].loadSound(soundfile, "GOTPARTSND", SOUND_GET_PART); + ok |= m_soundslot[SOUND_LEVEL_DONE].loadSound(soundfile, "LVLDONESND", SOUND_LEVEL_DONE); + ok |= m_soundslot[SOUND_GAME_OVER].loadSound(soundfile, "GAMEOVERSND", SOUND_GAME_OVER); + ok |= m_soundslot[SOUND_TELEPORT].loadSound(soundfile, "TELEPORTSND", SOUND_TELEPORT); + ok |= m_soundslot[SOUND_EXTRA_LIFE].loadSound(soundfile, "EXTRAMANSND", SOUND_EXTRA_LIFE); + ok |= m_soundslot[SOUND_CHUNKSMASH].loadSound(soundfile, "CHUNKSMASH", SOUND_CHUNKSMASH); + ok |= m_soundslot[SOUND_GOINDOOR].loadSound(soundfile, "GOINDOORSND", SOUND_GOINDOOR); + ok |= m_soundslot[SOUND_GET_CARD].loadSound(soundfile, "GETCARDSND", SOUND_GET_CARD); + ok |= m_soundslot[SOUND_USE_KEY].loadSound(soundfile, "USEKEYSND", SOUND_USE_KEY); + ok |= m_soundslot[SOUND_SWITCH_TOGGLE].loadSound(soundfile, "CLICKSND", SOUND_SWITCH_TOGGLE); + ok |= m_soundslot[SOUND_DOOR_OPEN].loadSound(soundfile, "DOOROPENSND", SOUND_DOOR_OPEN); + + ok |= m_soundslot[SOUND_YORP_BUMP].loadSound(soundfile, "YORPBUMPSND", SOUND_YORP_BUMP); + ok |= m_soundslot[SOUND_YORP_STUN].loadSound(soundfile, "YORPBOPSND", SOUND_YORP_STUN); + ok |= m_soundslot[SOUND_YORP_DIE].loadSound(soundfile, "YORPSCREAM", SOUND_YORP_DIE); + ok |= m_soundslot[SOUND_GARG_DIE].loadSound(soundfile, "GARGSCREAM", SOUND_GARG_DIE); + ok |= m_soundslot[SOUND_VORT_DIE].loadSound(soundfile, "vortscream", SOUND_VORT_DIE); + ok |= m_soundslot[SOUND_TANK_FIRE].loadSound(soundfile, "TANKFIRE", SOUND_TANK_FIRE); + + if (Episode == 2) + { + ok |= m_soundslot[33].loadSound(soundfile, "EARTHPOW", SOUND_EARTHPOW); + } + else if (Episode == 3) + { + ok |= m_soundslot[SOUND_MEEP].loadSound(soundfile, "MEEP", SOUND_MEEP); + ok |= m_soundslot[SOUND_ANKH].loadSound(soundfile, "ANKH", SOUND_ANKH); + ok |= m_soundslot[SOUND_MORTIMER].loadSound(soundfile, "MORTIMER", SOUND_MORTIMER); + ok |= m_soundslot[SOUND_FOOTSLAM].loadSound(soundfile, "FOOTSLAM", SOUND_FOOTSLAM); + } + + for( unsigned short i=0 ; i (2008) + Copyright (C) 2007 Hans de Goede + + Many thanks to Mitugu(Kou) Kurizono for the decompression algorithm. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +char CSound::extractOfExeFile(char *inputpath, int episode) +{ + const char *outputfname; + int bit_count; + FILE *fin, *fout; + unsigned char buf[131072]; + short offset; + int pos, repeat, sounds_start, sounds_end, ret = 0; + char buffer[MAX_STRING_LENGTH]; + char inputfname[MAX_STRING_LENGTH]; + + pos = 0; + bit_count = 0; + memset(buffer,0, MAX_STRING_LENGTH*sizeof(char)); + memset(inputfname,0, MAX_STRING_LENGTH*sizeof(char)); + + if (episode == 2) + { + outputfname = "sounds.ck2"; + sounds_start = 0x12730; + sounds_end = 0x14BDA; + } + else if (episode == 3) + { + outputfname = "sounds.ck3"; + sounds_start = 0x13A70; + sounds_end = 0x164D4; + } + else + { + g_pLogFile->ftextOut("Error: Unknown keen executable name: %s
    ", inputfname); + return 1; + } + + strcpy(buffer,inputpath); + sprintf(inputfname,"%skeen%d.exe", inputpath, episode); + + fin = fopen(inputfname, "rb"); + + if (!fin) + { + g_pLogFile->ftextOut( "Error opening input file %s: ", inputfname); + perror(NULL); + return 2; + } + else + { + sprintf(buffer,"%s%s", inputpath, outputfname); + + fout = fopen(buffer, "wb"); + if (!fout) + { + g_pLogFile->ftextOut( "Error opening output file %s: ", outputfname); + perror(NULL); + fclose(fin); + } + + /* skip header */ + fseek(fin, 32, SEEK_SET); + + while (1) + { + if (ferror(fin)) + { + g_pLogFile->ftextOut( "Error reading from input file %s:", inputfname); + perror(NULL); + fclose(fin); + fclose(fout); + return 1; + } + + if (get_bit(&bit_count, &fin)) + { + buf[pos++] = getc(fin); + } + else + { + if (get_bit(&bit_count, &fin)) + { + unsigned char tmp[2]; + fread(tmp, 1, 2, fin); + repeat = (tmp[1] & 0x07); + + offset = ((tmp[1] & ~0x07) << 5) | tmp[0] | 0xE000; + + if (repeat == 0) + { + repeat = getc (fin); + + + if (repeat == 0) + break; + else if (repeat == 1) + continue; + else + repeat++; + } + else + repeat += 2; + } + else + { + repeat = ((get_bit(&bit_count, &fin) << 1) | get_bit(&bit_count, &fin)) + 2; + offset = getc(fin) | 0xFF00; + } + + while (repeat > 0) + { + buf[pos] = buf[pos + offset]; + pos++; + repeat--; + } + } + } + g_pLogFile->ftextOut("Decompression (unlzexe) of %s done
    ", inputfname); + + if (strcmp((char *)(&buf[sounds_start]), "SND")) + { + g_pLogFile->ftextOut( "Error: Beginning of sound data not found at expected offset
    "); + ret = 1; + } + else if ((int)fwrite(&buf[sounds_start], 1, sounds_end - sounds_start, fout) != + (sounds_end - sounds_start)) + { + g_pLogFile->ftextOut( "error writing to output file %s: ", outputfname); + perror(NULL); + ret = 1; + } + g_pLogFile->ftextOut("%s has been successfully written
    ", outputfname); + + fclose(fin); + fclose(fout); + + } + + return ret; +} +void CSound::setSoundmode(int freq, bool stereo) +{ + if(stereo) + AudioSpec.channels = 2; + else + AudioSpec.channels = 1; + + switch(freq) + { + case 0: break; // means that the actual frequency stays untouched + case 11000: + case 22050: + case 44100: + case 48000: + AudioSpec.freq = freq; + break; + default: + AudioSpec.freq = 48000; + } +} + diff --git a/src/sdl/sound/CSound.h b/src/sdl/sound/CSound.h new file mode 100644 index 000000000..23e59e0e3 --- /dev/null +++ b/src/sdl/sound/CSound.h @@ -0,0 +1,63 @@ +/* + * CSound.h + * + * Created on: 23.05.2009 + * Author: gerstrong + */ + +#ifndef CSOUND_H_ +#define CSOUND_H_ + +#include "../../CSingleton.h" +#define g_pSound CSound::Get() + +#include +#include "CSoundChannel.h" +#include "CSoundSlot.h" + +class CSound : public CSingleton +{ +public: + CSound(); + virtual ~CSound(); + + bool init(void); + void stop(void); + char loadSoundData(unsigned short Episode, char *DataDirectory); + void stopAllSounds(void); + + bool forcedisPlaying(void); + char sound_load_all(const char *path); + void transform_into_logaritmic_sound(int *pcmstream, int len); + void callback(void *unused, Uint8 *stream, int len); + void pauseSound(void); + void resumeSounds(void); + void playSound(int snd, char mode); + void playStereofromCoord(int snd, char mode, unsigned int xcoordinate); + void playStereosound(int snd, char mode, short balance); + bool isPlaying(int snd); + void stopSound(int snd); + void destroy(void); + + SDL_AudioSpec getAudioSpec(void) { return AudioSpec; } + unsigned short getMixingchannels(void) { return m_mixing_channels; }; + + void setSoundmode(int freq, bool stereo); + + char extractOfExeFile(char *inputpath, int episode); // This is a special funktion. It doesn't belong here! + +private: + CSoundChannel *m_soundchannel; + CSoundSlot *m_soundslot; + + SDL_AudioSpec AudioSpec; + + unsigned short m_volume; + bool m_active; + unsigned short m_mixing_channels; + unsigned short m_mixing_channels_base; + + Uint8 *m_MixedForm; // Mainly used by the callback function. Declared once and allocated +}; + +#endif /* CSOUND_H_ */ diff --git a/src/sdl/sound/CSoundChannel.cpp b/src/sdl/sound/CSoundChannel.cpp new file mode 100644 index 000000000..2ebba2e4d --- /dev/null +++ b/src/sdl/sound/CSoundChannel.cpp @@ -0,0 +1,259 @@ +/* + * CSoundChannel.cpp + * + * Created on: 23.05.2009 + * Author: gerstrong + */ + +#include "CSoundChannel.h" + +CSoundChannel::CSoundChannel() { + m_current_sound = 0; + m_freq_corr = 0; // used for correcting PC-Speaker sampling for different frequencies + m_sound_ptr = 0; + m_sound_timer = 0; + m_sound_playing = false; + m_waveState = WAVE_IN; + m_hq = false; + m_sound_paused = true; + m_sound_forced = false; + m_pSoundSlot = NULL; + + m_desiredfreq = 0; // current desired frequency in hz + m_changerate = 0; // frequency in samples (calculated) + m_freqtimer = 0; // time when to change waveform state + m_waveState = 0; // current position of the output waveform + m_balance = 0; +} + +CSoundChannel::~CSoundChannel() { +} + +void CSoundChannel::setFrequencyCorrection(int freq) +{ + switch (freq) + { + case 48000: m_freq_corr = 16; break; + case 44100: m_freq_corr = 15; break; + case 22050: m_freq_corr = 14; break; + case 11000: m_freq_corr = 12; break; + default: m_freq_corr = 0; break; + } +} + +void CSoundChannel::stopSound(void) +{ + m_current_sound = 0; + m_sound_ptr = 0; + m_sound_timer = 0; + m_sound_playing = false; + m_waveState = WAVE_IN; + m_freqtimer = 0; +} + +void CSoundChannel::setupSound(unsigned short current_sound, + unsigned int sound_timer, + bool playing, + int waveState, + unsigned int freqtimer, + bool sound_forced) +{ + m_current_sound = current_sound; + m_sound_timer = sound_timer; + m_sound_playing = playing; + m_waveState = waveState; + m_freqtimer = freqtimer; + m_sound_forced = sound_forced; +} + +// generates len bytes of waveform for the channel. +void CSoundChannel::generateWaveform(Uint8 *waveform, unsigned int len, int frequency, bool stereo) +{ + int i; + int waittime; // How much do we divide wait time for change? + unsigned int halffreq; + unsigned int index; + char firsttime; + unsigned char *WaveBuffer; + + WaveBuffer = new unsigned char[len]; + + halffreq = (frequency>>1); + + if(m_freq_corr == 16) + waittime = (frequency / SLOW_RATE); + else + waittime = (((m_freq_corr*frequency)>>4) / SLOW_RATE); + + // setup so we process a new byte of the sound first time through + firsttime = 1; + + for(index=0;index m_changerate) + { // toggle waveform, generating a square wave + i=0; + + if(m_sound_ptr > 0) + i=5; + + if (m_waveState == WAVE_SILENCE-i) + m_waveState = WAVE_SILENCE+i; + else + m_waveState = WAVE_SILENCE-i; + + m_freqtimer = 0; + } + else m_freqtimer++; + + // put wave data into buffer + WaveBuffer[index] = m_waveState; + } + + if(stereo) // Primitive stereo transformation + { + if(index < len) + { + WaveBuffer[index + 1] = m_waveState; + index++; + } + } + } + + memcpy(waveform, WaveBuffer,len); + + delete[] WaveBuffer; +} + +// This programme reads the balance information and balances the stereo sound +void CSoundChannel::transintoStereoChannels(Uint8* waveform, unsigned int len) +{ + if(m_balance != 0) // Because, if it is not zero, there is no balance, and waves must be adapted + { + // -127 is only for the left speaker, while 127 is for the right speaker. 0 Is center + + unsigned int index; + float f_value; // Needed for better calculation of mixing the stereo channels + + if(m_hq) + { + // balance the left channel. + for( index = 0 ; index < len-1 ; index += 2 ) + { + // balance here! + f_value = (127 - (m_balance)) * ( waveform[index] - WAVE_SILENCE ); + f_value /= 127 ; + if(WAVE_SILENCE + f_value < 255) + waveform[index] = WAVE_SILENCE + f_value; + } + + // balance the right channel. + for( index = 1 ; index < len; index += 2 ) + { + // balance here! + f_value = (127 + (m_balance)) * ( waveform[index] - WAVE_SILENCE ); + f_value /= 127 ; + if(WAVE_SILENCE + f_value < 255) + waveform[index] = WAVE_SILENCE + f_value; + } + } + else + { + // balance the left channel. + for( index = 0 ; index < len-1 ; index += 2 ) + { + // balance here! + f_value = ( (127 - (m_balance)) * ( waveform[index] - WAVE_SILENCE ) ) / 127 ; + waveform[index] = WAVE_SILENCE + f_value; + } + + // balance the right channel. + for( index = 1 ; index < len; index += 2 ) + { + // balance here! + f_value = ( (127 + (m_balance)) * ( waveform[index] - WAVE_SILENCE ) ) / 127 ; + waveform[index] = WAVE_SILENCE + f_value; + } + } + } +} + +void CSoundChannel::readWaveform(Uint8* waveform, int len, Uint8 channels, int frequency) +{ + if (m_sound_playing) + { + if(!m_hq) // There is no hq sound in the buffer + { + generateWaveform(waveform, len, frequency, (channels==2) ? true : false); + } + else + { + stHQSound* hqsound = m_pSoundSlot[m_current_sound].getHQSoundPtr(); + + //memcpy(waveform, hqsounds[m_current_sound].sound_buffer + m_sound_ptr, len); + memcpy(waveform, hqsound->sound_buffer + m_sound_ptr, len); + m_sound_ptr += len; + + if ((m_sound_ptr + len) > hqsound->sound_len) + { + m_sound_ptr = 0; + m_sound_playing = false; + } + } + + if(channels == 2) + transintoStereoChannels(waveform, len); + + } + else + memset(waveform,WAVE_SILENCE,len); +} diff --git a/src/sdl/sound/CSoundChannel.h b/src/sdl/sound/CSoundChannel.h new file mode 100644 index 000000000..254c8fca9 --- /dev/null +++ b/src/sdl/sound/CSoundChannel.h @@ -0,0 +1,69 @@ +/* + * CSoundChannel.h + * + * Created on: 23.05.2009 + * Author: gerstrong + */ + +#ifndef CSOUNDCHANNEL_H_ +#define CSOUNDCHANNEL_H_ + +#include +#include "CSoundSlot.h" + +#define WAVEFORM_VOLUME 5 +#define WAVE_SILENCE 128 +#define WAVE_IN (WAVE_SILENCE-WAVEFORM_VOLUME) +#define WAVE_OUT (WAVE_SILENCE+WAVEFORM_VOLUME) + +#define SLOW_RATE 90 // Wait time for resampling PC Speaker Sound. + // The higher it is, the faster sound is played! + + +class CSoundChannel { +public: + CSoundChannel(); + virtual ~CSoundChannel(); + + void stopSound(void); + bool isPlaying() { return m_sound_playing; } + bool isForcedPlaying() { return (m_sound_playing && m_sound_forced); } + unsigned short getCurrentsound() { return m_current_sound; } + void readWaveform(Uint8* waveform, int len, Uint8 channels, int frequency); + void generateWaveform(Uint8 *waveform, unsigned int len, int frequency, bool stereo); + void transintoStereoChannels(Uint8* waveform, unsigned int len); + + short getBalance() { return m_balance; } + void setBalance(short value) { m_balance = value; } + void setFrequencyCorrection(int freq); + void enableHighQuality(bool value) { m_hq = value; } + + void setupSound(unsigned short current_sound, + unsigned int sound_timer, + bool playing, + int waveState, + unsigned int freqtimer, + bool sound_forced); + + void setSoundSlotPtr(CSoundSlot *pSoundSlot) { m_pSoundSlot = pSoundSlot;} + +private: + bool m_sound_playing; // true = a sound is currently playing + bool m_hq; // true = the sound is high quality + unsigned short m_current_sound; // # of the sound that is currently playing + Uint32 m_sound_ptr; // position within sound that we're at + unsigned int m_sound_timer; // used to slow down the rate of playback + bool m_sound_paused; // true = pause playback + bool m_sound_forced; + + unsigned int m_desiredfreq; // current desired frequency in hz + unsigned int m_changerate; // frequency in samples (calculated) + unsigned int m_freqtimer; // time when to change waveform state + int m_waveState; // current position of the output waveform + short m_balance; // This variable is used for stereo sound, and to calculate where the sound must be played! + unsigned int m_freq_corr; // used for correcting PC-Speaker sampling for different frequencies + + CSoundSlot *m_pSoundSlot; // Pointer to the Soundslots of CSound +}; + +#endif /* CSOUNDCHANNEL_H_ */ diff --git a/src/sdl/sound/CSoundSlot.cpp b/src/sdl/sound/CSoundSlot.cpp new file mode 100644 index 000000000..243a44516 --- /dev/null +++ b/src/sdl/sound/CSoundSlot.cpp @@ -0,0 +1,125 @@ +/* + * CSoundSlot.cpp + * + * Created on: 23.05.2009 + * Author: gerstrong + */ + +#define MAX_STRING_LENGTH 256 +#define MAX_SOUNDS 50 + +#define MAX_STACK_SPACE 1024 +#define SOUND_FREQ_DIVISOR 1363634 // The past original one + +#include +#include +#include "CSoundSlot.h" +#include "../../CLogFile.h" +#include "../../fileio.h" + +CSoundSlot::CSoundSlot() { + m_priority = 0; + m_sounddata = NULL; + m_hqsound.enabled = false; + m_hqsound.sound_buffer = NULL; + m_soundlength = 0; +} + +CSoundSlot::~CSoundSlot() { + HQSndDrv_Unload(&m_hqsound); + if(m_sounddata){ delete[] m_sounddata; m_sounddata = NULL; } + m_priority = 0; + m_hqsound.enabled = false; +} + +// loads sound searchname from file fname, into sounds[] entry loadnum +// return value is nonzero on failure +bool CSoundSlot::loadSound(const char *fname, const char *searchname, unsigned int loadnum) +{ + // Unload the sound if any was previously loaded + if(m_sounddata){ delete[] m_sounddata; m_sounddata = NULL; } + + // If a high quality sound file is available, try to open it. + // Otherwise open the classic sounds from the original data files + if(HQSndDrv_Load(m_pAudioSpec, &m_hqsound, searchname) == 0) + { + return true; + } + else + { + FILE *fp; + int curheader = 0x10; + int i,j; + int offset, priority, garbage, nr_of_sounds; + int sndbyte; + char name[12]; + + for(i=0;i<12;i++) + name[i] = 0; + + fp = fopen(fname, "rb"); + if (!fp) + { + g_pLogFile->ftextOut("loadSound : Sounds file '%s' unopenable attempting load of '%s'
    ", fname, searchname); + return false; + } + + fseek(fp, 0x6, SEEK_SET); + nr_of_sounds = fgeti(fp); + + j=0; + for(j=0;(jftextOut("loadSound : sound %s could not be found in %s.
    ", searchname, fname); + fclose(fp); + return false; + + sound_found: ; + // use stacking method for reading sound + unsigned int tempstack[MAX_STACK_SPACE]; + + m_soundlength = 0; + fseek(fp, offset, SEEK_SET); + for(i=0;iftextOut("loadSound : loaded sound %s of %d bytes.
    ", searchname, m_soundlength); + m_hqsound.enabled = false; + + fclose(fp); + return true; + } +} + diff --git a/src/sdl/sound/CSoundSlot.h b/src/sdl/sound/CSoundSlot.h new file mode 100644 index 000000000..f0c131f20 --- /dev/null +++ b/src/sdl/sound/CSoundSlot.h @@ -0,0 +1,36 @@ +/* + * CSoundSlot.h + * + * Created on: 23.05.2009 + * Author: gerstrong + */ + +#ifndef CSOUNDSLOT_H_ +#define CSOUNDSLOT_H_ + +#include "../../hqp/hq_sound.h" + +class CSoundSlot { +public: + CSoundSlot(); + virtual ~CSoundSlot(); + + bool loadSound(const char *fname, const char *searchname, unsigned int loadnum); + + void setpAudioSpec(SDL_AudioSpec *pAudioSpec){ m_pAudioSpec = pAudioSpec; } + + unsigned char getPriority(void){ return m_priority; } + bool isHighQuality(void){ return m_hqsound.enabled; } + unsigned int *getSoundData(void){ return m_sounddata; } + unsigned int getSoundlength(void) { return m_soundlength; } + stHQSound *getHQSoundPtr(void) { return &m_hqsound; } + +private: + unsigned char m_priority; + unsigned int *m_sounddata; + unsigned int m_soundlength; + stHQSound m_hqsound; + SDL_AudioSpec *m_pAudioSpec; +}; + +#endif /* CSOUNDSLOT_H_ */ diff --git a/src/sdl/video/colourconvert.cpp b/src/sdl/video/colourconvert.cpp new file mode 100644 index 000000000..4d9478f55 --- /dev/null +++ b/src/sdl/video/colourconvert.cpp @@ -0,0 +1,101 @@ +/* + * colourconvert.cpp + * + * Created on: 18.03.2009 + * Author: gerstrong + */ + +#include +#include "colourtable.h" + +Uint16 convert4to16BPPcolor(Uint8 c, SDL_Surface *BlitSurface) +{ + // This function converts the colour from the keen palette to 16-bit format + int alpha; + + alpha = 128; + + if(c == 16) + return SDL_MapRGBA(BlitSurface->format,1,0,0,alpha); + else if(c == COLOUR_BLACK) + return 0; + else if(c == 1) + return SDL_MapRGBA(BlitSurface->format,0,0,170,alpha); + else if(c == 2) + return SDL_MapRGBA(BlitSurface->format,0,170,0,alpha); + else if(c == 3) + return SDL_MapRGBA(BlitSurface->format,0,170,170,alpha); + else if(c == COLOUR_DARKRED) + return SDL_MapRGBA(BlitSurface->format,170,0,0,alpha); + else if(c == 5) + return SDL_MapRGBA(BlitSurface->format,170,0,170,alpha); + else if(c == 6) + return SDL_MapRGBA(BlitSurface->format,170,85,0,alpha); + else if(c == COLOUR_GREY) + return SDL_MapRGBA(BlitSurface->format,170,170,170,alpha); + else if(c == 8) + return SDL_MapRGBA(BlitSurface->format,85,85,85,alpha); + else if(c == 9) + return SDL_MapRGBA(BlitSurface->format,85,85,255,alpha); + else if(c == 10) + return SDL_MapRGBA(BlitSurface->format,85,255,85,alpha); + else if(c == COLOUR_CYAN) + return SDL_MapRGBA(BlitSurface->format,85,255,255,alpha); + else if(c == 12) + return SDL_MapRGBA(BlitSurface->format,255,85,85,alpha); + else if(c == 13) + return SDL_MapRGBA(BlitSurface->format,255,85,255,alpha); + else if(c == 14) + return SDL_MapRGBA(BlitSurface->format,255,255,85,alpha); + else if(c == 15) + return SDL_MapRGBA(BlitSurface->format,255,255,255,alpha); + else + return SDL_MapRGBA(BlitSurface->format,128,128,128,alpha); + return 0; +} + +Uint32 convert4to32BPPcolor(Uint8 c, SDL_Surface *BlitSurface) +{ + // This function converts the colour from the keen palette to 16-bit format + int alpha; + + alpha = 255; + + if(c == 16) + return SDL_MapRGBA(BlitSurface->format,1,0,0,alpha); + else if(c == COLOUR_BLACK) + return 0; + else if(c == 1) + return SDL_MapRGBA(BlitSurface->format,0,0,170,alpha); + else if(c == 2) + return SDL_MapRGBA(BlitSurface->format,0,170,0,alpha); + else if(c == 3) + return SDL_MapRGBA(BlitSurface->format,0,170,170,alpha); + else if(c == COLOUR_DARKRED) + return SDL_MapRGBA(BlitSurface->format,170,0,0,alpha); + else if(c == 5) + return SDL_MapRGBA(BlitSurface->format,170,0,170,alpha); + else if(c == 6) + return SDL_MapRGBA(BlitSurface->format,170,85,0,alpha); + else if(c == COLOUR_GREY) + return SDL_MapRGBA(BlitSurface->format,170,170,170,alpha); + else if(c == 8) + return SDL_MapRGBA(BlitSurface->format,85,85,85,alpha); + else if(c == 9) + return SDL_MapRGBA(BlitSurface->format,85,85,255,alpha); + else if(c == 10) + return SDL_MapRGBA(BlitSurface->format,85,255,85,alpha); + else if(c == COLOUR_CYAN) + return SDL_MapRGBA(BlitSurface->format,85,255,255,alpha); + else if(c == 12) + return SDL_MapRGBA(BlitSurface->format,255,85,85,alpha); + else if(c == 13) + return SDL_MapRGBA(BlitSurface->format,255,85,255,alpha); + else if(c == 14) + return SDL_MapRGBA(BlitSurface->format,255,255,85,alpha); + else if(c == 15) + return SDL_MapRGBA(BlitSurface->format,255,255,255,alpha); + else + return SDL_MapRGBA(BlitSurface->format,128,128,128,alpha); + return 0; +} diff --git a/src/sdl/video/colourconvert.h b/src/sdl/video/colourconvert.h new file mode 100644 index 000000000..b36846038 --- /dev/null +++ b/src/sdl/video/colourconvert.h @@ -0,0 +1,14 @@ +/* + * colourconvert.h + * + * Created on: 18.03.2009 + * Author: gerstrong + */ + +#ifndef COLOURCONVERT_H_ +#define COLOURCONVERT_H_ + +Uint32 convert4to32BPPcolor(Uint8 c, SDL_Surface *BlitSurface); +Uint16 convert4to16BPPcolor(Uint8 c, SDL_Surface *BlitSurface); + +#endif /* COLOURCONVERT_H_ */ diff --git a/src/sdl/video/colourtable.h b/src/sdl/video/colourtable.h new file mode 100644 index 000000000..18570d7fe --- /dev/null +++ b/src/sdl/video/colourtable.h @@ -0,0 +1,13 @@ +/* + * colourtable.h + * + * Created on: 18.01.2009 + * Author: gerstrong + * A Primitive 16-Colour table. + */ + +#define COLOUR_DARKRED 4 +#define COLOUR_GREY 7 +#define COLOUR_CYAN 11 +#define COLOUR_BLACK 0 +#define COLOUR_MASK 17 // Used, when this part of pixel must be transparent diff --git a/src/sgrle.cpp b/src/sgrle.cpp new file mode 100644 index 000000000..35c1b8466 --- /dev/null +++ b/src/sgrle.cpp @@ -0,0 +1,150 @@ +/* SGRLE.C + RLE compression and decompression functions for the SGRLE format... + These are used for saved games (hence the name SG RLE). Could be used + for other things too, I guess. + + After opening a file for decompression you must call sgrle_reset() before + the first time you use sgrle_decompress(). +*/ +#include "keen.h" + +void sgrle_reset(void); +void sgrle_compress(FILE *fp, unsigned char *ptr, unsigned long nbytes); +void sgrle_decompress(FILE *fp, unsigned char *ptr, unsigned long nbytes); +unsigned char sgrle_get_next_byte(FILE *fp); + +#define SGRLE_RLEMARKER 255 +#define SGRLE_MAXRLELEN 65530 +int sgrle_runlen; +unsigned char sgrle_runchar; + +/* decompresses the next byte from file FP. */ +/* used internally by sgrle_decompress(). */ +unsigned char sgrle_get_next_byte(FILE *fp) +{ + // are we currently in a RLE run? + if (sgrle_runlen) + { + // decrease length of RLE run and return the previously + // read char for the run + sgrle_runlen--; + return sgrle_runchar; + } + else + { // not currently in a RLE run + sgrle_runchar = fgetc(fp); + if (sgrle_runchar==SGRLE_RLEMARKER) + { // start of a RLE run + sgrle_runlen = fgeti(fp); + sgrle_runchar = fgetc(fp); + return sgrle_get_next_byte(fp); + } + else return sgrle_runchar; + } +} + +/* decompresses nbytes bytes of SGRLE-compressed data from */ +/* file pointer *fp to the memory area pointed to by *ptr. */ +void sgrle_decompress(FILE *fp, unsigned char *ptr, unsigned long nbytes) +{ +unsigned long i; + for(i=0;i= (nbytes-1) || runlength >= SGRLE_MAXRLELEN) + { + // if it's a forced stop because we hit the end of the buffer + // we need to add 1 to runlength + if (run_ahead_index >= (nbytes-1)) + { + runlength++; + } + break; + } + run_ahead_index++; + runlength++; + } while(1); + + // it takes 4 bytes to code a RLE run, so if the run is less than + // 4 bytes, it would actually be smaller if we didn't compress it + if (runlength < 4 && readbyt!=SGRLE_RLEMARKER) + { + // RLE run, but too small to bother with + for(i=0;i> 8, fp); + fputc(readbyt, fp); + } + // advance + compress_index += runlength; + } + else + { + // next byte is different, this is not a run it's just a single char + if (readbyt != SGRLE_RLEMARKER) + { + fputc(readbyt, fp); + } + else + { + // it's a single uncompressed byte which is equal to the RLE marker. + // delimit it by placing it in a RLE run of length 1. + runlength = 1; + fputc(SGRLE_RLEMARKER, fp); + fputc(runlength & 255, fp); + fputc(runlength >> 8, fp); + fputc(readbyt, fp); + } + compress_index++; + } + + } + +} + +/* resets the decompression engine. (must call this before the first + time you use sgrle_decompress(), each time you open a new file) */ +void sgrle_reset(void) +{ + sgrle_runlen = 0; +} diff --git a/src/vorbis/oggsupport.cpp b/src/vorbis/oggsupport.cpp new file mode 100644 index 000000000..a193045e7 --- /dev/null +++ b/src/vorbis/oggsupport.cpp @@ -0,0 +1,97 @@ +/* + * oggsupport.c + * + * Created on: 06.01.2009 + * Author: gerstrong + */ +#ifdef BUILD_WITH_OGG +#include + +#include +#include + +#define MAX_LEVELS 100 // Stupid! But you need it! + +#include "../include/declarations.h" +#include "../hqp/hq_sound.h" +#include "../sdl/CVideoDriver.h" +#include "../CLogFile.h" + +short openOGGSound(FILE *fp, SDL_AudioSpec *pspec, stHQSound *psound) +{ + // it is an ogg file + // If Ogg detected, decode it into the stream psound->sound_buffer. It must fit to Audio_cvt structure, so that + // it can be converted + + int result; + OggVorbis_File oggStream; // stream handle + vorbis_info* vorbisInfo; // some formatting data + vorbis_comment* vorbisComment; // user comments + + if((result = ov_open(fp, &oggStream, NULL, 0)) < 0) + { + fclose(fp); + return 1; + } + else + { + vorbisInfo = ov_info(&oggStream, -1); + vorbisComment = ov_comment(&oggStream, -1); + + pspec->format = 32784; // Not sure, if this works with any ogg file + pspec->channels = vorbisInfo->channels; + pspec->freq = vorbisInfo->rate; + } + + long length; + int section; + long pos=0; + long ret; + char *stream; + + length = 4 * (long)ov_pcm_total(&oggStream,-1); + + stream = (char*) malloc(length*sizeof(char)); + + if(stream == NULL) + { + g_pLogFile->textOut(RED,"Error! Out of memory! in Loading the Ogg file
    "); + return 1; + } + + int eof=0; + + while(!eof){ + ret=ov_read(&oggStream,stream + pos,sizeof(stream),0,2,1,§ion); + if (ret == 0) { + /* EOF */ + eof=1; + } else if (ret < 0) { + /* error in the stream. Not a problem, just reporting it in + case we (the app) cares. In this case, we don't. */ + } else { + /* we don't bother dealing with sample rate changes, etc, but + you'll have to*/ + if(pos > length) + { + // Something went wrong here! Stream is already full! + g_pLogFile->ftextOut("WARNING: Stream overflow while reading the ogg-file!
    "); + ret = 0; + break; + } + pos += ret; + } + } + + psound->sound_buffer = (Uint8*) malloc(length); + psound->sound_len = pos; + + memcpy( psound->sound_buffer, stream, psound->sound_len); + + free(stream); + + ov_clear(&oggStream); // This also closes fp + + return 0; +} +#endif diff --git a/src/vorticon/CDialog.cpp b/src/vorticon/CDialog.cpp new file mode 100644 index 000000000..b4672247f --- /dev/null +++ b/src/vorticon/CDialog.cpp @@ -0,0 +1,383 @@ +/* + * CDialog.cpp + * + * Created on: 20.03.2009 + * Author: gerstrong + */ + +#include "CDialog.h" + +#include // Must be changed, when Graphics Class is implemented +#include "../funcdefs.h" // This class should not depend on those headers +#include + +#include "../keen.h" +#include "../sdl/CTimer.h" +#include "../include/gamedo.h" +#include "../CGraphics.h" + +#include +using namespace std; + + +#define FONT_TWIRL 9 +#define FONT_UPARROW 15 +#define FONT_DOWNARROW 19 +#define TWIRL_TIME 25 +#define TWIRL_NUM_FRAMES 5 + +CDialog::CDialog() { + x = y = w = h = 0; + + number_of_options = 0; + selection = -1; + twirlframe = 0; + twirltime = 0; + scrollpos = 0; + + isanimated = false; + isVisible = false; + + OptionTextList = NULL; +} + +CDialog::~CDialog() { + + // If there is a list of optional text data, it must be freed! + if(OptionTextList != NULL) + freeTextListData(); +} +void CDialog::freeTextListData(void) +{ + stTextList* curTextptr; + stTextList* prevTextptr; + + curTextptr = OptionTextList; + prevTextptr = NULL; + + while(OptionTextList->nextElement) + { + if(curTextptr->nextElement == NULL) + { + delete curTextptr; + prevTextptr->nextElement = NULL; + curTextptr = OptionTextList; + } + else + { + prevTextptr = curTextptr; + curTextptr = (stTextList*)curTextptr->nextElement; + } + } + delete OptionTextList; +} + +void CDialog::addSeparator(void) +{ + addOptionText(""); +} + +void CDialog::addOptionText(const char *text) +{ + char buf[TEXT_LENGTH]; + memset(buf,0,TEXT_LENGTH); + // This algorithm is similar to one pointer session and + // list implementation. TextList is the head. + if(OptionTextList == NULL) + { + OptionTextList = new stTextList; + OptionTextList->nextElement = NULL; + + memset(OptionTextList->text,0,TEXT_LENGTH); + + strcpy(buf,text); + + unsigned int length; + length = strlen(buf); + + // before the text is copied, check if that string is too long. + if(length > w-4) + { + copy(text,text+w-7,OptionTextList->text); + strcat(OptionTextList->text,"..."); + } + else + { + strcpy(OptionTextList->text,text); + } + + number_of_options = 1; + selection = 0; + } + else + { + stTextList *curTextList; + + curTextList = OptionTextList; + + while (curTextList->nextElement != NULL) + { + curTextList = (stTextList*) curTextList->nextElement; + } + + curTextList->nextElement = new stTextList; + + curTextList = (stTextList*) curTextList->nextElement; + + memset(curTextList->text,0, TEXT_LENGTH); + + number_of_options++; + + strcpy(buf,text); + + unsigned int length; + length = strlen(buf); + + // before the text is copied, check if that string is too long. + if(length > w-4) + { + copy(text,text+w-7,curTextList->text); + strcat(curTextList->text,"..."); + } + else + { + strcpy(curTextList->text,text); + } + curTextList->nextElement = NULL; + } +} + +void CDialog::setOptionText(unsigned int pos, const char *text) +{ + unsigned int i; + stTextList *curTextList; + + curTextList = OptionTextList; + + for(i=0 ; inextElement; + + memset(curTextList->text,0,TEXT_LENGTH); + strcpy(curTextList->text,text); +} + +void CDialog::setDimensions(int rectx, int recty, int rectw, int recth) +{ + x = rectx; + y = recty, + w = rectw-1; + h = recth; +} + +void CDialog::setVisible(bool value) { isVisible = value; } + +void CDialog::renderDialog() +{ + unsigned int i; + stTextList *curTextList; + + if(!isVisible) return; + + curTextList = OptionTextList; + + // Open the Dialog animation + if(isanimated) + renderOpenDialogAnimation(x,y,w,h); + + // draw the empty Dialog + drawDialogbox(x,y,w,h); + + // draw the objects (text. items, etc.) + + // scroll as many times necessary + for(i=0 ; inextElement; + + i=0; + + while(curTextList != NULL) + { + g_pGraphics->sb_font_draw((unsigned char*)(curTextList->text), (x+3)<<3, (y+i+1)<<3); + curTextList = (stTextList*) curTextList->nextElement; + i++; + if(i >= h-2) + break; + } + + + // Draw the twirl at the right position + // Render the smooth twirl + if(twirltime < TWIRL_TIME) + twirltime++; + else + { + twirlframe++; + twirltime=0; + } + + if(twirlframe > TWIRL_NUM_FRAMES) + twirlframe=0; + + g_pGraphics->sb_drawCharacter((x+1)<<3, (y+selection-scrollpos+1)<<3, FONT_TWIRL+twirlframe); + + // Now draw the up and down arrows if the list is going to be scrolled + if(scrollpos > h-5) + g_pGraphics->sb_drawCharacter((x+w-1)<<3, (y+1)<<3, FONT_UPARROW); + + if(scrollpos < (number_of_options-h+2) && number_of_options > (int)(h-2)) + g_pGraphics->sb_drawCharacter((x+w-1)<<3, (y+h-2)<<3, FONT_DOWNARROW); +} + +// The original Game had a open Dialog Animation. This is what that function does... +void CDialog::animateDialogBox(bool value){ isanimated = value; } +void CDialog::renderOpenDialogAnimation(int x,int y, int w, int h) +{ + if(!isanimated || !isVisible) + return; + + int timer=0; + + int mx, my, mw, mh; + + mw = mh = 0; + + // Calculate the center + mx = x + (w>>1); + my = y + (h>>1); + + do + { + if(timer == 10) + { + if(mx > x) + mx--; + if(my > y) + my--; + if(mh < h) + { + if(mh+1 == h) + mh++; + else + mh+=2; + } + if(mw < w) + { + if(mw+1 == w) + mw++; + else + mw+=2; + } + + timer = 0; + } + + + if(mx <= x && my <= y && mh >= h && mw >= w) + break; + + drawDialogbox(mx,my,mw,mh); + + gamedo_AnimatedTiles(); + gamedo_frameskipping(NULL); + g_pTimer->SpeedThrottle(); + + timer++; + }while(1); + + isanimated = false; +} + +char *CDialog::getOptionString(unsigned int pos) +{ + unsigned int i; + stTextList *curTextList; + + curTextList = OptionTextList; + + for(i=0 ; inextElement; + + return curTextList->text; +} + +bool CDialog::setSelection(int value) +{ + if(value < number_of_options && value >= 0) + { + selection = value; + + if(selection < (int)scrollpos) + scrollpos = selection; + + if(selection >= (int)(scrollpos+h-2) ) + scrollpos = selection-h+3; + + return true; + } + return false; +} + +int CDialog::getSelection(void) +{ + return selection; +} + +bool CDialog::setNextSelection() +{ + int i=0; + if(selection+1 < number_of_options) + { + while(strcmp(getOptionString(selection+i+1),"") == 0) + i++; + + selection += i; + } + + return setSelection(selection+1); +} + +bool CDialog::setPrevSelection() +{ + int i=0; + if(selection-1 > 0) + { + while(strcmp(getOptionString(selection-i-1),"") == 0) + i++; + + selection -= i; + } + + return setSelection(selection-1); +} + +void CDialog::drawDialogbox(int x1, int y1, int w, int h) +{ + int px,py,pi,pj; + + g_pGraphics->sb_drawCharacter(x1*8, y1*8, 1); + g_pGraphics->sb_drawCharacter((x1+w)*8, y1*8, 3); + for(px=(x1*8)+8,pi=0;pisb_drawCharacter(px, y1*8, 2); + px+=8; + } + py=(y1+1)*8; + for(pj=0;pjsb_drawCharacter(px, py, 4); + else if (pi==w) g_pGraphics->sb_drawCharacter(px, py, 5); + else g_pGraphics->sb_drawCharacter(px, py, ' '); + px+=8; + } + py+=8; + } + for(px=(x1*8),pi=0;pi<=w;pi++) + { + if (pi==0) g_pGraphics->sb_drawCharacter(px, py, 6); + else if (pi==w) g_pGraphics->sb_drawCharacter(px, py, 8); + else g_pGraphics->sb_drawCharacter(px, py, 7); + px+=8; + } +} diff --git a/src/vorticon/CDialog.h b/src/vorticon/CDialog.h new file mode 100644 index 000000000..f81cd2299 --- /dev/null +++ b/src/vorticon/CDialog.h @@ -0,0 +1,65 @@ +/* + * CDialog.h + * + * Created on: 20.03.2009 + * Author: gerstrong + */ + +#ifndef CDIALOG_H_ +#define CDIALOG_H_ + +#define TEXT_LENGTH 256 + +typedef struct stTextList +{ + char text[TEXT_LENGTH]; + void *nextElement; +}stTextList; + +class CDialog { +public: + CDialog(); + virtual ~CDialog(); + + void renderDialog(); + void drawDialogbox(int x1, int y1, int w, int h); + void setDimensions(int rectx, int recty, int rectw, int recth); + + void addOptionText(const char *text); + void setOptionText(unsigned int pos, const char *text); + void addSeparator(void); + + bool setSelection(int value); + bool setNextSelection(); + bool setPrevSelection(); + + int getSelection(void); + char *getOptionString(unsigned int pos); + + void renderOpenDialogAnimation(int x,int y, int w, int h); + void animateDialogBox(bool value); + + void setVisible(bool value); + +private: + unsigned int x; + unsigned int y; + unsigned int w; + unsigned int h; + + int number_of_options; + int selection; + unsigned int scrollpos; + + stTextList *OptionTextList; + + int twirlframe; + int twirltime; + + bool isanimated; + bool isVisible; + + void freeTextListData(void); +}; + +#endif /* CDIALOG_H_ */ diff --git a/src/vorticon/CHighScores.cpp b/src/vorticon/CHighScores.cpp new file mode 100644 index 000000000..973aee3a2 --- /dev/null +++ b/src/vorticon/CHighScores.cpp @@ -0,0 +1,430 @@ +/* + * CHighScores.cpp + * + * Created on: 09.04.2009 + * Author: gerstrong + */ + +#include +#include +#include + +using namespace std; + +#include + +#include "../keen.h" +#include "../include/menu.h" +#include "../include/gamedo.h" +#include "CHighScores.h" +#include "../sdl/CInput.h" +#include "../sdl/CTimer.h" +#include "../CGraphics.h" + +#define HIGHSCORETABLE_X 1344 +#define HIGHSCORETABLE_Y 32 + +CHighScores::CHighScores(stCloneKeenPlus *poutsideCKP) { + // Set default Scores + strcpy(Name[0],"Gerstrong"); + strcpy(Name[1],"Tulip"); + strcpy(Name[2],"Spleen"); + strcpy(Name[3],"Yorpy"); + strcpy(Name[4],"Garg"); + strcpy(Name[5],"Vorticon"); + strcpy(Name[6],"maybeyou"); + + int i; + for(i=0 ; i<7 ; i++) + sprintf(Score[i],"100"); + + memset(Extra, false, 7*4*sizeof(unsigned char)); + memset(Cities, false, 7*sizeof(unsigned int)); + + pCKP = poutsideCKP; + + Episode = pCKP->Control.levelcontrol.episode; + DataDirectory = pCKP->GameData->DataDirectory; +} + +CHighScores::~CHighScores() { +} + + +char CHighScores::showHighScore(void) +{ + unsigned char i; + int x1,y1; + int x2,y2; + int x3; + int x4; + int bTitle; + int bName; + int bScore; + int bExtra; + + loadHighScoreTable(); + + // show High-score Frame + showmapatpos(90, HIGHSCORETABLE_X, HIGHSCORETABLE_Y, 0, pCKP); + + // Prepare some extra items if available (Ep1 + 2) + memset(ItemTiles,0,4*sizeof(int)); + + if(pCKP->Control.levelcontrol.episode == 1) + { + int t; + for(t=0 ; tgetBitmapNumberFromName("HIGHSCOR"); + bName = g_pGraphics->getBitmapNumberFromName("NAME"); + bScore = g_pGraphics->getBitmapNumberFromName("SCORE"); + + if(Episode == 2) + bExtra = g_pGraphics->getBitmapNumberFromName("SAVED"); + else + bExtra = g_pGraphics->getBitmapNumberFromName("PARTS"); + + x1 = 160-(bitmaps[bTitle].xsize/2); + y1 = 8; + x2 = 40; + y2 = 42; + x3 = 178-(bitmaps[bScore].xsize/2); + x4 = 230; + + // They are blit once. + g_pGraphics->drawBitmap(x1, y1, bTitle); + g_pGraphics->drawBitmap(x2, y2, bName); + g_pGraphics->drawBitmap(x3, y2, bScore); + if(Episode == 2) + g_pGraphics->drawBitmap(x4, y2-8, bExtra); + else + g_pGraphics->drawBitmap(x4, y2, bExtra); + + // This cycle only serves as a key which must be pressed for now + do + { + + // Here it must be split up in Episodes 1, 2 and 3. + if(pCKP->Control.levelcontrol.episode == 1) + { + // Print the labels + + for( i=0 ; i<7 ; i++ ) + { + g_pGraphics->sb_color_font_draw((unsigned char*) Name[i],40,64+(i<<4),4,7); + g_pGraphics->sb_color_font_draw((unsigned char*) Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7); + if(Extra[i][0] == true) + g_pGraphics->drawTile(32,90+(i<<4),ItemTiles[0]); + if(Extra[i][1] == true) + g_pGraphics->drawTile(48,90+(i<<4),ItemTiles[1]); + if(Extra[i][2] == true) + g_pGraphics->drawTile(64,90+(i<<4),ItemTiles[2]); + if(Extra[i][3] == true) + g_pGraphics->drawTile(80,90+(i<<4),ItemTiles[3]); + } + } + else if(pCKP->Control.levelcontrol.episode == 2) + { + for( i=0 ; i<7 ; i++ ) + { + char buf[2]; + g_pGraphics->sb_color_font_draw((unsigned char*) Name[i],40,64+(i<<4),4,7); + g_pGraphics->sb_color_font_draw((unsigned char*) Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7); + sprintf(buf,"%d",Cities[i]); + g_pGraphics->sb_color_font_draw((unsigned char*) buf,250,64+(i<<4),4,7); + } + } + else + { + for( i=0 ; i<7 ; i++ ) + { + g_pGraphics->sb_color_font_draw((unsigned char*) Name[i],40,64+(i<<4),4,7); + g_pGraphics->sb_color_font_draw((unsigned char*) Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7); + } + } + + gamedo_AnimatedTiles(); + + gamedo_frameskipping(pCKP); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + }while(!g_pInput->getPressedAnyKey()); + + return 0; +} + +char CHighScores::writeHighScore(int points, bool *extras, int cities) +{ + int place; + char buf[256]; + + unsigned char i; + int num; + int x1,y1; + int x2,y2; + int x3; + int x4; + int bTitle; + int bName; + int bScore; + int bExtra; + + loadHighScoreTable(); + + // show High-score Frame + showmapatpos(90, HIGHSCORETABLE_X, HIGHSCORETABLE_Y, 0, pCKP); + + place=6; + sscanf(Score[place],"%d",&num); + if(num > points) + return 1; // Sorry, but score not high enough + + while(place>0 && points > num) + { + memcpy(Name[place],Name[place-1],16*sizeof(char)); + memcpy(Score[place],Score[place-1],8*sizeof(char)); + memcpy(Extra[place],Extra[place-1],4*sizeof(char)); + place--; + + if(place > 0) + sscanf(Score[place-1],"%d",&num); + } + + sprintf(buf,"%d", points); + + memcpy(Name[place+1],Name[place],16*sizeof(char)); + memcpy(Score[place],buf,8*sizeof(char)); + + if(points < 999999) + sprintf(Score[place],"%d",points); + else + sprintf(Score[place],"*MAX*"); + + memcpy(Extra[place],extras,4*sizeof(bool)); + Cities[place] = cities; + + memset(Name[place],0,16*sizeof(char)); + + sprintf(Name[place],"_"); + + string WrittenName; + + // Prepare some extra items if available (Ep1 + 2) + memset(ItemTiles,0,4*sizeof(int)); + + if(pCKP->Control.levelcontrol.episode == 1) + { + int t; + for(t=0 ; tControl.levelcontrol.episode == 2) + { + for( i=0 ; i<7 ; i++ ) + { + char buf[2]; + g_pGraphics->sb_color_font_draw((unsigned char*) Name[i],40,64+(i<<4),4,7); + g_pGraphics->sb_color_font_draw((unsigned char*) Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7); + sprintf(buf,"%d",Cities[i]); + g_pGraphics->sb_color_font_draw((unsigned char*) buf,250,64+(i<<4),4,7); + } + } + else + { + for( i=0 ; i<7 ; i++ ) + { + g_pGraphics->sb_color_font_draw((unsigned char*) Name[i],40,64+(i<<4),4,7); + g_pGraphics->sb_color_font_draw((unsigned char*) Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7); + } + } + + + // Get the Bitmap IDs and set the correct positions on screen + bTitle = g_pGraphics->getBitmapNumberFromName("HIGHSCOR"); + bName = g_pGraphics->getBitmapNumberFromName("NAME"); + bScore = g_pGraphics->getBitmapNumberFromName("SCORE"); + + if(Episode == 2) + bExtra = g_pGraphics->getBitmapNumberFromName("SAVED"); + else + bExtra = g_pGraphics->getBitmapNumberFromName("PARTS"); + + x1 = 160-(bitmaps[bTitle].xsize/2); + y1 = 8; + x2 = 40; + y2 = 42; + x3 = 178-(bitmaps[bScore].xsize/2); + x4 = 230; + + + // They are blit once. + g_pGraphics->drawBitmap(x1, y1, bTitle); + g_pGraphics->drawBitmap(x2, y2, bName); + g_pGraphics->drawBitmap(x3, y2, bScore); + if(Episode == 2) + g_pGraphics->drawBitmap(x4, y2-8, bExtra); + else + g_pGraphics->drawBitmap(x4, y2, bExtra); + + memset(buf,0,256); + *buf= '_'; + + // This cycle will wait for the input of name and hit of enter + do + { + // Blit all the text and images + + for(i=KA ; igetPressedKey(i)) + { + sprintf(buf,"%c",'A' + i - KA); + WrittenName.append(buf); + copy(WrittenName.data(),WrittenName.data()+WrittenName.length(),Name[place]); + WrittenName.copy(buf,WrittenName.length(),0); + strcat(buf,"_"); + } + } + if(g_pInput->getPressedKey(KBCKSPCE) && (WrittenName.length() > 0)) + { + memset(buf,0,256); + g_pGraphics->sb_color_font_draw((unsigned char*) " ",40,64+(place<<4),4,7); + WrittenName.erase(WrittenName.length()-1); + WrittenName.copy(buf,WrittenName.length(),0); + memset(Name[place],0,16); + WrittenName.copy(Name[place],WrittenName.length(),0); + strcat(buf,"_"); + } + + + if(WrittenName.length() > 14) + break; + + // Here it must be split up in Episodes 1, 2 and 3. + // Print the labels + + for( i=0 ; i<7 ; i++ ) + { + if(i != place) + g_pGraphics->sb_color_font_draw((unsigned char*) Name[i],40,64+(i<<4),4,7); + else + g_pGraphics->sb_color_font_draw((unsigned char*) buf,40,64+(i<<4),4,7); + g_pGraphics->sb_color_font_draw((unsigned char*) Score[i],200-(strlen(Score[i])<<3),64+(i<<4),4,7); + + if(pCKP->Control.levelcontrol.episode == 1) + { + if(Extra[i][0] == true) + g_pGraphics->drawTile(32,90+(i<<4),ItemTiles[0]); + if(Extra[i][1] == true) + g_pGraphics->drawTile(48,90+(i<<4),ItemTiles[1]); + if(Extra[i][2] == true) + g_pGraphics->drawTile(64,90+(i<<4),ItemTiles[2]); + if(Extra[i][3] == true) + g_pGraphics->drawTile(80,90+(i<<4),ItemTiles[3]); + } + } + + gamedo_AnimatedTiles(); + + gamedo_frameskipping(pCKP); + + g_pInput->pollEvents(); + g_pTimer->SpeedThrottle(); + + }while(!g_pInput->getPressedKey(KENTER)); + + saveHighScoreTable(); + + return 0; +} + +char CHighScores::loadHighScoreTable(void) +{ + string sBuf; + char chBuf[256]; + + sprintf(chBuf,"%d",Episode); + + sBuf.append("data/"); + sBuf.append(DataDirectory); + sBuf.append("highscoreep"); + sBuf.append(chBuf); + sBuf.append(".dat"); + + ifstream ScoreTableFile (sBuf.data(), ios::binary); + + if(ScoreTableFile == NULL) + { + return -1; + } + + ScoreTableFile.read((*Name), 7*16*sizeof(char)); + ScoreTableFile.seekg(7*16*sizeof(char),ios_base::cur); + ScoreTableFile.read((*Score), 7*8*sizeof(char)); + ScoreTableFile.seekg(7*8*sizeof(char),ios_base::cur); + ScoreTableFile.read((char*)(*Extra), 7*4*sizeof(unsigned char)); + ScoreTableFile.seekg(7*4*sizeof(char),ios_base::cur); + ScoreTableFile.read((char*)Cities, 7*sizeof(unsigned char)); + + ScoreTableFile.close(); + + return 0; +} + +char CHighScores::saveHighScoreTable(void) +{ + string sBuf; + char chBuf[256]; + + sprintf(chBuf,"%d",Episode); + + sBuf.append("data/"); + sBuf.append(DataDirectory); + sBuf.append("highscoreep"); + sBuf.append(chBuf); + sBuf.append(".dat"); + + ofstream ScoreTableFile (sBuf.data(), ios::binary); + + if(ScoreTableFile == NULL) + { + return -1; + } + + ScoreTableFile.write((*Name), 7*16*sizeof(char)); + ScoreTableFile.seekp(7*16*sizeof(char),ios_base::cur); + ScoreTableFile.write((*Score), 7*8*sizeof(char)); + ScoreTableFile.seekp(7*8*sizeof(char),ios_base::cur); + ScoreTableFile.write((char*)(*Extra), 7*4*sizeof(unsigned char)); + ScoreTableFile.seekp(7*4*sizeof(char),ios_base::cur); + ScoreTableFile.write((char*) Cities, 7*sizeof(unsigned char)); + + + ScoreTableFile.close(); + + return 0; +} + diff --git a/src/vorticon/CHighScores.h b/src/vorticon/CHighScores.h new file mode 100644 index 000000000..7b822a657 --- /dev/null +++ b/src/vorticon/CHighScores.h @@ -0,0 +1,37 @@ +/* + * CHighScores.h + * + * Created on: 09.04.2009 + * Author: gerstrong + */ + +#ifndef CHIGHSCORES_H_ +#define CHIGHSCORES_H_ + +class CHighScores { +public: + CHighScores(stCloneKeenPlus *poutsideCKP); + virtual ~CHighScores(); + + char showHighScore(void); + char writeHighScore(int points, bool *extras, int cities); + char loadHighScoreTable(void); + +private: + char Name[7][16]; + char Score[7][8]; + bool Extra[7][4]; + int Cities[7]; + int ItemTiles[4]; + + char Episode; + char *DataDirectory; + + stCloneKeenPlus *pCKP; + + void writeName(char *name, int place); + char saveHighScoreTable(void); + +}; + +#endif /* CHIGHSCORES_H_ */ diff --git a/src/vorticon/CObject.cpp b/src/vorticon/CObject.cpp new file mode 100644 index 000000000..ea7facff5 --- /dev/null +++ b/src/vorticon/CObject.cpp @@ -0,0 +1,18 @@ +/* + * CObject.cpp + * + * Created on: 17.05.2009 + * Author: gerstrong + */ + +#include "CObject.h" + +CObject::CObject() { + // TODO Auto-generated constructor stub + +} + +CObject::~CObject() { + // TODO Auto-generated destructor stub +} + diff --git a/src/vorticon/CObject.h b/src/vorticon/CObject.h new file mode 100644 index 000000000..11e5f4557 --- /dev/null +++ b/src/vorticon/CObject.h @@ -0,0 +1,21 @@ +/* + * CObject.h + * + * Created on: 17.05.2009 + * Author: gerstrong + */ + +#ifndef COBJECT_H_ +#define COBJECT_H_ + +class CObject { +public: + CObject(); + virtual ~CObject(); + +private: + + +}; + +#endif /* COBJECT_H_ */ diff --git a/src/vorticon/CPlayer.cpp b/src/vorticon/CPlayer.cpp new file mode 100644 index 000000000..4de3fd4e7 --- /dev/null +++ b/src/vorticon/CPlayer.cpp @@ -0,0 +1,501 @@ +/* + * CPlayer.cpp + * + * Created on: 31.03.2009 + * Author: gerstrong + */ + +#include +#include "CPlayer.h" +#include "../sdl/CInput.h" + +#include "../keen.h" +#include "../funcdefs.h" + +extern int **TileProperty; + +//////////////////////// +// section of defines // +//////////////////////// + +#define CSF 5 + +// the walking defines +#define STANDING_LEFT 0 +#define STANDING_RIGHT 4 + +#define WALK_SPEED 16 + +// rate at which player walking animation is shown +#define WALKANIMRATE 40+WALK_SPEED + +// friction + +// the various jump states +enum jumpstates{ +NOJUMP, PREPAREJUMP, JUMPUP, JUMPED, PREPAREPOGO,POGOING}; + +// Now the frictions we have in the game +enum frictiontable +{ + FRIC_GROUND = 10, + FRIC_SLIPPERY = 10, + FRIC_ICE = 10, + FRIC_AIR = 10, +}; + +enum direction{ LEFT, RIGHT}; + +#define MAX_FRICTIONTIME 1000 + +#define PFIREFRAME 20 // raygun frame index + +// pogo frames +#define PFRAME_POGO 24 +#define PFRAME_POGOBOUNCE 25 + +// frame and animation speed for frozen keen (ep1) and stunned keen (ep2&3) +#define PFRAME_FROZEN 28 +#define PFROZENANIMTIME 100 +// how long keen should stay frozen when hit by an ice chunk +#define PFROZEN_TIME 1000 +#define PFROZEN_THAW 100 + +// when falling keen's Y inertia increases at INCREASERATE up to MAXSPEED +#define PFALL_INCREASERATE 3 +#define PFALL_MAXSPEED 19 + +// friction when player is pushed by yorp's, ball's, etc. +#define PLAYPUSH_DECREASERATE 1 + +#define PDIEFRAME 22 + +#define PLAYERHEIGHT 24 +#define PLAYERWIDTH 12 + +///////////////////////////////////////// +// Section of functions implementation // +///////////////////////////////////////// + + +CPlayer::CPlayer() { + object = 1; // it is only 1 for the first player + + episode=0; // while no episode is selected. Indeed the program must select one manually + + mp_scrx = NULL; + mp_scry = NULL; + + active = false; + isGameover = false; + isFalling = false; + isDying = false; + isWalking = false; + isPushed = false; + cannotWalk = false; + cannotfall = false; + usePogostick = false; + isStanding = true; + + bisBlockedUp = false; + bisBlockedDown = false; + bisBlockedLeft = false; + bisBlockedRight = false; + + walktimer = 0; + frictiontimer = 0; + + Jumpmode = 0; +} + +CPlayer::~CPlayer() { +} + +unsigned long CPlayer::getCoordX(void) +{ + return m_x; +} + +unsigned long CPlayer::getCoordY(void) +{ + return m_y; +} + +void CPlayer::setpScrCoord(int *px, int *py) +{ + mp_scrx = px; + mp_scry = py; +} + +void CPlayer::setCoord(unsigned long in_x, unsigned long in_y) +{ + m_x = in_x; + m_y = in_y; +} + +unsigned short CPlayer::getObject(void) +{ + return object; +} + +void CPlayer::useObject(unsigned short value) +{ + object = value; +} + +bool CPlayer::isPlaying(void) +{ + return active; +} + +void CPlayer::enablePlayer(bool value) +{ + active = value; +} + +void CPlayer::handlePlayer(void) +{ +/* char doFall; + + if (player[cp].pdie) + { + gamepdo_dieanim(cp, pCKP); + if (!pCKP->Control.levelcontrol.gameovermode) + { + gamepdo_StatusBox(cp, pCKP); + } + } + else + { + if (!pCKP->Control.levelcontrol.gameovermode) + { + player[cp].inhibitwalking = 0; + player[cp].inhibitfall = 0; + + gamepdo_StatusBox(cp, pCKP); + + gamepdo_ProcessInput(cp, pCKP); + + gamepdo_setdir(cp, pCKP); + + gamepdo_setblockedlru(cp, pCKP); + gamepdo_getgoodies(cp, pCKP); + + if (pCKP->Control.levelcontrol.episode==3) gamepdo_ankh(cp); + + gamepdo_raygun(cp, pCKP); + + gamepdo_keencicle(cp, pCKP); + + + if(!player[cp].pjumping && !player[cp].pfalling) + { + gamepdo_walking(cp, pCKP); + gamepdo_walkinganim(cp, pCKP); + } + + + if (fade.mode==NO_FADE || fade.dir==FADE_IN || demomode) + { + gamepdo_playpushed(cp, pCKP); + gamepdo_InertiaAndFriction_X(cp, pCKP); + } + + gamepdo_JumpAndPogo(cp, pCKP); + + // decide if player should fall + doFall = 1; + if (player[cp].inhibitfall) doFall = 0; + //else if (pCKP->Option[OPT_CHEATS].value) doFall = 0; + + if (doFall) + { + gamepdo_falling(cp, pCKP); + } + else + { + if(player[cp].pjumping == PJUMPED) + player[cp].pfalling = 0; + player[cp].psupportingtile = 145; + player[cp].psupportingobject = 0; + } + + } + else + { // we're in game-over mode + + } + } +*/ + applyFrame(); +} + +void CPlayer::performDieAnimation(void) +{ + +} + +void CPlayer::processInput(void) +{ + +} + +void CPlayer::processDirection(void) +{ + +} + +void CPlayer::checkCollisions(void) +{ + unsigned int tx,ty; + short i; + + tx = (m_x>>CSF)+2; + ty = (m_y>>CSF); + + bisBlockedDown = false; + bisBlockedUp = false; + bisBlockedLeft = false; + bisBlockedRight = false; + + for( i=1 ; i < PLAYERWIDTH ; i++ ) + { + if(TileProperty[getmaptileat((tx+i),ty)][BDOWN] || checkobjsolid((tx+i)<getHoldedCommand(IC_RIGHT)) + { + isStanding = false; + isWalking = true; + m_vx = WALK_SPEED; + headingDirection = RIGHT; + } + else if(g_pInput->getHoldedCommand(IC_LEFT)) + { + isStanding = false; + isWalking = true; + m_vx = -WALK_SPEED; + headingDirection = LEFT; + } + else + { + isStanding = true; + isWalking = false; + } + + if(g_pInput->getHoldedCommand(IC_UP)) + { + isStanding = false; + isWalking = true; + m_vy = -WALK_SPEED; + } + else if(g_pInput->getHoldedCommand(IC_DOWN)) + { + isStanding = false; + isWalking = true; + m_vy = WALK_SPEED; + } + } + +} + +void CPlayer::processMovements(void) +{ + // Acceleration formula + if(m_vx != 0) + m_vx += m_ax; + if(m_vy != 0) + m_vy += m_ay; + + if(bisBlockedDown) + { + if(headingDirection == RIGHT && (isWalking || walkframe > 0)) + { + if(walktimer < WALKANIMRATE) + { + //m_vx = 0; + walktimer++; + } + else + { + walktimer = 0; + if(walkframe < 3) + walkframe++; + else + walkframe = 0; + } + + if(walkframe != 0 && !isWalking) + m_vx = 1; + } + } + + // Check, if player is blocked + // If it is not the add Players velocity + if((!bisBlockedRight && m_vx > 0) || + (!bisBlockedLeft && m_vx < 0)) + m_x += m_vx; + + if((!bisBlockedUp && m_vy < 0) || + (!bisBlockedDown && m_vy > 0)) + m_y += m_vy; +} + +void CPlayer::processInertia(void) +{ + +} + +void CPlayer::processFriction(void) +{ + frictiontimer++; + if(frictiontimer > MAX_FRICTIONTIME) + frictiontimer = 0; + + // We have two sections: friction in the air and on ground + + // friction in the air + + // friction on the ground: Division again in three section. Normal, slippery and ice + // on the Ground + if(bisBlockedDown) + { + // He is standing on something solid + if(frictiontimer % 1 == 0) + { + if(m_vx > 0) + { + m_vx-=3; + if(m_vx < 0) + m_vx = 0; + } + if(m_vx < 0) + { + m_vx+=3; + if(m_vx > 0) + m_vx = 0; + } + } + } + +} + +void CPlayer::processSwitches(void) +{ + +} + +void CPlayer::processPogo(void) +{ + +} + +void CPlayer::processJump(void) +{ + +} + +void CPlayer::processFalling(void) +{ + +} + +void CPlayer::showStatusBox(void) +{ + +} + +unsigned short CPlayer::getPlayerframe(void) +{ + return playframe; +} + +// select the appropriate player frame based on what he's doing +void CPlayer::applyFrame(void) +{ + playframe = 0; // basic standing + + // select the frame assuming he's pointing right. ep1 does not select + // a walk frame while fading--this is for the bonus teleporter in L13. + if (isDying) playframe = PDIEFRAME + dieframe; + else + { + if (frozentime) playframe = PFRAME_FROZEN + frozenframe; + else if (isFiring) playframe = PFIREFRAME; + else if (usePogostick) playframe = PFRAME_POGO + (Jumpmode==PREPAREPOGO); + else if (Jumpmode) playframe += jumpframe; + else if (isFalling) playframe += 13; + else if (isWalking || isPushed) playframe += walkframe; + } + + // if he's going left switch the frame selected above to the + // appropriate one for the left direction + if (headingDirection==LEFT && !isDying && !frozentime) + { + if (isFiring) + { + playframe++; + } + else if (usePogostick) + { + playframe+=2; + } + else if (Jumpmode || isFalling) + { + playframe+=6; + } + else + { + playframe+=4; + } + } +} diff --git a/src/vorticon/CPlayer.h b/src/vorticon/CPlayer.h new file mode 100644 index 000000000..5a3e90ed8 --- /dev/null +++ b/src/vorticon/CPlayer.h @@ -0,0 +1,91 @@ +/* + * CPlayer.h + * + * Created on: 31.03.2009 + * Author: gerstrong + */ + +#ifndef CPLAYER_H_ +#define CPLAYER_H_ + +class CPlayer { +public: + CPlayer(); + virtual ~CPlayer(); + + void handlePlayer(void); + void showStatusBox(void); + unsigned short getPlayerframe(void); + bool isPlaying(void); + void enablePlayer(bool value); + void useObject(unsigned short value); + unsigned short getObject(void); + unsigned long getCoordX(void); + unsigned long getCoordY(void); + void setCoord(unsigned long in_x, unsigned long in_y); + void setpScrCoord(int *px, int *py); + +private: + short episode; + + bool active; + bool isGameover; + bool isFalling; + bool isDying; + bool isFiring; + bool isWalking; + bool isPushed; + bool isStanding; + bool cannotWalk; + bool cannotfall; + bool usePogostick; + + unsigned long m_x; + unsigned long m_y; + int *mp_scrx; + int *mp_scry; + + + unsigned short playframe; + unsigned short Jumpmode; + unsigned short dieframe; + unsigned short frozenframe; + unsigned short jumpframe; + unsigned short headingDirection; + unsigned short frozentime; + unsigned short walkframe; + unsigned short object; + unsigned short walktimer; + unsigned short frictiontimer; + short m_vx; + short m_vy; + short m_ax; + short m_ay; + + bool bisBlockedUp; + bool bisBlockedDown; + bool bisBlockedLeft; + bool bisBlockedRight; + + void performDieAnimation(void); + void processInput(void); + void processDirection(void); + void checkCollisions(void); + void processGoodies(void); + void processInvincibility(void); + void processRaygun(void); + void processStunned(void); + void processWalking(void); + void processInertia(void); + void processFriction(void); + void processSwitches(void); + void processPogo(void); + void processJump(void); + void processFalling(void); + void processMovements(void); + + void applyFrame(void); + +}; + +#endif /* CPLAYER_H_ */ diff --git a/src/vorticon/sounds.h b/src/vorticon/sounds.h new file mode 100644 index 000000000..27632a65b --- /dev/null +++ b/src/vorticon/sounds.h @@ -0,0 +1,50 @@ +/* sound play modes */ +// start playing sound now, unless a higher priority sound is playing +#define PLAY_NOW 0 +// will not restart the sound if it is already playing. +#define PLAY_NORESTART 1 +// plays the sound regardless of priority, and does not allow any other +// sounds to play until it completes. +#define PLAY_FORCE 2 + +#define SOUND_KEEN_WALK 0 +#define SOUND_KEEN_WALK2 1 +#define SOUND_KEEN_JUMP 2 +#define SOUND_KEEN_POGO 3 +#define SOUND_KEEN_DIE 4 +#define SOUND_KEEN_FALL 5 +#define SOUND_KEEN_BUMPHEAD 6 +#define SOUND_KEENSLEFT 7 +#define SOUND_KEEN_FIRE 8 +#define SOUND_GUN_CLICK 9 +#define SOUND_SHOT_HIT 10 +#define SOUND_GET_ITEM 11 +#define SOUND_GET_PART 12 +#define SOUND_LEVEL_DONE 13 +#define SOUND_GAME_OVER 14 +#define SOUND_TELEPORT 15 +#define SOUND_EXTRA_LIFE 16 +#define SOUND_CHUNKSMASH 17 +#define SOUND_GOINDOOR 18 +#define SOUND_GET_CARD 19 +#define SOUND_USE_KEY 20 +#define SOUND_DOOR_OPEN 21 +#define SOUND_YORP_BUMP 22 +#define SOUND_YORP_STUN 23 +#define SOUND_YORP_DIE 24 +#define SOUND_GARG_DIE 25 +#define SOUND_VORT_DIE 26 + +#define SOUND_KEEN_LAND 27 +#define SOUND_GET_BONUS 28 + +#define SOUND_ENTER_LEVEL 29 +#define SOUND_SWITCH_TOGGLE 30 +#define SOUND_EARTHPOW 31 +#define SOUND_TANK_FIRE 32 +#define SOUND_KEEN_BLOK 33 + +#define SOUND_MEEP 34 +#define SOUND_ANKH 35 +#define SOUND_MORTIMER 36 +#define SOUND_FOOTSLAM 37 diff --git a/strings.dat b/strings.dat new file mode 100644 index 000000000..05f5106f3 --- /dev/null +++ b/strings.dat @@ -0,0 +1,469 @@ +; ABOUT THIS FILE... +; +; This file contains string data for CloneKeen. +; Each string is prefaced with a string name, which is enclosed +; in square brackets. The next line after the string name +; is the first line of the string. The string data continues until +; another opening square bracket is seen. +; +; You can use a backslash to delimit special characters. A backslash +; followed by an open or close parenthese can be used to insert square +; brackets into the string text. A backslash followed by an uppercase H +; will turn on highlighting (text will appear red on a grey background). +; A lower case h will turn off highlighting (text will appear black on a +; white background). Two backslashes will result in a single backslash. +; +; You can specify numeric attributes for a string by adding them on to the +; same line as the string name after the closing bracket. For example this +; is used with strings defining text to go in dialog boxes to specify the +; dimensions of the dialog box. + +[MAIN_MENU] LEFT=11 TOP=9 WIDTH=17 HEIGHT=11 + 1-Player Game + 2-Player Game + Load Game + Story + Options + Controls + Demo + New Game + Quit +[Tribute_Page_1] ONTIME=200 OFFTIME=200 + + + +[Tribute_Page_2] ONTIME=1600 OFFTIME=500 +Thanks to ID Software +for the wonderful +"Commander Keen" series. +[Tribute_Page_3] ONTIME=1200 OFFTIME=500 Y1ADJ=3 Y2ADJ=3 +As a child, I spent way too +much time playing these games. + +[Tribute_Page_4] ONTIME=1200 OFFTIME=100 +And now I have spent way +too much time programming +this game. +[Tribute_Page_5] ONTIME=550 OFFTIME=200 SLOWPRINT=2 SLOWPRINTSPD=100 + +... + +[Tribute_Page_6] ONTIME=1200 OFFTIME=500 Y1ADJ=1 Y2ADJ=2 +Hmmm...History repeats itself? +;) + +[Tribute_Page_7] ONTIME=1200 OFFTIME=500 Y1ADJ=-1 Y2ADJ=1 +This is my tribute to +the "Keen legacy". + +[Tribute_Page_8] ONTIME=1700 OFFTIME=200 Y1ADJ=-5 LASTPAGE=1 + Enjoy the Game. \h + + -Katy and Gerstrong +[WhichSlotSave] LEFT=8 TOP=11 WIDTH=23 HEIGHT=4 +Which slot do you want +want to save (1-9)? +[WhichSlotLoad] LEFT=8 TOP=11 WIDTH=23 HEIGHT=4 +Which slot do you want +want to load (1-9)? +[SaveSlotOverwrite] LEFT=7 TOP=10 WIDTH=26 HEIGHT=6 +That slot already exists! + +Do you want to overwrite +the existing game \(Y/N\)? +[GameSaveSuccess] LEFT=7 TOP=9 WIDTH=26 HEIGHT=7 +Your game has been saved! + +You can continue this +game from the main menu +next time you play. +[LoadNoSuchSlot] LEFT=7 TOP=10 WIDTH=25 HEIGHT=5 +That game hasn't been +saved yet! Please select +a different slot. +[VerifyQuit] LEFT=7 TOP=10 WIDTH=26 HEIGHT=4 +(Q)uit entire program or +quit to (T)itle \(Q/T\)? +[EP1_SHIP] LEFT=5 TOP=9 WIDTH=29 HEIGHT=8 +Your ship needs these parts: + + + + + Go find them! +[EP1_StatusBox] LEFT=5 TOP=5 WIDTH=30 HEIGHT=15 +\H SCORE EXTRA LIFE AT \h +\h \H \h +\H LIVES SHIP PARTS \h +\h \H \h +\h \H \h +\h \H \h +\H RAYGUN POGO KEYCARDS \h +\h \H \h \H \h +\h \H \h \H \h +\h \H \h \H \h +\H CHARGE \h \H \h +\h \H \h \H \h +\H PLEASE PRESS A KEY \h +[EP2_StatusBox] LEFT=5 TOP=5 WIDTH=30 HEIGHT=15 +\H SCORE EXTRA LIFE AT \h +\h \H \h +\H LIVES RAY GUN \h +\h \H \h +\h \H \h +\h \H \h +\H TARGETS SAVED KEY CARDS \h +\h \H \h +\h \H \h +\h \H \h +\h \H \h +\h \H \h +\H PLEASE PRESS A KEY \h +[EP3_StatusBox] LEFT=5 TOP=6 WIDTH=30 HEIGHT=13 +\H SCORE EXTRA LIFE AT \h +\h \H \h +\H LIVES PISTOL \h +\h \H \h +\h \H \h +\h \H \h +\H ANKH TIME KEY CARDS \h +\h \H \h +\h \H \h +\h \H \h +\H PLEASE PRESS A KEY \h +[LIVES_LEFT_BACKGROUND] +\H \h +[LIVES_LEFT] +\HKEENS LEFT\h +[EP1_YSIYM_LVL2] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +You see in your +mind: + +It is too bad that +you can not read the +Standard Galatic +Alphabet, human. + + + PRESS ENTER: +[EP1_YSIYM_LVL6] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +A message echoes +in your head: + +The teleporter in +the ice will send +you to the dark side +of Mars. + + + PRESS ENTER: +[EP1_YSIYM_LVL9] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +You hear in your +mind: + +A secret city is +hidden in the dark +area of the city on +the dark side to the +south. + + PRESS ENTER: +[EP1_YSIYM_LVL10] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +You see these words +in your head: + +You will need a raygun +in the end, but not to +shoot the Vorticon... + + + + PRESS ENTER: +[EP1_YSIYM_LVL11] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +You hear in your +mind: + +GAAARRRRGG!!!! + + + + + + PRESS ENTER: +[EP1_YSIYM_LVL12] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +A Yorpish whisper +says: + +Huh? Oh, you thought +I was going to +dispense some wisdom +or something. I'm +sorry...it's my day +off. + PRESS ENTER: +[EP1_YSIYM_LVL15] LEFT=8 TOP=7 WIDTH=23 HEIGHT=12 TWIRLX=18 TWIRLY=10 +A Yorpy mind-thought +bellows: + +You cannot kill the +Vorticon Commander +directly. + + + + PRESS ENTER: +[EP1_ESEQ_PART1] +Commander Keen returns to his ship +and quickly replaces the missing +parts. He must get home before his +parents do! +[EP1_ESEQ_PART2_PAGE1] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Keen makes it home and +rushes to beat his +parents upstairs. +[EP1_ESEQ_PART2_PAGE2] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Shhh, honey...let's +see if little Billy is +asleep. +[EP1_ESEQ_PART2_PAGE3] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Billy...? Are you a-- +WHAT IS THIS ONE-EYED +GREEN THING IN YOUR +ROOM!!!!??? +[EP1_ESEQ_PART2_PAGE4] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Ahhh, Mom, can't I keep +him? +[EP1_ESEQ_PART2_PAGE5] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Well, we'll talk about +that in the morning, son. +You get some rest. +[EP1_ESEQ_PART2_PAGE6] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Okay Mom; Goodnight. +[EP1_ESEQ_PART2_PAGE7] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Goodnight, dear. +[EP1_ESEQ_PART2_PAGE8] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +But there is no sleep +for Commander Keen! The +Vorticon Mothership +looms above, ready to +destroy Earth! + + + +[TO_BE_CONTINUED] LEFT=7 TOP=4 WIDTH=26 HEIGHT=3 +TO BE CONTINUED.......... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[EP2_VE_NOJUMPINDARK] LEFT=8 TOP=6 WIDTH=23 HEIGHT=14 TWIRLX=18 TWIRLY=12 +The Elder Vorticon +in the statis field +says: + +The wise Vorticon +never jumps in the +dark. In fact, even +unwise Vorticons will +not jump in darkness. + + + PRESS ENTER: +[EP2_VE_EVILBELTS] LEFT=8 TOP=5 WIDTH=23 HEIGHT=16 TWIRLX=18 TWIRLY=14 +The Vorticon Elder +says through the +statis field: + +The Grand Intellect +is not from Vorticon +VI--he is from the +planet Earth. His evil +Mind-Belts control +their minds. They are +not evil. Please do +not shoot them, human. + + PRESS ENTER: +[EP2_LVL4_TargetName] +London +[EP2_LVL6_TargetName] +Cairo +[EP2_LVL7_TargetName] +Sydney +[EP2_LVL9_TargetName] +New York +[EP2_LVL11_TargetName] +Paris +[EP2_LVL13_TargetName] +Moscow +[EP2_LVL15_TargetName] +Rome +[EP2_LVL16_TargetName] +Wash. DC +[EP2_AfterVibrateString] LEFT=17 TOP=11 WIDTH=7 HEIGHT=3 +Uh-oh. +[EP2_ESEQ_PART1] +After disabling the weaponry of +the Vorticon Mothership, Billy +heads for Earth. Even great +space heroes need a nap after +defeating a vicious horde of +violence-bent aliens! +[EP2_ESEQ_PART2] +The Vorticon ship limps back +towards Vorticon VI to tell of +their defeat at the hands of +Commander Keen. The Grand +Intellect will not be pleased. +[EP2_ESEQ_PART3_PAGE1] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Look honey it snowed +outside! There's no +school! +[EP2_ESEQ_PART3_PAGE2] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Wonderful. That gives me +time to travel to +Vorticon VI and solve the +mystery of the Grand +Intellect! +[EP2_ESEQ_PART3_PAGE3] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 +Ok, hun, but you'd better +eat a nourishing vitamin +fortified bowl of Sugar +Stoopies first. +[EP2_ESEQ_PART3_PAGE4] LEFT=2 TOP=17 WIDTH=26 HEIGHT=7 LASTPAGE=1 +Ok Mom... +[EP3_SHIP1] LEFT=3 TOP=9 WIDTH=33 HEIGHT=8 TWIRLX=21 TWIRLY=6 +You enter your ship, sit around +for a while, get bored, then +remember you have to find +the Grand Intellect! + + PRESS ENTER: +[EP3_SHIP2] LEFT=3 TOP=9 WIDTH=33 HEIGHT=8 TWIRLX=21 TWIRLY=6 +Into the ship you journey, lie +about a bit, then resume your +quest for the Grand Intellect! + + + PRESS ENTER: +[EP3_SHIP3] LEFT=3 TOP=9 WIDTH=33 HEIGHT=8 TWIRLX=21 TWIRLY=6 +You feel like entering the ship +and taking a rest, but the +mystery of the Grand Intellect's +identity changes your mind. + + PRESS ENTER: +[EP3_SHIP4] LEFT=3 TOP=9 WIDTH=33 HEIGHT=8 TWIRLX=21 TWIRLY=6 +Entering the ship might be a +fun thing to do, but right now, +you need to find the Grand +Intellect and vanquish him! + + PRESS ENTER: +[EP3_MORTIMER] LEFT=3 TOP=6 WIDTH=34 HEIGHT=9 +No. It can't be! + +Mortimer McMire! +[EP3_MORTIMER2] +Mortimer has been a thorn in your +side for as long as you can +remember. Your IQ test score was +314-Mortimer's was 315. He always +held that over you, never letting +you forget for one day. +[EP3_MORTIMER3] +All the practical jokes, the +mental cruelty, the swirlies-each +memory makes your teeth grit +harder. And now he's out to +destroy Earth! You have had +enough! +[EP3_MORTIMER4] +"Alright Mortimer, what's the +problem? Why destroy Earth?" + +"You and all those mental wimps +deserve to die! I'm the smartest +person in the galaxy. Aren't I +Mister THREE FOURTEEN! Ah,ha,ha!" +[EP3_MORTIMER5] +"I'll get you for that,Mortimer!" + + +"Come and try! You'll never get +past my hideous Mangling Machine! +Prepare to die, Commander Clown!" + + + + +[EP3_ESEQ_PAGE1] LEFT=0 TOP=18 WIDTH=39 HEIGHT=6 +With Mortimer McMire out of the +picture, and his brain-wave belts no +longer controlling them, the Vorticons +are freed of their mental enslavement. +[EP3_ESEQ_PAGE2] +"Commander Keen, in honor of your +meritorious service in freeing us from +the Grand Intellect's mental chains," +[EP3_ESEQ_PAGE3] +"I and the other Vorticons you haven't +slaughtered want to award you the +Big V, our highest honor." +[EP3_ESEQ_PAGE4] +"Thank you!" +[THE_END] LEFT=16 TOP=20 WIDTH=9 HEIGHT=3 +THE END? +[*] +This is a dummy string... +you must have a dummy string +at the end of this file.