update 20.06.2009

git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@27 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
gerstrong
2009-06-20 18:08:58 +00:00
parent 0e9ddc542c
commit 053a44eeae
58 changed files with 838 additions and 1298 deletions

View File

@@ -6,6 +6,7 @@
CPP_SRCS += \
../src/sdl/CInput.cpp \
../src/sdl/COpenGL.cpp \
../src/sdl/CSettings.cpp \
../src/sdl/CTimer.cpp \
../src/sdl/CVideoDriver.cpp \
../src/sdl/joydrv.cpp
@@ -13,6 +14,7 @@ CPP_SRCS += \
OBJS += \
./src/sdl/CInput.o \
./src/sdl/COpenGL.o \
./src/sdl/CSettings.o \
./src/sdl/CTimer.o \
./src/sdl/CVideoDriver.o \
./src/sdl/joydrv.o
@@ -20,6 +22,7 @@ OBJS += \
CPP_DEPS += \
./src/sdl/CInput.d \
./src/sdl/COpenGL.d \
./src/sdl/CSettings.d \
./src/sdl/CTimer.d \
./src/sdl/CVideoDriver.d \
./src/sdl/joydrv.d

View File

@@ -4,20 +4,26 @@
# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../src/vorticon/CCredits.cpp \
../src/vorticon/CDialog.cpp \
../src/vorticon/CHighScores.cpp \
../src/vorticon/CIntro.cpp \
../src/vorticon/CObject.cpp \
../src/vorticon/CPlayer.cpp
OBJS += \
./src/vorticon/CCredits.o \
./src/vorticon/CDialog.o \
./src/vorticon/CHighScores.o \
./src/vorticon/CIntro.o \
./src/vorticon/CObject.o \
./src/vorticon/CPlayer.o
CPP_DEPS += \
./src/vorticon/CCredits.d \
./src/vorticon/CDialog.d \
./src/vorticon/CHighScores.d \
./src/vorticon/CIntro.d \
./src/vorticon/CObject.d \
./src/vorticon/CPlayer.d

View File

@@ -95,7 +95,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -26,7 +26,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -23,7 +23,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -29,7 +29,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -23,7 +23,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -6,6 +6,7 @@
CPP_SRCS += \
../src/sdl/CInput.cpp \
../src/sdl/COpenGL.cpp \
../src/sdl/CSettings.cpp \
../src/sdl/CTimer.cpp \
../src/sdl/CVideoDriver.cpp \
../src/sdl/joydrv.cpp
@@ -13,6 +14,7 @@ CPP_SRCS += \
OBJS += \
./src/sdl/CInput.o \
./src/sdl/COpenGL.o \
./src/sdl/CSettings.o \
./src/sdl/CTimer.o \
./src/sdl/CVideoDriver.o \
./src/sdl/joydrv.o
@@ -20,6 +22,7 @@ OBJS += \
CPP_DEPS += \
./src/sdl/CInput.d \
./src/sdl/COpenGL.d \
./src/sdl/CSettings.d \
./src/sdl/CTimer.d \
./src/sdl/CVideoDriver.d \
./src/sdl/joydrv.d
@@ -29,7 +32,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -17,7 +17,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -74,7 +74,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -17,7 +17,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -4,20 +4,26 @@
# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../src/vorticon/CCredits.cpp \
../src/vorticon/CDialog.cpp \
../src/vorticon/CHighScores.cpp \
../src/vorticon/CIntro.cpp \
../src/vorticon/CObject.cpp \
../src/vorticon/CPlayer.cpp
OBJS += \
./src/vorticon/CCredits.o \
./src/vorticon/CDialog.o \
./src/vorticon/CHighScores.o \
./src/vorticon/CIntro.o \
./src/vorticon/CObject.o \
./src/vorticon/CPlayer.o
CPP_DEPS += \
./src/vorticon/CCredits.d \
./src/vorticon/CDialog.d \
./src/vorticon/CHighScores.d \
./src/vorticon/CIntro.d \
./src/vorticon/CObject.d \
./src/vorticon/CPlayer.d
@@ -26,7 +32,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -95,7 +95,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -26,7 +26,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -23,7 +23,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -29,7 +29,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -23,7 +23,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -6,6 +6,7 @@
CPP_SRCS += \
../src/sdl/CInput.cpp \
../src/sdl/COpenGL.cpp \
../src/sdl/CSettings.cpp \
../src/sdl/CTimer.cpp \
../src/sdl/CVideoDriver.cpp \
../src/sdl/joydrv.cpp
@@ -13,6 +14,7 @@ CPP_SRCS += \
OBJS += \
./src/sdl/CInput.o \
./src/sdl/COpenGL.o \
./src/sdl/CSettings.o \
./src/sdl/CTimer.o \
./src/sdl/CVideoDriver.o \
./src/sdl/joydrv.o
@@ -20,6 +22,7 @@ OBJS += \
CPP_DEPS += \
./src/sdl/CInput.d \
./src/sdl/COpenGL.d \
./src/sdl/CSettings.d \
./src/sdl/CTimer.d \
./src/sdl/CVideoDriver.d \
./src/sdl/joydrv.d
@@ -29,7 +32,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -17,7 +17,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -74,7 +74,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -17,7 +17,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -4,20 +4,26 @@
# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../src/vorticon/CCredits.cpp \
../src/vorticon/CDialog.cpp \
../src/vorticon/CHighScores.cpp \
../src/vorticon/CIntro.cpp \
../src/vorticon/CObject.cpp \
../src/vorticon/CPlayer.cpp
OBJS += \
./src/vorticon/CCredits.o \
./src/vorticon/CDialog.o \
./src/vorticon/CHighScores.o \
./src/vorticon/CIntro.o \
./src/vorticon/CObject.o \
./src/vorticon/CPlayer.o
CPP_DEPS += \
./src/vorticon/CCredits.d \
./src/vorticon/CDialog.d \
./src/vorticon/CHighScores.d \
./src/vorticon/CIntro.d \
./src/vorticon/CObject.d \
./src/vorticon/CPlayer.d
@@ -26,7 +32,7 @@ CPP_DEPS += \
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"$@" "$<"
g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -95,7 +95,7 @@ CPP_DEPS += \
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"$@" "$<"
i586-mingw32msvc-g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -26,7 +26,7 @@ CPP_DEPS += \
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"$@" "$<"
i586-mingw32msvc-g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -23,7 +23,7 @@ CPP_DEPS += \
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"$@" "$<"
i586-mingw32msvc-g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -29,7 +29,7 @@ CPP_DEPS += \
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"$@" "$<"
i586-mingw32msvc-g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -23,7 +23,7 @@ CPP_DEPS += \
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"$@" "$<"
i586-mingw32msvc-g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -6,6 +6,7 @@
CPP_SRCS += \
../src/sdl/CInput.cpp \
../src/sdl/COpenGL.cpp \
../src/sdl/CSettings.cpp \
../src/sdl/CTimer.cpp \
../src/sdl/CVideoDriver.cpp \
../src/sdl/joydrv.cpp
@@ -13,6 +14,7 @@ CPP_SRCS += \
OBJS += \
./src/sdl/CInput.o \
./src/sdl/COpenGL.o \
./src/sdl/CSettings.o \
./src/sdl/CTimer.o \
./src/sdl/CVideoDriver.o \
./src/sdl/joydrv.o
@@ -20,6 +22,7 @@ OBJS += \
CPP_DEPS += \
./src/sdl/CInput.d \
./src/sdl/COpenGL.d \
./src/sdl/CSettings.d \
./src/sdl/CTimer.d \
./src/sdl/CVideoDriver.d \
./src/sdl/joydrv.d
@@ -29,7 +32,7 @@ CPP_DEPS += \
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"$@" "$<"
i586-mingw32msvc-g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -17,7 +17,7 @@ CPP_DEPS += \
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"$@" "$<"
i586-mingw32msvc-g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -74,7 +74,7 @@ CPP_DEPS += \
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"$@" "$<"
i586-mingw32msvc-g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -17,7 +17,7 @@ CPP_DEPS += \
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"$@" "$<"
i586-mingw32msvc-g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -4,20 +4,26 @@
# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../src/vorticon/CCredits.cpp \
../src/vorticon/CDialog.cpp \
../src/vorticon/CHighScores.cpp \
../src/vorticon/CIntro.cpp \
../src/vorticon/CObject.cpp \
../src/vorticon/CPlayer.cpp
OBJS += \
./src/vorticon/CCredits.o \
./src/vorticon/CDialog.o \
./src/vorticon/CHighScores.o \
./src/vorticon/CIntro.o \
./src/vorticon/CObject.o \
./src/vorticon/CPlayer.o
CPP_DEPS += \
./src/vorticon/CCredits.d \
./src/vorticon/CDialog.d \
./src/vorticon/CHighScores.d \
./src/vorticon/CIntro.d \
./src/vorticon/CObject.d \
./src/vorticon/CPlayer.d
@@ -26,7 +32,7 @@ CPP_DEPS += \
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"$@" "$<"
i586-mingw32msvc-g++ -DBUILD_SDL -DUSE_OPENGL -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 ' '

View File

@@ -7,10 +7,20 @@
#include <stdlib.h>
#include "CGame.h"
#include "fileio.h"
#include "keen.h"
#include "CGame.h"
#include "include/game.h"
#include "include/misc.h"
#include "include/main.h"
#include "include/menu.h"
#include "include/fileio/story.h"
#include "vorticon/CHighScores.h"
#include "vorticon/CIntro.h"
#include "vorticon/CCredits.h"
#include "CLogFile.h"
#include "fileio.h"
#include "sdl/sound/CSound.h"
#include "sdl/CVideoDriver.h"
CGame::CGame() {
m_Episode = 0;
@@ -22,9 +32,189 @@ CGame::~CGame() {
if(Latch){ delete Latch; Latch = NULL;}
}
void CGame::runCycle(void)
short CGame::runCycle(stCloneKeenPlus *pCKP)
{
// TODO: Code here!!
int opt = MAINMNU_1PLAYER;
int retval;
int eseq = 0;
int defaultopt = 0;
initgamefirsttime(pCKP, Latch->getLatchHeader()->NumSprites);
initgame(pCKP);
g_pLogFile->ftextOut("Game starting...<br>");
if (eseq)
{
endsequence(pCKP);
closeCKP(pCKP);
}
if(!pCKP->Control.skipstarting)
{
CIntro Intro;
Intro.Render(pCKP);
//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()<br>");
opt = mainmenu(pCKP, defaultopt); // Read option from the main menu
// of the game.
pCKP->Control.skipstarting=0;
g_pLogFile->ftextOut("gcl: opt = %d<br>", opt);
}
defaultopt = 0;
IntroCanceled = 0;
switch(opt)
{
case MAINMNU_1PLAYER:
numplayers = 1;
defaultopt = 0;
current_demo = 1;
initgamefirsttime(pCKP, Latch->getLatchHeader()->NumSprites);
loadinggame = 0;
playgame_levelmanager(pCKP);
break;
case MAINMNU_2PLAYER:
defaultopt = 0;
current_demo = 1;
numplayers = 2;
initgamefirsttime(pCKP, Latch->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, Latch->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!!<br>");
}
delete pHighscores;
break;
case MAINMNU_NEW_GAME:
if(loadStartMenu(pCKP) == 1)
{
pCKP->shutdown = SHUTDOWN_EXIT;
break;
}
//loadResourcesforGame(pCKP);
loadResources(pCKP->Control.levelcontrol.episode, pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
pCKP->shutdown = SHUTDOWN_RESTART;
break;
case MAINMNU_ABOUT:
CCredits *pCredit;
pCredit = new CCredits;
pCredit->Render(pCKP);
delete pCredit;
pCredit = NULL;
break;
case MAINMNU_TIMEOUT:
case MAINMNU_DEMO:
retval = play_demo(current_demo, pCKP, Latch->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);
CIntro *pIntro;
pIntro = new CIntro();
delete pIntro;
pIntro = NULL;
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("********************<br>");
g_pLogFile->ftextOut(" Restarting game...<br>");
g_pLogFile->ftextOut("********************<br>\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<br>", opt, crashflag);
if(pCKP->shutdown == SHUTDOWN_EXIT) break;
} while(opt != MAINMNU_QUIT && opt != MAINMNU_NEW_GAME && !crashflag);
return 0;
}
int CGame::loadResources(unsigned short Episode, char *DataDirectory)
@@ -44,5 +234,36 @@ int CGame::loadResources(unsigned short Episode, char *DataDirectory)
return 0;
}
void CGame::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;
g_pVideoDriver->showFPS(false);
player[0].x = player[0].y = 0;
}
CLatch *CGame::getLatch(void)
{ return Latch; }

View File

@@ -16,14 +16,16 @@ public:
CGame();
virtual ~CGame();
void runCycle(void);
int loadResources(unsigned short Episode, char *DataDirectory);
short runCycle(stCloneKeenPlus *pCKP);
void preallocateCKP(stCloneKeenPlus *pCKP);
CLatch *getLatch(void);
private:
static const unsigned short MAX_TEXT_LENGTH = 256;
unsigned short m_Episode;
char m_DataDirectory[MAX_TEXT_LENGTH];
int current_demo;
CLatch *Latch;
};

View File

@@ -531,6 +531,8 @@ unsigned char *bmdataptr;
int CGraphics::getBitmapNumberFromName(const char *bmname)
{
// TODO: Implement Code for Introduction Screen
int i;
for(i=0;i<MAX_BITMAPS;i++)
{

View File

@@ -240,7 +240,11 @@ char buffer[256];
else
{
g_pLogFile->ftextOut("latch_loadlatch(): Reading %d bytes...<br>", RawDataSize);
fread(RawData, RawDataSize, 1, latchfile);
if(!fread(RawData, 1, RawDataSize, latchfile))
{
g_pLogFile->ftextOut(RED,"latch_loadlatch(): Error reading the file...<br>");
return 1;
}
}
fclose(latchfile);
@@ -480,7 +484,11 @@ char buffer[256];
else
{
g_pLogFile->ftextOut("latch_loadsprites(): Reading %d bytes...<br>", RawDataSize);
fread(RawData, RawDataSize, 1, spritfile);
if(!fread(RawData, 1, RawDataSize, spritfile))
{
g_pLogFile->ftextOut(RED,"latch_loadsprites(): Error reading the file...<br>");
return 1;
}
}
fclose(spritfile);

View File

@@ -8,7 +8,7 @@
#ifndef CLOGFILE_H_
#define CLOGFILE_H_
#define REVISION "CloneKeenPlus Beta v0.2.9.2 (Commander Genius)"
#define REVISION "CloneKeenPlus Beta v0.2.9.5 (Commander Genius)"
#include <stdio.h>
#include "CSingleton.h"

View File

@@ -396,7 +396,7 @@ int dlgX, dlgY, dlgW, dlgH;
return 0;
gamedo_fades();
gamedo_frameskipping_blitonly(pCKP);
gamedo_frameskipping_blitonly();
lastenterstate = enter;

View File

@@ -383,7 +383,7 @@ int cancel, lastcancelstate;
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_frameskipping_blitonly();
gamedo_render_eraseobjects();
if (showtimer > LETTER_SHOW_SPD)

View File

@@ -267,14 +267,12 @@ void gameloop(stCloneKeenPlus *pCKP)
// if (numplayers>1) net_senddata();
#endif
if (g_pInput->getPressedKey(KQUIT))
if (g_pInput->getPressedKey(KQUIT))
{
VerifyQuit(pCKP);
}
if (QuitState != NO_QUIT) return;
// limit frame rate
if (!acceleratemode)
{

View File

@@ -43,7 +43,6 @@ void gamedo_getInput(stCloneKeenPlus *pCKP)
int i;
int byt;
unsigned int msb, lsb;
int p/*, keysdirty*/;
if (demomode==DEMO_PLAYBACK)
{
@@ -56,17 +55,19 @@ int p/*, keysdirty*/;
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;
player[0].playcontrol[PA_X] = 0;
player[0].playcontrol[PA_POGO] = 0;
player[0].playcontrol[PA_JUMP] = 0;
player[0].playcontrol[PA_FIRE] = 0;
player[0].playcontrol[PA_STATUS] = 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)
if (byt & 1) player[0].playcontrol[PA_X] -= 100;
if (byt & 2) player[0].playcontrol[PA_X] += 100;
if (byt & 4) player[0].playcontrol[PA_POGO] = 1;
if (byt & 8) player[0].playcontrol[PA_JUMP] = 1;
if (byt & 16)player[0].playcontrol[PA_FIRE] = 1;
if (byt & 32)player[0].playcontrol[PA_STATUS] = 1;
if (byt & 64)
{ // demo STOP command
if (fade.mode!=FADE_GO) endlevel(1, pCKP);
}
@@ -93,94 +94,49 @@ int p/*, keysdirty*/;
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 ; i<PA_MAX_ACTIONS ; i++)
for(Uint8 p=0 ; p<numplayers ; p++)
{
player[p].playcontrol[i] = 0;
memcpy(player[p].lastplaycontrol,player[p].playcontrol,PA_MAX_ACTIONS);
// Entry for every player
for(Uint8 j=0 ; j<PA_MAX_ACTIONS ; j++)
player[p].playcontrol[j] = 0;
if(g_pInput->getHoldedCommand(p, IC_LEFT))
player[p].playcontrol[PA_X] -= 100;
if(g_pInput->getHoldedCommand(p, IC_RIGHT))
player[p].playcontrol[PA_X] += 100;
if(g_pInput->getHoldedCommand(p, IC_UP))
player[p].playcontrol[PA_Y] -= 100;
if(g_pInput->getHoldedCommand(p, IC_DOWN))
player[p].playcontrol[PA_Y] += 100;
if(g_pInput->getHoldedCommand(p, IC_JUMP))
player[p].playcontrol[PA_JUMP] = 1;
if(g_pInput->getHoldedCommand(p, IC_POGO))
player[p].playcontrol[PA_POGO] = 1;
if(g_pInput->getHoldedCommand(p, IC_FIRE))
player[p].playcontrol[PA_FIRE] = 1;
if(g_pInput->getHoldedCommand(p, IC_STATUS))
player[p].playcontrol[PA_STATUS] = 1;
if (demomode==DEMO_RECORD)
{
if(i) player[p].playcontrol[PA_X] += 100;
fputc(i, demofile);
if(i) player[p].playcontrol[PA_X] -= 100;
fputc(i, demofile);
if(i) player[p].playcontrol[PA_POGO] = 1;
fputc(i, demofile);
if(i) player[p].playcontrol[PA_JUMP] = 1;
fputc(i, demofile);
if(i) player[p].playcontrol[PA_FIRE] = 1;
fputc(i, demofile);
if(i) player[p].playcontrol[PA_STATUS] = 1;
fputc(i, demofile);
}
}
if(g_pInput->getHoldedCommand(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
@@ -553,7 +509,6 @@ void gamedo_RenderScreen(stCloneKeenPlus *pCKP)
g_pGraphics->renderHQBitmap();
gamedo_render_drawobjects(pCKP);
//gamedo_render_drawdebug();
if(pCKP != NULL)
{
@@ -572,30 +527,6 @@ void gamedo_RenderScreen(stCloneKeenPlus *pCKP)
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++;
}
@@ -799,7 +730,7 @@ void gamedo_frameskipping(stCloneKeenPlus *pCKP)
// same as above but only does a sb_blit, not the full RenderScreen.
// used for intros etc.
void gamedo_frameskipping_blitonly(stCloneKeenPlus *pCKP)
void gamedo_frameskipping_blitonly(void)
{
if (framebyframe)
{

View File

@@ -74,12 +74,10 @@ char doFall;
}
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)
{
@@ -290,7 +288,7 @@ void gamepdo_ProcessInput(unsigned int cp, stCloneKeenPlus *pCKP)
gamedo_render_drawobjects(pCKP);
gamedo_AnimatedTiles();
PauseDialog->renderDialog();
gamedo_frameskipping_blitonly(pCKP);
gamedo_frameskipping_blitonly();
} while(!g_pInput->getPressedAnyKey());
delete PauseDialog;
@@ -672,7 +670,7 @@ void gamepdo_InertiaAndFriction_X(unsigned int cp, stCloneKeenPlus *pCKP)
{
if(player[cp].ppogostick)
{
player[cp].pinertia_x += player[cp].pboost_x/PJUMPINERTIA;
player[cp].pinertia_x += 3*player[cp].pboost_x/(PJUMPINERTIA*2);
}
else
{

View File

@@ -5,26 +5,8 @@
#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;

View File

@@ -2,6 +2,6 @@
void gamedo_RenderScreen(stCloneKeenPlus *pCKP);
void gamedo_frameskipping(stCloneKeenPlus *pCKP);
void gamedo_HandleFKeys(stCloneKeenPlus *pCKP);
void gamedo_frameskipping_blitonly(stCloneKeenPlus *pCKP);
void gamedo_frameskipping_blitonly(void);
void gamedo_getInput(stCloneKeenPlus *pCKP);
void gamedo_render_drawobjects(stCloneKeenPlus *pCKP);

View File

@@ -5,9 +5,6 @@
* 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);

View File

@@ -19,7 +19,6 @@ 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);

View File

@@ -773,10 +773,11 @@ typedef struct stShipQueue
#define MAINMNU_OPTIONS 5
#define MAINMNU_DEMO 6
#define MAINMNU_NEW_GAME 7
#define MAINMNU_QUIT 8
#define MAINMNU_TIMEOUT 10 // going to demo due to timeout
#define RESTART_GAME 11
#define BACK2MAINMENU 12
#define MAINMNU_ABOUT 8
#define MAINMNU_QUIT 9
#define MAINMNU_TIMEOUT 11 // going to demo due to timeout
#define RESTART_GAME 12
#define BACK2MAINMENU 13
#define MAINMENU_NUM_OPTIONS MAINMNU_QUIT
@@ -848,6 +849,7 @@ typedef struct stShipQueue
#include <SDL.h>
#include "include/declarations.h"
#include "keenext.h"
#include "sdl/CSettings.h"
typedef struct stCloneKeenPlus
{

View File

@@ -1,9 +1,10 @@
#include "sdl/CSettings.h"
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];

View File

@@ -49,14 +49,13 @@
#include "CLogFile.h"
#include "CGame.h"
#include "CGraphics.h"
#include "sdl/CSettings.h"
int IntroCanceled;
int NessieObjectHandle;
int DemoObjectHandle;
int BlankSprite;
int DemoSprite;
int current_demo;
int framebyframe;
int fps=0, curfps=0;
@@ -113,62 +112,10 @@ char frameskiptimer=0;
int thisplayer;
unsigned int primaryplayer;
unsigned int numplayers;
char is_client;
char is_server;
char localmp;
int crashflag,crashflag2,crashflag3;
const char *why_term_ptr = "No reason given.";
void setoption(stOption *options, int opt, const char *name, char value)
{
if (name != NULL)
options[opt].name = (char*) name;
options[opt].value = value;
}
short loadGamesConfig(stOption *Option)
{
short retval = 0;
int i;
CParser Parser;
if(!Parser.loadParseFile())
return 1;
for (i = 0; i < NUM_OPTIONS; i++)
{
Option[i].value = Parser.getIntValue(Option[i].name,"Game");
if(Option[i].value == -1)
{
createDefaultSettings(Option);
break;
}
}
return retval;
g_pLogFile->ftextOut("<br>Your personal settings were loaded successfully...<br>");
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[])
{
@@ -179,14 +126,19 @@ int main(int argc, char *argv[])
banner(); // Intro on the text-console.
preallocateCKP(&CKP);
CGame* Game;
Game = new CGame();
if(loadDriverConfiguration(&CKP) != 0) // Always return 0 if no ERROR
Game->preallocateCKP(&CKP);
CSettings *Settings;
Settings = new CSettings;
if(Settings->loadDrvCfg() != 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.<br>");
saveDriverConfiguration(&CKP);
Settings->saveDrvCfg();
}
// TODO: Implement Driver Configuration as class
if(readCommandLine(argc, argv, &CKP) != 0)
{
@@ -200,15 +152,13 @@ int main(int argc, char *argv[])
return 1;
}
createDefaultSettings(CKP.Option);
if(loadGamesConfig(CKP.Option) != 0)
Settings->loadDefaultGameCfg(CKP.Option);
if(Settings->loadGameCfg(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.<br>");
SaveConfig(CKP.Option);
Settings->saveGameCfg(CKP.Option);
}
CGame* Game;
Game = new CGame();
delete Settings; Settings = NULL;
if(loadResourcesforStartMenu(&CKP, Game) != 0)
{
@@ -240,7 +190,7 @@ int main(int argc, char *argv[])
while( CKP.shutdown == SHUTDOWN_RESTART || CKP.shutdown == SHUTDOWN_BOOTUP )
{
CKP.shutdown = SHUTDOWN_NONE; // Game is runnning
runGameCycle(&CKP, Game);
Game->runCycle(&CKP);
}
}
@@ -253,204 +203,21 @@ int main(int argc, char *argv[])
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...<br>");
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()<br>");
opt = mainmenu(pCKP, defaultopt); // Read option from the main menu
// of the game.
pCKP->Control.skipstarting=0;
g_pLogFile->ftextOut("gcl: opt = %d<br>", 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!!<br>");
}
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("********************<br>");
g_pLogFile->ftextOut(" Restarting game...<br>");
g_pLogFile->ftextOut("********************<br>\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<br>", 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...<br>");
if (!g_pVideoDriver->start())
{
return abortCKP(pCKP);
}
g_pLogFile->ftextOut("Starting sound driver...<br>");
@@ -463,90 +230,6 @@ short loadCKPDrivers(stCloneKeenPlus *pCKP)
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("autoframeskip","Video",g_pVideoDriver->getTargetFPS());
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->setTargetFPS(Parser.getIntValue("autoframeskip","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.<br>");
@@ -559,20 +242,26 @@ short closeCKP(stCloneKeenPlus *pCKP)
{
int count;
int i;
banner();
SaveConfig(pCKP->Option);
g_pLogFile->ftextOut("<br>Thanks for playing!<br><br>");
cleanup(pCKP);
if (crashflag)
{
if (crashflag != QUIT_NONFATAL) g_pLogFile->ftextOut("\a");
g_pLogFile->ftextOut("abnormal program termination, error code %d/%d/%d<br>explanation: %s<br>", crashflag,crashflag2,crashflag3, why_term_ptr);
CSettings Settings;
g_pLogFile->ftextOut("numplayers: %d<br>", numplayers);
for(count=0,i=0;i<MAX_PLAYERS;i++) if (player[i].isPlaying) count++;
g_pLogFile->ftextOut("# of player instances with isPlaying set: %d<br>", count);
}
return 0;
banner();
Settings.saveGameCfg(pCKP->Option);
g_pLogFile->ftextOut("<br>Thanks for playing!<br><br>");
cleanup(pCKP);
if (crashflag)
{
if (crashflag != QUIT_NONFATAL) g_pLogFile->ftextOut("\a");
g_pLogFile->ftextOut("abnormal program termination, error code %d/%d/%d<br>explanation: %s<br>", crashflag,crashflag2,crashflag3, why_term_ptr);
g_pLogFile->ftextOut("numplayers: %d<br>", numplayers);
for(count=0,i=0;i<MAX_PLAYERS;i++) if (player[i].isPlaying) count++;
g_pLogFile->ftextOut("# of player instances with isPlaying set: %d<br>", count);
}
return 0;
}
void playgame_levelmanager(stCloneKeenPlus *pCKP)
@@ -756,6 +445,12 @@ void playgame_levelmanager(stCloneKeenPlus *pCKP)
}
g_pGraphics->unloadHQGraphics();
for(unsigned int i=0;i<numplayers;i++)
{
player[i].x = 0;
player[i].y = 0;
}
} while(p_levelcontrol->command==LVLC_CHANGE_LEVEL && !crashflag);
g_pGraphics->unloadHQGraphics();
@@ -959,16 +654,6 @@ short readCommandLine(int argc, char *argv[], stCloneKeenPlus *pCKP)
{
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;
@@ -988,35 +673,3 @@ short readCommandLine(int argc, char *argv[], stCloneKeenPlus *pCKP)
}
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;
}

View File

@@ -1,4 +1,4 @@
/* MENU.C
/* MENU.C
The main menu, intro, and other such stuff.
*/
@@ -22,6 +22,7 @@
#include "sdl/CInput.h"
#include "vorticon/CDialog.h"
#include "CLogFile.h"
#include "sdl/CSettings.h"
#include <SDL.h>
#include <iostream>
#include <fstream>
@@ -43,7 +44,6 @@ g_pLogFile->ftextOut("showmapatpos(%d, %d, %d, %d);<br>",level,xoff,yoff,wm);
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;
@@ -182,13 +182,13 @@ short loadStartMenu(stCloneKeenPlus *pCKP)
gamedo_AnimatedTiles();
// Check the Input
if(g_pInput->getPressedCommand(IC_DOWN))
if(g_pInput->getPressedCommand(0, IC_DOWN))
GamesMenu->setNextSelection();
if(g_pInput->getPressedCommand(IC_UP))
if(g_pInput->getPressedCommand(0, IC_UP))
GamesMenu->setPrevSelection();
if(g_pInput->getPressedCommand(IC_STATUS))
if(g_pInput->getPressedCommand(0, IC_STATUS))
{
fade.dir = FADE_OUT;
fade.curamt = PAL_FADE_SHADES;
@@ -204,7 +204,7 @@ short loadStartMenu(stCloneKeenPlus *pCKP)
GamesMenu->renderDialog();
// blit the scrollbuffer to the display
gamedo_frameskipping_blitonly(pCKP);
gamedo_frameskipping_blitonly();
} while(!g_pInput->getExitEvent());
delete GamesMenu;
@@ -230,7 +230,7 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt)
// Prepare the Games Menu
MainMenu = new CDialog();
MainMenu->setDimensions(11,9,18,11);
MainMenu->setDimensions(11,8,18,12);
// Load the Title Bitmap
bmnum = g_pGraphics->getBitmapNumberFromName("TITLE");
@@ -243,6 +243,7 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt)
MainMenu->addOptionText("Options");
MainMenu->addOptionText("Demo");
MainMenu->addOptionText("Change Game");
MainMenu->addOptionText("About CG");
MainMenu->addOptionText("Quit");
x = (320/2)-(bitmaps[bmnum].xsize/2);
@@ -282,7 +283,7 @@ int mainmenu(stCloneKeenPlus *pCKP,int defaultopt)
MainMenu->renderDialog();
// blit the scrollbuffer to the display
gamedo_frameskipping_blitonly(pCKP);
gamedo_frameskipping_blitonly();
if(g_pInput->getExitEvent())
return MAINMNU_QUIT;
@@ -414,7 +415,7 @@ int getDifficulty(stCloneKeenPlus *pCKP)
DifficultyMenu->renderDialog();
// blit the scrollbuffer to the display
gamedo_frameskipping_blitonly(pCKP);
gamedo_frameskipping_blitonly();
g_pInput->pollEvents();
g_pTimer->SpeedThrottle();
@@ -509,7 +510,10 @@ int AudioDlg(stCloneKeenPlus *pCKP)
{
g_pSound->destroy();
g_pSound->setSoundmode(rate, mode ? true : false);
saveDriverConfiguration(pCKP);
CSettings *Settings;
Settings = new CSettings();
Settings->saveDrvCfg();
delete Settings; Settings = NULL;
g_pSound->init();
ok = g_pSound->loadSoundData(pCKP->Control.levelcontrol.episode,
pCKP->GameData[pCKP->Resources.GameSelected-1].DataDirectory);
@@ -524,7 +528,7 @@ int AudioDlg(stCloneKeenPlus *pCKP)
AudioMenu->renderDialog();
// blit the scrollbuffer to the display
gamedo_frameskipping_blitonly(pCKP);
gamedo_frameskipping_blitonly();
g_pInput->pollEvents();
g_pTimer->SpeedThrottle();
@@ -608,7 +612,8 @@ void OptionsDlg(stCloneKeenPlus *pCKP)
}
else
{
SaveConfig(pCKP->Option);
CSettings Settings;
Settings.saveGameCfg(pCKP->Option);
break;
}
}
@@ -616,7 +621,7 @@ void OptionsDlg(stCloneKeenPlus *pCKP)
OptionsMenu->renderDialog();
// blit the scrollbuffer to the display
gamedo_frameskipping_blitonly(pCKP);
gamedo_frameskipping_blitonly();
g_pInput->pollEvents();
g_pTimer->SpeedThrottle();
@@ -644,6 +649,7 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
char buf[256];
short retval = 0;
unsigned char autoframeskip = 0;
bool aspect;
showmapatpos(90, MAINMENU_X, MENUS_Y, 0, pCKP);
@@ -654,7 +660,7 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
// Prepare the Games Menu
DisplayMenu = new CDialog();
DisplayMenu->setDimensions(4,4,32,11);
DisplayMenu->setDimensions(4,3,32,13);
width = g_pVideoDriver->getWidth();
height = g_pVideoDriver->getHeight();
@@ -720,27 +726,24 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
DisplayMenu->addOptionText("Software Rendering");
autoframeskip = g_pVideoDriver->getTargetFPS();
switch(autoframeskip)
{
case 60:
DisplayMenu->addOptionText("Auto-Frameskip : 60 fps"); break;
case 50:
DisplayMenu->addOptionText("Auto-Frameskip : 50 fps"); break;
case 40:
DisplayMenu->addOptionText("Auto-Frameskip : 40 fps"); break;
case 30:
DisplayMenu->addOptionText("Auto-Frameskip : 30 fps"); break;
case 20:
DisplayMenu->addOptionText("Auto-Frameskip : 20 fps"); break;
default:
DisplayMenu->addOptionText("Auto-Frameskip disabled"); break;
};
if(autoframeskip)
sprintf(buf,"Auto-Frameskip : %d fps",autoframeskip);
else
sprintf(buf,"Auto-Frameskip disabled");
DisplayMenu->addOptionText(buf);
aspect = g_pVideoDriver->getAspectCorrection();
if(aspect)
DisplayMenu->addOptionText("Aspect Ratio Enabled");
else
DisplayMenu->addOptionText("Aspect Ratio Disabled");
DisplayMenu->addSeparator();
DisplayMenu->addOptionText("Save and return");
DisplayMenu->addOptionText("Cancel");
DisplayMenu->animateDialogBox(true);
do
@@ -764,29 +767,34 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
if(selection == 0)
{
// Now the part of the resolution list
if(width == 1024)
{
width = 320;
height = 240;
}
else if(width == 320)
switch(width)
{
case 320:
width = 640;
height = 480;
}
else if(width == 640)
{
break;
case 640:
width = 800;
height = 600;
}
else if(width == 800)
{
break;
case 800:
width = 1024;
height = 768;
break;
case 1024:
width = 1280;
height = 1024;
break;
case 1280:
width = 1680;
height = 1050;
break;
default:
width = 320;
height = 240;
break;
}
// TODO: Replace this by the available modes list!
sprintf(buf,"Resolution: %dx%dx%d",width,height,depth);
DisplayMenu->setOptionText(selection,buf);
}
@@ -864,30 +872,30 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
}
else if(selection == 6)
{
if(autoframeskip < 60 && autoframeskip >= 0)
autoframeskip += 10;
else
autoframeskip = 0;
switch(autoframeskip)
if(autoframeskip < 70 && autoframeskip >= 0)
{
case 60:
DisplayMenu->setOptionText(6,"Auto-Frameskip : 60 fps"); break;
case 50:
DisplayMenu->setOptionText(6,"Auto-Frameskip : 50 fps"); break;
case 40:
DisplayMenu->setOptionText(6,"Auto-Frameskip : 40 fps"); break;
case 30:
DisplayMenu->setOptionText(6,"Auto-Frameskip : 30 fps"); break;
case 20:
DisplayMenu->setOptionText(6,"Auto-Frameskip : 20 fps"); break;
case 10:
DisplayMenu->setOptionText(6,"Auto-Frameskip : 10 fps"); break;
default:
DisplayMenu->setOptionText(6,"Auto-Frameskip disabled"); break;
};
autoframeskip += 10;
sprintf(buf,"Auto-Frameskip : %d fps", autoframeskip);
}
else
{
autoframeskip = 0;
sprintf(buf,"Auto-Frameskip disabled");
}
DisplayMenu->setOptionText(6, buf);
}
else if(selection == 8)
else if(selection == 7)
{
aspect = !aspect;
if(aspect)
DisplayMenu->setOptionText(7,"Aspect Ratio Enabled");
else
DisplayMenu->setOptionText(7,"Aspect Ratio Disabled");
}
else if(selection == 9)
{
g_pVideoDriver->stop();
@@ -903,11 +911,15 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
g_pVideoDriver->setFilter(filter);
g_pVideoDriver->setFrameskip(frameskip);
g_pVideoDriver->setTargetFPS(autoframeskip);
saveDriverConfiguration(pCKP);
g_pGraphics->allocScrollBufmem();
g_pVideoDriver->setAspectCorrection(aspect);
CSettings *Settings;
Settings = new CSettings();
Settings->saveDrvCfg();
delete Settings; Settings = NULL;
// initialize/activate all drivers
g_pLogFile->ftextOut("Starting graphics driver...<br>");
g_pLogFile->ftextOut("Restarting graphics driver... (Menu)<br>");
if (g_pVideoDriver->start())
retval = 1;
@@ -928,7 +940,7 @@ short GraphicsDlg(stCloneKeenPlus *pCKP)
DisplayMenu->renderDialog();
// blit the scrollbuffer to the display
gamedo_frameskipping_blitonly(pCKP);
gamedo_frameskipping_blitonly();
g_pInput->pollEvents();
g_pTimer->SpeedThrottle();
@@ -947,10 +959,8 @@ void showPage(char *text, stCloneKeenPlus *pCKP, int textsize)
unsigned int i, j, k;
int exit=0;
int textpos;
//char lastupstate, lastdnstate;
int enter;
bool enter;
unsigned int dlgX,dlgY,dlgW,dlgH;
//unsigned char lastkeytable[KEYTABLE_SIZE+1];
unsigned int scroll, maxscroll;
char buffer[200][40];
@@ -1059,20 +1069,20 @@ void showPage(char *text, stCloneKeenPlus *pCKP, int textsize)
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 (g_pInput->getHoldedCommand(0,IC_DOWN) || g_pInput->getHoldedCommand(1,IC_DOWN))
{
if(scroll < (totnumline-dlgH)<<3)
scroll++;
SDL_Delay(2);
}
else if (g_pInput->getHoldedCommand(IC_UP))
else if (g_pInput->getHoldedCommand(0,IC_UP) || g_pInput->getHoldedCommand(1,IC_UP))
{
if(scroll > 0)
scroll--;
SDL_Delay(2);
}
enter = (g_pInput->getPressedCommand(IC_STATUS));//||g_pInput->getPressedCommand(KCTRL)||g_pInput->getPressedCommand(KALT));
enter = (g_pInput->getPressedCommand(0,IC_STATUS) || g_pInput->getPressedCommand(1,IC_STATUS));
if (enter)
{
exit=1;
@@ -1152,7 +1162,7 @@ char configmenu(stCloneKeenPlus *pCKP)
OptionsMenu->renderDialog();
// blit the scrollbuffer to the display
gamedo_frameskipping_blitonly(pCKP);
gamedo_frameskipping_blitonly();
g_pInput->pollEvents();
g_pTimer->SpeedThrottle();
@@ -1207,31 +1217,56 @@ char controlsmenu(stCloneKeenPlus *pCKP)
// Prepare the Games Menu
ControlsMenu = new CDialog();
ControlsMenu->setDimensions(1,1,38,24);
ControlsMenu->setDimensions(1,3,38,20);
g_pInput->getEventName(IC_LEFT,buf2);
sprintf(buf,"Left: %s",buf2);
g_pInput->getEventName(IC_LEFT, 0, buf2);
sprintf(buf,"P1 Left: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_UP,buf2);
sprintf(buf,"Up: %s",buf2);
g_pInput->getEventName(IC_UP, 0, buf2);
sprintf(buf,"P1 Up: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_RIGHT,buf2);
sprintf(buf,"Right: %s",buf2);
g_pInput->getEventName(IC_RIGHT, 0, buf2);
sprintf(buf,"P1 Right: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_DOWN,buf2);
sprintf(buf,"Down: %s",buf2);
g_pInput->getEventName(IC_DOWN, 0, buf2);
sprintf(buf,"P1 Down: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_JUMP,buf2);
sprintf(buf,"Jump: %s",buf2);
g_pInput->getEventName(IC_JUMP, 0, buf2);
sprintf(buf,"P1 Jump: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_POGO,buf2);
sprintf(buf,"Pogo: %s",buf2);
g_pInput->getEventName(IC_POGO, 0, buf2);
sprintf(buf,"P1 Pogo: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_FIRE,buf2);
sprintf(buf,"Fire: %s",buf2);
g_pInput->getEventName(IC_FIRE, 0, buf2);
sprintf(buf,"P1 Fire: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_STATUS,buf2);
sprintf(buf,"Status: %s",buf2);
g_pInput->getEventName(IC_STATUS, 0, buf2);
sprintf(buf,"P1 Status: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_LEFT, 1, buf2);
sprintf(buf,"P2 Left: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_UP, 1, buf2);
sprintf(buf,"P2 Up: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_RIGHT, 1, buf2);
sprintf(buf,"P2 Right: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_DOWN, 1, buf2);
sprintf(buf,"P2 Down: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_JUMP, 1, buf2);
sprintf(buf,"P2 Jump: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_POGO, 1, buf2);
sprintf(buf,"P2 Pogo: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_FIRE, 1, buf2);
sprintf(buf,"P2 Fire: %s",buf2);
ControlsMenu->addOptionText(buf);
g_pInput->getEventName(IC_STATUS, 1, buf2);
sprintf(buf,"P2 Status: %s",buf2);
ControlsMenu->addOptionText(buf);
ControlsMenu->addSeparator();
ControlsMenu->addOptionText("Return");
@@ -1266,27 +1301,61 @@ char controlsmenu(stCloneKeenPlus *pCKP)
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;
case 0: sprintf(buf,"P1 Left: "); break;
case 1: sprintf(buf,"P1 Up: "); break;
case 2: sprintf(buf,"P1 Right: "); break;
case 3: sprintf(buf,"P1 Down: "); break;
case 4: sprintf(buf,"P1 Jump: "); break;
case 5: sprintf(buf,"P1 Pogo: "); break;
case 6: sprintf(buf,"P1 Fire: "); break;
case 7: sprintf(buf,"P1 Status: "); break;
}
strcpy(buf2,buf);
strcat(buf2,"*Waiting for Input*");
ControlsMenu->setOptionText(selection,buf2);
while(!g_pInput->readNewEvent(item))
while(!g_pInput->readNewEvent(0,item))
{
ControlsMenu->renderDialog();
gamedo_frameskipping_blitonly(pCKP);
gamedo_frameskipping_blitonly();
}
g_pInput->getEventName(item,buf2);
g_pInput->getEventName(item, 0, buf2);
strcat(buf,buf2);
ControlsMenu->setOptionText(selection,buf);
}
else if(selection >= MAX_COMMANDS && selection < MAX_COMMANDS*2)
{
int item=0;
if(selection < (4 + MAX_COMMANDS))
item = selection + 4 - MAX_COMMANDS;
else
item = selection - 4 - MAX_COMMANDS;
switch(selection)
{
case 0+ MAX_COMMANDS: sprintf(buf,"P2 Left: "); break;
case 1+ MAX_COMMANDS: sprintf(buf,"P2 Up: "); break;
case 2+ MAX_COMMANDS: sprintf(buf,"P2 Right: "); break;
case 3+ MAX_COMMANDS: sprintf(buf,"P2 Down: "); break;
case 4+ MAX_COMMANDS: sprintf(buf,"P2 Jump: "); break;
case 5+ MAX_COMMANDS: sprintf(buf,"P2 Pogo: "); break;
case 6+ MAX_COMMANDS: sprintf(buf,"P2 Fire: "); break;
case 7+ MAX_COMMANDS: sprintf(buf,"P2 Status: "); break;
}
strcpy(buf2,buf);
strcat(buf2,"*Waiting for Input*");
ControlsMenu->setOptionText(selection,buf2);
while(!g_pInput->readNewEvent(1,item))
{
ControlsMenu->renderDialog();
gamedo_frameskipping_blitonly();
}
g_pInput->getEventName(item, 1, buf2);
strcat(buf,buf2);
ControlsMenu->setOptionText(selection,buf);
}
@@ -1300,7 +1369,7 @@ char controlsmenu(stCloneKeenPlus *pCKP)
ControlsMenu->renderDialog();
// blit the scrollbuffer to the display
gamedo_frameskipping_blitonly(pCKP);
gamedo_frameskipping_blitonly();
g_pInput->pollEvents();
g_pTimer->SpeedThrottle();
@@ -1311,446 +1380,6 @@ char controlsmenu(stCloneKeenPlus *pCKP)
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;i<KEYTABLE_SIZE;i++)
{
if (g_pInput->getPressedKey(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;y<PRESSF10_HEIGHT;y++)
{
yb = ((PRESSF10_Y+y+scrolly_buf)&511)<<9;
for(x=0;x<PRESSF10_WIDTH;x++)
{
g_pGraphics->getScrollbuffer()[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());
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;i<strlen(stStringData);i++)
{
if (stStringData[i] != 13)
{
*copyPtr = stStringData[i];
copyPtr++;
}
else
{ // hit a CR
// null-terminate
*copyPtr = 0;
// start copying to next buffer
if (copyIndex==0) copyPtr = stTextLine2;
else if (copyIndex==1) copyPtr = stTextLine3;
else if (copyIndex==2) break;
copyIndex++;
}
}
*copyPtr = 0; // null-terminate
// figure out what X position these lines to be drawn in order
// to be centered.
x1 = (320/2)-((strlen(stTextLine1)*8)/2);
x2 = (320/2)-((strlen(stTextLine2)*8)/2);
x3 = (320/2)-((strlen(stTextLine3)*8)/2);
// figure out their Y positions
y1 = 90 + y1adj;
y2 = 98 + y2adj;
y3 = 106 + y3adj;
// if we're going to do slowprinting then copy the line we're going
// to slowprint into the slowprint buffer and fill it with spaces
if (SlowPrint)
{
// set up a pointer to the line we're going to slowprint
if (SlowPrint==1) SlowPrintPtr = &stTextLine1[0];
else if (SlowPrint==2) SlowPrintPtr = &stTextLine2[0];
else SlowPrintPtr = &stTextLine3[0];
// copy the text line into the slow print buffer.
// replace '@''s with the episode number
for(i=0;i<strlen(SlowPrintBuffer)+1;i++)
{
if (SlowPrintPtr[i]=='@')
{
SlowPrintBuffer[i] = pCKP->Control.levelcontrol.episode + '0';
}
else
{
SlowPrintBuffer[i] = SlowPrintPtr[i];
}
}
// clear out the text line
for(i=0;i<strlen(SlowPrintPtr);i++) SlowPrintPtr[i] = ' ';
}
// set up some variables
textVisible = 1;
textTimer = ontime;
changedPage = 0;
SlowPrintTimer = 0;
SlowPrintIndex = 0;
}
// handle slowprinting
if (SlowPrint)
{
if (SlowPrintTimer > 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;i<strlen(stTextLine1);i++) stTextLine1[i] = ' ';
for(i=0;i<strlen(stTextLine2);i++) stTextLine2[i] = ' ';
for(i=0;i<strlen(stTextLine3);i++) stTextLine3[i] = ' ';
textVisible = 0;
textTimer = offtime;
}
else
{
// time for more text
if (lastpage != 1)
{
curPage++;
changedPage = 1;
}
else
{ // reached last page...initiate fadeout
fade.dir = FADE_OUT;
fade.curamt = PAL_FADE_SHADES;
fade.fadetimer = 0;
fade.rate = FADE_NORM;
fade.mode = FADE_GO;
IntroCanceled = 0;
}
}
}
else textTimer--;
// if user pressed a key cancel the intro
keypressed = 0;
for(i=0;i<KEYTABLE_SIZE;i++)
{
if (g_pInput->getPressedKey(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;

View File

@@ -10,6 +10,7 @@
#include "CInput.h"
#include "../CLogFile.h"
#include "CVideoDriver.h"
#ifdef WIZ
#include "gp2x.h"
@@ -26,42 +27,54 @@ CInput::CInput() {
for(i=0 ; i<NUMBER_OF_COMMANDS ; i++)
{
InputCommand[i].active = false;
for(Uint8 player=0 ; player<NUM_INPUTS ; player++)
InputCommand[player][i].active = false;
}
// These are the default keyboard commands
InputCommand[IC_LEFT].keysym = SDLK_LEFT;
InputCommand[IC_UP].keysym = SDLK_UP;
InputCommand[IC_RIGHT].keysym = SDLK_RIGHT;
InputCommand[IC_DOWN].keysym = SDLK_DOWN;
for(i=0 ; i<NUM_INPUTS ; i++)
{
// These are the default keyboard commands
InputCommand[i][IC_LEFT].keysym = SDLK_LEFT;
InputCommand[i][IC_UP].keysym = SDLK_UP;
InputCommand[i][IC_RIGHT].keysym = SDLK_RIGHT;
InputCommand[i][IC_DOWN].keysym = SDLK_DOWN;
InputCommand[IC_JUMP].keysym = SDLK_RCTRL;
InputCommand[IC_POGO].keysym = SDLK_MODE;
InputCommand[IC_FIRE].keysym = SDLK_SPACE;
InputCommand[IC_STATUS].keysym = SDLK_RETURN;
InputCommand[i][IC_JUMP].keysym = SDLK_RCTRL;
InputCommand[i][IC_POGO].keysym = SDLK_MODE;
InputCommand[i][IC_FIRE].keysym = SDLK_SPACE;
InputCommand[i][IC_STATUS].keysym = SDLK_RETURN;
// And those are the default joystick handlings
InputCommand[IC_LEFT].joyeventtype = ETYPE_JOYAXIS;
InputCommand[IC_LEFT].joyaxis = 0;
InputCommand[IC_LEFT].joyvalue = -32767;
InputCommand[IC_UP].joyeventtype = ETYPE_JOYAXIS;
InputCommand[IC_UP].joyaxis = 1;
InputCommand[IC_UP].joyvalue = -32767;
InputCommand[IC_RIGHT].joyeventtype = ETYPE_JOYAXIS;
InputCommand[IC_RIGHT].joyaxis = 0;
InputCommand[IC_RIGHT].joyvalue = 32767;
InputCommand[IC_DOWN].joyeventtype = ETYPE_JOYAXIS;
InputCommand[IC_DOWN].joyaxis = 1;
InputCommand[IC_DOWN].joyvalue = 32767;
// And those are the default joystick handlings
InputCommand[i][IC_LEFT].joyeventtype = ETYPE_JOYAXIS;
InputCommand[i][IC_LEFT].joyaxis = 0;
InputCommand[i][IC_LEFT].joyvalue = -32767;
InputCommand[i][IC_LEFT].which = 0;
InputCommand[i][IC_UP].joyeventtype = ETYPE_JOYAXIS;
InputCommand[i][IC_UP].joyaxis = 1;
InputCommand[i][IC_UP].joyvalue = -32767;
InputCommand[i][IC_UP].which = 0;
InputCommand[i][IC_RIGHT].joyeventtype = ETYPE_JOYAXIS;
InputCommand[i][IC_RIGHT].joyaxis = 0;
InputCommand[i][IC_RIGHT].joyvalue = 32767;
InputCommand[i][IC_RIGHT].which = 0;
InputCommand[i][IC_DOWN].joyeventtype = ETYPE_JOYAXIS;
InputCommand[i][IC_DOWN].joyaxis = 1;
InputCommand[i][IC_DOWN].joyvalue = 32767;
InputCommand[i][IC_DOWN].which = 0;
InputCommand[IC_JUMP].joyeventtype = ETYPE_JOYBUTTON;
InputCommand[IC_JUMP].joybutton = 0;
InputCommand[IC_POGO].joyeventtype = ETYPE_JOYBUTTON;
InputCommand[IC_POGO].joybutton = 1;
InputCommand[IC_FIRE].joyeventtype = ETYPE_JOYBUTTON;
InputCommand[IC_FIRE].joybutton = 2;
InputCommand[IC_STATUS].joyeventtype = ETYPE_JOYBUTTON;
InputCommand[IC_STATUS].joybutton = 3;
InputCommand[i][IC_JUMP].joyeventtype = ETYPE_JOYBUTTON;
InputCommand[i][IC_JUMP].joybutton = 0;
InputCommand[i][IC_JUMP].which = 0;
InputCommand[i][IC_POGO].joyeventtype = ETYPE_JOYBUTTON;
InputCommand[i][IC_POGO].joybutton = 1;
InputCommand[i][IC_POGO].which = 0;
InputCommand[i][IC_FIRE].joyeventtype = ETYPE_JOYBUTTON;
InputCommand[i][IC_FIRE].joybutton = 2;
InputCommand[i][IC_FIRE].which = 0;
InputCommand[i][IC_STATUS].joyeventtype = ETYPE_JOYBUTTON;
InputCommand[i][IC_STATUS].joybutton = 3;
InputCommand[i][IC_STATUS].which = 0;
}
}
CInput::~CInput() {
@@ -72,7 +85,7 @@ short CInput::loadControlconfig(void)
FILE *fp;
if((fp=fopen("controls.dat","rb")) != NULL)
{
if(fread(InputCommand, sizeof(stInputCommand),NUMBER_OF_COMMANDS, fp) == 0 )
if(fread(InputCommand, sizeof(stInputCommand),NUMBER_OF_COMMANDS*NUM_INPUTS, fp) == 0 )
{
fclose(fp);
return 1;
@@ -88,45 +101,45 @@ short CInput::saveControlconfig(void)
FILE *fp;
if((fp=fopen("controls.dat","wb")) != NULL)
{
fwrite(InputCommand, sizeof(stInputCommand),NUMBER_OF_COMMANDS, fp);
fwrite(InputCommand, sizeof(stInputCommand),NUMBER_OF_COMMANDS*NUM_INPUTS, fp);
fclose(fp);
return 0;
}
return 1;
}
void CInput::getEventName(int position, char *buf)
void CInput::getEventName(int position, unsigned char input, char *buf)
{
char buf2[256];
memset(buf,0,256);
strcat(buf,SDL_GetKeyName(InputCommand[position].keysym));
if(InputCommand[position].joyeventtype == ETYPE_JOYAXIS)
strcat(buf,SDL_GetKeyName(InputCommand[input][position].keysym));
if(InputCommand[input][position].joyeventtype == ETYPE_JOYAXIS)
{
strcat(buf,", ");
sprintf(buf2,"Joy-A%d",InputCommand[position].joyaxis);
sprintf(buf2,"Joy%d-A%d",InputCommand[input][position].which, InputCommand[input][position].joyaxis);
strcat(buf,buf2);
if(InputCommand[position].joyvalue < 0)
if(InputCommand[input][position].joyvalue < 0)
strcat(buf,"-");
else
strcat(buf,"+");
}
if(InputCommand[position].joyeventtype == ETYPE_JOYBUTTON)
if(InputCommand[input][position].joyeventtype == ETYPE_JOYBUTTON)
{
strcat(buf,", ");
sprintf(buf2,"Joy-B%d",InputCommand[position].joybutton);
sprintf(buf2,"Joy%d-B%d",InputCommand[input][position].which, InputCommand[input][position].joybutton);
strcat(buf,buf2);
}
}
bool CInput::readNewEvent(int position)
bool CInput::readNewEvent(Uint8 device, int position)
{
while( SDL_PollEvent( &Event ) )
{
switch ( Event.type )
{
case SDL_KEYDOWN:
InputCommand[position].keysym = Event.key.keysym.sym;
InputCommand[device][position].keysym = Event.key.keysym.sym;
return true;
break;
case SDL_JOYBUTTONDOWN:
@@ -134,15 +147,17 @@ bool CInput::readNewEvent(int position)
WIZ_EmuKeyboard( Event.jbutton.button, 1 );
return false;
#else
InputCommand[position].joyeventtype = ETYPE_JOYBUTTON;
InputCommand[position].joybutton = Event.jbutton.button;
InputCommand[device][position].joyeventtype = ETYPE_JOYBUTTON;
InputCommand[device][position].joybutton = Event.jbutton.button;
InputCommand[device][position].which = Event.jbutton.which;
return true;
#endif
break;
case SDL_JOYAXISMOTION:
InputCommand[position].joyeventtype = ETYPE_JOYAXIS;
InputCommand[position].joyaxis = Event.jaxis.axis;
InputCommand[position].joyvalue = Event.jaxis.value;
InputCommand[device][position].joyeventtype = ETYPE_JOYAXIS;
InputCommand[device][position].joyaxis = Event.jaxis.axis;
InputCommand[device][position].which = Event.jaxis.which;
InputCommand[device][position].joyvalue = Event.jaxis.value;
return true;
break;
}
@@ -155,13 +170,12 @@ void CInput::cancelExitEvent(void) { m_exit=false; }
void CInput::pollEvents()
{
Uint8 i;
// copy all the input of the last poll to a space for checking pressing or holding a button
memcpy(last_immediate_keytable, immediate_keytable, KEYTABLE_SIZE*sizeof(char));
for(i=0 ; i<NUMBER_OF_COMMANDS ; i++)
InputCommand[i].lastactive = InputCommand[i].active;
for(Uint8 i=0 ; i<NUMBER_OF_COMMANDS ; i++)
for(Uint8 j=0 ; j<NUM_INPUTS ; j++)
InputCommand[j][i].lastactive = InputCommand[j][i].active;
//While there's an event to handle
while( SDL_PollEvent( &Event ) )
@@ -190,27 +204,62 @@ void CInput::pollEvents()
}
}
// Check, if LALT+ENTER was pressed
if(getHoldedKey(KLALT) && getPressedKey(KENTER))
{
bool value;
value = g_pVideoDriver->getFullscreen();
value = !value;
g_pLogFile->textOut(GREEN,"Fullscreen mode triggered by user!<br>");
g_pVideoDriver->isFullscreen(value);
// initialize/activate all drivers
g_pLogFile->ftextOut("Restarting graphics driver...<br>");
if (!g_pVideoDriver->applyMode())
{
value = !value;
g_pLogFile->ftextOut(PURPLE, "Couldn't change the resolution, Rolling back...<br>");
if(g_pVideoDriver->applyMode()) g_pVideoDriver->initOpenGL();
}
else
g_pVideoDriver->initOpenGL();
if(value) g_pVideoDriver->AddConsoleMsg("Fullscreen enabled");
else g_pVideoDriver->AddConsoleMsg("Fullscreen disabled");
}
// Check, if LALT+Q or LALT+F4 was pressed
if(getHoldedKey(KLALT) && (getPressedKey(KF4) || getPressedKey(KQ)) )
{
g_pLogFile->textOut("User exit request!");
m_exit = true;
}
#ifdef WIZ
WIZ_AdjustVolume( volume_direction );
WIZ_AdjustVolume( volume_direction );
#endif
}
void CInput::processJoystickAxis(void)
{
unsigned int i;
for(i=0 ; i<NUMBER_OF_COMMANDS ; i++)
for(Uint8 j=0 ; j<NUM_INPUTS ; j++)
{
if(InputCommand[i].joyeventtype == ETYPE_JOYAXIS)
for(Uint8 i=0 ; i<NUMBER_OF_COMMANDS ; i++)
{
// Axis are configured for this commmand
if(Event.jaxis.axis == InputCommand[i].joyaxis)
if(InputCommand[j][i].joyeventtype == ETYPE_JOYAXIS)
{
// Deadzone
if((Event.jaxis.value > 3200 && InputCommand[i].joyvalue > 0) ||
(Event.jaxis.value < -3200 && InputCommand[i].joyvalue < 0))
InputCommand[i].active = true;
else
InputCommand[i].active = false;
// Axis are configured for this commmand
if(Event.jaxis.axis == InputCommand[j][i].joyaxis && Event.jaxis.which == InputCommand[j][i].which )
{
// Deadzone
if((Event.jaxis.value > 3200 && InputCommand[0][i].joyvalue > 0) ||
(Event.jaxis.value < -3200 && InputCommand[0][i].joyvalue < 0))
InputCommand[j][i].active = true;
else
InputCommand[j][i].active = false;
}
}
}
}
@@ -220,14 +269,17 @@ void CInput::processJoystickButton(int value)
#ifdef WIZ
WIZ_EmuKeyboard( Event.jbutton.button, value );
#else
unsigned int i;
for(i=0 ; i<NUMBER_OF_COMMANDS ; i++)
for(Uint8 j=0 ; j<NUM_INPUTS ; j++)
{
if(InputCommand[i].joyeventtype == ETYPE_JOYBUTTON)
for(Uint8 i=0 ; i<NUMBER_OF_COMMANDS ; i++)
{
// Joystick buttons are configured for this event !!
if(Event.jbutton.button == InputCommand[i].joybutton)
InputCommand[i].active = value;
// TODO: Check all NUM_INPUTS, if they can be reduced to another variable
if(InputCommand[j][i].joyeventtype == ETYPE_JOYBUTTON)
{
// Joystick buttons are configured for this event !!
if(Event.jbutton.button == InputCommand[j][i].joybutton && Event.jbutton.which == InputCommand[j][i].which )
InputCommand[j][i].active = value;
}
}
}
#endif
@@ -237,17 +289,17 @@ void CInput::sendKey(int key){ immediate_keytable[key] = true; }
void CInput::processKeys(int value)
{
unsigned short i;
for(i=0 ; i<NUMBER_OF_COMMANDS ; i++)
for(Uint8 i=0 ; i<NUMBER_OF_COMMANDS ; i++)
{
if(InputCommand[i].keysym == Event.key.keysym.sym)
for(Uint8 j=0 ; j<NUM_INPUTS ; j++)
{
if(value)
InputCommand[i].active = true;
else
InputCommand[i].active = false;
if(InputCommand[j][i].keysym == Event.key.keysym.sym)
{
if(value)
InputCommand[j][i].active = true;
else
InputCommand[j][i].active = false;
}
}
}
@@ -266,6 +318,7 @@ void CInput::processKeys(int value)
case SDLK_TAB:immediate_keytable[KTAB] = value; break;
case SDLK_LSHIFT:immediate_keytable[KLSHIFT] = value; break;
case SDLK_ESCAPE:immediate_keytable[KQUIT] = value; break;
case SDLK_LALT:immediate_keytable[KLALT] = value; break;
case SDLK_BACKSPACE:immediate_keytable[KBCKSPCE] = value; break;
@@ -317,7 +370,6 @@ void CInput::processKeys(int value)
case SDLK_8:immediate_keytable[KNUM8] = value; break;
case SDLK_9:immediate_keytable[KNUM9] = value; break;
default: break;
}
}
@@ -325,9 +377,7 @@ void CInput::processKeys(int value)
bool CInput::getHoldedKey(int key)
{
if(immediate_keytable[key])
{
return true;
}
return false;
}
@@ -353,36 +403,57 @@ bool CInput::getPressedAnyKey(void)
}
return false;
}
bool CInput::getHoldedCommand(int command)
{
if(InputCommand[command].active)
{
return true;
}
bool retval = true;
for( Uint8 player=0; player<NUM_INPUTS ; player++ )
retval &= getHoldedCommand(player, command);
return retval;
}
return false;
bool CInput::getHoldedCommand(Uint8 player, int command)
{
if(InputCommand[player][command].active)
return true;
else
return false;
}
bool CInput::getPressedCommand(int command)
{
if(InputCommand[command].active && !InputCommand[command].lastactive)
bool retval = false;
for(Uint8 player=0; player<NUM_INPUTS ; player++ )
retval |= getPressedCommand(player, command);
return retval;
}
bool CInput::getPressedCommand(Uint8 player, int command)
{
if(InputCommand[player][command].active && !InputCommand[player][command].lastactive)
{
InputCommand[command].active = false;
InputCommand[player][command].active = false;
return true;
}
return false;
}
bool CInput::getPressedAnyCommand(void)
bool CInput::getPressedAnyCommand()
{
bool retval = true;
for(Uint8 player=0 ; player<NUM_INPUTS ; player++)
retval &= getPressedAnyCommand(player);
return retval;
}
bool CInput::getPressedAnyCommand(Uint8 player)
{
int i;
for(i=0 ; i<4 ; i++)
{
if(getPressedCommand(i))
if(getPressedCommand(player,i))
return true;
}
return false;
}
@@ -482,12 +553,12 @@ void CInput::WIZ_EmuKeyboard( int button, int value )
if( fakeevent1.key.keysym.sym != SDLK_UNKNOWN )
{
SDL_PushEvent (&fakeevent1);
SDL_PushEvent (&fakeevent1);
}
if( fakeevent2.key.keysym.sym != SDLK_UNKNOWN )
{
SDL_PushEvent (&fakeevent2);
SDL_PushEvent (&fakeevent2);
}
}

View File

@@ -72,6 +72,7 @@
#define KTAB 48
#define KBCKSPCE 49
#define KLALT 50
// New keys
#define KA 54
@@ -114,6 +115,7 @@
#define IC_DOWN 7
#define NUMBER_OF_COMMANDS 8
#define NUM_INPUTS 2
#define ETYPE_NO_JOYSTICK 0
#define ETYPE_JOYAXIS 1
@@ -126,7 +128,9 @@ typedef struct stInputCommand
//int value;
SDLKey keysym;
unsigned int joyeventtype;
Uint8 which;
int joyaxis;
unsigned short joybutton;
int joyvalue;
@@ -147,12 +151,15 @@ public:
bool getHoldedCommand(int command);
bool getPressedCommand(int command);
bool getPressedAnyCommand(void);
bool getPressedAnyCommand();
bool getHoldedCommand(Uint8 player, int command);
bool getPressedCommand(Uint8 player, int command);
bool getPressedAnyCommand(Uint8 player);
bool getExitEvent(void);
void cancelExitEvent(void);
void getEventName(int position, char *buf);
bool readNewEvent(int position);
void getEventName(int position, unsigned char input, char *buf);
bool readNewEvent(Uint8 device, int position);
short loadControlconfig(void);
short saveControlconfig(void);
@@ -161,7 +168,7 @@ public:
private:
SDL_Event Event;
stInputCommand InputCommand[NUMBER_OF_COMMANDS];
stInputCommand InputCommand[NUM_INPUTS][NUMBER_OF_COMMANDS];
bool m_exit;
bool immediate_keytable[KEYTABLE_SIZE];

View File

@@ -20,7 +20,7 @@ COpenGL::~COpenGL() {
}
bool COpenGL::initGL(unsigned Width, unsigned Height, unsigned char Depth,
GLint oglfilter, unsigned char scalex)
GLint oglfilter, unsigned char scalex, bool aspect)
{
m_Depth = Depth;
m_ScaleX = scalex;
@@ -28,7 +28,10 @@ bool COpenGL::initGL(unsigned Width, unsigned Height, unsigned char Depth,
m_texparam = GL_TEXTURE_2D;
// Set the proper resolution for OpenGL. Very important, when user changes the resolution
glViewport(0,0,Width, Height);
if(aspect)
glViewport(0,(Height-(Height*200)/240)/2,Width, (Height*200)/240);
else
glViewport(0,0,Width, Height);
//glViewport(0,0,1024, 1024);
// Set clear colour

View File

@@ -20,7 +20,7 @@ public:
void render(void);
bool initGL(unsigned Width, unsigned Height, unsigned char Depth,
GLint oglfilter, unsigned char scalex);
GLint oglfilter, unsigned char scalex, bool aspect);
void setSurface(SDL_Surface *blitsurface);

View File

@@ -27,7 +27,7 @@ Uint32 FPSCallback(Uint32 interval, void* param)
unsigned char targetfps;
targetfps = g_pVideoDriver->getTargetFPS();
if(targetfps > 0)
if(targetfps > 0 && fps > 0)
{
if(fps > targetfps + 10)
{

View File

@@ -47,6 +47,17 @@ CVideoDriver::CVideoDriver() {
// Default values
showfps=true;
#ifdef WIZ
Width=320;
Height=240;
Depth=16;
Mode=0;
Fullscreen=true;
Filtermode=0;
Zoom=1;
FrameSkip=0;
m_targetfps = 30; // Enable automatic frameskipping by default at 30
#else
Width=640;
Height=480;
Depth=0;
@@ -56,11 +67,13 @@ CVideoDriver::CVideoDriver() {
Zoom=2;
FrameSkip=2;
m_targetfps = 0; // Disable automatic frameskipping by default
#endif
m_opengl = false;
#ifdef USE_OPENGL
m_opengl_filter = GL_NEAREST;
mp_OpenGL = NULL;
#endif
m_aspect_correction = true;
screenrect.x=0;
screenrect.y=0;
@@ -79,9 +92,9 @@ CVideoDriver::~CVideoDriver() {
void CVideoDriver::stop(void)
{
if(screen) { SDL_FreeSurface(screen); g_pLogFile->textOut("freed screen<br>"); }
if(ScrollSurface && (ScrollSurface->map != NULL)) { SDL_FreeSurface(ScrollSurface); g_pLogFile->textOut("freed scrollsurface<br>"); }
if(blitsurface_alloc) { blitsurface_alloc = 0; SDL_FreeSurface(BlitSurface); g_pLogFile->textOut("freed blitsurface<br>"); }
if(screen) { SDL_FreeSurface(screen); g_pLogFile->textOut("freed screen<br>"); screen = NULL; }
if(ScrollSurface && (ScrollSurface->map != NULL)) { SDL_FreeSurface(ScrollSurface); g_pLogFile->textOut("freed scrollsurface<br>"); ScrollSurface = NULL; }
if(blitsurface_alloc) { blitsurface_alloc = 0; SDL_FreeSurface(BlitSurface); g_pLogFile->textOut("freed blitsurface<br>"); BlitSurface=NULL; }
#ifdef USE_OPENGL
if(mp_OpenGL) { delete mp_OpenGL; mp_OpenGL = NULL; }
#endif
@@ -91,32 +104,53 @@ void CVideoDriver::stop(void)
bool CVideoDriver::start(void)
{
bool retval = false;
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO) < 0)
{
g_pLogFile->textOut(RED,"Could not initialize SDL: %s<br>", 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);
}
g_pLogFile->textOut(GREEN,"SDL was successfully initialized!<br>");
SDL_WM_SetCaption("Commander Genius (CKP)", NULL);
// When the program is through executing, call SDL_Quit
atexit(SDL_Quit);
if(!applyMode())
{
g_pLogFile->textOut(RED,"VideoDriver: Error applying mode! Your Videocard doesn't seem to work on CKP<br>");
g_pLogFile->textOut(RED,"Check, if you have the most recent drivers installed!<br>");
return false;
}
return createSurfaces();
retval = createSurfaces();
initOpenGL();
return retval;
}
bool CVideoDriver::initOpenGL()
{
#ifdef USE_OPENGL
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, m_aspect_correction)))
{
delete mp_OpenGL;
mp_OpenGL = NULL;
m_opengl = false;
}
else
mp_OpenGL->setSurface(BlitSurface);
}
#endif
return m_opengl;
}
bool CVideoDriver::applyMode(void)
{
// Check if some zoom/filter modes are illogical
@@ -256,21 +290,6 @@ bool CVideoDriver::createSurfaces(void)
dstrect.w = GAME_STD_WIDTH;
dstrect.h = GAME_STD_HEIGHT;
#ifdef USE_OPENGL
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);
}
#endif
return true;
}
@@ -635,37 +654,8 @@ 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!<br>");
}
// 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!<br>");
Fullscreen = value;*/
Fullscreen = value;
return;
}
unsigned short CVideoDriver::getFrameskip(void)

View File

@@ -71,16 +71,20 @@ public:
void setZoom(short vale);
#ifdef USE_OPENGL
void enableOpenGL(bool value) { m_opengl = value; }
bool initOpenGL();
void setOGLFilter(unsigned char value) { m_opengl_filter = (value==1) ? GL_LINEAR : GL_NEAREST ; }
#else
void enableOpenGL(bool value) { m_opengl = false; }
void setOGLFilter(unsigned char value) { m_opengl_filter = 0; }
#endif
void setTargetFPS(unsigned int targetfps){ if( targetfps >= 0 && targetfps <= 60 ) m_targetfps = targetfps; }
void setTargetFPS(unsigned int targetfps){ if( targetfps >= 0 && targetfps <= 70 ) m_targetfps = targetfps; }
unsigned char getTargetFPS(void){ return m_targetfps; }
void showFPS(bool value);
void setAspectCorrection(bool value) { m_aspect_correction = value; }
bool getAspectCorrection(void) { return m_aspect_correction; }
private:
#ifdef USE_OPENGL
COpenGL *mp_OpenGL;
@@ -98,6 +102,7 @@ private:
bool showfps;
bool m_opengl;
int m_opengl_filter;
bool m_aspect_correction;
SDL_Rect screenrect;
SDL_Rect blitrect;

View File

@@ -502,7 +502,12 @@ char CSound::extractOfExeFile(char *inputpath, int episode)
if (get_bit(&bit_count, &fin))
{
unsigned char tmp[2];
fread(tmp, 1, 2, fin);
if(fread(tmp, 1, 2, fin))
{
g_pLogFile->ftextOut(RED,"Read-Error!");
return 1;
}
repeat = (tmp[1] & 0x07);
offset = ((tmp[1] & ~0x07) << 5) | tmp[0] | 0xE000;