mirror of
https://github.com/jeremysrand/BuGS.git
synced 2025-08-10 02:25:06 +00:00
Load the sounds at startup.
This commit is contained in:
50
BuGS/main.c
50
BuGS/main.c
@@ -13,6 +13,10 @@
|
|||||||
#include <Memory.h>
|
#include <Memory.h>
|
||||||
#include <Locator.h>
|
#include <Locator.h>
|
||||||
#include <MiscTool.h>
|
#include <MiscTool.h>
|
||||||
|
#include <Resources.h>
|
||||||
|
#include <Sound.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "game.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 main(void)
|
||||||
{
|
{
|
||||||
int event;
|
int event;
|
||||||
@@ -70,6 +118,8 @@ int main(void)
|
|||||||
|
|
||||||
InitMouse(0);
|
InitMouse(0);
|
||||||
SetMouse(transparent);
|
SetMouse(transparent);
|
||||||
|
|
||||||
|
loadSounds();
|
||||||
|
|
||||||
game();
|
game();
|
||||||
|
|
||||||
|
@@ -36,6 +36,8 @@ resource rToolStartup (TOOL_STARTUP) {
|
|||||||
{
|
{
|
||||||
3, $0100, /* Misc Tool */
|
3, $0100, /* Misc Tool */
|
||||||
8, $0100, /* Sound Tool */
|
8, $0100, /* Sound Tool */
|
||||||
|
30, $0100, /* Resource Manager */
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user