Added: Underwater/Above water soundscape, misc sound effects. Reworked player class a bit to contain pointer to the game engine for sound playing.
This commit is contained in:
@@ -32,6 +32,12 @@ Player::~Player()
|
||||
{
|
||||
}
|
||||
|
||||
void Player::init(Engine *t_engine)
|
||||
{
|
||||
pEngine = t_engine;
|
||||
waterImpact = t_engine->audio.loadADPCM("sound/water_impact.sad");
|
||||
}
|
||||
|
||||
void Player::update(Pad &t_pad)
|
||||
{
|
||||
if (lift > 0.0F)
|
||||
@@ -81,6 +87,19 @@ void Player::update(Pad &t_pad)
|
||||
printf("Swim animation\n");
|
||||
mesh.playAnimation(1, 14, 0);
|
||||
}
|
||||
if (mesh.getCurrentAnimationFrame() == 42)
|
||||
{
|
||||
if (!bIsImpactingWater)
|
||||
{
|
||||
pEngine->audio.setADPCMVolume(50, 2);
|
||||
pEngine->audio.playADPCM(waterImpact, 2);
|
||||
}
|
||||
bIsImpactingWater = true;
|
||||
}
|
||||
else if (bIsImpactingWater)
|
||||
{
|
||||
bIsImpactingWater = false;
|
||||
}
|
||||
|
||||
velocity *= 60.0F / Dolphin::engineFPS; //Moving by deltatime of last frame.
|
||||
mesh.position.z +=
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
#define WATER_LEVEL -5.0F
|
||||
|
||||
#include "../camera.hpp"
|
||||
#include <audsrv.h>
|
||||
#include <modules/pad.hpp>
|
||||
#include <tamtypes.h>
|
||||
|
||||
class Engine;
|
||||
class Player
|
||||
{
|
||||
|
||||
@@ -25,6 +26,7 @@ public:
|
||||
Mesh mesh;
|
||||
Player();
|
||||
~Player();
|
||||
void init(Engine *t_engine);
|
||||
void update(Pad &t_pad);
|
||||
const u8 &isJumping() { return bIsJumping; }
|
||||
const u8 &getLifes() { return lifes; }
|
||||
@@ -33,6 +35,9 @@ private:
|
||||
u8 bIsJumping;
|
||||
Vector3 playerNextPosition;
|
||||
u8 lifes;
|
||||
audsrv_adpcm_t *waterImpact;
|
||||
Engine *pEngine;
|
||||
u8 bIsImpactingWater;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user