reverted all src changes from rev95 commit (because all old work was just removed)
git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@107 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
@@ -22,9 +22,9 @@ CHQBitmap::~CHQBitmap() {
|
||||
if(m_blackscreen){ SDL_FreeSurface(m_blackscreen); m_blackscreen = NULL;}
|
||||
}
|
||||
|
||||
bool CHQBitmap::loadImage(const char *pFilename, int wsize, int hsize)
|
||||
bool CHQBitmap::loadImage(const std::string& pFilename, int wsize, int hsize)
|
||||
{
|
||||
SDL_Surface *BitmapSurface = SDL_LoadBMP(pFilename);
|
||||
SDL_Surface *BitmapSurface = SDL_LoadBMP(pFilename.c_str());
|
||||
|
||||
m_active = false;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#define CHQBITMAP_H_
|
||||
|
||||
#include <SDL.h>
|
||||
#include <string>
|
||||
|
||||
class CHQBitmap {
|
||||
public:
|
||||
@@ -17,7 +18,7 @@ public:
|
||||
|
||||
void setScrollposition(unsigned int xpos, unsigned int ypos);
|
||||
void updateHQBitmap(SDL_Surface *m_surface, SDL_Rect *p_srcrect, SDL_Rect *p_dstrect);
|
||||
bool loadImage(const char *pFilename, int wsize, int hsize);
|
||||
bool loadImage(const std::string& pFilename, int wsize, int hsize);
|
||||
void setAlphaBlend(Uint8 alpha);
|
||||
void offsetAlphaBlend(Uint8 alpha);
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
CMusic::CMusic() {
|
||||
playmode = PLAY_MODE_STOP;
|
||||
music_buffer = NULL;
|
||||
}
|
||||
|
||||
CMusic::~CMusic() {
|
||||
@@ -21,8 +20,6 @@ CMusic::~CMusic() {
|
||||
|
||||
int CMusic::load(SDL_AudioSpec AudioSpec, char *musicfile)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
if(AudioSpec.format != 0)
|
||||
{
|
||||
|
||||
@@ -36,10 +33,10 @@ int CMusic::load(SDL_AudioSpec AudioSpec, char *musicfile)
|
||||
pOggAudio.sound_len=0;
|
||||
pOggAudio.sound_pos=0;
|
||||
|
||||
FILE *fp;
|
||||
if((fp = fopen(musicfile,"rb")) == NULL)
|
||||
{
|
||||
g_pLogFile->textOut(PURPLE,"Music Driver(): \"%s\". File does not exist!<br>", musicfile);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -104,8 +101,7 @@ void CMusic::unload(void)
|
||||
|
||||
void CMusic::play(void)
|
||||
{
|
||||
if(music_buffer)
|
||||
playmode = PLAY_MODE_PLAY;
|
||||
playmode = PLAY_MODE_PLAY;
|
||||
}
|
||||
|
||||
void CMusic::stop(void)
|
||||
|
||||
@@ -11,17 +11,17 @@
|
||||
#include "../include/vorbis/oggsupport.h"
|
||||
#include "../CLogFile.h"
|
||||
|
||||
short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const char *soundfile)
|
||||
short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const std::string& soundfile)
|
||||
{
|
||||
SDL_AudioSpec AudioFileSpec;
|
||||
SDL_AudioCVT Audio_cvt;
|
||||
|
||||
psound->sound_buffer = NULL;
|
||||
char buf[80];
|
||||
std::string buf;
|
||||
FILE *fp;
|
||||
|
||||
sprintf(buf,"data/hqp/snd/%s.OGG",soundfile); // Start with OGG
|
||||
if((fp = fopen(buf,"rb")) != NULL)
|
||||
buf = "data/hqp/snd/" + soundfile + ".OGG"; // Start with OGG
|
||||
if((fp = fopen(buf.c_str(),"rb")) != NULL)
|
||||
{
|
||||
#ifdef BUILD_WITH_OGG
|
||||
if(openOGGSound(fp, &AudioFileSpec, AudioSpec->format, psound) != 0)
|
||||
@@ -29,38 +29,37 @@ short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const char *sou
|
||||
g_pLogFile->textOut(PURPLE,"OGG file could not be opened: \"%s\". The file was detected, but appears to be damaged. Trying to load the classical sound<br>", soundfile);
|
||||
return 1;
|
||||
}
|
||||
psound->enabled = true;
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef BUILD_WITH_OGG
|
||||
g_pLogFile->textOut(PURPLE,"Sorry, OGG-Support is disabled!<br>");
|
||||
sprintf(buf,"data/hqp/snd/%s.WAV",soundfile);
|
||||
buf = "data/hqp/snd/"+ soundfile + ".WAV";
|
||||
|
||||
// Check, if it is a wav file or go back to classic sounds
|
||||
if (SDL_LoadWAV (buf, &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL)
|
||||
if (SDL_LoadWAV (buf.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);
|
||||
g_pLogFile->textOut(PURPLE,"Wave file could not be opened: \"%s\". Trying to load the classical sound<br>", buf.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
psound->enabled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf(buf,"data/hqp/snd/%s.WAV",soundfile);
|
||||
buf = "data/hqp/snd/" + soundfile + ".WAV";
|
||||
|
||||
// Check, if it is a wav file or go back to classic sounds
|
||||
if (SDL_LoadWAV (buf, &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL)
|
||||
if (SDL_LoadWAV (buf.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);
|
||||
g_pLogFile->textOut(PURPLE,"Wave file could not be opened: \"%s\". Trying to load the classical sounds<br>", buf.c_str());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
psound->sound_pos = 0;
|
||||
g_pLogFile->textOut(PURPLE,"File \"%s\" opened successfully!<br>", buf);
|
||||
g_pLogFile->textOut(PURPLE,"File \"%s\" opened successfully!<br>", buf.c_str());
|
||||
|
||||
int ret;
|
||||
/* Build AudioCVT (This is needed for the conversion from one format to the one used in the game)*/
|
||||
|
||||
@@ -5,15 +5,21 @@
|
||||
* Author: gerstrong
|
||||
*/
|
||||
|
||||
#include <SDL.h>
|
||||
#ifndef __CG_HQ_SOUND_H__
|
||||
#define __CG_HQ_SOUND_H__
|
||||
|
||||
typedef struct stHQSound
|
||||
#include <SDL.h>
|
||||
#include <string>
|
||||
|
||||
struct stHQSound
|
||||
{
|
||||
Uint8 *sound_buffer;
|
||||
Uint32 sound_len;
|
||||
int sound_pos;
|
||||
bool enabled;
|
||||
} stHQSound;
|
||||
};
|
||||
|
||||
short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const char *soundfile);
|
||||
short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const std::string& soundfile);
|
||||
void HQSndDrv_Unload(stHQSound *psound);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user