• 大小: 6.99MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-01
  • 语言: C/C++
  • 标签: FC  重装机兵  

资源简介

经典FC 重装机兵C++版 源码 经典FC 重装机兵C++版 源码

资源截图

代码片段和文件信息

#include “fmodsound.h“
#include 
#include 

FSOUND_SAMPLE* FmodSound::spSoundSample[MAX_SOUND_CHANNELS] = {NULL};
FSOUND_STREAM* FmodSound::spSoundStream = NULL;
int FmodSound::sLastMusicIndex = -1;

static const char* sSoundFileNames[MAX_SOUND_CHANNELS] =
{
“../Sound/Sfx/Select.wav“
“../Sound/Sfx/Confirm.wav“
“../Sound/Sfx/OpenDoor.wav“
“../Sound/Sfx/IntoEntry.wav“
“../Sound/Sfx/Fall.wav“
“../Sound/Sfx/Coin.wav“
“../Sound/Sfx/Inn.mp3“
“../Sound/Sfx/GotoTank.wav“
“../Sound/Sfx/GetItem.wav“
“../Sound/Sfx/StartBattle.mp3“
“../Sound/Sfx/EnemyAppear.wav“
“../Sound/Sfx/Escape.wav“
“../Sound/Sfx/Fail.mp3“
“../Sound/Sfx/Winning.mp3“
“../Sound/Sfx/Disappear.wav“
“../Sound/Sfx/LevelUp.mp3“
“../Sound/Sfx/WT_Body.wav“
“../Sound/Sfx/WT_Body_End.wav“
“../Sound/Sfx/WT_Cannon.wav“
“../Sound/Sfx/WT_Cannon_End.wav“
“../Sound/Sfx/WT_Fire.wav“
“../Sound/Sfx/WT_Fire_End.wav“
“../Sound/Sfx/WT_Sling.wav“
“../Sound/Sfx/WT_Sling_End.wav“
“../Sound/Sfx/WT_Gun.wav“
};

static const char* sMusicFileNames[MAX_MUSIC_INDEX] =
{
“../Sound/Bgm/Startup.mp3“
“../Sound/Bgm/NameSetting.mp3“
“../Sound/Bgm/TownTheme.mp3“
“../Sound/Bgm/WorldTheme.mp3“
“../Sound/Bgm/CaveTheme.mp3“
“../Sound/Bgm/GateTheme.mp3“
“../Sound/Bgm/BarTheme.mp3“
“../Sound/Bgm/TankTheme.mp3“
“../Sound/Bgm/BattleTheme.mp3“
“../Sound/Bgm/BossFight.mp3“
};


bool FmodSound::InitFmodSound(void)
{
if(!FSOUND_Init(44100 MAX_CHANNELS FSOUND_INIT_GLOBALFOCUS))
{
MessageBox(0 “Fmod FSOUND_Init() - FAILED“ 0 0);
return false;
}

for(int i=0; i {
if(!LoadSoundSample(i))
return false;
}

return true;
}

void FmodSound::CloseFmodSound(void)
{
for(int i=0; i {
FSOUND_Sample_Free(spSoundSample[i]);
}
FSOUND_Stream_Close(spSoundStream);
FSOUND_Close();
}

bool FmodSound::LoadSoundSample(unsigned int soundIndex)
{
spSoundSample[soundIndex] = FSOUND_Sample_Load(soundIndex sSoundFileNames[soundIndex] 0 0);
if(spSoundSample[soundIndex])
{
FSOUND_Sample_SetMode(spSoundSample[soundIndex] FSOUND_LOOP_OFF|FSOUND_NORMAL);
}
else
{
char errStr[128];
sprintf_s(errStr “Failed to load sound file: %s“ sSoundFileNames[soundIndex]);
MessageBox(0 errStr 0 0);
return false;
}

return true;
}

void FmodSound::PlaySnd(unsigned int soundIndex)
{
FSOUND_PlaySound(soundIndex spSoundSample[soundIndex]);
}

void FmodSound::StopSnd(unsigned int soundIndex)
{
FSOUND_StopSound(soundIndex);
}

void FmodSound::PlayMusic(unsigned int musicIndex)
{
if(sLastMusicIndex == musicIndex)
return;

FSOUND_Stream_Close(spSoundStream);
spSoundStream = FSOUND_Stream_OpenFile(sMusicFileNames[musicIndex] 0 0);
if(spSoundStream)
{
FSOUND_Stream_SetMode(spSoundStream FSOUND_LOOP_NORMAL|FSOUND_NORMAL);
FSOUND_Stream_Play(MUSIC_CHANNEL spSoundStream);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-06-29 22:54  metalMax\
     文件      120880  2011-03-21 21:36  metalMax\Image.jpg
     文件         223  2018-06-29 22:54  metalMax\ReadMe.txt
     目录           0  2018-06-29 22:53  metalMax\Release\
     文件      241664  2011-03-22 20:52  metalMax\Release\metalMax.exe
     文件      137216  2006-01-01 16:43  metalMax\Release\fmod.dll
     目录           0  2018-06-29 22:54  metalMax\Save\
     目录           0  2018-06-29 22:53  metalMax\Sound\
     目录           0  2018-06-29 22:53  metalMax\Sound\Bgm\
     文件      326843  2010-08-08 14:26  metalMax\Sound\Bgm\BarTheme.mp3
     文件      528717  2011-01-09 16:53  metalMax\Sound\Bgm\BattleTheme.mp3
     文件      584306  2011-02-27 12:33  metalMax\Sound\Bgm\BossFight.mp3
     文件      531643  2010-08-01 13:38  metalMax\Sound\Bgm\CaveTheme.mp3
     文件      394134  2010-08-01 13:39  metalMax\Sound\Bgm\GateTheme.mp3
     文件      445125  2010-05-03 15:21  metalMax\Sound\Bgm\NameSetting.mp3
     文件      798719  2010-04-28 12:11  metalMax\Sound\Bgm\Startup.mp3
     文件      513670  2010-12-18 15:28  metalMax\Sound\Bgm\TankTheme.mp3
     文件      447633  2010-07-29 20:38  metalMax\Sound\Bgm\TownTheme.mp3
     文件      641148  2010-07-29 21:06  metalMax\Sound\Bgm\WorldTheme.mp3
     目录           0  2018-06-29 22:53  metalMax\Sound\Sfx\
     文件       67192  2010-12-08 17:46  metalMax\Sound\Sfx\Coin.wav
     文件       51768  2010-05-03 15:05  metalMax\Sound\Sfx\Confirm.wav
     文件       89876  2011-02-21 21:05  metalMax\Sound\Sfx\Disappear.wav
     文件       49044  2011-02-13 14:13  metalMax\Sound\Sfx\EnemyAppear.wav
     文件       89876  2011-02-20 12:51  metalMax\Sound\Sfx\Escape.wav
     文件      180557  2011-03-20 19:08  metalMax\Sound\Sfx\Fail.mp3
     文件       88200  2010-08-01 13:16  metalMax\Sound\Sfx\Fall.wav
     文件       65376  2010-12-19 15:57  metalMax\Sound\Sfx\GetItem.wav
     文件       49044  2010-12-18 15:31  metalMax\Sound\Sfx\GotoTank.wav
     文件       35901  2011-03-20 19:08  metalMax\Sound\Sfx\Inn.mp3
     文件      121636  2010-07-29 20:29  metalMax\Sound\Sfx\IntoEntry.wav
............此处省略560个文件信息

评论

共有 条评论