diff --git a/Debug/CommanderGenius b/Debug/CommanderGenius
index 76db8f6e1..38917cd04 100755
Binary files a/Debug/CommanderGenius and b/Debug/CommanderGenius differ
diff --git a/Debug/src/ai/subdir.mk b/Debug/src/ai/subdir.mk
index 7d56c1bef..758a96083 100644
--- a/Debug/src/ai/subdir.mk
+++ b/Debug/src/ai/subdir.mk
@@ -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 -O0 -g3 -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 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
diff --git a/Debug/src/fileio/subdir.mk b/Debug/src/fileio/subdir.mk
index b40db2206..e79c27115 100644
--- a/Debug/src/fileio/subdir.mk
+++ b/Debug/src/fileio/subdir.mk
@@ -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 -O0 -g3 -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 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
diff --git a/Debug/src/hqp/CHQBitmap.d b/Debug/src/hqp/CHQBitmap.d
index 530762bf9..ba05aa506 100644
--- a/Debug/src/hqp/CHQBitmap.d
+++ b/Debug/src/hqp/CHQBitmap.d
@@ -12,7 +12,8 @@ src/hqp/CHQBitmap.d src/hqp/CHQBitmap.o: ../src/hqp/CHQBitmap.cpp \
/usr/include/SDL/SDL_mouse.h /usr/include/SDL/SDL_video.h \
/usr/include/SDL/SDL_joystick.h /usr/include/SDL/SDL_quit.h \
/usr/include/SDL/SDL_loadso.h /usr/include/SDL/SDL_timer.h \
- /usr/include/SDL/SDL_version.h
+ /usr/include/SDL/SDL_version.h ../src/hqp/../CLogFile.h \
+ ../src/hqp/../CSingleton.h
../src/hqp/CHQBitmap.h:
@@ -67,3 +68,7 @@ src/hqp/CHQBitmap.d src/hqp/CHQBitmap.o: ../src/hqp/CHQBitmap.cpp \
/usr/include/SDL/SDL_timer.h:
/usr/include/SDL/SDL_version.h:
+
+../src/hqp/../CLogFile.h:
+
+../src/hqp/../CSingleton.h:
diff --git a/Debug/src/hqp/subdir.mk b/Debug/src/hqp/subdir.mk
index 2596c41c4..e8c872721 100644
--- a/Debug/src/hqp/subdir.mk
+++ b/Debug/src/hqp/subdir.mk
@@ -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 -O0 -g3 -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 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
diff --git a/Debug/src/scale2x/subdir.mk b/Debug/src/scale2x/subdir.mk
index a4f1eecbb..1e858dd87 100644
--- a/Debug/src/scale2x/subdir.mk
+++ b/Debug/src/scale2x/subdir.mk
@@ -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 -O0 -g3 -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 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
diff --git a/Debug/src/sdl/sound/subdir.mk b/Debug/src/sdl/sound/subdir.mk
index 72675f50c..aa98bd66b 100644
--- a/Debug/src/sdl/sound/subdir.mk
+++ b/Debug/src/sdl/sound/subdir.mk
@@ -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 -O0 -g3 -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 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
diff --git a/Debug/src/sdl/subdir.mk b/Debug/src/sdl/subdir.mk
index d60f9bedb..d340cecc8 100644
--- a/Debug/src/sdl/subdir.mk
+++ b/Debug/src/sdl/subdir.mk
@@ -29,7 +29,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 -O0 -g3 -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 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
diff --git a/Debug/src/sdl/video/subdir.mk b/Debug/src/sdl/video/subdir.mk
index 7efe451bf..077426a0c 100644
--- a/Debug/src/sdl/video/subdir.mk
+++ b/Debug/src/sdl/video/subdir.mk
@@ -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 -O0 -g3 -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 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
diff --git a/Debug/src/subdir.mk b/Debug/src/subdir.mk
index c1b235657..e08473e28 100644
--- a/Debug/src/subdir.mk
+++ b/Debug/src/subdir.mk
@@ -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 -O0 -g3 -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 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
diff --git a/Debug/src/vorbis/subdir.mk b/Debug/src/vorbis/subdir.mk
index 2bf236bd3..74693be35 100644
--- a/Debug/src/vorbis/subdir.mk
+++ b/Debug/src/vorbis/subdir.mk
@@ -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 -O0 -g3 -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 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
diff --git a/Debug/src/vorticon/subdir.mk b/Debug/src/vorticon/subdir.mk
index 62b20ac08..d09a1d383 100644
--- a/Debug/src/vorticon/subdir.mk
+++ b/Debug/src/vorticon/subdir.mk
@@ -26,7 +26,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 -O0 -g3 -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 -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
@echo 'Finished building: $<'
@echo ' '
diff --git a/changelog.txt b/changelog.txt
index 350518a62..f188fcf05 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,6 +1,11 @@
-Commander Genius v0.2.9.1 Beta (CloneKeenPlus):
+Commander Genius v0.2.9.2 Beta (CloneKeenPlus):
-----------------------------------------------
+08-06-2009
+- Added Doublebuffering support
+- Detection of Bitmapsize in HQBitmap implemented
+- Added Wiz-code and some fixed bugs (Thanks to Pickle)
+
07-06-2009
- Improved the timer
- Improved blit-speed at resolution of 320x200
diff --git a/src/CGraphics.cpp b/src/CGraphics.cpp
index 574a0883e..e9b2e7e2e 100644
--- a/src/CGraphics.cpp
+++ b/src/CGraphics.cpp
@@ -20,6 +20,7 @@
CGraphics::CGraphics() {
HQBitmap = NULL;
scrollbuffer=NULL;
+ blitbuffer=NULL;
scrollbuf_memsize = 0;
blitbuf_memsize = 0;
}
@@ -704,7 +705,7 @@ void CGraphics::loadHQGraphics(unsigned char episode, unsigned char level, char
screen_rect.h = g_pVideoDriver->getHeight();
HQBitmap = new CHQBitmap(screen_rect);
- if(!HQBitmap->loadImage(buf2))
+ if(!HQBitmap->loadImage(buf2, (int) map.xsize, (int) map.ysize))
{
delete HQBitmap;
HQBitmap = NULL;
diff --git a/src/CLogFile.cpp b/src/CLogFile.cpp
index 16628c2a4..1c79b8910 100644
--- a/src/CLogFile.cpp
+++ b/src/CLogFile.cpp
@@ -103,7 +103,6 @@ void CLogFile::textOut(int Color, bool List, const char *Text)
textOut("
");
else
textOut("");
-
}
diff --git a/src/CLogFile.h b/src/CLogFile.h
index 13de5505c..c6146b0bf 100644
--- a/src/CLogFile.h
+++ b/src/CLogFile.h
@@ -8,7 +8,7 @@
#ifndef CLOGFILE_H_
#define CLOGFILE_H_
-#define REVISION "CloneKeenPlus Beta v0.2.9.1 (Commander Genius)"
+#define REVISION "CloneKeenPlus Beta v0.2.9.2 (Commander Genius)"
#include
#include "CSingleton.h"
diff --git a/src/hqp/CHQBitmap.cpp b/src/hqp/CHQBitmap.cpp
index 627bfcb4c..4fd85cd51 100644
--- a/src/hqp/CHQBitmap.cpp
+++ b/src/hqp/CHQBitmap.cpp
@@ -6,6 +6,7 @@
*/
#include "CHQBitmap.h"
+#include "../CLogFile.h"
#include
CHQBitmap::CHQBitmap(SDL_Rect screenrect) {
@@ -21,21 +22,29 @@ CHQBitmap::~CHQBitmap() {
if(m_blackscreen){ SDL_FreeSurface(m_blackscreen); m_blackscreen = NULL;}
}
-bool CHQBitmap::loadImage(const char *pFilename)
+bool CHQBitmap::loadImage(const char *pFilename, int wsize, int hsize)
{
m_scrimg = SDL_LoadBMP(pFilename);
- // TODO: Resolution detection and comparison with the tilesize must be performed
+ m_active = false;
- m_active = true;
- if(!m_scrimg)
- m_active = false;
- else
+ if(m_scrimg)
{
- m_active = true;
- // Create a empty black surface for alpha blending with black
- m_blackscreen = SDL_CreateRGBSurface(SDL_SWSURFACE,
- 320,240,32,0,0,0,0);
+
+ if( ((m_scrimg->h>>4) > hsize) || ((m_scrimg->w>>4) > wsize) )
+ {
+ g_pLogFile->textOut(PURPLE,"HQBitmapLoader : The dimensions of the bitmap don't match to the dimensions of the level.
");
+ g_pLogFile->ftextOut("Please use a proper bitmap with %dx%d dimensions.
", m_scrimg->w, m_scrimg->h);
+ g_pLogFile->ftextOut("Your bitmap is of %dx%d.
", wsize, hsize);
+ g_pLogFile->textOut(BLUE,"HQBitmapLoader : Loading the level without HQBitmap.
");
+ }
+ else
+ {
+ m_active = true;
+ // Create a empty black surface for alpha blending with black
+ m_blackscreen = SDL_CreateRGBSurface(SDL_SWSURFACE,
+ 320,240,32,0,0,0,0);
+ }
}
return m_active;
}
diff --git a/src/hqp/CHQBitmap.h b/src/hqp/CHQBitmap.h
index d80597be6..26329eb00 100644
--- a/src/hqp/CHQBitmap.h
+++ b/src/hqp/CHQBitmap.h
@@ -17,7 +17,7 @@ public:
void setScrollposition(unsigned int xpos, unsigned int ypos);
void updateHQBitmap(SDL_Surface *m_surface, unsigned int x, unsigned int y);
- bool loadImage(const char *pFilename);
+ bool loadImage(const char *pFilename, int wsize, int hsize);
void setAlphaBlend(Uint8 alpha);
void offsetAlphaBlend(Uint8 alpha);
diff --git a/src/menu.cpp b/src/menu.cpp
index 683ef9fdc..1e4bff09d 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -1535,7 +1535,6 @@ char ShowPressF10;
}*/
} while(!g_pInput->getExitEvent());
- // TODO: This invokes Segfault. Please check, where!
if(g_pInput->getExitEvent())
return 1;
diff --git a/src/sdl/CInput.cpp b/src/sdl/CInput.cpp
index 9bcb7c610..b538305f9 100644
--- a/src/sdl/CInput.cpp
+++ b/src/sdl/CInput.cpp
@@ -11,6 +11,9 @@
#include "CInput.h"
#include "../CLogFile.h"
+#ifdef WIZ
+#include "gp2x.h"
+#endif
CInput::CInput() {
@@ -127,9 +130,14 @@ bool CInput::readNewEvent(int position)
return true;
break;
case SDL_JOYBUTTONDOWN:
+#ifdef WIZ
+ WIZ_EmuKeyboard( Event.jbutton.button, 1 );
+ return false;
+#else
InputCommand[position].joyeventtype = ETYPE_JOYBUTTON;
InputCommand[position].joybutton = Event.jbutton.button;
return true;
+#endif
break;
case SDL_JOYAXISMOTION:
InputCommand[position].joyeventtype = ETYPE_JOYAXIS;
@@ -180,8 +188,11 @@ void CInput::pollEvents()
processJoystickButton(0);
break;
}
-
}
+
+#ifdef WIZ
+ WIZ_AdjustVolume( volume_direction );
+#endif
}
void CInput::processJoystickAxis(void)
@@ -206,6 +217,9 @@ void CInput::processJoystickAxis(void)
}
void CInput::processJoystickButton(int value)
{
+#ifdef WIZ
+ WIZ_EmuKeyboard( Event.jbutton.button, value );
+#else
unsigned int i;
for(i=0 ; i VOLUME_MAX ) volume = VOLUME_MAX;
+
+ printf( "Volume Change: %i\n", volume );
+
+ unsigned long soundDev = open("/dev/mixer", O_RDWR);
+ if(soundDev)
+ {
+ int vol = ((volume << 8) | volume);
+ ioctl(soundDev, SOUND_MIXER_WRITE_PCM, &vol);
+ close(soundDev);
+ }
+ }
+}
+#endif
diff --git a/src/sdl/CInput.h b/src/sdl/CInput.h
index 341cbaac8..1c48a1b6e 100644
--- a/src/sdl/CInput.h
+++ b/src/sdl/CInput.h
@@ -8,6 +8,13 @@
#ifndef CINPUT_H_
#define CINPUT_H_
+#ifdef WIZ
+#include
+#include
+#include
+#include
+#endif
+
#include "../CSingleton.h"
#define g_pInput CInput::Get()
@@ -159,10 +166,18 @@ private:
bool immediate_keytable[KEYTABLE_SIZE];
bool last_immediate_keytable[KEYTABLE_SIZE];
+#ifdef WIZ
+ int volume;
+ int volume_direction;
+#endif
void processKeys(int value);
void processJoystickAxis(void);
void processJoystickButton(int value);
+#ifdef WIZ
+ void WIZ_EmuKeyboard( int button, int value );
+ void WIZ_AdjustVolume( int direction );
+#endif
};
diff --git a/src/sdl/COpenGL.cpp b/src/sdl/COpenGL.cpp
index e74cca51c..55e0ffc90 100644
--- a/src/sdl/COpenGL.cpp
+++ b/src/sdl/COpenGL.cpp
@@ -4,7 +4,6 @@
* Created on: 04.06.2009
* Author: gerstrong
*/
-
#include "COpenGL.h"
#include "../CLogFile.h"
@@ -102,8 +101,6 @@ bool COpenGL::initGL(unsigned Width, unsigned Height, unsigned char Depth,
g_pLogFile->ftextOut("OpenGL Init(): Interface succesfully opened!
");
}
- // TODO: Find out where crashes, when OpenGL init failed!
-
return true;
}
diff --git a/src/sdl/COpenGL.h b/src/sdl/COpenGL.h
index 75a55f881..22b0ed6cb 100644
--- a/src/sdl/COpenGL.h
+++ b/src/sdl/COpenGL.h
@@ -9,9 +9,6 @@
*
*/
-#ifndef COPENGL_H_
-#define COPENGL_H_
-
#include
#include
#include "../scale2x/scalebit.h"
@@ -35,4 +32,3 @@ private:
unsigned int m_texparam;
};
-#endif /* COPENGL_H_ */
diff --git a/src/sdl/CVideoDriver.cpp b/src/sdl/CVideoDriver.cpp
index ffbc2ac4e..9e2bf6af7 100644
--- a/src/sdl/CVideoDriver.cpp
+++ b/src/sdl/CVideoDriver.cpp
@@ -57,8 +57,10 @@ CVideoDriver::CVideoDriver() {
FrameSkip=2;
m_targetfps = 0; // Disable automatic frameskipping by default
m_opengl = false;
+#ifdef USE_OPENGL
m_opengl_filter = GL_NEAREST;
mp_OpenGL = NULL;
+#endif
screenrect.x=0;
screenrect.y=0;
@@ -80,7 +82,10 @@ void CVideoDriver::stop(void)
if(screen) { SDL_FreeSurface(screen); g_pLogFile->textOut("freed screen
"); }
if(ScrollSurface && (ScrollSurface->map != NULL)) { SDL_FreeSurface(ScrollSurface); g_pLogFile->textOut("freed scrollsurface
"); }
if(blitsurface_alloc) { blitsurface_alloc = 0; SDL_FreeSurface(BlitSurface); g_pLogFile->textOut("freed blitsurface
"); }
+#ifdef USE_OPENGL
if(mp_OpenGL) { delete mp_OpenGL; mp_OpenGL = NULL; }
+#endif
+ g_pLogFile->textOut(GREEN,"CVideoDriver Close%s
", SDL_GetError());
}
@@ -121,12 +126,18 @@ bool CVideoDriver::applyMode(void)
// Grab a surface on the screen
Mode = SDL_HWPALETTE;
+ // Support for doublebuffering
+ Mode |= SDL_DOUBLEBUF;
+
// Enable OpenGL
+#ifdef USE_OPENGL
if(m_opengl)
{
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
+ SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
Mode |= SDL_OPENGL;
}
+#endif
// Now we decide if it will be fullscreen or windowed mode.
if(Fullscreen)
@@ -245,6 +256,7 @@ 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();
@@ -257,6 +269,7 @@ bool CVideoDriver::createSurfaces(void)
else
mp_OpenGL->setSurface(BlitSurface);
}
+#endif
return true;
}
@@ -384,6 +397,7 @@ void CVideoDriver::blitBGLayer(void)
void CVideoDriver::update_screen(void)
{
+#ifdef USE_OPENGL
if(m_opengl)
{
SDL_BlitSurface(FGLayerSurface, NULL, BlitSurface, NULL);
@@ -398,6 +412,7 @@ void CVideoDriver::update_screen(void)
}
else // No OpenGL but Software Rendering
{
+#endif
SDL_BlitSurface(FGLayerSurface, NULL, BlitSurface, NULL);
// if we're doing zoom then we have copied the scroll buffer into
@@ -471,16 +486,19 @@ void CVideoDriver::update_screen(void)
}
SDL_UnlockSurface(screen);
SDL_UnlockSurface(BlitSurface);
-
}
- SDL_UpdateRect(screen, screenrect.x, screenrect.y, screenrect.w, screenrect.h);
+
+ SDL_Flip(screen);
+ //SDL_UpdateRect(screen, screenrect.x, screenrect.y, screenrect.w, screenrect.h);
SDL_LockSurface(FGLayerSurface);
// Flush the layers
memset(FGLayerSurface->pixels,SDL_MapRGB(FGLayerSurface->format, 0, 0, 0),
GAME_STD_WIDTH*GAME_STD_HEIGHT*FGLayerSurface->format->BytesPerPixel);
SDL_UnlockSurface(FGLayerSurface);
+#ifdef USE_OPENGL
}
+#endif
}
void CVideoDriver::noscale(char *dest, char *src, short bbp)
diff --git a/src/sdl/CVideoDriver.h b/src/sdl/CVideoDriver.h
index 783d58e92..5b9f35b01 100644
--- a/src/sdl/CVideoDriver.h
+++ b/src/sdl/CVideoDriver.h
@@ -11,7 +11,9 @@
#include "../CSingleton.h"
#define g_pVideoDriver CVideoDriver::Get()
+#ifdef USE_OPENGL
#include "COpenGL.h"
+#endif
#include
@@ -56,23 +58,33 @@ public:
unsigned int getHeight(void);
unsigned short getDepth(void);
bool isOpenGL(void) { return m_opengl; }
+#ifdef USE_OPENGL
unsigned char getOGLFilter(void) { return (m_opengl_filter==GL_LINEAR); }
+#else
+ unsigned char getOGLFilter(void) { return 0; }
+#endif
SDL_Surface *getScrollSurface(void);
SDL_Surface *getBGLayerSurface(void);
void setFrameskip(unsigned short value);
void setFilter(short value);
- void setZoom(short value);
+ void setZoom(short vale);
+#ifdef USE_OPENGL
void enableOpenGL(bool value) { m_opengl = value; }
void setOGLFilter(unsigned char value) { m_opengl_filter = (value==1) ? GL_LINEAR : GL_NEAREST ; }
-
- void setTargetFPS(unsigned char targetfps){ if( targetfps >= 0 && targetfps <= 60 ) m_targetfps = targetfps; }
+#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; }
unsigned char getTargetFPS(void){ return m_targetfps; }
void showFPS(bool value);
private:
+#ifdef USE_OPENGL
COpenGL *mp_OpenGL;
+#endif
unsigned int Width;
unsigned int Height;
@@ -82,7 +94,7 @@ private:
short Filtermode;
unsigned short Zoom;
unsigned short FrameSkip;
- unsigned char m_targetfps; // Used for automatic frame skipping
+ unsigned int m_targetfps; // Used for automatic frame skipping
bool showfps;
bool m_opengl;
int m_opengl_filter;