mirror of
https://github.com/jeremysrand/BuGS.git
synced 2025-02-08 20:30:42 +00:00
Load the sounds at startup.
This commit is contained in:
parent
42585898a4
commit
8b2e753b68
50
BuGS/main.c
50
BuGS/main.c
@ -13,6 +13,10 @@
|
||||
#include <Memory.h>
|
||||
#include <Locator.h>
|
||||
#include <MiscTool.h>
|
||||
#include <Resources.h>
|
||||
#include <Sound.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "game.h"
|
||||
@ -42,6 +46,50 @@ word randomMushroomOffset(void)
|
||||
}
|
||||
|
||||
|
||||
void setupSound(word soundNum, SoundParamBlock * soundParams, boolean looped)
|
||||
{
|
||||
static word nextDocBuffer = 0;
|
||||
|
||||
Handle handle = LoadResource(rRawSound, soundNum);
|
||||
HLock(handle);
|
||||
|
||||
word handleSize = GetHandleSize(handle);
|
||||
|
||||
soundParams->freqOffset = 214;
|
||||
soundParams->docBuffer = nextDocBuffer;
|
||||
soundParams->volSetting = 255;
|
||||
soundParams->waveStart = *handle;
|
||||
soundParams->waveSize = (handleSize / 256) + 1;
|
||||
soundParams->bufferSize = 0;
|
||||
nextDocBuffer += (soundParams->waveSize * 256);
|
||||
if (looped)
|
||||
soundParams->nextWavePtr = soundParams;
|
||||
else
|
||||
soundParams->nextWavePtr = NULL;
|
||||
|
||||
FFSetUpSound((soundNum << 8) | 1, (Pointer)soundParams);
|
||||
}
|
||||
|
||||
|
||||
void loadSounds(void)
|
||||
{
|
||||
static SoundParamBlock spiderSound;
|
||||
static SoundParamBlock deathSound;
|
||||
static SoundParamBlock segmentsSound;
|
||||
static SoundParamBlock bonusSound;
|
||||
static SoundParamBlock killSound;
|
||||
static SoundParamBlock fireSound;
|
||||
|
||||
setupSound(SPIDER_SOUND, &spiderSound, TRUE);
|
||||
setupSound(DEATH_SOUND, &deathSound, FALSE);
|
||||
setupSound(SEGMENTS_SOUND, &segmentsSound, TRUE);
|
||||
setupSound(BONUS_SOUND, &bonusSound, FALSE);
|
||||
setupSound(KILL_SOUND, &killSound, FALSE);
|
||||
setupSound(FIRE_SOUND, &fireSound, FALSE);
|
||||
// FFStartPlaying(1 << SEGMENTS_SOUND);
|
||||
}
|
||||
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int event;
|
||||
@ -70,6 +118,8 @@ int main(void)
|
||||
|
||||
InitMouse(0);
|
||||
SetMouse(transparent);
|
||||
|
||||
loadSounds();
|
||||
|
||||
game();
|
||||
|
||||
|
@ -36,6 +36,8 @@ resource rToolStartup (TOOL_STARTUP) {
|
||||
{
|
||||
3, $0100, /* Misc Tool */
|
||||
8, $0100, /* Sound Tool */
|
||||
30, $0100, /* Resource Manager */
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user