summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2014-07-11 15:24:44 +0200
committerkrzys-h <krzys_h@interia.pl>2014-07-11 15:24:44 +0200
commit96d49d84aafecd78c902681f20de6207badf7e85 (patch)
tree7a835fce4f264c6c0886441c4f79e02cdf47582c /src/common
parent5223ef1fb116780298495a4d2f63e6c2c39fdfbd (diff)
parent852223262055440569ecca70f1b9da46089424c4 (diff)
downloadcolobot-96d49d84aafecd78c902681f20de6207badf7e85.tar.gz
colobot-96d49d84aafecd78c902681f20de6207badf7e85.tar.bz2
colobot-96d49d84aafecd78c902681f20de6207badf7e85.zip
Merge branch 'dev' into dev-physfs
Conflicts: data src/app/gamedata.cpp src/ui/control.cpp src/ui/edit.cpp src/ui/maindialog.cpp
Diffstat (limited to 'src/common')
-rw-r--r--src/common/event.cpp2
-rw-r--r--src/common/event.h2
-rw-r--r--src/common/image.cpp41
-rw-r--r--src/common/image.h6
-rw-r--r--src/common/misc.cpp18
-rw-r--r--src/common/restext.cpp4
-rw-r--r--src/common/restext.h2
7 files changed, 47 insertions, 28 deletions
diff --git a/src/common/event.cpp b/src/common/event.cpp
index 9dc3943..fc5bc98 100644
--- a/src/common/event.cpp
+++ b/src/common/event.cpp
@@ -67,7 +67,6 @@ void InitializeEventTypeTexts()
EVENT_TYPE_TEXT[EVENT_BUTTON_CANCEL] = "EVENT_BUTTON_CANCEL";
EVENT_TYPE_TEXT[EVENT_BUTTON_NEXT] = "EVENT_BUTTON_NEXT";
EVENT_TYPE_TEXT[EVENT_BUTTON_PREV] = "EVENT_BUTTON_PREV";
- EVENT_TYPE_TEXT[EVENT_BUTTON_QUIT] = "EVENT_BUTTON_QUIT";
EVENT_TYPE_TEXT[EVENT_BUTTON0] = "EVENT_BUTTON0";
EVENT_TYPE_TEXT[EVENT_BUTTON1] = "EVENT_BUTTON1";
@@ -170,7 +169,6 @@ void InitializeEventTypeTexts()
EVENT_TYPE_TEXT[EVENT_INTERFACE_READ] = "EVENT_INTERFACE_READ";
EVENT_TYPE_TEXT[EVENT_INTERFACE_ABORT] = "EVENT_INTERFACE_ABORT";
EVENT_TYPE_TEXT[EVENT_INTERFACE_USER] = "EVENT_INTERFACE_USER";
- EVENT_TYPE_TEXT[EVENT_INTERFACE_TEEN] = "EVENT_INTERFACE_TEEN";
EVENT_TYPE_TEXT[EVENT_INTERFACE_CHAP] = "EVENT_INTERFACE_CHAP";
EVENT_TYPE_TEXT[EVENT_INTERFACE_LIST] = "EVENT_INTERFACE_LIST";
diff --git a/src/common/event.h b/src/common/event.h
index c5eb615..220b807 100644
--- a/src/common/event.h
+++ b/src/common/event.h
@@ -90,7 +90,6 @@ enum EventType
EVENT_BUTTON_CANCEL = 41,
EVENT_BUTTON_NEXT = 42,
EVENT_BUTTON_PREV = 43,
- EVENT_BUTTON_QUIT = 44,
EVENT_BUTTON0 = 50,
EVENT_BUTTON1 = 51,
@@ -193,7 +192,6 @@ enum EventType
EVENT_INTERFACE_READ = 411,
EVENT_INTERFACE_ABORT = 412,
EVENT_INTERFACE_USER = 413,
- EVENT_INTERFACE_TEEN = 414,
EVENT_INTERFACE_CHAP = 420,
EVENT_INTERFACE_LIST = 421,
diff --git a/src/common/image.cpp b/src/common/image.cpp
index 9916c8f..dd905a7 100644
--- a/src/common/image.cpp
+++ b/src/common/image.cpp
@@ -428,3 +428,44 @@ bool CImage::SavePNG(const std::string& fileName)
return true;
}
+void CImage::SetDataPixels(void *pixels){
+
+ Uint8* srcPixels = static_cast<Uint8*> (pixels);
+ Uint8* resultPixels = static_cast<Uint8*> (m_data->surface->pixels);
+
+ Uint32 pitch = m_data->surface->pitch;
+
+ for(int line = 0; line < m_data->surface->h; ++line) {
+ Uint32 pos = line * pitch;
+ memcpy(&resultPixels[pos], &srcPixels[pos], pitch);
+ }
+}
+
+void CImage::flipVertically(){
+
+ SDL_Surface* result = SDL_CreateRGBSurface( m_data->surface->flags,
+ m_data->surface->w,
+ m_data->surface->h,
+ m_data->surface->format->BytesPerPixel * 8,
+ m_data->surface->format->Rmask,
+ m_data->surface->format->Gmask,
+ m_data->surface->format->Bmask,
+ m_data->surface->format->Amask);
+
+ assert(result != nullptr);
+
+ Uint8* srcPixels = static_cast<Uint8*> (m_data->surface->pixels);
+ Uint8* resultPixels = static_cast<Uint8*> (result->pixels);
+
+ Uint32 pitch = m_data->surface->pitch;
+ Uint32 pxLength = pitch*m_data->surface->h;
+
+ for(int line = 0; line < m_data->surface->h; ++line) {
+ Uint32 pos = line * pitch;
+ memcpy(&resultPixels[pos], &srcPixels[(pxLength-pos)-pitch], pitch);
+ }
+
+ SDL_FreeSurface(m_data->surface);
+
+ m_data->surface = result;
+}
diff --git a/src/common/image.h b/src/common/image.h
index 31dab2d..b93f2f9 100644
--- a/src/common/image.h
+++ b/src/common/image.h
@@ -109,6 +109,12 @@ public:
//! Returns the last error
std::string GetError();
+ //! Flips the image vertically
+ void flipVertically();
+
+ //! sets/replaces the pixels from the surface
+ void SetDataPixels(void *pixels);
+
private:
//! Blit to new RGBA surface with given size
void BlitToNewRGBASurface(int width, int height);
diff --git a/src/common/misc.cpp b/src/common/misc.cpp
index 65689e6..92c3e9a 100644
--- a/src/common/misc.cpp
+++ b/src/common/misc.cpp
@@ -192,18 +192,6 @@ void TimeToAscii(time_t time, char *buffer)
year = when.tm_year+1900;
if ( year < 2000 ) year -= 1900;
else year -= 2000;
-/* TODO
-#if _FRENCH
- sprintf(buffer, "%.2d.%.2d.%.2d %.2d:%.2d",
- when.tm_mday, when.tm_mon+1, year,
- when.tm_hour, when.tm_min);
-#endif
-#if _GERMAN | _WG
- sprintf(buffer, "%.2d.%.2d.%.2d %.2d:%.2d",
- when.tm_mday, when.tm_mon+1, year,
- when.tm_hour, when.tm_min);
-#endif
-#if _ENGLISH*/
char format[10];
int hour;
@@ -222,12 +210,6 @@ void TimeToAscii(time_t time, char *buffer)
sprintf(buffer, "%.2d.%.2d.%.2d %.2d:%.2d %s",
when.tm_mon+1, when.tm_mday, year,
hour, when.tm_min, format);
-/*#endif
-#if _POLISH
- sprintf(buffer, "%.2d.%.2d.%.2d %.2d:%.2d",
- when.tm_mday, when.tm_mon+1, year,
- when.tm_hour, when.tm_min);
-#endif*/
}
// Converting time to string.
diff --git a/src/common/restext.cpp b/src/common/restext.cpp
index b63160d..2248f2b 100644
--- a/src/common/restext.cpp
+++ b/src/common/restext.cpp
@@ -61,7 +61,6 @@ void InitializeRestext()
stringsText[RT_TITLE_DEFI] = "Challenges";
stringsText[RT_TITLE_MISSION] = "Missions";
stringsText[RT_TITLE_FREE] = "Free game";
- stringsText[RT_TITLE_TEEN] = "Free game";
stringsText[RT_TITLE_USER] = "User levels";
stringsText[RT_TITLE_SETUP] = "Options";
stringsText[RT_TITLE_NAME] = "Player's name";
@@ -80,7 +79,6 @@ void InitializeRestext()
stringsText[RT_PLAY_LISTm] = " Missions on this planet:";
stringsText[RT_PLAY_LISTf] = " Free game on this planet:";
stringsText[RT_PLAY_LISTu] = " Missions on this level:";
- stringsText[RT_PLAY_LISTk] = " Free game on this chapter:";
stringsText[RT_PLAY_RESUME] = " Summary:";
stringsText[RT_SETUP_DEVICE] = " Drivers:";
@@ -141,7 +139,6 @@ void InitializeRestext()
stringsEvent[EVENT_BUTTON_CANCEL] = "Cancel";
stringsEvent[EVENT_BUTTON_NEXT] = "Next";
stringsEvent[EVENT_BUTTON_PREV] = "Previous";
- stringsEvent[EVENT_BUTTON_QUIT] = "Menu (\\key quit;)";
stringsEvent[EVENT_DIALOG_OK] = "OK";
stringsEvent[EVENT_DIALOG_CANCEL] = "Cancel";
@@ -150,7 +147,6 @@ void InitializeRestext()
stringsEvent[EVENT_INTERFACE_DEFI] = "Challenges\\Programming challenges";
stringsEvent[EVENT_INTERFACE_MISSION] = "Missions\\Select mission";
stringsEvent[EVENT_INTERFACE_FREE] = "Free game\\Free game without a specific goal";
- stringsEvent[EVENT_INTERFACE_TEEN] = "Free game\\Free game without a specific goal";
stringsEvent[EVENT_INTERFACE_USER] = "User\\User levels";
stringsEvent[EVENT_INTERFACE_NAME] = "Change player\\Change player";
stringsEvent[EVENT_INTERFACE_SETUP] = "Options\\Preferences";
diff --git a/src/common/restext.h b/src/common/restext.h
index cde7203..d145f24 100644
--- a/src/common/restext.h
+++ b/src/common/restext.h
@@ -72,7 +72,6 @@ enum ResTextType
RT_TITLE_WRITE = 50,
RT_TITLE_READ = 51,
RT_TITLE_USER = 52,
- RT_TITLE_TEEN = 53,
RT_PLAY_CHAPt = 60,
RT_PLAY_CHAPd = 61,
@@ -86,7 +85,6 @@ enum ResTextType
RT_PLAY_CHAPu = 71,
RT_PLAY_LISTu = 72,
RT_PLAY_CHAPte = 73,
- RT_PLAY_LISTk = 74,
RT_SETUP_DEVICE = 80,
RT_SETUP_MODE = 81,