some more fixes

git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@157 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
albertzeyer
2009-07-24 18:28:43 +00:00
parent f854745f9e
commit 01c6db1b9b
6 changed files with 24 additions and 18 deletions

View File

@@ -64,12 +64,12 @@ void CGraphics::freemem(void)
if (scrollbuffer) if (scrollbuffer)
{ {
delete[] scrollbuffer; scrollbuffer = NULL; delete[] scrollbuffer; scrollbuffer = NULL;
g_pLogFile->ftextOut(BLACK,true," Scrollbuffer memory released to system.<br>"); g_pLogFile->fltextOut(BLACK,true," Scrollbuffer memory released to system.<br>");
} }
if (blitbuffer) if (blitbuffer)
{ {
delete[] blitbuffer; blitbuffer = NULL; delete[] blitbuffer; blitbuffer = NULL;
g_pLogFile->ftextOut(BLACK,true," Blitbuffer memory released to system.<br>"); g_pLogFile->fltextOut(BLACK,true," Blitbuffer memory released to system.<br>");
} }
} }

View File

@@ -72,13 +72,13 @@ void CLogFile::WriteTopic(const char *Topic, int Size)
// Now with colors // Now with colors
void CLogFile::textOut(int Color, const char *Text) void CLogFile::textOut(FONTCOLORS Color, const char *Text)
{ {
textOut(Color, false, Text); textOut(Color, false, Text);
} }
// Now the entire definition (with list and color) // Now the entire definition (with list and color)
void CLogFile::textOut(int Color, bool List, const char *Text) void CLogFile::textOut(FONTCOLORS Color, bool List, const char *Text)
{ {
if(List == true) if(List == true)
textOut("<li>"); textOut("<li>");
@@ -128,7 +128,7 @@ void CLogFile::ftextOut(const char *Text, ...)
textOut(buffer); textOut(buffer);
} }
void CLogFile::ftextOut(int Color, bool List, const char *Text, ...) void CLogFile::fltextOut(FONTCOLORS Color, bool List, const char *Text, ...)
{ {
char buffer[MAX_BUFFER]; char buffer[MAX_BUFFER];
va_list pArgList; va_list pArgList;
@@ -140,7 +140,7 @@ void CLogFile::ftextOut(int Color, bool List, const char *Text, ...)
textOut(Color, List, buffer); textOut(Color, List, buffer);
} }
void CLogFile::ftextOut(int Color, const char *Text, ...) void CLogFile::ftextOut(FONTCOLORS Color, const char *Text, ...)
{ {
char buffer[MAX_BUFFER]; char buffer[MAX_BUFFER];
va_list pArgList; va_list pArgList;

View File

@@ -33,11 +33,11 @@ public:
void CreateLogfile (const char *LogName); void CreateLogfile (const char *LogName);
void WriteTopic (const char *Topic, int Size); void WriteTopic (const char *Topic, int Size);
void textOut (const char *Text); void textOut (const char *Text);
void textOut (int Color, const char *Text); void textOut (FONTCOLORS Color, const char *Text);
void textOut (int Color, bool List, const char *Text); void textOut (FONTCOLORS Color, bool List, const char *Text);
void ftextOut (const char *Text, ...); void ftextOut (const char *Text, ...);
void ftextOut (int Color, const char *Text, ...); void ftextOut (FONTCOLORS Color, const char *Text, ...);
void ftextOut (int Color, bool List, const char *Text, ...); void fltextOut (FONTCOLORS Color, bool List, const char *Text, ...);
void FunctionResult (const char *Name, bool Result); void FunctionResult (const char *Name, bool Result);
private: private:

View File

@@ -64,7 +64,7 @@ bool CHQBitmap::loadImage(const std::string& pFilename, int wsize, int hsize)
} }
else else
{ {
SDL_GetError();
} }
return m_active; return m_active;

View File

@@ -40,10 +40,16 @@ short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const std::stri
g_pLogFile->textOut(PURPLE,"Sorry, OGG-Support is disabled!<br>"); g_pLogFile->textOut(PURPLE,"Sorry, OGG-Support is disabled!<br>");
buf = "data/hqp/snd/"+ soundfile + ".WAV"; buf = "data/hqp/snd/"+ soundfile + ".WAV";
// Check, if it is a wav file or go back to classic sounds std::string fullfname = GetFullFileName(buf);
if (SDL_LoadWAV (buf.c_str(), &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL) if(fullfname.size() == 0) {
g_pLogFile->textOut(PURPLE,"Wave file not found: \"%s\". Trying to load the classical sound<br>", buf.c_str());
return 1;
}
// Check, if it is a wav file or go back to classic sounds
if (SDL_LoadWAV (Utf8ToSystemNative(fullfname).c_str(), &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL)
{ {
g_pLogFile->textOut(PURPLE,"Wave file could not be opened: \"%s\". Trying to load the classical sound<br>", buf.c_str()); g_pLogFile->textOut(PURPLE,"Wave file %s could not be opened: \"%s\". Trying to load the classical sound<br>", buf.c_str(), SDL_GetError());
return 1; return 1;
} }
@@ -60,7 +66,7 @@ short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const std::stri
// Check, if it is a wav file or go back to classic sounds // Check, if it is a wav file or go back to classic sounds
if (SDL_LoadWAV (Utf8ToSystemNative(fullfname).c_str(), &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL) if (SDL_LoadWAV (Utf8ToSystemNative(fullfname).c_str(), &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL)
{ {
g_pLogFile->textOut(PURPLE,"Wave file could not be opened: \"%s\". Trying to load the classical sounds<br>", buf.c_str()); g_pLogFile->ftextOut(PURPLE, "Wave file %s could not be opened: \"%s\". Trying to load the classical sounds<br>", buf.c_str(), SDL_GetError());
return 1; return 1;
} }
} }

View File

@@ -53,7 +53,7 @@ void cleanup(stCloneKeenPlus *CKP)
{ {
if(CKP->GameData){ delete[] CKP->GameData; CKP->GameData = NULL; } if(CKP->GameData){ delete[] CKP->GameData; CKP->GameData = NULL; }
g_pLogFile->ftextOut(BLACK,true," Freed %d strings.<br>", freestrings()); g_pLogFile->fltextOut(BLACK,true," Freed %d strings.<br>", freestrings());
JoyDrv_Stop(&(CKP->Joystick)); JoyDrv_Stop(&(CKP->Joystick));
g_pLogFile->textOut(BLACK,true," Joystick driver shut down.<br>"); g_pLogFile->textOut(BLACK,true," Joystick driver shut down.<br>");
@@ -77,11 +77,11 @@ void cleanup(stCloneKeenPlus *CKP)
if (demofile) if (demofile)
{ {
fclose(demofile); fclose(demofile);
g_pLogFile->ftextOut(BLACK,true," Demo file closed.<br>"); g_pLogFile->fltextOut(BLACK,true," Demo file closed.<br>");
} }
g_pGraphics->stopGraphics(); g_pGraphics->stopGraphics();
g_pLogFile->ftextOut(BLACK,true," Graphics driver shut down.<br>"); g_pLogFile->fltextOut(BLACK,true," Graphics driver shut down.<br>");
g_pGraphics->freemem(); g_pGraphics->freemem();