aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/utils
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-03 06:32:19 +0200
committerEinar Johan Trøan Sømåen2012-07-03 06:32:19 +0200
commit370355f85ec1ac55b7a1467899ecfbff788ec1c7 (patch)
tree788aa5db2242a74928895967825364a9afebaa4d /engines/wintermute/utils
parent2457d3860470a757ccf7f008c5638c6a7b5af1de (diff)
downloadscummvm-rg350-370355f85ec1ac55b7a1467899ecfbff788ec1c7.tar.gz
scummvm-rg350-370355f85ec1ac55b7a1467899ecfbff788ec1c7.tar.bz2
scummvm-rg350-370355f85ec1ac55b7a1467899ecfbff788ec1c7.zip
WINTERMUTE: Rename FuncName->funcName in utils
Diffstat (limited to 'engines/wintermute/utils')
-rw-r--r--engines/wintermute/utils/utils.cpp142
-rw-r--r--engines/wintermute/utils/utils.h30
2 files changed, 86 insertions, 86 deletions
diff --git a/engines/wintermute/utils/utils.cpp b/engines/wintermute/utils/utils.cpp
index ae456b25e7..ab7ebac565 100644
--- a/engines/wintermute/utils/utils.cpp
+++ b/engines/wintermute/utils/utils.cpp
@@ -45,30 +45,30 @@ static inline unsigned Sqr(int x) {
//////////////////////////////////////////////////////////////////////////////////
-void CBUtils::Clip(int *DestX, int *DestY, RECT *SrcRect, RECT *DestRect) {
+void CBUtils::clip(int *destX, int *destY, RECT *srcRect, RECT *destRect) {
// If it's partly off the right side of the screen
- if (*DestX + (SrcRect->right - SrcRect->left) > DestRect->right)
- SrcRect->right -= *DestX + (SrcRect->right - SrcRect->left) - DestRect->right;
+ if (*destX + (srcRect->right - srcRect->left) > destRect->right)
+ srcRect->right -= *destX + (srcRect->right - srcRect->left) - destRect->right;
- if (SrcRect->right < 0) SrcRect->right = 0;
+ if (srcRect->right < 0) srcRect->right = 0;
// Partly off the left side of the screen
- if (*DestX < DestRect->left) {
- SrcRect->left += DestRect->left - *DestX;
- *DestX = DestRect->left;
+ if (*destX < destRect->left) {
+ srcRect->left += destRect->left - *destX;
+ *destX = destRect->left;
}
// Partly off the top of the screen
- if (*DestY < DestRect->top) {
- SrcRect->top += DestRect->top - *DestY;
- *DestY = DestRect->top;
+ if (*destY < destRect->top) {
+ srcRect->top += destRect->top - *destY;
+ *destY = destRect->top;
}
// If it's partly off the bottom side of the screen
- if (*DestY + (SrcRect->bottom - SrcRect->top) > DestRect->bottom)
- SrcRect->bottom -= ((SrcRect->bottom - SrcRect->top) + *DestY) - DestRect->bottom;
+ if (*destY + (srcRect->bottom - srcRect->top) > destRect->bottom)
+ srcRect->bottom -= ((srcRect->bottom - srcRect->top) + *destY) - destRect->bottom;
- if (SrcRect->bottom < 0) SrcRect->bottom = 0;
+ if (srcRect->bottom < 0) srcRect->bottom = 0;
return;
}
@@ -76,36 +76,36 @@ void CBUtils::Clip(int *DestX, int *DestY, RECT *SrcRect, RECT *DestRect) {
//////////////////////////////////////////////////////////////////////////////////
// Swap - swaps two integers
//////////////////////////////////////////////////////////////////////////////////
-void CBUtils::Swap(int *a, int *b) {
+void CBUtils::swap(int *a, int *b) {
int Temp = *a;
*a = *b;
*b = Temp;
}
//////////////////////////////////////////////////////////////////////////
-bool CBUtils::StrBeginsI(const char *String, const char *Fragment) {
- return (scumm_strnicmp(String, Fragment, strlen(Fragment)) == 0);
+bool CBUtils::strBeginsI(const char *string, const char *fragment) {
+ return (scumm_strnicmp(string, fragment, strlen(fragment)) == 0);
}
//////////////////////////////////////////////////////////////////////////
-float CBUtils::NormalizeAngle(float Angle) {
- while (Angle > 360) Angle -= 360;
- while (Angle < 0) Angle += 360;
+float CBUtils::normalizeAngle(float angle) {
+ while (angle > 360) angle -= 360;
+ while (angle < 0) angle += 360;
- return Angle;
+ return angle;
}
////////////////////////////////////////////////////////////////////////////////
-void CBUtils::CreatePath(const char *Path, bool PathOnly) {
- AnsiString path;
+void CBUtils::createPath(const char *path, bool pathOnly) {
+ AnsiString pathStr;
- if (!PathOnly) path = PathUtil::getDirectoryName(Path);
- else path = Path;
+ if (!pathOnly) pathStr = PathUtil::getDirectoryName(path);
+ else pathStr = path;
// try {
- warning("CBUtils::CreatePath - not implemented: %s", Path);
+ warning("CBUtils::CreatePath - not implemented: %s", path);
// boost::filesystem::create_directories(path);
// } catch (...) {
return;
@@ -114,13 +114,13 @@ void CBUtils::CreatePath(const char *Path, bool PathOnly) {
//////////////////////////////////////////////////////////////////////////
-void CBUtils::DebugMessage(HWND hWnd, const char *Text) {
+void CBUtils::debugMessage(HWND hWnd, const char *text) {
//MessageBox(hWnd, Text, "WME", MB_OK|MB_ICONINFORMATION);
}
//////////////////////////////////////////////////////////////////////////
-char *CBUtils::SetString(char **string, const char *value) {
+char *CBUtils::setString(char **string, const char *value) {
delete[] *string;
*string = new char[strlen(value) + 1];
if (*string) strcpy(*string, value);
@@ -128,34 +128,34 @@ char *CBUtils::SetString(char **string, const char *value) {
}
//////////////////////////////////////////////////////////////////////////
-int CBUtils::StrNumEntries(const char *Str, const char Delim) {
- int NumEntries = 1;
- for (uint32 i = 0; i < strlen(Str); i++) {
- if (Str[i] == Delim) NumEntries++;
+int CBUtils::strNumEntries(const char *str, const char delim) {
+ int numEntries = 1;
+ for (uint32 i = 0; i < strlen(str); i++) {
+ if (str[i] == delim) numEntries++;
}
- return NumEntries;
+ return numEntries;
}
//////////////////////////////////////////////////////////////////////////
-char *CBUtils::StrEntry(int Entry, const char *Str, const char Delim) {
- int NumEntries = 0;
+char *CBUtils::strEntry(int entry, const char *str, const char delim) {
+ int numEntries = 0;
- const char *Start = NULL;
- int Len = 0;
+ const char *start = NULL;
+ int len = 0;
- for (uint32 i = 0; i <= strlen(Str); i++) {
- if (NumEntries == Entry) {
- if (!Start) Start = Str + i;
- else Len++;
+ for (uint32 i = 0; i <= strlen(str); i++) {
+ if (numEntries == entry) {
+ if (!start) start = str + i;
+ else len++;
}
- if (Str[i] == Delim || Str[i] == '\0') {
- NumEntries++;
- if (Start) {
- char *Ret = new char[Len + 1];
- memset(Ret, 0, Len + 1);
- strncpy(Ret, Start, Len);
- return Ret;
+ if (str[i] == delim || str[i] == '\0') {
+ numEntries++;
+ if (start) {
+ char *ret = new char[len + 1];
+ memset(ret, 0, len + 1);
+ strncpy(ret, start, len);
+ return ret;
}
}
}
@@ -163,7 +163,7 @@ char *CBUtils::StrEntry(int Entry, const char *Str, const char Delim) {
}
//////////////////////////////////////////////////////////////////////////
-int CBUtils::RandomInt(int from, int to) {
+int CBUtils::randomInt(int from, int to) {
if (to < from) {
int i = to;
to = from;
@@ -174,27 +174,27 @@ int CBUtils::RandomInt(int from, int to) {
}
//////////////////////////////////////////////////////////////////////////
-float CBUtils::RandomFloat(float from, float to) {
+float CBUtils::randomFloat(float from, float to) {
const uint32 randMax = RAND_MAX;
float randNum = (float)g_wintermute->randInt(0, randMax) / (float)randMax;
return from + (to - from) * randNum;
}
//////////////////////////////////////////////////////////////////////////
-float CBUtils::RandomAngle(float From, float To) {
+float CBUtils::randomAngle(float From, float To) {
while (To < From) {
To += 360;
}
- return NormalizeAngle(RandomFloat(From, To));
+ return normalizeAngle(randomFloat(From, To));
}
//////////////////////////////////////////////////////////////////////////
-bool CBUtils::MatchesPattern(const char *Pattern, const char *String) {
+bool CBUtils::matchesPattern(const char *pattern, const char *string) {
char stringc, patternc;
- for (;; ++String) {
- stringc = toupper(*String);
- patternc = toupper(*Pattern++);
+ for (;; ++string) {
+ stringc = toupper(*string);
+ patternc = toupper(*pattern++);
switch (patternc) {
case 0:
@@ -205,29 +205,29 @@ bool CBUtils::MatchesPattern(const char *Pattern, const char *String) {
break;
case '*':
- if (!*Pattern) return true;
+ if (!*pattern) return true;
- if (*Pattern == '.') {
+ if (*pattern == '.') {
char *dot;
- if (Pattern[1] == '*' && Pattern[2] == 0) return true;
- dot = (char *)strchr(String, '.');
- if (Pattern[1] == 0) return (dot == NULL || dot[1] == 0);
+ if (pattern[1] == '*' && pattern[2] == 0) return true;
+ dot = (char *)strchr(string, '.');
+ if (pattern[1] == 0) return (dot == NULL || dot[1] == 0);
if (dot != NULL) {
- String = dot;
- if (strpbrk(Pattern, "*?[") == NULL && strchr(String + 1, '.') == NULL)
- return(scumm_stricmp(Pattern + 1, String + 1) == 0);
+ string = dot;
+ if (strpbrk(pattern, "*?[") == NULL && strchr(string + 1, '.') == NULL)
+ return(scumm_stricmp(pattern + 1, string + 1) == 0);
}
}
- while (*String)
- if (CBUtils::MatchesPattern(Pattern, String++))
+ while (*string)
+ if (CBUtils::matchesPattern(pattern, string++))
return true;
return false;
default:
if (patternc != stringc)
if (patternc == '.' && stringc == 0)
- return(CBUtils::MatchesPattern(Pattern, String));
+ return(CBUtils::matchesPattern(pattern, string));
else
return false;
break;
@@ -236,10 +236,10 @@ bool CBUtils::MatchesPattern(const char *Pattern, const char *String) {
}
//////////////////////////////////////////////////////////////////////////
-char *CBUtils::GetPath(const char *Filename) {
- AnsiString path = PathUtil::getDirectoryName(Filename);
+char *CBUtils::getPath(const char *filename) {
+ AnsiString path = PathUtil::getDirectoryName(filename);
//path = boost::filesystem::syste_complete(path).string();
- warning("CBUtils::GetPath: (%s), not implemented", Filename);
+ warning("CBUtils::GetPath: (%s), not implemented", filename);
char *ret = new char[path.size() + 1];
strcpy(ret, path.c_str());
@@ -247,8 +247,8 @@ char *CBUtils::GetPath(const char *Filename) {
}
//////////////////////////////////////////////////////////////////////////
-char *CBUtils::GetFilename(const char *Filename) {
- AnsiString path = PathUtil::getFileName(Filename);
+char *CBUtils::getFilename(const char *filename) {
+ AnsiString path = PathUtil::getFileName(filename);
char *ret = new char[path.size() + 1];
strcpy(ret, path.c_str());
return ret;
diff --git a/engines/wintermute/utils/utils.h b/engines/wintermute/utils/utils.h
index 46e895ff4d..219cacd249 100644
--- a/engines/wintermute/utils/utils.h
+++ b/engines/wintermute/utils/utils.h
@@ -37,27 +37,27 @@ class CBGame;
class CBUtils {
public:
- static void Clip(int *DestX, int *DestY, RECT *SrcRect, RECT *DestRect);
- static void Swap(int *a, int *b);
- static bool StrBeginsI(const char *String, const char *Fragment);
- static float NormalizeAngle(float Angle);
+ static void clip(int *DestX, int *DestY, RECT *SrcRect, RECT *DestRect);
+ static void swap(int *a, int *b);
+ static bool strBeginsI(const char *String, const char *Fragment);
+ static float normalizeAngle(float Angle);
- static void CreatePath(const char *Path, bool PathOnly = false);
+ static void createPath(const char *Path, bool PathOnly = false);
- static void DebugMessage(HWND hWnd, const char *Text);
- static char *SetString(char **String, const char *Value);
+ static void debugMessage(HWND hWnd, const char *Text);
+ static char *setString(char **String, const char *Value);
- static int StrNumEntries(const char *Str, const char Delim = ',');
- static char *StrEntry(int Entry, const char *Str, const char Delim = ',');
+ static int strNumEntries(const char *Str, const char Delim = ',');
+ static char *strEntry(int Entry, const char *Str, const char Delim = ',');
- static int RandomInt(int From, int To);
- static float RandomFloat(float From, float To);
- static float RandomAngle(float From, float To);
+ static int randomInt(int From, int To);
+ static float randomFloat(float From, float To);
+ static float randomAngle(float From, float To);
- static bool MatchesPattern(const char *pattern, const char *string);
+ static bool matchesPattern(const char *pattern, const char *string);
- static char *GetPath(const char *Filename);
- static char *GetFilename(const char *Filename);
+ static char *getPath(const char *Filename);
+ static char *getFilename(const char *Filename);
static void RGBtoHSL(uint32 RGBColor, byte *OutH, byte *OutS, byte *OutL);
static uint32 HSLtoRGB(byte H, byte S, byte L);