Play sound when recharging from power pool.

This commit is contained in:
Steve 2018-03-04 09:49:16 +00:00
parent 1073276c6f
commit a3a4c01049
7 changed files with 13 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -318,6 +318,7 @@ enum
SND_TROPHY, SND_TROPHY,
SND_ELECTRIC_HIT, SND_ELECTRIC_HIT,
SND_ITEM_PAD, SND_ITEM_PAD,
SND_POWER_POOL,
SND_MAX SND_MAX
}; };

View File

@ -73,6 +73,8 @@ static void tick(void)
s->spriteTime = 12; s->spriteTime = 12;
} }
} }
s->bobTouching = MAX(s->bobTouching - 1, 0);
} }
static void action(void) static void action(void)
@ -102,6 +104,13 @@ static void touch(Entity *other)
{ {
world.bob->power = MIN(world.bob->power + 0.05, world.bob->powerMax); world.bob->power = MIN(world.bob->power + 0.05, world.bob->powerMax);
if (s->bobTouching == 0)
{
playSound(SND_POWER_POOL, s->uniqueId % MAX_SND_CHANNELS);
}
s->bobTouching = 2;
if (world.bob->power == world.bob->powerMax) if (world.bob->power == world.bob->powerMax)
{ {
s->thinkTime = FPS * 10; s->thinkTime = FPS * 10;

View File

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern Structure *createStructure(void); extern Structure *createStructure(void);
extern Sprite *getSprite(char *name); extern Sprite *getSprite(char *name);
extern void playSound(int snd, int ch);
extern Entity *self; extern Entity *self;
extern World world; extern World world;

View File

@ -172,7 +172,8 @@ static void loadSounds(void)
sounds[SND_CONFIRMED] = loadSound("sound/39028__wildweasel__cardlock-open.ogg"); sounds[SND_CONFIRMED] = loadSound("sound/39028__wildweasel__cardlock-open.ogg");
sounds[SND_HEART_CELL] = loadSound("sound/162467__kastenfrosch__gotitem.ogg"); sounds[SND_HEART_CELL] = loadSound("sound/162467__kastenfrosch__gotitem.ogg");
sounds[SND_ELECTRIC_HIT] = loadSound("sound/46501__phreaksaccount__welder1.ogg"); sounds[SND_ELECTRIC_HIT] = loadSound("sound/46501__phreaksaccount__welder1.ogg");
sounds[SND_ITEM_PAD] = loadSound("sound/383779__jay-you__telephone-dialing.ogg"); sounds[SND_ITEM_PAD] = loadSound("sound/319996__kenrt__ratchet.ogg");
sounds[SND_POWER_POOL] = loadSound("sound/235737__copyc4t__tf-power-tools.ogg");
sounds[SND_MISSION_COMPLETE] = loadSound("sound/113989__kastenfrosch__gewonnen.ogg"); sounds[SND_MISSION_COMPLETE] = loadSound("sound/113989__kastenfrosch__gewonnen.ogg");
sounds[SND_TROPHY] = loadSound("sound/278142__ricemaster__effect-notify.ogg"); sounds[SND_TROPHY] = loadSound("sound/278142__ricemaster__effect-notify.ogg");