Some style and whitespace fixes

master
Piotr Dziwinski 2015-08-02 08:45:02 +02:00
parent 60ae9b1959
commit 3b585d9f51
28 changed files with 135 additions and 136 deletions

View File

@ -448,8 +448,8 @@ void CImage::SetDataPixels(void *pixels){
} }
} }
void CImage::flipVertically(){ void CImage::FlipVertically()
{
SDL_Surface* result = SDL_CreateRGBSurface( m_data->surface->flags, SDL_Surface* result = SDL_CreateRGBSurface( m_data->surface->flags,
m_data->surface->w, m_data->surface->w,
m_data->surface->h, m_data->surface->h,
@ -467,7 +467,8 @@ void CImage::flipVertically(){
Uint32 pitch = m_data->surface->pitch; Uint32 pitch = m_data->surface->pitch;
Uint32 pxLength = pitch*m_data->surface->h; Uint32 pxLength = pitch*m_data->surface->h;
for(int line = 0; line < m_data->surface->h; ++line) { for (int line = 0; line < m_data->surface->h; ++line)
{
Uint32 pos = line * pitch; Uint32 pos = line * pitch;
memcpy(&resultPixels[pos], &srcPixels[(pxLength-pos)-pitch], pitch); memcpy(&resultPixels[pos], &srcPixels[(pxLength-pos)-pitch], pitch);
} }

View File

@ -113,7 +113,7 @@ public:
std::string GetError(); std::string GetError();
//! Flips the image vertically //! Flips the image vertically
void flipVertically(); void FlipVertically();
//! sets/replaces the pixels from the surface //! sets/replaces the pixels from the surface
void SetDataPixels(void *pixels); void SetDataPixels(void *pixels);

View File

@ -31,7 +31,7 @@ unsigned int GetVirtualKey(unsigned int key)
return VIRTUAL_KMOD(META); return VIRTUAL_KMOD(META);
if(key == KEY(KP_ENTER)) if(key == KEY(KP_ENTER))
return KEY(RETURN); return KEY(RETURN);
return key; return key;
} }

View File

@ -41,6 +41,3 @@ boost::smatch RegexUtils::AssertRegexMatch(const std::string& text, const std::s
return matches; return matches;
} }
/*
boost::cmatch matches;*/

View File

@ -487,7 +487,7 @@ bool CEngine::WriteScreenShot(const std::string& fileName, int width, int height
CImage img({width, height}); CImage img({width, height});
img.SetDataPixels(pixels); img.SetDataPixels(pixels);
img.flipVertically(); img.FlipVertically();
if ( img.SavePNG(fileName.c_str()) ) if ( img.SavePNG(fileName.c_str()) )
{ {

View File

@ -619,24 +619,24 @@ Texture CGL21Device::CreateTexture(ImageData *data, const TextureCreateParams &p
// Set mipmap level and automatic mipmap generation if neccesary // Set mipmap level and automatic mipmap generation if neccesary
if (params.mipmap) if (params.mipmap)
{ {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapLevel - 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapLevel - 1);
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
} }
else else
{ {
// Has to be set to 0 because no mipmaps are generated // Has to be set to 0 because no mipmaps are generated
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE); glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE);
} }
// Set anisotropy level if available // Set anisotropy level if available
if (m_anisotropyAvailable) if (m_anisotropyAvailable)
{ {
float level = Math::Min(m_maxAnisotropy, CEngine::GetInstance().GetTextureAnisotropyLevel()); float level = Math::Min(m_maxAnisotropy, CEngine::GetInstance().GetTextureAnisotropyLevel());
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, level); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, level);
} }
bool convert = false; bool convert = false;

View File

@ -647,22 +647,22 @@ Texture CGL33Device::CreateTexture(ImageData *data, const TextureCreateParams &p
// Set mipmap level and automatic mipmap generation if neccesary // Set mipmap level and automatic mipmap generation if neccesary
if (params.mipmap) if (params.mipmap)
{ {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapLevel - 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapLevel - 1);
} }
else else
{ {
// Has to be set to 0 because no mipmaps are generated // Has to be set to 0 because no mipmaps are generated
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
} }
// Set anisotropy level if available // Set anisotropy level if available
if (m_anisotropyAvailable) if (m_anisotropyAvailable)
{ {
float level = Math::Min(m_maxAnisotropy, CEngine::GetInstance().GetTextureAnisotropyLevel()); float level = Math::Min(m_maxAnisotropy, CEngine::GetInstance().GetTextureAnisotropyLevel());
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, level); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, level);
} }
bool convert = false; bool convert = false;

View File

@ -592,24 +592,24 @@ Texture CGLDevice::CreateTexture(ImageData *data, const TextureCreateParams &par
// Set mipmap level and automatic mipmap generation if neccesary // Set mipmap level and automatic mipmap generation if neccesary
if (params.mipmap) if (params.mipmap)
{ {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapLevel - 1); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, mipmapLevel - 1);
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
} }
else else
{ {
// Has to be set to 0 because no mipmaps are generated // Has to be set to 0 because no mipmaps are generated
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE); glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE);
} }
// Set anisotropy level if available // Set anisotropy level if available
if (m_anisotropyAvailable) if (m_anisotropyAvailable)
{ {
float level = Math::Min(m_maxAnisotropy, CEngine::GetInstance().GetTextureAnisotropyLevel()); float level = Math::Min(m_maxAnisotropy, CEngine::GetInstance().GetTextureAnisotropyLevel());
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, level); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, level);
} }
bool convert = false; bool convert = false;

View File

@ -19,7 +19,8 @@
#pragma once #pragma once
enum MissionType { enum MissionType
{
MISSION_NORMAL = 0, MISSION_NORMAL = 0,
MISSION_RETRO, MISSION_RETRO,
MISSION_CODE_BATTLE MISSION_CODE_BATTLE