some fixes for menu
git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@104 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
@@ -218,7 +218,7 @@ short CGame::runCycle(stCloneKeenPlus *pCKP)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CGame::loadResources(unsigned short Episode, char *DataDirectory)
|
||||
bool CGame::loadResources(unsigned short Episode, char *DataDirectory)
|
||||
{
|
||||
m_Episode = Episode;
|
||||
memcpy(m_DataDirectory, DataDirectory, 256);
|
||||
@@ -251,12 +251,17 @@ int CGame::loadResources(unsigned short Episode, char *DataDirectory)
|
||||
|
||||
if(ExeFile->getData() == NULL) {
|
||||
g_pLogFile->textOut(RED, "CGame::loadResources: Could not load data out of EXE<br>");
|
||||
return 1;
|
||||
delete ExeFile;
|
||||
return false;
|
||||
}
|
||||
|
||||
TileLoader = new CTileLoader(Episode, ExeFile->getEXEVersion(), ExeFile->getData());
|
||||
if(!TileLoader->load()) return 1;
|
||||
|
||||
if(!TileLoader->load()) {
|
||||
g_pLogFile->textOut(RED, "CGame::loadResources: Could not load data with TileLoader<br>");
|
||||
delete ExeFile;
|
||||
return false;
|
||||
}
|
||||
|
||||
// load the strings. TODO: After that this one will replace loadstrings
|
||||
//m_Messages = new CMessages(); delete ExeFile;
|
||||
//m_Messages->readData(char *buf, int episode, int version);
|
||||
@@ -265,10 +270,9 @@ int CGame::loadResources(unsigned short Episode, char *DataDirectory)
|
||||
delete ExeFile;
|
||||
|
||||
// Load the sound data
|
||||
int ok;
|
||||
ok = g_pSound->loadSoundData(m_Episode, DataDirectory);
|
||||
if( ok ) return ok;
|
||||
return 0;
|
||||
bool ok = g_pSound->loadSoundData(m_Episode, DataDirectory);
|
||||
if( !ok ) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CGame::freeResources(void)
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
CGame();
|
||||
virtual ~CGame();
|
||||
|
||||
int loadResources(unsigned short Episode, char *DataDirectory);
|
||||
bool loadResources(unsigned short Episode, char *DataDirectory);
|
||||
void freeResources(void);
|
||||
short runCycle(stCloneKeenPlus *pCKP);
|
||||
void preallocateCKP(stCloneKeenPlus *pCKP);
|
||||
|
||||
1364
src/main.cpp
1364
src/main.cpp
File diff suppressed because it is too large
Load Diff
@@ -297,12 +297,12 @@ playsound: ;
|
||||
m_soundchannel[chnl].setupSound((unsigned short)snd, 0, true, WAVE_IN, 0, (mode==PLAY_FORCE) ? true : false );
|
||||
}
|
||||
|
||||
char CSound::loadSoundData(unsigned short Episode, char *DataDirectory)
|
||||
bool CSound::loadSoundData(unsigned short Episode, char *DataDirectory)
|
||||
{
|
||||
if(!m_active) return false;
|
||||
|
||||
char *path;
|
||||
int ok;
|
||||
bool ok = true;
|
||||
char soundfile[80];
|
||||
char buf[256];
|
||||
|
||||
@@ -338,52 +338,52 @@ char CSound::loadSoundData(unsigned short Episode, char *DataDirectory)
|
||||
fclose(p_file);
|
||||
|
||||
ok = m_soundslot[SOUND_KEEN_WALK].loadSound(soundfile, "KEENWALKSND", SOUND_KEEN_WALK);
|
||||
ok |= m_soundslot[SOUND_KEEN_WALK2].loadSound(soundfile, "KEENWLK2SND", SOUND_KEEN_WALK2);
|
||||
ok |= m_soundslot[SOUND_KEEN_JUMP].loadSound(soundfile, "KEENJUMPSND", SOUND_KEEN_JUMP);
|
||||
ok |= m_soundslot[SOUND_KEEN_POGO].loadSound(soundfile, "KEENPOGOSND", SOUND_KEEN_POGO);
|
||||
ok |= m_soundslot[SOUND_KEEN_LAND].loadSound(soundfile, "KEENLANDSND", SOUND_KEEN_LAND);
|
||||
ok |= m_soundslot[SOUND_KEEN_BLOK].loadSound(soundfile, "KEENBLOKSND", SOUND_KEEN_BLOK);
|
||||
ok |= m_soundslot[SOUND_KEEN_DIE].loadSound(soundfile, "KEENDIESND", SOUND_KEEN_DIE);
|
||||
ok |= m_soundslot[SOUND_KEEN_FALL].loadSound(soundfile, "PLUMMETSND", SOUND_KEEN_FALL);
|
||||
ok |= m_soundslot[SOUND_KEEN_BUMPHEAD].loadSound(soundfile, "BUMPHEADSND", SOUND_KEEN_BUMPHEAD);
|
||||
ok |= m_soundslot[SOUND_ENTER_LEVEL].loadSound(soundfile, "WLDENTERSND", SOUND_ENTER_LEVEL);
|
||||
ok |= m_soundslot[SOUND_KEENSLEFT].loadSound(soundfile, "keensleft", SOUND_KEENSLEFT);
|
||||
ok &= m_soundslot[SOUND_KEEN_WALK2].loadSound(soundfile, "KEENWLK2SND", SOUND_KEEN_WALK2);
|
||||
ok &= m_soundslot[SOUND_KEEN_JUMP].loadSound(soundfile, "KEENJUMPSND", SOUND_KEEN_JUMP);
|
||||
ok &= m_soundslot[SOUND_KEEN_POGO].loadSound(soundfile, "KEENPOGOSND", SOUND_KEEN_POGO);
|
||||
ok &= m_soundslot[SOUND_KEEN_LAND].loadSound(soundfile, "KEENLANDSND", SOUND_KEEN_LAND);
|
||||
ok &= m_soundslot[SOUND_KEEN_BLOK].loadSound(soundfile, "KEENBLOKSND", SOUND_KEEN_BLOK);
|
||||
ok &= m_soundslot[SOUND_KEEN_DIE].loadSound(soundfile, "KEENDIESND", SOUND_KEEN_DIE);
|
||||
ok &= m_soundslot[SOUND_KEEN_FALL].loadSound(soundfile, "PLUMMETSND", SOUND_KEEN_FALL);
|
||||
ok &= m_soundslot[SOUND_KEEN_BUMPHEAD].loadSound(soundfile, "BUMPHEADSND", SOUND_KEEN_BUMPHEAD);
|
||||
ok &= m_soundslot[SOUND_ENTER_LEVEL].loadSound(soundfile, "WLDENTERSND", SOUND_ENTER_LEVEL);
|
||||
ok &= m_soundslot[SOUND_KEENSLEFT].loadSound(soundfile, "keensleft", SOUND_KEENSLEFT);
|
||||
|
||||
ok |= m_soundslot[SOUND_KEEN_FIRE].loadSound(soundfile, "KEENFIRESND", SOUND_KEEN_FIRE);
|
||||
ok |= m_soundslot[SOUND_GUN_CLICK].loadSound(soundfile, "GUNCLICK", SOUND_GUN_CLICK);
|
||||
ok |= m_soundslot[SOUND_SHOT_HIT].loadSound(soundfile, "SHOTHIT", SOUND_SHOT_HIT);
|
||||
ok &= m_soundslot[SOUND_KEEN_FIRE].loadSound(soundfile, "KEENFIRESND", SOUND_KEEN_FIRE);
|
||||
ok &= m_soundslot[SOUND_GUN_CLICK].loadSound(soundfile, "GUNCLICK", SOUND_GUN_CLICK);
|
||||
ok &= m_soundslot[SOUND_SHOT_HIT].loadSound(soundfile, "SHOTHIT", SOUND_SHOT_HIT);
|
||||
|
||||
ok |= m_soundslot[SOUND_GET_ITEM].loadSound(soundfile, "GOTITEMSND", SOUND_GET_ITEM);
|
||||
ok |= m_soundslot[SOUND_GET_BONUS].loadSound(soundfile, "GOTBONUSSND", SOUND_GET_BONUS);
|
||||
ok |= m_soundslot[SOUND_GET_PART].loadSound(soundfile, "GOTPARTSND", SOUND_GET_PART);
|
||||
ok |= m_soundslot[SOUND_LEVEL_DONE].loadSound(soundfile, "LVLDONESND", SOUND_LEVEL_DONE);
|
||||
ok |= m_soundslot[SOUND_GAME_OVER].loadSound(soundfile, "GAMEOVERSND", SOUND_GAME_OVER);
|
||||
ok |= m_soundslot[SOUND_TELEPORT].loadSound(soundfile, "TELEPORTSND", SOUND_TELEPORT);
|
||||
ok |= m_soundslot[SOUND_EXTRA_LIFE].loadSound(soundfile, "EXTRAMANSND", SOUND_EXTRA_LIFE);
|
||||
ok |= m_soundslot[SOUND_CHUNKSMASH].loadSound(soundfile, "CHUNKSMASH", SOUND_CHUNKSMASH);
|
||||
ok |= m_soundslot[SOUND_GOINDOOR].loadSound(soundfile, "GOINDOORSND", SOUND_GOINDOOR);
|
||||
ok |= m_soundslot[SOUND_GET_CARD].loadSound(soundfile, "GETCARDSND", SOUND_GET_CARD);
|
||||
ok |= m_soundslot[SOUND_USE_KEY].loadSound(soundfile, "USEKEYSND", SOUND_USE_KEY);
|
||||
ok |= m_soundslot[SOUND_SWITCH_TOGGLE].loadSound(soundfile, "CLICKSND", SOUND_SWITCH_TOGGLE);
|
||||
ok |= m_soundslot[SOUND_DOOR_OPEN].loadSound(soundfile, "DOOROPENSND", SOUND_DOOR_OPEN);
|
||||
ok &= m_soundslot[SOUND_GET_ITEM].loadSound(soundfile, "GOTITEMSND", SOUND_GET_ITEM);
|
||||
ok &= m_soundslot[SOUND_GET_BONUS].loadSound(soundfile, "GOTBONUSSND", SOUND_GET_BONUS);
|
||||
ok &= m_soundslot[SOUND_GET_PART].loadSound(soundfile, "GOTPARTSND", SOUND_GET_PART);
|
||||
ok &= m_soundslot[SOUND_LEVEL_DONE].loadSound(soundfile, "LVLDONESND", SOUND_LEVEL_DONE);
|
||||
ok &= m_soundslot[SOUND_GAME_OVER].loadSound(soundfile, "GAMEOVERSND", SOUND_GAME_OVER);
|
||||
ok &= m_soundslot[SOUND_TELEPORT].loadSound(soundfile, "TELEPORTSND", SOUND_TELEPORT);
|
||||
ok &= m_soundslot[SOUND_EXTRA_LIFE].loadSound(soundfile, "EXTRAMANSND", SOUND_EXTRA_LIFE);
|
||||
ok &= m_soundslot[SOUND_CHUNKSMASH].loadSound(soundfile, "CHUNKSMASH", SOUND_CHUNKSMASH);
|
||||
ok &= m_soundslot[SOUND_GOINDOOR].loadSound(soundfile, "GOINDOORSND", SOUND_GOINDOOR);
|
||||
ok &= m_soundslot[SOUND_GET_CARD].loadSound(soundfile, "GETCARDSND", SOUND_GET_CARD);
|
||||
ok &= m_soundslot[SOUND_USE_KEY].loadSound(soundfile, "USEKEYSND", SOUND_USE_KEY);
|
||||
ok &= m_soundslot[SOUND_SWITCH_TOGGLE].loadSound(soundfile, "CLICKSND", SOUND_SWITCH_TOGGLE);
|
||||
ok &= m_soundslot[SOUND_DOOR_OPEN].loadSound(soundfile, "DOOROPENSND", SOUND_DOOR_OPEN);
|
||||
|
||||
ok |= m_soundslot[SOUND_YORP_BUMP].loadSound(soundfile, "YORPBUMPSND", SOUND_YORP_BUMP);
|
||||
ok |= m_soundslot[SOUND_YORP_STUN].loadSound(soundfile, "YORPBOPSND", SOUND_YORP_STUN);
|
||||
ok |= m_soundslot[SOUND_YORP_DIE].loadSound(soundfile, "YORPSCREAM", SOUND_YORP_DIE);
|
||||
ok |= m_soundslot[SOUND_GARG_DIE].loadSound(soundfile, "GARGSCREAM", SOUND_GARG_DIE);
|
||||
ok |= m_soundslot[SOUND_VORT_DIE].loadSound(soundfile, "vortscream", SOUND_VORT_DIE);
|
||||
ok |= m_soundslot[SOUND_TANK_FIRE].loadSound(soundfile, "TANKFIRE", SOUND_TANK_FIRE);
|
||||
ok &= m_soundslot[SOUND_YORP_BUMP].loadSound(soundfile, "YORPBUMPSND", SOUND_YORP_BUMP);
|
||||
ok &= m_soundslot[SOUND_YORP_STUN].loadSound(soundfile, "YORPBOPSND", SOUND_YORP_STUN);
|
||||
ok &= m_soundslot[SOUND_YORP_DIE].loadSound(soundfile, "YORPSCREAM", SOUND_YORP_DIE);
|
||||
ok &= m_soundslot[SOUND_GARG_DIE].loadSound(soundfile, "GARGSCREAM", SOUND_GARG_DIE);
|
||||
ok &= m_soundslot[SOUND_VORT_DIE].loadSound(soundfile, "vortscream", SOUND_VORT_DIE);
|
||||
ok &= m_soundslot[SOUND_TANK_FIRE].loadSound(soundfile, "TANKFIRE", SOUND_TANK_FIRE);
|
||||
|
||||
if (Episode == 2)
|
||||
{
|
||||
ok |= m_soundslot[SOUND_KEEN_BLOK].loadSound(soundfile, "EARTHPOW", SOUND_EARTHPOW);
|
||||
ok &= m_soundslot[SOUND_KEEN_BLOK].loadSound(soundfile, "EARTHPOW", SOUND_EARTHPOW);
|
||||
}
|
||||
else if (Episode == 3)
|
||||
{
|
||||
ok |= m_soundslot[SOUND_MEEP].loadSound(soundfile, "MEEP", SOUND_MEEP);
|
||||
ok |= m_soundslot[SOUND_ANKH].loadSound(soundfile, "ANKH", SOUND_ANKH);
|
||||
ok |= m_soundslot[SOUND_MORTIMER].loadSound(soundfile, "MORTIMER", SOUND_MORTIMER);
|
||||
ok |= m_soundslot[SOUND_FOOTSLAM].loadSound(soundfile, "FOOTSLAM", SOUND_FOOTSLAM);
|
||||
ok &= m_soundslot[SOUND_MEEP].loadSound(soundfile, "MEEP", SOUND_MEEP);
|
||||
ok &= m_soundslot[SOUND_ANKH].loadSound(soundfile, "ANKH", SOUND_ANKH);
|
||||
ok &= m_soundslot[SOUND_MORTIMER].loadSound(soundfile, "MORTIMER", SOUND_MORTIMER);
|
||||
ok &= m_soundslot[SOUND_FOOTSLAM].loadSound(soundfile, "FOOTSLAM", SOUND_FOOTSLAM);
|
||||
}
|
||||
|
||||
for( unsigned short i=0 ; i<m_mixing_channels ; i++ )
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
|
||||
bool init(void);
|
||||
void stop(void);
|
||||
char loadSoundData(unsigned short Episode, char *DataDirectory);
|
||||
bool loadSoundData(unsigned short Episode, char *DataDirectory);
|
||||
void stopAllSounds(void);
|
||||
|
||||
bool forcedisPlaying(void);
|
||||
|
||||
@@ -33,7 +33,7 @@ CSoundSlot::~CSoundSlot() {
|
||||
}
|
||||
|
||||
// loads sound searchname from file fname, into sounds[] entry loadnum
|
||||
// return value is nonzero on failure
|
||||
// return value is false on failure
|
||||
bool CSoundSlot::loadSound(const char *fname, const char *searchname, unsigned int loadnum)
|
||||
{
|
||||
// Unload the sound if any was previously loaded
|
||||
|
||||
Reference in New Issue
Block a user